|
|
@@ -2,72 +2,51 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.xunmei.core.resumption.mapper.AppRulePointMapper">
|
|
|
<select id="selectDataListByItemId" resultType="com.xunmei.core.resumption.dto.appRulePoint.AppRulePointDetailDto">
|
|
|
- select p.id,
|
|
|
- rule_id as ruleId,
|
|
|
- point_num as pointNum,
|
|
|
- point_name as pointName,
|
|
|
- area_id as areaId,
|
|
|
- a.name as areaName,
|
|
|
- safe_type as safeType,
|
|
|
- d.name as safeTypeName,
|
|
|
- reform_day as reformDay,
|
|
|
- inspection as inspection,
|
|
|
- d1.name as inspectionName,
|
|
|
- p.data_type as dataType,
|
|
|
- i.DATA_NAME as dataTypeName,
|
|
|
- time_type as timeType,
|
|
|
- remark as remark,
|
|
|
- degree_risk as degreeRisk,
|
|
|
- d2.name as degreeRiskName,
|
|
|
- p.business_type as businessType
|
|
|
- from t_app_rule_point p
|
|
|
- inner join t_area a on p.area_id = a.id
|
|
|
- left join sys_dict_detail d on d.code = p.safe_type and d.dict_code = 'check_type'
|
|
|
- left join sys_dict_detail d1 on d1.id = p.inspection and d1.dict_code = 'check_method'
|
|
|
- left join sys_dict_detail d2 on d2.code = p.degree_risk and d2.dict_code = 'degree_risk'
|
|
|
- inner join sec_book_dt_inst i on p.data_type = i.ID
|
|
|
+ select p.*,a.name as areaName
|
|
|
+ from core_resumption_rule_point p
|
|
|
+ inner join sys_area a on p.area_id = a.id
|
|
|
where item_id = #{id}
|
|
|
and p.deleted = 0
|
|
|
</select>
|
|
|
- <select id="selectDataListByIdList" resultType="com.xunmei.core.resumption.dto.appRulePoint.AppRulePointInfoDto"
|
|
|
- parameterType="java.util.List">
|
|
|
- select
|
|
|
- ri.id as itemId,
|
|
|
- ri.item_name as itemName,
|
|
|
- ri.item_num as itemNum,
|
|
|
- ri.item_desc as itemDesc,
|
|
|
- p.id as id,
|
|
|
- p.point_num as pointNum,
|
|
|
- p.point_name as pointName,
|
|
|
- p.safe_type as safeType,
|
|
|
- d.name as safeTypeText,
|
|
|
- p.area_id as areaId,
|
|
|
- p.business_type as businessType,
|
|
|
- a.name as areaName,
|
|
|
- ap.plan_name as planName,
|
|
|
- ap.id as planId,
|
|
|
- 1 as pointSource
|
|
|
-
|
|
|
- from t_app_rule_point p
|
|
|
- inner join t_app_rule_item ri on ri.id=p.item_id
|
|
|
- inner join t_area a on p.area_id = a.id
|
|
|
- inner join sys_dict_detail d on d.code = p.safe_type and d.dict_code = 'check_type'
|
|
|
- inner join t_app_plan_to_item ti on ti.item_id=p.id
|
|
|
- inner join t_app_plan ap on ti.plan_id =ap.id
|
|
|
- where p.deleted = 0
|
|
|
- <if test="pointIds != null and pointIds.size > 0">
|
|
|
- and p.id in
|
|
|
- <foreach collection="pointIds" item="pointId" open="(" separator="," close=")">
|
|
|
- #{pointId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="planIdList != null and planIdList.size > 0">
|
|
|
- and ap.id in
|
|
|
- <foreach collection="planIdList" item="planId" open="(" separator="," close=")">
|
|
|
- #{planId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
+<!-- <select id="selectDataListByIdList" resultType="com.xunmei.core.resumption.dto.appRulePoint.AppRulePointInfoDto"-->
|
|
|
+<!-- parameterType="java.util.List">-->
|
|
|
+<!-- select-->
|
|
|
+<!-- ri.id as itemId,-->
|
|
|
+<!-- ri.item_name as itemName,-->
|
|
|
+<!-- ri.item_num as itemNum,-->
|
|
|
+<!-- ri.item_desc as itemDesc,-->
|
|
|
+<!-- p.id as id,-->
|
|
|
+<!-- p.point_num as pointNum,-->
|
|
|
+<!-- p.point_name as pointName,-->
|
|
|
+<!-- p.safe_type as safeType,-->
|
|
|
+<!-- d.name as safeTypeText,-->
|
|
|
+<!-- p.area_id as areaId,-->
|
|
|
+<!-- p.business_type as businessType,-->
|
|
|
+<!-- a.name as areaName,-->
|
|
|
+<!-- ap.plan_name as planName,-->
|
|
|
+<!-- ap.id as planId,-->
|
|
|
+<!-- 1 as pointSource-->
|
|
|
+
|
|
|
+<!-- from core_resumption_rule_point p-->
|
|
|
+<!-- inner join t_app_rule_item ri on ri.id=p.item_id-->
|
|
|
+<!-- inner join sys_area a on p.area_id = a.id-->
|
|
|
+<!-- inner join sys_dict_detail d on d.code = p.safe_type and d.dict_code = 'check_type'-->
|
|
|
+<!-- inner join t_app_plan_to_item ti on ti.item_id=p.id-->
|
|
|
+<!-- inner join t_app_plan ap on ti.plan_id =ap.id-->
|
|
|
+<!-- where p.deleted = 0-->
|
|
|
+<!-- <if test="pointIds != null and pointIds.size > 0">-->
|
|
|
+<!-- and p.id in-->
|
|
|
+<!-- <foreach collection="pointIds" item="pointId" open="(" separator="," close=")">-->
|
|
|
+<!-- #{pointId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="planIdList != null and planIdList.size > 0">-->
|
|
|
+<!-- and ap.id in-->
|
|
|
+<!-- <foreach collection="planIdList" item="planId" open="(" separator="," close=")">-->
|
|
|
+<!-- #{planId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </select>-->
|
|
|
<select id="findPointByPlan" parameterType="Long" resultType="com.xunmei.core.resumption.vo.AppRulePointTaskVo">
|
|
|
SELECT a.*, b.point_scan
|
|
|
from sys_rule_point a
|
|
|
@@ -93,7 +72,7 @@
|
|
|
ap.rule_name as planName,
|
|
|
ap.id as planId,
|
|
|
2 as pointSource
|
|
|
- from t_app_rule_point p
|
|
|
+ from core_resumption_rule_point p
|
|
|
inner join t_app_rule_item ri on ri.id=p.item_id
|
|
|
inner join t_area a on p.area_id = a.id
|
|
|
inner join sys_dict_detail d on d.code = p.safe_type and d.dict_code = 'check_type'
|
|
|
@@ -116,7 +95,7 @@
|
|
|
|
|
|
<!-- <select id="findPointByPlan" parameterType="Long" resultType="com.xunmei.core.resumption.vo.resumption.AppRulePointTaskVo">-->
|
|
|
<!-- SELECT a.*, b.point_scan-->
|
|
|
-<!-- from t_app_rule_point a-->
|
|
|
+<!-- from core_resumption_rule_point a-->
|
|
|
<!-- LEFT JOIN t_app_plan_to_item b ON a.id = b.item_id-->
|
|
|
<!-- LEFT JOIN t_app_plan c ON b.plan_id = c.id-->
|
|
|
<!-- WHERE c.id = #{planid}-->
|
|
|
@@ -124,7 +103,7 @@
|
|
|
|
|
|
<select id="findAreaListPlan" parameterType="Long" resultType="java.util.Map">
|
|
|
SELECT a.area_id as areaid, d.name as areaname
|
|
|
- from t_app_rule_point a
|
|
|
+ from core_resumption_rule_point a
|
|
|
LEFT JOIN t_app_plan_to_item b ON a.id = b.item_id
|
|
|
LEFT JOIN t_app_plan c ON b.plan_id = c.id
|
|
|
LEFT JOIN t_area d ON a.area_id = d.id
|
|
|
@@ -134,14 +113,14 @@
|
|
|
|
|
|
<select id="findByName" parameterType="java.util.HashMap" resultType="java.util.Map">
|
|
|
SELECT id, area_id
|
|
|
- FROM t_app_rule_point a
|
|
|
- WHERE a.point_name = #{name}
|
|
|
+ FROM core_resumption_rule_point a
|
|
|
+ WHERE a.name = #{name}
|
|
|
and rule_id = #{ruleId}
|
|
|
</select>
|
|
|
|
|
|
<select id="checkIsUsed" resultType="java.lang.Integer">
|
|
|
SELECT 1
|
|
|
- FROM t_app_resumption_data a
|
|
|
+ FROM core_resumption_data a
|
|
|
WHERE a.item_id = #{pointId}
|
|
|
limit 1
|
|
|
</select>
|
|
|
@@ -149,13 +128,13 @@
|
|
|
|
|
|
<select id="selectPointIds" resultType="java.lang.Long">
|
|
|
select id
|
|
|
- from t_app_rule_point
|
|
|
+ from core_resumption_rule_point
|
|
|
where item_id = #{id}
|
|
|
and deleted = 0
|
|
|
</select>
|
|
|
|
|
|
<update id="updateDeleted">
|
|
|
- update t_app_rule_point
|
|
|
+ update core_resumption_rule_point
|
|
|
set deleted=#{deleted}
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
@@ -166,21 +145,21 @@
|
|
|
where item_id = #{id}
|
|
|
</update>
|
|
|
|
|
|
- <select id="checkPointNumRepeat" resultType="java.lang.Integer">
|
|
|
- select count(*)
|
|
|
- from t_app_rule_point
|
|
|
- where point_num = #{pointNum}
|
|
|
- and item_id = #{itemId}
|
|
|
- and deleted = 0
|
|
|
- <if test="pointId != null">
|
|
|
- and id != #{pointId}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
+<!-- <select id="checkPointNumRepeat" resultType="java.lang.Integer">-->
|
|
|
+<!-- select count(*)-->
|
|
|
+<!-- from core_resumption_rule_point-->
|
|
|
+<!-- where -->
|
|
|
+<!-- and item_id = #{itemId}-->
|
|
|
+<!-- and deleted = 0-->
|
|
|
+<!-- <if test="pointId != null">-->
|
|
|
+<!-- and id != #{pointId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </select>-->
|
|
|
|
|
|
<select id="checkPointNameRepeat" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
- from t_app_rule_point
|
|
|
- where point_name = #{pointName}
|
|
|
+ from core_resumption_rule_point
|
|
|
+ where name = #{pointName}
|
|
|
and item_id = #{itemId}
|
|
|
and deleted = 0
|
|
|
<if test="pointId != null">
|
|
|
@@ -191,7 +170,7 @@
|
|
|
<!-- <select id="findPointBySafetyPlan" parameterType="java.util.HashMap" resultType="com.isp.safecheck.vo.PointVo">-->
|
|
|
<!-- SELECT a.id as pointId,a.point_name as pointName ,a.point_num as pointNum,a.item_id as itemId,a.area_id as areaId,f.name as areaName,a.time_type as timeType,-->
|
|
|
<!-- b.plan_id as planId,e.item_name as itemName,b.point_scan as pointScan,d.DATA_NAME as dataName,d1.DATA_ITEM_NAME as dataDetailNameA,d2.DATA_ITEM_NAME as dataDetailNameB-->
|
|
|
-<!-- from t_app_rule_point a-->
|
|
|
+<!-- from core_resumption_rule_point a-->
|
|
|
<!-- LEFT JOIN t_app_safecheck_plan_to_item b ON a.id = b.item_id-->
|
|
|
<!-- LEFT JOIN t_app_safecheck_plan c ON b.plan_id = c.id-->
|
|
|
<!-- LEFT JOIN t_app_rule_item e ON a.item_id = e.id-->
|
|
|
@@ -206,7 +185,7 @@
|
|
|
<!-- SELECT b.id as pointId,b.point_name as pointName ,b.point_num as pointNum,b.item_id as itemId,b.area_id as areaId,b.time_type as timeType,f.name as areaName,-->
|
|
|
<!-- a.plan_id as planId,e.item_name as itemName,a.id as pointDataId,a.res_value as resValue,a.res_time as resTime,a.res_value as resValue,d.DATA_NAME as dataName,-->
|
|
|
<!-- d1.DATA_ITEM_NAME as dataDetailNameA,d2.DATA_ITEM_NAME as dataDetailNameB-->
|
|
|
-<!-- FROM t_app_safety_task_data a LEFT JOIN t_app_rule_point b ON a.point_id = b.id-->
|
|
|
+<!-- FROM t_app_safety_task_data a LEFT JOIN core_resumption_rule_point b ON a.point_id = b.id-->
|
|
|
<!-- LEFT JOIN t_area f ON a.area_id = f.id-->
|
|
|
<!-- LEFT JOIN t_app_rule_item e ON a.item_id = e.id-->
|
|
|
<!-- left join sec_book_dt_inst d on b.data_type = d.id-->
|
|
|
@@ -219,7 +198,7 @@
|
|
|
<select id="findPointByRulePlan" resultType="com.xunmei.core.resumption.vo.ResumptionPointVo">
|
|
|
SELECT a.id as pointid,a.point_name as pointname ,a.point_num as pointnum,a.item_id as itemid,a.area_id as areaid,f.name as areaname,a.time_type as timeType,
|
|
|
b.plan_id as planId,e.item_name as itemname,b.point_scan as pointScan,b.required,a.business_type as businessType
|
|
|
- from t_app_rule_point a
|
|
|
+ from core_resumption_rule_point a
|
|
|
LEFT JOIN t_app_plan_to_item b ON a.id = b.item_id
|
|
|
LEFT JOIN t_app_plan c ON b.plan_id = c.id
|
|
|
LEFT JOIN t_app_rule_item e ON a.item_id = e.id
|
|
|
@@ -228,20 +207,20 @@
|
|
|
</select>
|
|
|
<select id="checkIsJoinResumptionPlan" resultType="java.lang.Integer">
|
|
|
SELECT DISTINCT 1
|
|
|
- FROM t_app_plan_to_item
|
|
|
- WHERE item_id in
|
|
|
- <foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">
|
|
|
- #{pointId}
|
|
|
- </foreach>
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="checkIsJoinSafetyCheckTaskPlan" resultType="java.lang.Integer">
|
|
|
- SELECT DISTINCT 1
|
|
|
- FROM t_app_safecheck_plan_to_item
|
|
|
+ FROM sys_plan_to_item
|
|
|
WHERE item_id in
|
|
|
<foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">
|
|
|
#{pointId}
|
|
|
</foreach>
|
|
|
limit 1
|
|
|
</select>
|
|
|
+<!-- <select id="checkIsJoinSafetyCheckTaskPlan" resultType="java.lang.Integer">-->
|
|
|
+<!-- SELECT DISTINCT 1-->
|
|
|
+<!-- FROM t_app_safecheck_plan_to_item-->
|
|
|
+<!-- WHERE item_id in-->
|
|
|
+<!-- <foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">-->
|
|
|
+<!-- #{pointId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- limit 1-->
|
|
|
+<!-- </select>-->
|
|
|
</mapper>
|