|
|
@@ -3,10 +3,9 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.xunmei.core.safetyCheck.mapper.CoreSafecheckPlanToRoleMapper">
|
|
|
-
|
|
|
<resultMap type="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole" id="CoreSafecheckPlanToRoleResult">
|
|
|
- <result property="planId" column="plan_id"/>
|
|
|
- <result property="roleId" column="role_id"/>
|
|
|
+ <result property="planId" column="plan_id"/>
|
|
|
+ <result property="roleId" column="role_id"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectCoreSafecheckPlanToRoleVo">
|
|
|
@@ -14,54 +13,70 @@
|
|
|
from core_safecheck_plan_to_role
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectCoreSafecheckPlanToRoleList" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole"
|
|
|
+ <select id="selectCoreSafecheckPlanToRoleList"
|
|
|
+ parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole"
|
|
|
resultMap="CoreSafecheckPlanToRoleResult">
|
|
|
<include refid="selectCoreSafecheckPlanToRoleVo"/>
|
|
|
<where>
|
|
|
- <if test="planId != null ">
|
|
|
- and plan_id = #{planId}
|
|
|
- </if>
|
|
|
- <if test="roleId != null ">
|
|
|
- and role_id = #{roleId}
|
|
|
- </if>
|
|
|
+ <if test="planId != null ">
|
|
|
+ and plan_id = #{planId}
|
|
|
+ </if>
|
|
|
+ <if test="roleId != null ">
|
|
|
+ and role_id = #{roleId}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCoreSafecheckPlanToRoleByPlanId" parameterType="Long"
|
|
|
resultMap="CoreSafecheckPlanToRoleResult">
|
|
|
- <include refid="selectCoreSafecheckPlanToRoleVo"/>
|
|
|
- where plan_id = #{planId}
|
|
|
+ <include refid="selectCoreSafecheckPlanToRoleVo"/>
|
|
|
+ where plan_id = #{planId}
|
|
|
</select>
|
|
|
-
|
|
|
- <insert id="insertCoreSafecheckPlanToRole" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole">
|
|
|
+ <select id="selectRoles" resultType="com.xunmei.core.safetyCheck.vo.plan.SafetyPlanRoleVo">
|
|
|
+ select pr.role_id as roleId,pr.plan_id as planId,r.role_name as roleName from core_safecheck_plan_to_role pr
|
|
|
+ inner join sys_role r on pr.role_id=r.id
|
|
|
+ where r.del_flag=0 and pr.plan_id in
|
|
|
+ <foreach collection="planId" item="id" separator="," open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+ <insert id="insertCoreSafecheckPlanToRole"
|
|
|
+ parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole">
|
|
|
insert into core_safecheck_plan_to_role
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="planId != null">plan_id,
|
|
|
- </if>
|
|
|
- <if test="roleId != null">role_id,
|
|
|
- </if>
|
|
|
+ <if test="planId != null">
|
|
|
+ plan_id,
|
|
|
+ </if>
|
|
|
+ <if test="roleId != null">
|
|
|
+ role_id,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="planId != null">#{planId},
|
|
|
- </if>
|
|
|
- <if test="roleId != null">#{roleId},
|
|
|
- </if>
|
|
|
+ <if test="planId != null">
|
|
|
+ #{planId},
|
|
|
+ </if>
|
|
|
+ <if test="roleId != null">
|
|
|
+ #{roleId},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
- <update id="updateCoreSafecheckPlanToRole" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole">
|
|
|
+ <update id="updateCoreSafecheckPlanToRole"
|
|
|
+ parameterType="com.xunmei.core.safetyCheck.domain.CoreSafecheckPlanToRole">
|
|
|
update core_safecheck_plan_to_role
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="roleId != null">role_id =
|
|
|
- #{roleId},
|
|
|
- </if>
|
|
|
+ <if test="roleId != null">
|
|
|
+ role_id =
|
|
|
+ #{roleId},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
where plan_id = #{planId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteCoreSafecheckPlanToRoleByPlanId" parameterType="Long">
|
|
|
delete
|
|
|
- from core_safecheck_plan_to_role where plan_id = #{planId}
|
|
|
+ from core_safecheck_plan_to_role
|
|
|
+ where plan_id = #{planId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteCoreSafecheckPlanToRoleByPlanIds" parameterType="String">
|