|
@@ -20,19 +20,19 @@
|
|
left join sys_user t5 on t5.user_id = t1.service_id
|
|
left join sys_user t5 on t5.user_id = t1.service_id
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
t1.deleted = 0
|
|
t1.deleted = 0
|
|
- <if test="id != null "> AND t1.id = #{id}</if>
|
|
|
|
|
|
+ <if test="id != null ">AND t1.id = #{id}</if>
|
|
<if test="ids != null and ids.size() > 0">
|
|
<if test="ids != null and ids.size() > 0">
|
|
AND t1.id IN
|
|
AND t1.id IN
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
#{item,jdbcType=BIGINT}
|
|
#{item,jdbcType=BIGINT}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
- <if test="companyName != null and companyName!=''"> AND t2.name like concat('%', #{companyName}, '%')</if>
|
|
|
|
|
|
+ <if test="companyName != null and companyName!=''">AND t2.name like concat('%', #{companyName}, '%')</if>
|
|
<if test="tenantId != null ">
|
|
<if test="tenantId != null ">
|
|
<!-- AND exists (select 1 from biz_entrust t1.tenant_id = tenant_id where )-->
|
|
<!-- AND exists (select 1 from biz_entrust t1.tenant_id = tenant_id where )-->
|
|
AND t1.tenant_id = #{tenantId}
|
|
AND t1.tenant_id = #{tenantId}
|
|
</if>
|
|
</if>
|
|
- <if test="companyId != null "> AND t1.company_id = #{companyId}</if>
|
|
|
|
|
|
+ <if test="companyId != null ">AND t1.company_id = #{companyId}</if>
|
|
<if test="type != null ">AND t1.type = #{type}</if>
|
|
<if test="type != null ">AND t1.type = #{type}</if>
|
|
<if test="noContract != null ">AND t1.no_contract = #{noContract}</if>
|
|
<if test="noContract != null ">AND t1.no_contract = #{noContract}</if>
|
|
<if test="workOrderNo != null and workOrderNo != ''">AND t1.work_order_no = #{workOrderNo}</if>
|
|
<if test="workOrderNo != null and workOrderNo != ''">AND t1.work_order_no = #{workOrderNo}</if>
|
|
@@ -41,12 +41,18 @@
|
|
<if test="startMonth != null ">AND t1.end_month >= #{startMonth}</if>
|
|
<if test="startMonth != null ">AND t1.end_month >= #{startMonth}</if>
|
|
<if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
|
|
<if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
|
|
<if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
|
|
<if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
|
|
- <if test="currentMonth != null"> AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') >= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') <= (case when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
|
|
|
|
|
|
+ <if test="currentMonth != null">AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') >= (case when t1.task_type_id
|
|
|
|
+ = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') <=
|
|
|
|
+ (case when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then
|
|
|
|
+ DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)
|
|
|
|
+ </if>
|
|
<if test="toTenantId != null and currentMonth != null">
|
|
<if test="toTenantId != null and currentMonth != null">
|
|
- AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
|
|
|
|
|
|
+ AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and
|
|
|
|
+ t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
|
|
</if>
|
|
</if>
|
|
<if test="toTenantId != null">
|
|
<if test="toTenantId != null">
|
|
- AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t1.id = t6.work_order_id )
|
|
|
|
|
|
+ AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and
|
|
|
|
+ t1.id = t6.work_order_id )
|
|
</if>
|
|
</if>
|
|
</trim>
|
|
</trim>
|
|
</select>
|
|
</select>
|
|
@@ -62,19 +68,19 @@
|
|
left join sys_user t5 on t5.user_id = t1.service_id
|
|
left join sys_user t5 on t5.user_id = t1.service_id
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
t1.deleted = 0
|
|
t1.deleted = 0
|
|
- <if test="id != null "> AND t1.id = #{id}</if>
|
|
|
|
|
|
+ <if test="id != null ">AND t1.id = #{id}</if>
|
|
<if test="ids != null and ids.size() > 0">
|
|
<if test="ids != null and ids.size() > 0">
|
|
AND t1.id IN
|
|
AND t1.id IN
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
#{item,jdbcType=BIGINT}
|
|
#{item,jdbcType=BIGINT}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
- <if test="companyName != null and companyName!=''"> AND t2.name like concat('%', #{companyName}, '%')</if>
|
|
|
|
|
|
+ <if test="companyName != null and companyName!=''">AND t2.name like concat('%', #{companyName}, '%')</if>
|
|
<if test="tenantId != null ">
|
|
<if test="tenantId != null ">
|
|
-<!-- AND exists (select 1 from biz_entrust t1.tenant_id = tenant_id where )-->
|
|
|
|
|
|
+ <!-- AND exists (select 1 from biz_entrust t1.tenant_id = tenant_id where )-->
|
|
AND t1.tenant_id = #{tenantId}
|
|
AND t1.tenant_id = #{tenantId}
|
|
</if>
|
|
</if>
|
|
- <if test="companyId != null "> AND t1.company_id = #{companyId}</if>
|
|
|
|
|
|
+ <if test="companyId != null ">AND t1.company_id = #{companyId}</if>
|
|
<if test="type != null ">AND t1.type = #{type}</if>
|
|
<if test="type != null ">AND t1.type = #{type}</if>
|
|
<if test="noContract != null ">AND t1.no_contract = #{noContract}</if>
|
|
<if test="noContract != null ">AND t1.no_contract = #{noContract}</if>
|
|
<if test="workOrderNo != null and workOrderNo != ''">AND t1.work_order_no = #{workOrderNo}</if>
|
|
<if test="workOrderNo != null and workOrderNo != ''">AND t1.work_order_no = #{workOrderNo}</if>
|
|
@@ -84,12 +90,18 @@
|
|
<if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
|
|
<if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
|
|
<if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
|
|
<if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
|
|
<if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
|
|
<if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
|
|
- <if test="currentMonth != null"> AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') >= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') <= (case when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
|
|
|
|
|
|
+ <if test="currentMonth != null">AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') >= (case when t1.task_type_id
|
|
|
|
+ = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') <=
|
|
|
|
+ (case when t1.is_continue=1 then #{currentMonth} when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then
|
|
|
|
+ DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)
|
|
|
|
+ </if>
|
|
<if test="toTenantId != null and currentMonth != null">
|
|
<if test="toTenantId != null and currentMonth != null">
|
|
- AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
|
|
|
|
|
|
+ AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and
|
|
|
|
+ t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
|
|
</if>
|
|
</if>
|
|
<if test="toTenantId != null">
|
|
<if test="toTenantId != null">
|
|
- AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t1.id = t6.work_order_id )
|
|
|
|
|
|
+ AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and
|
|
|
|
+ t1.id = t6.work_order_id )
|
|
</if>
|
|
</if>
|
|
</trim>
|
|
</trim>
|
|
ORDER BY t1.create_time DESC
|
|
ORDER BY t1.create_time DESC
|
|
@@ -107,12 +119,12 @@
|
|
<insert id="insertTasks">
|
|
<insert id="insertTasks">
|
|
<foreach collection="tableValues" item="item" index="index" separator=";">
|
|
<foreach collection="tableValues" item="item" index="index" separator=";">
|
|
insert into ${item.tableName} (
|
|
insert into ${item.tableName} (
|
|
- id,
|
|
|
|
- company_id,
|
|
|
|
- work_order_id,
|
|
|
|
- tenant_id,
|
|
|
|
- create_time,
|
|
|
|
- creator_id
|
|
|
|
|
|
+ id,
|
|
|
|
+ company_id,
|
|
|
|
+ work_order_id,
|
|
|
|
+ tenant_id,
|
|
|
|
+ create_time,
|
|
|
|
+ creator_id
|
|
)values (
|
|
)values (
|
|
#{item.id,jdbcType=BIGINT},
|
|
#{item.id,jdbcType=BIGINT},
|
|
#{item.companyId,jdbcType=BIGINT},
|
|
#{item.companyId,jdbcType=BIGINT},
|