wl_management/src/main/resources/mapper/flow/StaffRoleMenuMapper.xml
2020-11-05 10:11:33 +08:00

97 lines
3.2 KiB
XML

<?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.lz.modules.flow.dao.StaffRoleMenuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.StaffRoleMenu">
<id column="id" property="id"/>
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="role_id" property="roleId"/>
<result column="menu_id" property="menuId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, role_id AS roleId, menu_id AS menuId
</sql>
<select id="selectStaffRoleMenuById" resultType="StaffRoleMenu" >
select * from lz_staff_role_menu where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertStaffRoleMenu" parameterType="StaffRoleMenu" useGeneratedKeys="true" keyProperty="id" >
insert into lz_staff_role_menu(
<if test="roleId != null">role_id, </if>
<if test="menuId != null">menu_id, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="roleId != null">#{ roleId}, </if>
<if test="menuId != null">#{ menuId}, </if>
0,
now(),
now()
)
</insert>
<update id="updateStaffRoleMenuById" parameterType="StaffRoleMenu" >
update
lz_staff_role_menu
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="menuId != null">menu_id = #{menuId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverStaffRoleMenuById" parameterType="StaffRoleMenu" >
update
lz_staff_role_menu
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
role_id = #{roleId},
menu_id = #{menuId}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteStaffRoleMenuById" parameterType="java.lang.Long">
update lz_staff_role_menu set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByRoleId" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where id in (select menu_id from lz_staff_role_menu where role_id = #{roleId})
</select>
<delete id="deleteStaffRoleMenuByRoleId">
delete from lz_staff_role_menu where role_id = #{roleId}
</delete>
<select id="selectStaffRoleMenuByRoleIdMenuId" resultType="com.lz.modules.flow.entity.StaffRoleMenu">
select * from lz_staff_role_menu where is_delete = 1 and role_id = #{roleId} and menu_id = #{menuId}
</select>
</mapper>