|
@@ -7,15 +7,31 @@
|
|
|
<resultMap type="cn.ezhizao.project.business.workOrder.domain.BizWorkOrder" id="BizWorkOrderResult">
|
|
|
<id column="id" property="id"/>
|
|
|
<id column="contract_id" property="contractId"/>
|
|
|
-
|
|
|
- <association property="record" column="id" select="getRecord"
|
|
|
- javaType="cn.ezhizao.project.business.workOrder.domain.BizWorkOrderRecord"/>
|
|
|
-
|
|
|
- <association property="arriveAmount" column="contract_id" select="getReceive"
|
|
|
- javaType="java.math.BigDecimal"/>
|
|
|
-
|
|
|
- <association property="onWorkDetail" column="id" select="getOnWorkDetail"
|
|
|
- javaType="java.lang.String"/>
|
|
|
+ <id column="recordId" property="record.id"/>
|
|
|
+ <id column="recordYear" property="record.year"/>
|
|
|
+ <id column="recordMonth" property="record.month"/>
|
|
|
+ <id column="recordCompanyId" property="record.companyId"/>
|
|
|
+ <id column="recordWorkOrderId" property="record.workOrderId"/>
|
|
|
+ <id column="recordStatus" property="record.status"/>
|
|
|
+ <id column="recordStatusDescript" property="record.statusDescript"/>
|
|
|
+ <id column="recordTenantId" property="record.tenantId"/>
|
|
|
+ <id column="recordRecorderId" property="record.recorderId"/>
|
|
|
+ <id column="recordCost" property="record.cost"/>
|
|
|
+ <id column="recordRemark" property="record.remark"/>
|
|
|
+ <id column="recordCreateTime" property="record.createTime"/>
|
|
|
+ <id column="recordCreatorId" property="record.creatorId"/>
|
|
|
+ <id column="recordUpdateTime" property="record.updateTime"/>
|
|
|
+ <id column="recordUpdaterId" property="record.updaterId"/>
|
|
|
+ <id column="recordDeleted" property="record.deleted"/>
|
|
|
+ <id column="recordVersion" property="record.version"/>
|
|
|
+ <id column="recordFromId" property="record.fromId"/>
|
|
|
+ <id column="recordHandlerTime" property="record.handlerTime"/>
|
|
|
+ <id column="recordHandlerId" property="record.handlerId"/>
|
|
|
+ <id column="recordFinishTime" property="record.finishTime"/>
|
|
|
+ <id column="recordResultStatus" property="record.resultStatus"/>
|
|
|
+ <id column="handlerName" property="record.handlerName"/>
|
|
|
+ <id column="recorderName" property="record.recorderName"/>
|
|
|
+ <id column="entrustTime" property="record.entrustTime"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="RecordResult" type="cn.ezhizao.project.business.workOrder.domain.BizWorkOrderRecord">
|
|
@@ -42,8 +58,18 @@
|
|
|
select CONCAT(DATE_FORMAT(record_date,'%m.%d'),'---',record_detail) as record_detail from biz_oncework_detail where work_order_id = #{id} and deleted = 0 order by record_date desc limit 1
|
|
|
</select>
|
|
|
<select id="getList" parameterType="BizWorkOrder" resultMap="BizWorkOrderResult">
|
|
|
- SELECT CONCAT(t1.remark, t3.name, t4.name) AS contact_info,if(t7.status is null,0,t7.`status`),t1.*, t2.name as
|
|
|
+ SELECT CONCAT(t1.remark, t3.name, t4.name) AS contact_info,if(record.recordStatus is null,0,record.recordStatus),t1.*, t2.name as
|
|
|
company_name, t2.social_credit_code,
|
|
|
+ (select ifnull(sum(arrive_amount),0) as arriveAmount from biz_collection
|
|
|
+ where contract_id = t1.contract_id
|
|
|
+ and status = 1
|
|
|
+ group by contract_id) as arriveAmount,
|
|
|
+ record.*,
|
|
|
+ t1.*,
|
|
|
+ (select CONCAT(DATE_FORMAT(record_date,'%m.%d'),'---',record_detail) as record_detail
|
|
|
+ from biz_oncework_detail
|
|
|
+ where work_order_id = t1.id
|
|
|
+ and deleted = 0 order by record_date desc limit 1) as onWorkDetail,
|
|
|
t3.name as task_type_name,
|
|
|
t4.name as task_type_detail_name, t5.nick_name as
|
|
|
service_name,t6.alter_type,t6.address_style,t6.fiction_address_id,t6.province as inputProvince,t6.city as
|
|
@@ -54,8 +80,37 @@
|
|
|
left join biz_task_type_detail t4 on t4.id = t1.task_type_detail_id
|
|
|
left join sys_user t5 on t5.user_id = t1.service_id
|
|
|
LEFT JOIN biz_archive_input_detail t6 ON t6.id = t1.contract_detail_id
|
|
|
- left join biz_work_order_record t7 on t7.work_order_id = t1.id
|
|
|
- left join sys_user t8 on t7.handler_id = t8.user_id
|
|
|
+ left join (select orderrecord.id as recordId,
|
|
|
+ orderrecord.year as recordYear,
|
|
|
+ orderrecord.month as recordMonth,
|
|
|
+ orderrecord.company_id as recordCompanyId,
|
|
|
+ orderrecord.work_order_id as recordWorkOrderId,
|
|
|
+ orderrecord.status as recordStatus,
|
|
|
+ orderrecord.status_descript as recordStatusDescript,
|
|
|
+ orderrecord.tenant_id as recordtenantId,
|
|
|
+ orderrecord.recorder_id as recordRecorderId,
|
|
|
+ orderrecord.cost as recordCost,
|
|
|
+ orderrecord.remark as recordRemark,
|
|
|
+ orderrecord.create_time as recordcReateTime,
|
|
|
+ orderrecord.creator_id as recordCreatorId,
|
|
|
+ orderrecord.update_time as recordUpdateTime,
|
|
|
+ orderrecord.updater_id as recordUpdaterId,
|
|
|
+ orderrecord.deleted as recordDeleted,
|
|
|
+ orderrecord.version as recordVersion,
|
|
|
+ orderrecord.from_id as recordFromId,
|
|
|
+ orderrecord.handler_time as recordHandlerTime,
|
|
|
+ orderrecord.handler_id as recordHandlerId,
|
|
|
+ orderrecord.finish_time as recordFinishTime,
|
|
|
+ orderrecord.result_status as recordResultStatus,
|
|
|
+ usert2.nick_name as handlerName, usert3.nick_name as recorderName, entrt4.create_time as entrustTime
|
|
|
+ from biz_work_order_record orderrecord
|
|
|
+ left join sys_user usert2 on orderrecord.handler_id = usert2.user_id
|
|
|
+ left join sys_user usert3 on orderrecord.recorder_id = usert3.user_id
|
|
|
+ left join biz_entrust entrt4 on orderrecord.work_order_id = entrt4.work_order_id AND entrt4.deleted = 0
|
|
|
+ where orderrecord.deleted = 0
|
|
|
+ and orderrecord.from_id = 0
|
|
|
+ ) as record on record.recordWorkOrderId = t1.id and t1.deleted =0 and record.recordFromId = 0
|
|
|
+ left join sys_user t8 on record.recordHandlerId = t8.user_id
|
|
|
left join biz_entrust t9 on t9.work_order_id = t1.id and t9.deleted = 0
|
|
|
left join biz_tenant t10 on t10.id = t9.from_tenant_id
|
|
|
LEFT JOIN biz_archive_input t11 ON t11.id = t1.contract_id
|
|
@@ -82,7 +137,7 @@
|
|
|
AND t8.nick_name like concat('%', #{handlerName}, '%')
|
|
|
</if>
|
|
|
<if test="recordStatus != null ">
|
|
|
- AND (IF(t7.STATUS IS NULL, 0, t7.`status`) = #{recordStatus} )
|
|
|
+ AND (IF(record.STATUS IS NULL, 0, record.`status`) = #{recordStatus} )
|
|
|
</if>
|
|
|
<if test="taskTypeId != null ">AND t1.task_type_id = #{taskTypeId}</if>
|
|
|
<if test="companyId != null ">AND t1.company_id = #{companyId}</if>
|
|
@@ -96,9 +151,9 @@
|
|
|
<if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
|
|
|
<if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
|
|
|
<if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
|
|
|
- <if test="resultStatus != null">AND t7.result_status = #{resultStatus}</if>
|
|
|
+ <if test="resultStatus != null">AND record.result_status = #{resultStatus}</if>
|
|
|
<if test="entrustTimeFilter != null">
|
|
|
- and t7.deleted = 0
|
|
|
+ and record.deleted = 0
|
|
|
AND (
|
|
|
DATE_FORMAT(t9.create_time,'%Y-%m-%d') >= #{entrustTimeFilter[0]}
|
|
|
AND
|
|
@@ -107,16 +162,16 @@
|
|
|
</if>
|
|
|
<if test="handlerTimeFilter != null">
|
|
|
AND (
|
|
|
- DATE_FORMAT(t7.handler_time,'%Y-%m-%d') >= #{handlerTimeFilter[0]}
|
|
|
+ DATE_FORMAT(record.handler_time,'%Y-%m-%d') >= #{handlerTimeFilter[0]}
|
|
|
AND
|
|
|
- DATE_FORMAT(t7.handler_time,'%Y-%m-%d') <= #{handlerTimeFilter[1]}
|
|
|
+ DATE_FORMAT(record.handler_time,'%Y-%m-%d') <= #{handlerTimeFilter[1]}
|
|
|
)
|
|
|
</if>
|
|
|
<if test="finishTimeFilter != null">
|
|
|
AND (
|
|
|
- DATE_FORMAT(t7.finish_time,'%Y-%m-%d') >= #{finishTimeFilter[0]}
|
|
|
+ DATE_FORMAT(record.finish_time,'%Y-%m-%d') >= #{finishTimeFilter[0]}
|
|
|
AND
|
|
|
- DATE_FORMAT(t7.finish_time,'%Y-%m-%d') <= #{finishTimeFilter[1]}
|
|
|
+ DATE_FORMAT(record.finish_time,'%Y-%m-%d') <= #{finishTimeFilter[1]}
|
|
|
)
|
|
|
</if>
|
|
|
<if test="companyName != null">AND t2.name like concat('%', #{companyName}, '%')</if>
|