select distinct p.id,p.name, p.code,p.client,p.province,p.city,p.district,p.business,p.invest,p.address,p.agency_id,
p.actual_location,p.location,p.estimate_type,p.filing_date,
p.credit_code,p.report_progress,p.phase,p.state,p.introduction,p.is_review,p.del_flag,p.create_by,p.create_time,
p.update_by,p.update_time,p.remark,d1.label as business_name,d2.label as estimate_type_name,e.leader_id,u.name as leader_name,e.link_phone,
c.id as contract_id,c.contract_money,c.actual_contract_money,a.name as agency_name,
(select count(*) from ass_project_material m where m.project_id=p.id and m.file_id is not null) as material_cnt
from ass_project p
left join ass_estimate_task e on e.project_id=p.id
left join sys_user u on u.id=e.leader_id
left join sys_dict_data d1 on d1.id=p.business
left join sys_dict_data d2 on d2.id=p.estimate_type
left join ass_contract c on c.project_id=p.id
left join sys_agency a on a.id=p.agency_id
left join ass_plan_person pp on pp.project_id=p.id
left join ass_project_material m on m.project_id=p.id
and p.del_flag = 0
and p.estimate_type != 33
and p.estimate_type = 33
and p.report_progress != 14
and a.name=#{agencyName}
AND p.name like concat('%', #{name}, '%')
AND p.client like concat('%', #{client}, '%')
AND p.business = #{business}
AND p.estimate_type = #{estimateType}
AND p.province = #{province}
AND p.city = #{city}
AND p.district = #{district}
AND p.agency_id=#{agencyId}
AND p.phase=#{phase}
and date_format(p.create_time,'%y%m%d') >= date_format(#{params.startTime},'%y%m%d')
and date_format(p.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
and pp.person_id=#{params.personId} and pp.del_flag=0
and (m.file_id is null)
and (m.file_id is not null)
order by p.create_time desc
where p.id=#{projectId}
select id,name from ass_project
where name=#{name} and agency_id=#{agencyId} and del_flag=0
and estimate_type != 33
and estimate_type = 33
limit 1
select report_progress from ass_project
where id=#{projectId}
select distinct p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,
e.leader_id,u.name as leader_name
from ass_project p
left join ass_plan_person a on a.project_id=p.id
left join ass_estimate_task e on e.project_id=p.id
left join sys_user u on u.id=e.leader_id
and a.person_id=#{personId} and p.del_flag=0 and a.del_flag=0
and p.report_progress=14
and p.report_progress!=14
AND p.agency_id=#{agencyId}
order by p.create_time desc
select distinct p.id,p.name,p.report_progress,p.code,p.client,p.province,p.city,p.district,p.business,p.create_time,a.id as plan_person_id,
e.leader_id,u.name as leader_name
from ass_project p
left join ass_plan_person a on a.project_id=p.id
left join ass_estimate_task e on e.project_id=p.id
left join sys_user u on u.id=e.leader_id
where a.person_id=#{personId} and p.del_flag=0 and a.job_type=2 and a.del_flag=0
and p.agency_id=#{agencyId}
order by p.create_time desc
select Ifnull(count(distinct p.id),0) from ass_project p
left join ass_project_material m on m.project_id=p.id
left join sys_agency a on a.id=p.agency_id
and p.del_flag=0
and p.estimate_type != 33
and p.estimate_type = 33
and p.report_progress != 14
and p.agency_id=#{agencyId}
and a.name=#{agencyName}
AND p.name like concat('%', #{name}, '%')
AND p.client like concat('%', #{client}, '%')
AND p.business = #{business}
AND p.estimate_type = #{estimateType}
AND p.province = #{province}
AND p.city = #{city}
AND p.district = #{district}
AND p.phase=#{phase}
and date_format(p.create_time,'%y%m%d') >= date_format(#{params.startTime},'%y%m%d')
and date_format(p.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
and (m.file_id is null)
and (m.file_id is not null)
select d.person_id,count(*) as project_count,max(d.create_time) as last_estimate_time from
(select a.person_id,a.project_id,max(p.create_time) as create_time from ass_project p
left join ass_plan_person a on a.project_id=p.id
where a.del_flag=0 and p.del_flag=0 and a.person_id in
#{personId}
group by a.person_id,a.project_id) d
group by d.person_id