|
|
@@ -21,6 +21,7 @@
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="modifiedBy" column="modified_by"/>
|
|
|
<result property="sourceType" column="source_type"/>
|
|
|
+ <result property="roleNames" column="role_names"/>
|
|
|
|
|
|
<result property="planCreateOrgId" column="plan_create_org_id"/>
|
|
|
<result property="planOfOrgId" column="plan_of_org_id"/>
|
|
|
@@ -39,14 +40,14 @@
|
|
|
<result column="role_id" property="id"/>
|
|
|
</collection>
|
|
|
<!-- 受检机构关系映射 -->
|
|
|
- <collection property="checkOrgList" ofType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToCheckOrg">
|
|
|
- <result column="check_org_plan_id" property="planId"/>
|
|
|
- <result column="check_org_org_id" property="orgId"/>
|
|
|
+ <collection property="checkOrgList" ofType="com.xunmei.system.api.domain.SysOrg">
|
|
|
+ <result column="check_org_id" property="id"/>
|
|
|
+ <result column="check_org_name" property="name"/>
|
|
|
</collection>
|
|
|
<!-- 检查机构关系映射 -->
|
|
|
- <collection property="execOrgList" ofType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToExecOrg">
|
|
|
- <result column="exec_org_plan_id" property="planId"/>
|
|
|
- <result column="exec_org_org_id" property="orgId"/>
|
|
|
+ <collection property="execOrgList" ofType="com.xunmei.system.api.domain.SysOrg">
|
|
|
+ <result column="exec_org_id" property="id"/>
|
|
|
+ <result column="exec_org_name" property="name"/>
|
|
|
</collection>
|
|
|
<!-- 检查要点关系映射 -->
|
|
|
<collection property="rulePointList" ofType="com.xunmei.core.safetyCheck.domain.SafetyCheckRulePoint">
|
|
|
@@ -83,10 +84,10 @@
|
|
|
<if test="planCycle != null ">
|
|
|
and plan_cycle = #{planCycle}
|
|
|
</if>
|
|
|
- <if test="execOrgType != null ">
|
|
|
+ <if test="execOrgType != null and execOrgType != ''">
|
|
|
and exec_org_type = #{execOrgType}
|
|
|
</if>
|
|
|
- <if test="checkOrgType != null ">
|
|
|
+ <if test="checkOrgType != null and checkOrgType != ''">
|
|
|
and check_org_type = #{checkOrgType}
|
|
|
</if>
|
|
|
<if test="planStatus != null ">
|
|
|
@@ -121,50 +122,64 @@
|
|
|
|
|
|
<select id="selectCoreSafecheckPlanById" parameterType="Long"
|
|
|
resultMap="CoreSafecheckPlanResult">
|
|
|
- SELECT
|
|
|
- c.*,
|
|
|
- o1.NAME AS plan_create_org_name,
|
|
|
- o2.NAME AS plan_of_org_name,
|
|
|
- r.role_name,
|
|
|
- r.id AS role_id,
|
|
|
- eo.plan_id AS exec_org_plan_id,
|
|
|
- eo.org_id AS exec_org_org_id,
|
|
|
- co.plan_id AS check_org_plan_id,
|
|
|
- co.org_id AS check_org_org_id ,
|
|
|
- rp.id as rule_point_id,
|
|
|
- rp.rule_id as rule_point_rule_id,
|
|
|
- rp.item_id as rule_point_item_id,
|
|
|
- rp.name as rule_point_name,
|
|
|
- rp.area_id as rule_point_area_id
|
|
|
-
|
|
|
-
|
|
|
- FROM
|
|
|
- core_safecheck_plan c
|
|
|
- LEFT JOIN sys_org o1 ON c.plan_create_org_id = o1.id
|
|
|
- LEFT JOIN sys_org o2 ON c.plan_of_org_id = o2.id
|
|
|
- LEFT JOIN core_safecheck_plan_to_role pr ON c.id = pr.plan_id
|
|
|
- LEFT JOIN sys_role r ON r.id = pr.role_id
|
|
|
- LEFT JOIN core_safecheck_plan_to_exec_org eo ON eo.plan_id = c.id
|
|
|
- LEFT JOIN sys_org o3 ON eo.org_id = o3.id
|
|
|
- LEFT JOIN core_safecheck_plan_to_check_org co ON co.plan_id = c.id
|
|
|
- LEFT JOIN sys_org o4 ON co.org_id = o4.id
|
|
|
- LEFT JOIN core_safecheck_plan_to_point pp ON pp.plan_id = c.id
|
|
|
- LEFT JOIN core_safetycheck_rule_point rp ON rp.id = pp.point_id
|
|
|
+ SELECT c.*,
|
|
|
+ o1.NAME AS plan_create_org_name,
|
|
|
+ o2.NAME AS plan_of_org_name,
|
|
|
+ r.role_name,
|
|
|
+ r.id AS role_id,
|
|
|
+ eo.plan_id AS exec_org_plan_id,
|
|
|
+ eo.org_id AS exec_org_org_id,
|
|
|
+ co.plan_id AS check_org_plan_id,
|
|
|
+ co.org_id AS check_org_org_id,
|
|
|
+ rp.id as rule_point_id,
|
|
|
+ rp.rule_id as rule_point_rule_id,
|
|
|
+ rp.item_id as rule_point_item_id,
|
|
|
+ rp.name as rule_point_name,
|
|
|
+ rp.area_id as rule_point_area_id,
|
|
|
+ o3.id as exec_org_id,
|
|
|
+ o3.name as exec_org_name,
|
|
|
+ o4.id as check_org_id,
|
|
|
+ o4.name as check_org_name
|
|
|
+ FROM core_safecheck_plan c
|
|
|
+ LEFT JOIN sys_org o1 ON c.plan_create_org_id = o1.id
|
|
|
+ LEFT JOIN sys_org o2 ON c.plan_of_org_id = o2.id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_role pr ON c.id = pr.plan_id
|
|
|
+ LEFT JOIN sys_role r ON r.id = pr.role_id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_exec_org eo ON eo.plan_id = c.id
|
|
|
+ LEFT JOIN sys_org o3 ON eo.org_id = o3.id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_check_org co ON co.plan_id = c.id
|
|
|
+ LEFT JOIN sys_org o4 ON co.org_id = o4.id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_point pp ON pp.plan_id = c.id
|
|
|
+ LEFT JOIN core_safetycheck_rule_point rp ON rp.id = pp.point_id
|
|
|
where c.id = #{id}
|
|
|
+
|
|
|
</select>
|
|
|
<select id="selectCoreSafecheckPlanPage" resultMap="CoreSafecheckPlanResult">
|
|
|
SELECT
|
|
|
+ GROUP_CONCAT(DISTINCT role_name) as role_names,
|
|
|
+ tem.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
c.*,
|
|
|
o1.NAME AS plan_create_org_name,
|
|
|
o2.NAME AS plan_of_org_name,
|
|
|
r.role_name,
|
|
|
- r.id as role_id
|
|
|
+ r.id AS role_id,
|
|
|
+ o3.id AS check_org_id,
|
|
|
+ o3.NAME AS check_org_name,
|
|
|
+ o4.id AS exec_org_id,
|
|
|
+ o4.NAME AS exec_org_name
|
|
|
FROM
|
|
|
core_safecheck_plan c
|
|
|
LEFT JOIN sys_org o1 ON c.plan_create_org_id = o1.id
|
|
|
LEFT JOIN sys_org o2 ON c.plan_of_org_id = o2.id
|
|
|
LEFT JOIN core_safecheck_plan_to_role pr ON c.id = pr.plan_id
|
|
|
LEFT JOIN sys_role r ON r.id = pr.role_id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_check_org co ON co.plan_id = c.id
|
|
|
+ LEFT JOIN sys_org o3 ON o3.id = co.org_id
|
|
|
+ LEFT JOIN core_safecheck_plan_to_exec_org eo ON eo.plan_id = c.id
|
|
|
+ LEFT JOIN sys_org o4 ON o4.id = eo.org_id
|
|
|
where 1=1
|
|
|
<if test="check.planName != null and check.planName != ''">
|
|
|
and c.plan_name like concat('%', #{check.planName}, '%')
|
|
|
@@ -172,20 +187,20 @@
|
|
|
<if test="check.planCycle != null ">
|
|
|
and c.plan_cycle = #{check.planCycle}
|
|
|
</if>
|
|
|
- <if test="check.execOrgType != null ">
|
|
|
+ <if test="check.execOrgType != null and check.execOrgType != ''">
|
|
|
and c.exec_org_type = #{check.execOrgType}
|
|
|
</if>
|
|
|
- <if test="check.checkOrgType != null ">
|
|
|
+ <if test="check.checkOrgType != null and check.checkOrgType != ''">
|
|
|
and c.check_org_type = #{check.checkOrgType}
|
|
|
</if>
|
|
|
<if test="check.planStatus != null ">
|
|
|
and c.plan_status = #{check.planStatus}
|
|
|
</if>
|
|
|
|
|
|
- <if test="check.checkRole != null ">
|
|
|
+ <if test="check.checkRole != null and check.checkRole != ''">
|
|
|
and r.id = #{check.checkRole}
|
|
|
</if>
|
|
|
-
|
|
|
+ ) tem GROUP BY tem.id
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertCoreSafecheckPlan" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlan"
|