wl_management/src/main/resources/mapper/flow/FlowDepartmentMapper.xml
2020-08-18 12:03:14 +08:00

101 lines
4.0 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.FlowDepartmentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.FlowDepartment">
<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="department_id" property="departmentId"/>
<result column="taff_id" property="taffId"/>
<result column="child_flow_id" property="childFlowId"/>
<result column="self_flow_id" property="selfFlowId"/>
<result column="department_level" property="departmentLevel"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_id AS departmentId, taff_id AS taffId, child_flow_id AS childFlowId, self_flow_id AS selfFlowId, department_level AS departmentLevel
</sql>
<select id="selectFlowDepartmentById" resultType="FlowDepartment" >
select * from lz_flow_department where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowDepartment" parameterType="FlowDepartment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_department(
<if test="departmentId != null">department_id, </if>
<if test="taffId != null">taff_id, </if>
<if test="childFlowId != null">child_flow_id, </if>
<if test="selfFlowId != null">self_flow_id, </if>
<if test="departmentLevel != null">department_level, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="departmentId != null">#{ departmentId}, </if>
<if test="taffId != null">#{ taffId}, </if>
<if test="childFlowId != null">#{ childFlowId}, </if>
<if test="selfFlowId != null">#{ selfFlowId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowDepartmentById" parameterType="FlowDepartment" >
update
lz_flow_department
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="departmentId != null">department_id = #{departmentId},</if>
<if test="taffId != null">taff_id = #{taffId},</if>
<if test="childFlowId != null">child_flow_id = #{childFlowId},</if>
<if test="selfFlowId != null">self_flow_id = #{selfFlowId},</if>
<if test="departmentLevel != null">department_level = #{departmentLevel}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverFlowDepartmentById" parameterType="FlowDepartment" >
update
lz_flow_department
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
department_id = #{departmentId},
taff_id = #{taffId},
child_flow_id = #{childFlowId},
self_flow_id = #{selfFlowId},
department_level = #{departmentLevel}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowDepartmentById" parameterType="java.lang.Long">
update lz_flow_department set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.FlowDepartment">
select * from lz_flow_department where is_delete = 0 and taff_id = #{staffId} limit 1
</select>
</mapper>