|
|
@@ -0,0 +1,449 @@
|
|
|
+<?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.drill.mapper.CoreDrillPlanMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.xunmei.common.core.domain.drill.domain.CoreDrillPlan" id="CoreDrillPlanResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="planName" column="plan_name"/>
|
|
|
+ <result property="planCycle" column="plan_cycle"/>
|
|
|
+ <result property="execTimes" column="exec_times"/>
|
|
|
+ <result property="planStatus" column="plan_status"/>
|
|
|
+ <result property="execOrgType" column="exec_org_type"/>
|
|
|
+ <result property="planStartDate" column="plan_start_date"/>
|
|
|
+ <result property="planEndDate" column="plan_end_date"/>
|
|
|
+ <result property="buildTaskNow" column="build_task_now"/>
|
|
|
+ <result property="createOrgId" column="create_org_id"/>
|
|
|
+ <result property="createOrgName" column="create_org_name"/>
|
|
|
+ <result property="createOrgPath" column="create_org_path"/>
|
|
|
+ <result property="belongOrgId" column="belong_org_id"/>
|
|
|
+ <result property="belongOrgName" column="belong_org_name"/>
|
|
|
+ <result property="belongOrgPath" column="belong_org_path"/>
|
|
|
+ <result property="standard" column="standard"/>
|
|
|
+ <result property="issue" column="issue"/>
|
|
|
+ <result property="beIssue" column="be_issue"/>
|
|
|
+ <result property="parentId" column="parent_id"/>
|
|
|
+ <result property="fileList" column="file_list"/>
|
|
|
+ <result property="deleted" column="deleted"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCoreDrillPlanVo">
|
|
|
+ select id, plan_name, plan_cycle, exec_times, plan_status, exec_org_type, plan_start_date, plan_end_date, build_task_now, remark, create_org_id, create_org_name, create_org_path, belong_org_id, belong_org_name, belong_org_path, standard, issue, be_issue, parent_id, file_list, deleted, create_by, create_time, update_by, update_time
|
|
|
+ from core_drill_plan
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCoreDrillPlanList" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillPlan"
|
|
|
+ resultMap="CoreDrillPlanResult">
|
|
|
+ <include refid="selectCoreDrillPlanVo"/>
|
|
|
+ <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="execTimes != null ">
|
|
|
+ and exec_times = #{execTimes}
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null ">
|
|
|
+ and plan_status = #{planStatus}
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null ">
|
|
|
+ and exec_org_type = #{execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="planStartDate != null ">
|
|
|
+ and plan_start_date = #{planStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="planEndDate != null ">
|
|
|
+ and plan_end_date = #{planEndDate}
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null ">
|
|
|
+ and build_task_now = #{buildTaskNow}
|
|
|
+ </if>
|
|
|
+ <if test="createOrgId != null ">
|
|
|
+ and create_org_id = #{createOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="createOrgName != null and createOrgName != ''">
|
|
|
+ and create_org_name like concat('%', #{createOrgName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="createOrgPath != null and createOrgPath != ''">
|
|
|
+ and create_org_path = #{createOrgPath}
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgId != null ">
|
|
|
+ and belong_org_id = #{belongOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgName != null and belongOrgName != ''">
|
|
|
+ and belong_org_name like concat('%', #{belongOrgName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgPath != null and belongOrgPath != ''">
|
|
|
+ and belong_org_path = #{belongOrgPath}
|
|
|
+ </if>
|
|
|
+ <if test="standard != null ">
|
|
|
+ and standard = #{standard}
|
|
|
+ </if>
|
|
|
+ <if test="issue != null ">
|
|
|
+ and issue = #{issue}
|
|
|
+ </if>
|
|
|
+ <if test="beIssue != null ">
|
|
|
+ and be_issue = #{beIssue}
|
|
|
+ </if>
|
|
|
+ <if test="parentId != null ">
|
|
|
+ and parent_id = #{parentId}
|
|
|
+ </if>
|
|
|
+ <if test="fileList != null and fileList != ''">
|
|
|
+ and file_list = #{fileList}
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null ">
|
|
|
+ and deleted = #{deleted}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCoreDrillPlanById" parameterType="Long"
|
|
|
+ resultMap="CoreDrillPlanResult">
|
|
|
+ <include refid="selectCoreDrillPlanVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCoreDrillPlan" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillPlan" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into core_drill_plan
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="planName != null">plan_name,
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">plan_cycle,
|
|
|
+ </if>
|
|
|
+ <if test="execTimes != null">exec_times,
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">plan_status,
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">exec_org_type,
|
|
|
+ </if>
|
|
|
+ <if test="planStartDate != null">plan_start_date,
|
|
|
+ </if>
|
|
|
+ <if test="planEndDate != null">plan_end_date,
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">build_task_now,
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">remark,
|
|
|
+ </if>
|
|
|
+ <if test="createOrgId != null">create_org_id,
|
|
|
+ </if>
|
|
|
+ <if test="createOrgName != null">create_org_name,
|
|
|
+ </if>
|
|
|
+ <if test="createOrgPath != null">create_org_path,
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgId != null">belong_org_id,
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgName != null">belong_org_name,
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgPath != null">belong_org_path,
|
|
|
+ </if>
|
|
|
+ <if test="standard != null">standard,
|
|
|
+ </if>
|
|
|
+ <if test="issue != null">issue,
|
|
|
+ </if>
|
|
|
+ <if test="beIssue != null">be_issue,
|
|
|
+ </if>
|
|
|
+ <if test="parentId != null">parent_id,
|
|
|
+ </if>
|
|
|
+ <if test="fileList != null">file_list,
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">deleted,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">create_by,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">update_by,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="planName != null">#{planName},
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">#{planCycle},
|
|
|
+ </if>
|
|
|
+ <if test="execTimes != null">#{execTimes},
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">#{planStatus},
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">#{execOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="planStartDate != null">#{planStartDate},
|
|
|
+ </if>
|
|
|
+ <if test="planEndDate != null">#{planEndDate},
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">#{buildTaskNow},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">#{remark},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgId != null">#{createOrgId},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgName != null">#{createOrgName},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgPath != null">#{createOrgPath},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgId != null">#{belongOrgId},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgName != null">#{belongOrgName},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgPath != null">#{belongOrgPath},
|
|
|
+ </if>
|
|
|
+ <if test="standard != null">#{standard},
|
|
|
+ </if>
|
|
|
+ <if test="issue != null">#{issue},
|
|
|
+ </if>
|
|
|
+ <if test="beIssue != null">#{beIssue},
|
|
|
+ </if>
|
|
|
+ <if test="parentId != null">#{parentId},
|
|
|
+ </if>
|
|
|
+ <if test="fileList != null">#{fileList},
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">#{deleted},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">#{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">#{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">#{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">#{updateTime},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCoreDrillPlan" parameterType="com.xunmei.common.core.domain.drill.domain.CoreDrillPlan">
|
|
|
+ update core_drill_plan
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="planName != null">plan_name =
|
|
|
+ #{planName},
|
|
|
+ </if>
|
|
|
+ <if test="planCycle != null">plan_cycle =
|
|
|
+ #{planCycle},
|
|
|
+ </if>
|
|
|
+ <if test="execTimes != null">exec_times =
|
|
|
+ #{execTimes},
|
|
|
+ </if>
|
|
|
+ <if test="planStatus != null">plan_status =
|
|
|
+ #{planStatus},
|
|
|
+ </if>
|
|
|
+ <if test="execOrgType != null">exec_org_type =
|
|
|
+ #{execOrgType},
|
|
|
+ </if>
|
|
|
+ <if test="planStartDate != null">plan_start_date =
|
|
|
+ #{planStartDate},
|
|
|
+ </if>
|
|
|
+ <if test="planEndDate != null">plan_end_date =
|
|
|
+ #{planEndDate},
|
|
|
+ </if>
|
|
|
+ <if test="buildTaskNow != null">build_task_now =
|
|
|
+ #{buildTaskNow},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">remark =
|
|
|
+ #{remark},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgId != null">create_org_id =
|
|
|
+ #{createOrgId},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgName != null">create_org_name =
|
|
|
+ #{createOrgName},
|
|
|
+ </if>
|
|
|
+ <if test="createOrgPath != null">create_org_path =
|
|
|
+ #{createOrgPath},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgId != null">belong_org_id =
|
|
|
+ #{belongOrgId},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgName != null">belong_org_name =
|
|
|
+ #{belongOrgName},
|
|
|
+ </if>
|
|
|
+ <if test="belongOrgPath != null">belong_org_path =
|
|
|
+ #{belongOrgPath},
|
|
|
+ </if>
|
|
|
+ <if test="standard != null">standard =
|
|
|
+ #{standard},
|
|
|
+ </if>
|
|
|
+ <if test="issue != null">issue =
|
|
|
+ #{issue},
|
|
|
+ </if>
|
|
|
+ <if test="beIssue != null">be_issue =
|
|
|
+ #{beIssue},
|
|
|
+ </if>
|
|
|
+ <if test="parentId != null">parent_id =
|
|
|
+ #{parentId},
|
|
|
+ </if>
|
|
|
+ <if test="fileList != null">file_list =
|
|
|
+ #{fileList},
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">deleted =
|
|
|
+ #{deleted},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">create_by =
|
|
|
+ #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time =
|
|
|
+ #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">update_by =
|
|
|
+ #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time =
|
|
|
+ #{updateTime},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCoreDrillPlanById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from core_drill_plan where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCoreDrillPlanByIds" parameterType="String">
|
|
|
+ delete from core_drill_plan where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+ <sql id="pageIncludeSP">
|
|
|
+ <if test="request.execOrgType!=null">
|
|
|
+ and sp.exec_org_type = #{request.execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="request.planCycle!=null">
|
|
|
+ and sp.plan_cycle = #{request.planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="request.planStatus!=null">
|
|
|
+ and sp.plan_status = #{request.planStatus}
|
|
|
+ </if>
|
|
|
+ <if test="request.planName!=null">
|
|
|
+ and p.plan_name like concat('%',#{request.planName},'%')
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="request.checkSub==true">
|
|
|
+ and sp.belong_org_path like concat(#{request.belongOrgPath},'%')
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and sp.belong_org_id = #{request.belongOrgId}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </sql>
|
|
|
+ <sql id="pageIncludeP">
|
|
|
+ <if test="request.execOrgType!=null">
|
|
|
+ and p.exec_org_type = #{request.execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="request.planCycle!=null">
|
|
|
+ and p.plan_cycle = #{request.planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="request.planStatus!=null">
|
|
|
+ and p.plan_status = #{request.planStatus}
|
|
|
+ </if>
|
|
|
+ <if test="request.planName!=null">
|
|
|
+ and p.plan_name like concat('%',#{request.planName},'%')
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="request.checkSub==true">
|
|
|
+ and p.belong_org_path like concat(#{request.belongOrgPath},'%')
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and p.belong_org_id = #{request.belongOrgId}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </sql>
|
|
|
+ <sql id="pageRoleIncludeReuqest">
|
|
|
+ select distinct p1.id
|
|
|
+ from core_edu_training_plan p1
|
|
|
+ inner join core_edu_training_plan_to_role r1 on p1.id = r1.plan_id
|
|
|
+ where p1.deleted = 0
|
|
|
+ and p1.plan_status = 0
|
|
|
+ and r1.role_id = #{request.planRoleId}
|
|
|
+ </sql>
|
|
|
+ <select id="selectPageData" resultType="com.xunmei.common.core.domain.drill.vo.CoreDrillPlanPageVo">
|
|
|
+ select
|
|
|
+ p.id as id,
|
|
|
+ p.plan_name,
|
|
|
+ p.create_org_id,
|
|
|
+ p.create_org_name,
|
|
|
+ p.exec_org_type,
|
|
|
+ p.plan_cycle,
|
|
|
+ p.exec_times,
|
|
|
+ p.remark,
|
|
|
+ u.name as updateBy,
|
|
|
+ p.plan_status,
|
|
|
+ p.issue,
|
|
|
+ p.standard,
|
|
|
+ P.belong_org_id,
|
|
|
+ P.belong_org_name from core_edu_training_plan p left join sys_user u on p.update_by=u.id
|
|
|
+ where p.deleted = 0 and p.parent_id is null
|
|
|
+ and p.standard=1 and p.issue=1
|
|
|
+ <if test="request.planRoleId!=null">
|
|
|
+ and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
|
|
|
+ </if>
|
|
|
+ and p.id in ( select sp.parent_id from core_edu_training_plan sp where sp.deleted = 0 and sp.parent_id is not
|
|
|
+ null<include refid="pageIncludeSP"/>)
|
|
|
+ <!-- 不是标准计划但是也没下发: 行社自建的计划 -->
|
|
|
+ or ( p.standard=0 and p.issue=0 and p.deleted=0 and p.parent_id is null
|
|
|
+ <if test="request.planRoleId!=null">
|
|
|
+ and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
|
|
|
+ </if>
|
|
|
+ <include refid="pageIncludeP"/>)
|
|
|
+ <!-- 是标准计划但是未下发 -->
|
|
|
+ or ( p.standard=1 and p.issue=0 and p.deleted=0 and p.parent_id is null
|
|
|
+ <if test="request.planRoleId!=null">
|
|
|
+ and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
|
|
|
+ </if>
|
|
|
+ <include refid="pageIncludeP"/>)
|
|
|
+ or ( p.standard=1 and p.issue=1 and p.deleted=0 and p.parent_id is null
|
|
|
+ <if test="request.planRoleId!=null">
|
|
|
+ and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
|
|
|
+ </if>
|
|
|
+ <include refid="pageIncludeP"/>)
|
|
|
+ order by p.create_time desc
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectChildrenPlan" resultType="com.xunmei.common.core.domain.drill.vo.CoreDrillPlanPageVo">
|
|
|
+ select
|
|
|
+ sp.id as id,
|
|
|
+ sp.plan_name,
|
|
|
+ sp.create_org_id,
|
|
|
+ sp.create_org_name,
|
|
|
+ sp.exec_org_type,
|
|
|
+ sp.plan_cycle,
|
|
|
+ sp.exec_times,
|
|
|
+ sp.remark,
|
|
|
+ sp.plan_status,
|
|
|
+ u.name as updateBy,
|
|
|
+ sp.issue,
|
|
|
+ sp.standard,
|
|
|
+ sp.belong_org_id as belongOrgId,
|
|
|
+ sp.belong_org_name as belongOrgName from core_drill_plan sp left join sys_user u on sp.update_by=u.id
|
|
|
+ where sp.deleted = 0 and sp.parent_id is not null
|
|
|
+ <if test="request.id!=null">
|
|
|
+ and sp.parent_id = #{request.id}
|
|
|
+ </if>
|
|
|
+ <if test="request.execOrgType!=null">
|
|
|
+ and sp.exec_org_type = #{request.execOrgType}
|
|
|
+ </if>
|
|
|
+ <if test="request.planCycle!=null">
|
|
|
+ and sp.plan_cycle = #{request.planCycle}
|
|
|
+ </if>
|
|
|
+ <if test="request.planStatus!=null">
|
|
|
+ and sp.plan_status = #{request.planStatus}
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="request.checkSub==true">
|
|
|
+ and sp.belong_org_path like concat(#{request.belongOrgPath},'%')
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and sp.belong_org_id = #{request.belongOrgId}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+</mapper>
|