wl_management/src/main/resources/mapper/flow/StaffMenuMapper.xml
2020-11-02 17:28:51 +08:00

94 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.StaffMenuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.StaffMenu">
<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="name" property="name"/>
<result column="parent_id" property="parentId"/>
<result column="auth_ids" property="authIds"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, parent_id AS parentId, auth_ids AS authIds
</sql>
<select id="selectStaffMenuById" resultType="StaffMenu" >
select * from lz_staff_menu where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertStaffMenu" parameterType="StaffMenu" useGeneratedKeys="true" keyProperty="id" >
insert into lz_staff_menu(
<if test="name != null">name, </if>
<if test="parentId != null">parent_id, </if>
<if test="authIds != null">auth_ids, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="name != null">#{ name}, </if>
<if test="parentId != null">#{ parentId}, </if>
<if test="authIds != null">#{ authIds}, </if>
0,
now(),
now()
)
</insert>
<update id="updateStaffMenuById" parameterType="StaffMenu" >
update
lz_staff_menu
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="name != null">name = #{name},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="authIds != null">auth_ids = #{authIds}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverStaffMenuById" parameterType="StaffMenu" >
update
lz_staff_menu
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
name = #{name},
parent_id = #{parentId},
auth_ids = #{authIds}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteStaffMenuById" parameterType="java.lang.Long">
update lz_staff_menu set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selctAll" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete = 0
</select>
<select id="selectByParentId" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete = 0 and parent_id = #{parentId}
</select>
</mapper>