tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpl.lot_id as proId,bpl.lot_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,
case when d.id = '31' then lai.company_audit_remark
when d.id = '32' then lai.dept_audit_remark
when d.id = '33' then lai.direct_audit_remark
when d.id = '98' then lai.company_audit_remark
when d.id = '99' then lai.dept_audit_remark
when d.id = '100' then lai.direct_audit_remark
end examineStatus,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE
tt.task_type = '29' and tt.status = '1'
<iftest="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
</if>
<iftest="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<iftest="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<iftest="record.projectId != null and record.projectId != ''">
AND bpl.lot_id = #{record.projectId}
</if>
<iftest="record.keyWord != null and record.keyWord != ''">
AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpl.lot_id as proId,bpl.lot_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,
case when d.id = '31' then lai.company_audit_remark
when d.id = '32' then lai.dept_audit_remark
when d.id = '33' then lai.direct_audit_remark
when d.id = '98' then lai.company_audit_remark
when d.id = '99' then lai.dept_audit_remark
when d.id = '100' then lai.direct_audit_remark
end examineStatus ,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE
tt.task_type = '29' and tt.status = '1' and tt.create_by = #{record.createBy}
<iftest="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
</if>
<iftest="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<iftest="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<iftest="record.projectId != null and record.projectId != ''">
AND bpl.lot_id = #{record.projectId}
</if>
<iftest="record.keyWord != null and record.keyWord != ''">
AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or