|
|
@@ -0,0 +1,288 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.xunmei.core.safetyCheck.mapper.CoreSafecheckPlanMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlan" id="CoreSafecheckPlanResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="planName" column="plan_name"/>
|
|
|
+ <result property="planCycle" column="plan_cycle"/>
|
|
|
+ <result property="execOrgType" column="exec_org_type"/>
|
|
|
+ <result property="checkOrgType" column="check_org_type"/>
|
|
|
+ <result property="planStatus" column="plan_status"/>
|
|
|
+ <result property="startDate" column="start_date"/>
|
|
|
+ <result property="endDate" column="end_date"/>
|
|
|
+ <result property="buildTaskNow" column="build_task_now"/>
|
|
|
+ <result property="description" column="description"/>
|
|
|
+ <result property="isDeleted" column="is_deleted"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="modifiedName" column="modified_name"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="modifiedBy" column="modified_by"/>
|
|
|
+ <result property="sourceType" column="source_type"/>
|
|
|
+
|
|
|
+ <result property="planCreateOrgId" column="plan_create_org_id"/>
|
|
|
+ <result property="planOfOrgId" column="plan_of_org_id"/>
|
|
|
+ <result property="checkType" column="check_type"/>
|
|
|
+ <result property="count" column="count"/>
|
|
|
+ <result property="modifiedTime" column="modified_time"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="planCreateOrgName" column="plan_create_org_name"/>
|
|
|
+ <result property="planOfOrgName" column="plan_of_org_name"/>
|
|
|
+ <result property="execOrg" column="exec_org"/>
|
|
|
+ <result property="checkOrg" column="check_org"/>
|
|
|
+ <collection property="roleList" ofType="com.xunmei.system.api.domain.SysRole">
|
|
|
+ <result column="role_name" property="roleName"/>
|
|
|
+ <result column="role_id" property="id"/>
|
|
|
+ </collection>
|
|
|
+
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCoreSafecheckPlanVo">
|
|
|
+ SELECT c.*,
|
|
|
+ o1.NAME AS plan_create_org_name,
|
|
|
+ o2.NAME AS plan_of_org_name,
|
|
|
+ r.role_name,
|
|
|
+ r.id as role_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
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCoreSafecheckPlanList" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlan"
|
|
|
+ resultMap="CoreSafecheckPlanResult">
|
|
|
+ <include refid="selectCoreSafecheckPlanVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="planName != null and planName != ''">
|
|
|
+ and plan_name like concat('%', #{planName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null ">
|
|
|
+ and plan_cycle = #{planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null ">
|
|
|
+ and exec_org_type = #{execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="checkOrgType != null ">
|
|
|
+ and check_org_type = #{checkOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null ">
|
|
|
+ and plan_status = #{planStatus}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null ">
|
|
|
+ and start_date = #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null ">
|
|
|
+ and end_date = #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null and buildTaskNow != ''">
|
|
|
+ and build_task_now = #{buildTaskNow}
|
|
|
+ </if>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ and description = #{description}
|
|
|
+ </if>
|
|
|
+ <if test="isDeleted != null and isDeleted != ''">
|
|
|
+ and is_deleted = #{isDeleted}
|
|
|
+ </if>
|
|
|
+ <if test="modifiedName != null and modifiedName != ''">
|
|
|
+ and modified_name like concat('%', #{modifiedName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="modifiedBy != null ">
|
|
|
+ and modified_by = #{modifiedBy}
|
|
|
+ </if>
|
|
|
+ <if test="sourceType != null ">
|
|
|
+ and source_type = #{sourceType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <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
|
|
|
+ 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
|
|
|
+ where c.id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="selectCoreSafecheckPlanPage" 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
|
|
|
+ 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
|
|
|
+ where 1=1
|
|
|
+ <if test="check.planName != null and check.planName != ''">
|
|
|
+ and c.plan_name like concat('%', #{check.planName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="check.planCycle != null ">
|
|
|
+ and c.plan_cycle = #{check.planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="check.execOrgType != null ">
|
|
|
+ and c.exec_org_type = #{check.execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="check.checkOrgType != null ">
|
|
|
+ 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 ">
|
|
|
+ and r.id = #{check.checkRole}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCoreSafecheckPlan" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlan"
|
|
|
+ useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into core_safecheck_plan
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="planName != null">plan_name,
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">plan_cycle,
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">exec_org_type,
|
|
|
+ </if>
|
|
|
+ <if test="checkOrgType != null">check_org_type,
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">plan_status,
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">start_date,
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">end_date,
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">build_task_now,
|
|
|
+ </if>
|
|
|
+ <if test="description != null">description,
|
|
|
+ </if>
|
|
|
+ <if test="isDeleted != null">is_deleted,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time,
|
|
|
+ </if>
|
|
|
+ <if test="modifiedName != null">modified_name,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time,
|
|
|
+ </if>
|
|
|
+ <if test="modifiedBy != null">modified_by,
|
|
|
+ </if>
|
|
|
+ <if test="sourceType != null">source_type,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="planName != null">#{planName},
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">#{planCycle},
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">#{execOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="checkOrgType != null">#{checkOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">#{planStatus},
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">#{startDate},
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">#{endDate},
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">#{buildTaskNow},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">#{description},
|
|
|
+ </if>
|
|
|
+ <if test="isDeleted != null">#{isDeleted},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">#{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="modifiedName != null">#{modifiedName},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">#{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="modifiedBy != null">#{modifiedBy},
|
|
|
+ </if>
|
|
|
+ <if test="sourceType != null">#{sourceType},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCoreSafecheckPlan" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlan">
|
|
|
+ update core_safecheck_plan
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="planName != null">plan_name =
|
|
|
+ #{planName},
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">plan_cycle =
|
|
|
+ #{planCycle},
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">exec_org_type =
|
|
|
+ #{execOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="checkOrgType != null">check_org_type =
|
|
|
+ #{checkOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">plan_status =
|
|
|
+ #{planStatus},
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">start_date =
|
|
|
+ #{startDate},
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">end_date =
|
|
|
+ #{endDate},
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">build_task_now =
|
|
|
+ #{buildTaskNow},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">description =
|
|
|
+ #{description},
|
|
|
+ </if>
|
|
|
+ <if test="isDeleted != null">is_deleted =
|
|
|
+ #{isDeleted},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time =
|
|
|
+ #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="modifiedName != null">modified_name =
|
|
|
+ #{modifiedName},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time =
|
|
|
+ #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="modifiedBy != null">modified_by =
|
|
|
+ #{modifiedBy},
|
|
|
+ </if>
|
|
|
+ <if test="sourceType != null">source_type =
|
|
|
+ #{sourceType},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCoreSafecheckPlanById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from core_safecheck_plan
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCoreSafecheckPlanByIds" parameterType="String">
|
|
|
+ delete from core_safecheck_plan where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|