|
|
@@ -6,7 +6,8 @@
|
|
|
</sql>
|
|
|
|
|
|
<sql id="baseColumn">
|
|
|
- id,plan_name,plan_type,plan_cycle,plan_exec,exec_org_type,check_org_type,check_type,exec_type,plan_status,description,create_time,modified_name,update_time,modified_by
|
|
|
+ id
|
|
|
+ ,plan_name,plan_type,plan_cycle,plan_exec,exec_org_type,check_org_type,check_type,exec_type,plan_status,description,create_time,modified_name,update_time,modified_by
|
|
|
</sql>
|
|
|
|
|
|
<resultMap id="appPlans" type="com.xunmei.core.resumption.domain.AppPlan">
|
|
|
@@ -31,7 +32,7 @@
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
- <select id="selectPage" parameterType="com.xunmei.core.resumption.vo.appPlan.AppPlanVo" resultMap="appPlans">
|
|
|
+ <select id="selectPage" parameterType="com.xunmei.core.resumption.dto.plan.CoreResumptionPlanPageDto" resultMap="appPlans">
|
|
|
SELECT
|
|
|
a.*,
|
|
|
d.roleNames,
|
|
|
@@ -82,6 +83,9 @@
|
|
|
<if test="info.orgType != null">
|
|
|
and a.exec_org_type = #{info.orgType}
|
|
|
</if>
|
|
|
+ <if test="info.orgId != null">
|
|
|
+ and a.plan_of_org_id = #{info.orgId}
|
|
|
+ </if>
|
|
|
<if test="info.roleList != null and info.roleList.size > 0">
|
|
|
and a.id in (select plan_id from core_resumption_plan_to_role where role_id in
|
|
|
<foreach collection="info.roleList" item="roleId" index="index" open="(" separator="," close=")">
|
|
|
@@ -89,16 +93,33 @@
|
|
|
</foreach>
|
|
|
)
|
|
|
</if>
|
|
|
- <if test="info.orgList != null and info.orgList.size > 0">
|
|
|
- and a.id in (select plan_id from core_resumption_plan_to_exec_org where org_id in
|
|
|
- <foreach collection="info.orgList" item="orgId" index="index" open="(" separator="," close=")">
|
|
|
+<!-- <if test="info.orgList != null and info.orgList.size > 0">-->
|
|
|
+<!-- and a.id in (select plan_id from core_resumption_plan_to_exec_org where org_id in-->
|
|
|
+<!-- (select id from sys_org-->
|
|
|
+<!-- where path like concat((select path from sys_org where id=#{info.orgId}),'%')-->
|
|
|
+<!-- )-->
|
|
|
+<!-- </if>-->
|
|
|
+ and a.id in (
|
|
|
+ select if(parent_id=-1,id,parent_id ) as id from core_resumption_plan
|
|
|
+ where 1=1
|
|
|
+ <if test="info.checkSub==false">
|
|
|
+ and plan_of_org_id=#{info.orgId}
|
|
|
+ </if>
|
|
|
+ <if test="info.checkSub=true">
|
|
|
+ and plan_of_org_id in (select id from sys_org
|
|
|
+ where path like concat((select path from sys_org where id=#{info.orgId}),'%'))
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ <if test="info.ids!=null and info.ids.size > 0">
|
|
|
+ and a.plan_of_org_id in
|
|
|
+ <foreach collection="info.ids" item="orgId" index="index" open="(" separator="," close=")">
|
|
|
#{orgId}
|
|
|
</foreach>
|
|
|
- )
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
- <select id="selectItemPage" parameterType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo" resultType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo">
|
|
|
+ <select id="selectItemPage" parameterType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo"
|
|
|
+ resultType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo">
|
|
|
select
|
|
|
a.id,
|
|
|
a.item_id,
|
|
|
@@ -131,18 +152,17 @@
|
|
|
|
|
|
|
|
|
<select id="selectByPlanId" resultType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo">
|
|
|
- SELECT
|
|
|
- h.point_id as id,
|
|
|
- a.item_id,
|
|
|
- b.NAME AS item_name,
|
|
|
- b.DESC AS item_desc,-- b.item_num,
|
|
|
+ SELECT h.point_id as id,
|
|
|
+ a.item_id,
|
|
|
+ b.NAME AS item_name,
|
|
|
+ b.DESC AS item_desc,-- b.item_num,
|
|
|
-- a.safe_type,
|
|
|
- c.`name` area_name,
|
|
|
- a.NAME AS point_name,-- a.point_num,
|
|
|
- h.point_scan,
|
|
|
- h.required,
|
|
|
- d.NAME AS ruleName,
|
|
|
- a.business_type AS businessType
|
|
|
+ c.`name` area_name,
|
|
|
+ a.NAME AS point_name,-- a.point_num,
|
|
|
+ h.point_scan,
|
|
|
+ h.required,
|
|
|
+ d.NAME AS ruleName,
|
|
|
+ a.business_type AS businessType
|
|
|
FROM (SELECT point_id, point_scan, required FROM core_resumption_plan_to_point WHERE plan_id = #{planId}) h
|
|
|
LEFT JOIN core_resumption_rule_point a ON h.point_id = a.id
|
|
|
LEFT JOIN core_resumption_rule_item b ON a.item_id = b.id
|
|
|
@@ -154,7 +174,7 @@
|
|
|
<select id="findExecOrgByPlan" parameterType="Long" resultType="Long">
|
|
|
select org_id
|
|
|
from core_resumption_plan_to_exec_org a
|
|
|
- INNER JOIN sys_org o on a.org_id=o.id and o.deleted=0 and o.is_lock=0
|
|
|
+ INNER JOIN sys_org o on a.org_id = o.id and o.deleted = 0 and o.is_lock = 0
|
|
|
where a.plan_id = #{plan_id}
|
|
|
</select>
|
|
|
<select id="findRoleByPlan" parameterType="Long" resultType="Long">
|
|
|
@@ -212,17 +232,99 @@
|
|
|
<select id="selectPlanByName" resultMap="appPlans">
|
|
|
select *
|
|
|
from core_resumption_plan
|
|
|
- where plan_name like CONCAT('%', #{planName}, '%') and deleted=0
|
|
|
+ where plan_name like CONCAT('%', #{planName}, '%')
|
|
|
+ and deleted = 0
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="selectPlanNameById" resultType="java.lang.String">
|
|
|
- select plan_name from core_resumption_plan where id = #{planId}
|
|
|
+ select plan_name
|
|
|
+ from core_resumption_plan
|
|
|
+ where id = #{planId}
|
|
|
</select>
|
|
|
<select id="selectPlanNames" resultType="com.xunmei.common.core.vo.IdNameVo">
|
|
|
select id, plan_name as name from core_resumption_plan where id in
|
|
|
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
+ <foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
and deleted=0
|
|
|
</select>
|
|
|
+ <select id="selectAll" resultType="com.xunmei.core.resumption.domain.AppPlan">
|
|
|
+ SELECT
|
|
|
+ a.*,
|
|
|
+ d.roleNames,
|
|
|
+ b.orgId,
|
|
|
+ b.orgNames,
|
|
|
+ o.name as plan_of_org_name,
|
|
|
+ g.name as plan_create_org_name,
|
|
|
+ g.type as org_type
|
|
|
+ FROM
|
|
|
+ core_resumption_plan a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ m.plan_id,
|
|
|
+ GROUP_CONCAT( n.`name` ) orgNames,
|
|
|
+ GROUP_CONCAT( n.id ) orgId
|
|
|
+ FROM
|
|
|
+ core_resumption_plan_to_exec_org m
|
|
|
+ LEFT JOIN sys_org n ON m.org_id = n.id
|
|
|
+
|
|
|
+ GROUP BY
|
|
|
+ m.plan_id
|
|
|
+ ) b ON a.id = b.plan_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ r.plan_id,
|
|
|
+ group_concat( t.`role_name` ) roleNames
|
|
|
+ FROM
|
|
|
+ core_resumption_plan_to_role r
|
|
|
+ LEFT JOIN sys_role t ON r.role_id = t.id
|
|
|
+ GROUP BY
|
|
|
+ r.plan_id
|
|
|
+ ) d ON a.id = d.plan_id
|
|
|
+ LEFT JOIN sys_org o ON a.plan_of_org_id = o.id
|
|
|
+ LEFT JOIN sys_org g ON a.plan_create_org_id = g.id
|
|
|
+
|
|
|
+ <where>
|
|
|
+ a.deleted=0
|
|
|
+ <if test="info.planName != '' and info.planName != null">
|
|
|
+ and a.plan_name LIKE CONCAT('%', #{info.planName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="info.planStatus != null">
|
|
|
+ and a.plan_status = #{info.planStatus}
|
|
|
+ </if>
|
|
|
+ <if test="info.planCycle != null">
|
|
|
+ and a.plan_cycle = #{info.planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="info.planExec != null">
|
|
|
+ and a.plan_exec = #{info.planExec}
|
|
|
+ </if>
|
|
|
+ <if test="info.orgType != null">
|
|
|
+ and a.exec_org_type = #{info.orgType}
|
|
|
+ </if>
|
|
|
+ <if test="info.orgId != null">
|
|
|
+ and a.plan_of_org_id = #{info.orgId}
|
|
|
+ </if>
|
|
|
+ <if test="info.roleList != null and info.roleList.size > 0">
|
|
|
+ and a.id in (select plan_id from core_resumption_plan_to_role where role_id in
|
|
|
+ <foreach collection="info.roleList" item="roleId" index="index" open="(" separator="," close=")">
|
|
|
+ #{roleId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="info.orgList != null and info.orgList.size > 0">
|
|
|
+ and a.id in (select plan_id from core_resumption_plan_to_exec_org where org_id in
|
|
|
+ <foreach collection="info.orgList" item="orgId" index="index" open="(" separator="," close=")">
|
|
|
+ #{orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="info.ids!=null and info.ids.size > 0">
|
|
|
+ and a.plan_of_org_id in
|
|
|
+ <foreach collection="info.ids" item="orgId" index="index" open="(" separator="," close=")">
|
|
|
+ #{orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|