|
|
@@ -15,16 +15,16 @@
|
|
|
<!-- and ymd_quarter = #{resumption.ymd.quarter}-->
|
|
|
</update>
|
|
|
<update id="updateNameByPlanId">
|
|
|
-update core_resumption set name=#{planName} where plan_id =#{planId} and status in (1,2)
|
|
|
-
|
|
|
-
|
|
|
+ update core_resumption
|
|
|
+ set name=#{planName}
|
|
|
+ where plan_id = #{planId}
|
|
|
+ and status in (1, 2)
|
|
|
</update>
|
|
|
<delete id="deleteResumption">
|
|
|
delete from core_resumption where ymd_year = #{year} and ymd_quarter=#{quarter} and id in
|
|
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
-
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
@@ -139,136 +139,154 @@ update core_resumption set name=#{planName} where plan_id =#{planId} and statu
|
|
|
<select id="selectAllByPlanStartTime" resultType="com.xunmei.core.resumption.domain.Resumption">
|
|
|
SELECT *
|
|
|
FROM core_resumption
|
|
|
- WHERE `status` =1 and type = #{type}
|
|
|
+ WHERE `status` = 1
|
|
|
+ and type = #{type}
|
|
|
and plan_end_time like concat(#{planEndTime}, '%')
|
|
|
</select>
|
|
|
<select id="selectDay" resultType="com.xunmei.core.resumption.domain.Resumption">
|
|
|
- SELECT
|
|
|
- a.*
|
|
|
- FROM
|
|
|
- core_resumption a
|
|
|
- LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
- WHERE
|
|
|
- a.type =2 AND b.plan_exec=#{planExec} and a.`status` =1
|
|
|
+ SELECT a.*
|
|
|
+ FROM core_resumption a
|
|
|
+ LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
+ WHERE a.type = 2
|
|
|
+ AND b.plan_exec = #{planExec}
|
|
|
+ and a.`status` = 1
|
|
|
AND a.plan_end_time like concat(#{planEndTime}, '%')
|
|
|
-
|
|
|
</select>
|
|
|
<select id="findResumptionList" resultType="com.xunmei.core.resumption.vo.WorkChangeResumptionVo">
|
|
|
select a.id,b.id as planId,b.plan_exec as planExec,a.status,a.org_id as orgId
|
|
|
from core_resumption a left join core_resumption_plan b on a.plan_id =b.id
|
|
|
- where a.ymd_year = #{year} and a.ymd_quarter=#{quarter} and a.ymd_date=#{date} and `type`=#{type} and b.plan_exec not in (4,5,6) and a.org_id in
|
|
|
+ where a.ymd_year = #{year} and a.ymd_quarter=#{quarter} and a.ymd_date=#{date} and `type`=#{type} and
|
|
|
+ b.plan_exec not in (4,5,6) and a.org_id in
|
|
|
<foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
<if test="status!=null">
|
|
|
and a.status=#{status}
|
|
|
</if>
|
|
|
-
|
|
|
</select>
|
|
|
<select id="selectResumptionPlan" resultType="com.xunmei.core.resumption.gx.vo.ResumptionPlanVo">
|
|
|
- select
|
|
|
- a.data_id,
|
|
|
- a.area_id,
|
|
|
- d.`name` as area_name,
|
|
|
- a.check_id,
|
|
|
- c.id as item_id,
|
|
|
- c.`name` as item_name,
|
|
|
- b.id as point_id,
|
|
|
- b.`name` as point_name,
|
|
|
- a.res_value,
|
|
|
- a.res_remark,
|
|
|
- a.rectification_deadline,
|
|
|
- a.data_status
|
|
|
- from
|
|
|
- (select id as data_id,area_id,check_id,item_id,res_value,res_remark,rectification_deadline,data_status
|
|
|
- from core_resumption_data where resumption_id = #{resumptionId}) a
|
|
|
- LEFT JOIN core_resumption_rule_point b on a.item_id = b.id
|
|
|
- LEFT JOIN core_resumption_rule_item c on b.item_id = c.id
|
|
|
- LEFT JOIN sys_area d on a.area_id = d.id
|
|
|
+ select a.data_id,
|
|
|
+ a.area_id,
|
|
|
+ d.`name` as area_name,
|
|
|
+ a.check_id,
|
|
|
+ c.id as item_id,
|
|
|
+ c.`name` as item_name,
|
|
|
+ b.id as point_id,
|
|
|
+ b.`name` as point_name,
|
|
|
+ a.res_value,
|
|
|
+ a.res_remark,
|
|
|
+ a.rectification_deadline,
|
|
|
+ a.data_status,
|
|
|
+ a.point_scan,
|
|
|
+ a.required
|
|
|
+ from (select id as data_id,
|
|
|
+ area_id,
|
|
|
+ check_id,
|
|
|
+ item_id,
|
|
|
+ res_value,
|
|
|
+ res_remark,
|
|
|
+ rectification_deadline,
|
|
|
+ data_status,
|
|
|
+ point_scan,
|
|
|
+ required
|
|
|
+ from core_resumption_data
|
|
|
+ where resumption_id = #{resumptionId}) a
|
|
|
+ LEFT JOIN core_resumption_rule_point b on a.item_id = b.id
|
|
|
+ LEFT JOIN core_resumption_rule_item c on b.item_id = c.id
|
|
|
+ LEFT JOIN sys_area d on a.area_id = d.id
|
|
|
</select>
|
|
|
<select id="selectResumptionNFC" resultType="com.xunmei.core.resumption.gx.vo.ResumptionNFCVo">
|
|
|
- SELECT
|
|
|
- a.area_id,
|
|
|
- a.check_id,
|
|
|
- a.id as nfc_id,
|
|
|
- a.collection_area_name as nfc_name,
|
|
|
- a.`code` as nfc_code,
|
|
|
- b.`status`,
|
|
|
- b.scan_method,
|
|
|
- b.img
|
|
|
- FROM
|
|
|
- ( SELECT area_id,check_id, collection_area_name, CODE, id FROM sys_nfc_bind WHERE (area_id =#{areaId} AND org_id = #{orgId} and del_flag='0' ) a
|
|
|
- LEFT JOIN ( SELECT nfc_id, point_id, img, STATUS, scan_method FROM core_resumption_data_nfc WHERE resumption_id = #{resumptionId} ) b ON a.id = b.nfc_id
|
|
|
-
|
|
|
+ SELECT a.area_id,
|
|
|
+ a.check_id,
|
|
|
+ a.id as nfc_id,
|
|
|
+ a.collection_area_name as nfc_name,
|
|
|
+ a.`code` as nfc_code,
|
|
|
+ b.`status`,
|
|
|
+ b.scan_method,
|
|
|
+ b.img
|
|
|
+ FROM (SELECT area_id, check_id, collection_area_name, CODE, id
|
|
|
+ FROM sys_nfc_bind
|
|
|
+ WHERE (area_id = #{areaId} AND org_id = #{orgId} and del_flag = '0') a
|
|
|
+ LEFT JOIN ( SELECT nfc_id, point_id, img, STATUS, scan_method FROM core_resumption_data_nfc WHERE resumption_id = #{resumptionId} ) b
|
|
|
+ ON a.id = b.nfc_id
|
|
|
</select>
|
|
|
<select id="selectNFCOfOrg" resultType="com.xunmei.core.resumption.gx.vo.ResumptionNFCVo">
|
|
|
- SELECT
|
|
|
- a.area_id,
|
|
|
- ar.name as area_name,
|
|
|
- a.check_id,
|
|
|
- a.id as nfc_id,
|
|
|
- a.label_name as nfc_name,
|
|
|
- a.`code` as nfc_code,
|
|
|
- b.`status`,
|
|
|
- b.scan_method,
|
|
|
- b.img
|
|
|
- FROM
|
|
|
- ( SELECT area_id,check_id, collection_area_name, CODE, id,label_name FROM sys_nfc_bind WHERE org_id = #{orgId} and del_flag='0'and enable='0' ) a
|
|
|
- LEFT JOIN ( SELECT nfc_id, point_id, img, STATUS, scan_method FROM core_resumption_data_nfc WHERE resumption_id = #{resumptionId} ) b ON a.id = b.nfc_id
|
|
|
- left join sys_area ar on ar.id=a.area_id and ar.del_flag='0'
|
|
|
+ SELECT a.area_id,
|
|
|
+ ar.name as area_name,
|
|
|
+ a.check_id,
|
|
|
+ a.id as nfc_id,
|
|
|
+ a.label_name as nfc_name,
|
|
|
+ a.`code` as nfc_code,
|
|
|
+ b.`status`,
|
|
|
+ b.scan_method,
|
|
|
+ b.img
|
|
|
+ FROM (SELECT area_id, check_id, collection_area_name, CODE, id, label_name
|
|
|
+ FROM sys_nfc_bind
|
|
|
+ WHERE org_id = #{orgId}
|
|
|
+ and del_flag = '0'
|
|
|
+ and enable = '0') a
|
|
|
+ LEFT JOIN (SELECT nfc_id, point_id, img, STATUS, scan_method
|
|
|
+ FROM core_resumption_data_nfc
|
|
|
+ WHERE resumption_id = #{resumptionId}) b ON a.id = b.nfc_id
|
|
|
+ left join sys_area ar on ar.id = a.area_id and ar.del_flag = '0'
|
|
|
</select>
|
|
|
<select id="selectCurUserTaskList" resultType="com.xunmei.common.core.domain.panel.vo.PanelListVo">
|
|
|
+ select distinct t.id as id,
|
|
|
+ name as taskName,
|
|
|
+ t.plan_start_time as startTime,
|
|
|
+ t.plan_end_time as endTime,
|
|
|
+ t.status
|
|
|
+ from core_resumption t
|
|
|
+ where t.org_id = #{request.orgId}
|
|
|
+ and t.plan_id in (select pr.plan_id
|
|
|
+ from core_resumption_plan_to_role pr
|
|
|
+ inner join core_resumption_plan p
|
|
|
+ on pr.plan_id = p.id and p.deleted = 0 and p.plan_status = 1)
|
|
|
|
|
|
- select distinct t.id as id, name as taskName,t.plan_start_time as startTime,t.plan_end_time as endTime,t.status
|
|
|
- from core_resumption t where t.org_id =#{request.orgId} and t.role_id in
|
|
|
- <foreach collection="request.roleIdList" item="roleId" open="(" separator="," close=")">
|
|
|
- #{roleId}
|
|
|
- </foreach>
|
|
|
- and t.status in (1,2)
|
|
|
- and ((
|
|
|
- #{request.startTime} <![CDATA[<=]]> t.plan_start_time
|
|
|
- and #{request.endTime} >= t.plan_start_time
|
|
|
- )
|
|
|
- or (
|
|
|
- #{request.startTime} <![CDATA[<=]]> t.plan_end_time
|
|
|
- and #{request.endTime} >= t.plan_end_time
|
|
|
- )
|
|
|
- or (
|
|
|
- #{request.startTime} >= t.plan_start_time
|
|
|
- and #{request.endTime} <![CDATA[<=]]> t.plan_end_time
|
|
|
- ))
|
|
|
+ and t.status in (1, 2)
|
|
|
+ and ((
|
|
|
+ #{request.startTime} <![CDATA[<=]]> t.plan_start_time
|
|
|
+ and #{request.endTime} >= t.plan_start_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{request.startTime} <![CDATA[<=]]> t.plan_end_time
|
|
|
+ and #{request.endTime} >= t.plan_end_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{request.startTime} >= t.plan_start_time
|
|
|
+ and #{request.endTime} <![CDATA[<=]]> t.plan_end_time
|
|
|
+ ))
|
|
|
</select>
|
|
|
|
|
|
<select id="findResumptionExceptionList"
|
|
|
resultType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData">
|
|
|
- <!-- SELECT a.id as dataId, a.org_id as orgId, a.plan_id as extraField1, a.status as extraField2, a.ymd_date as dataTime,'core_resumption' as dataSource,now() as createTime
|
|
|
- FROM core_resumption a
|
|
|
- WHERE a.plan_id IN (SELECT a.id
|
|
|
- FROM core_resumption_plan a
|
|
|
- WHERE a.plan_cycle IN (SELECT cycle
|
|
|
- FROM core_safety_index_calculate_rule a
|
|
|
- WHERE a.type_code = 1004
|
|
|
- GROUP BY org_type, cycle)
|
|
|
- AND exec_org_type IN (SELECT org_type
|
|
|
+ <!-- SELECT a.id as dataId, a.org_id as orgId, a.plan_id as extraField1, a.status as extraField2, a.ymd_date as dataTime,'core_resumption' as dataSource,now() as createTime
|
|
|
+ FROM core_resumption a
|
|
|
+ WHERE a.plan_id IN (SELECT a.id
|
|
|
+ FROM core_resumption_plan a
|
|
|
+ WHERE a.plan_cycle IN (SELECT cycle
|
|
|
FROM core_safety_index_calculate_rule a
|
|
|
WHERE a.type_code = 1004
|
|
|
- GROUP BY org_type, cycle))
|
|
|
- and ymd_year =#{year} and ymd_quarter=#{quarter} and ymd_month=#{month} and status in (4) and role_id =#{roleId}-->
|
|
|
- SELECT a.id as dataId,
|
|
|
- a.org_id as orgId,
|
|
|
- a.plan_id as extraField1,
|
|
|
- p.plan_cycle as extraField2,
|
|
|
- a.ymd_date as dataTime,
|
|
|
+ GROUP BY org_type, cycle)
|
|
|
+ AND exec_org_type IN (SELECT org_type
|
|
|
+ FROM core_safety_index_calculate_rule a
|
|
|
+ WHERE a.type_code = 1004
|
|
|
+ GROUP BY org_type, cycle))
|
|
|
+ and ymd_year =#{year} and ymd_quarter=#{quarter} and ymd_month=#{month} and status in (4) and role_id =#{roleId}-->
|
|
|
+ SELECT a.id as dataId,
|
|
|
+ a.org_id as orgId,
|
|
|
+ a.plan_id as extraField1,
|
|
|
+ p.plan_cycle as extraField2,
|
|
|
+ a.ymd_date as dataTime,
|
|
|
'core_resumption' as dataSource,
|
|
|
- now() as createTime
|
|
|
+ now() as createTime
|
|
|
FROM core_resumption a
|
|
|
inner join core_resumption_plan p on a.plan_id = p.id
|
|
|
where p.plan_cycle in (2, 3, 4) <!--营业前中后-->
|
|
|
- and ymd_year =#{year}
|
|
|
+ and ymd_year =#{year}
|
|
|
and ymd_quarter=#{quarter}
|
|
|
and ymd_month=#{month}
|
|
|
and status in (4)
|
|
|
and role_id = #{roleId}
|
|
|
-
|
|
|
</select>
|
|
|
</mapper>
|