116 lines
4.6 KiB
XML
116 lines
4.6 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.StaffRoleMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.StaffRole">
|
|
<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="staff_id" property="staffId"/>
|
|
<result column="department_level" property="departmentLevel"/>
|
|
<result column="type_role_ids" property="typeRoleIds"/>
|
|
<result column="staff_name" property="staffName"/>
|
|
<result column="evaluation_group_id" property="evaluationGroupId"/>
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds, staff_name AS staffName, evaluation_group_id AS evaluationGroupId
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectStaffRoleById" resultType="StaffRole" >
|
|
select * from lz_staff_role where id=#{id} and is_delete = 0 limit 1
|
|
</select>
|
|
|
|
|
|
<insert id="insertStaffRole" parameterType="StaffRole" useGeneratedKeys="true" keyProperty="id" >
|
|
insert into lz_staff_role(
|
|
<if test="staffId != null">staff_id, </if>
|
|
<if test="departmentLevel != null">department_level, </if>
|
|
<if test="typeRoleIds != null">type_role_ids, </if>
|
|
<if test="staffName != null">staff_name, </if>
|
|
<if test="evaluationGroupId != null">evaluation_group_id, </if>
|
|
is_delete,
|
|
gmt_create,
|
|
gmt_modified
|
|
)values(
|
|
<if test="staffId != null">#{ staffId}, </if>
|
|
<if test="departmentLevel != null">#{ departmentLevel}, </if>
|
|
<if test="typeRoleIds != null">#{ typeRoleIds}, </if>
|
|
<if test="staffName != null">#{ staffName}, </if>
|
|
<if test="evaluationGroupId != null">#{ evaluationGroupId}, </if>
|
|
0,
|
|
now(),
|
|
now()
|
|
)
|
|
</insert>
|
|
|
|
|
|
<update id="updateStaffRoleById" parameterType="StaffRole" >
|
|
update
|
|
lz_staff_role
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
|
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
|
<if test="staffId != null">staff_id = #{staffId},</if>
|
|
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
|
|
<if test="typeRoleIds != null">type_role_ids = #{typeRoleIds},</if>
|
|
<if test="staffName != null">staff_name = #{staffName},</if>
|
|
<if test="evaluationGroupId != null">evaluation_group_id = #{evaluationGroupId}</if>
|
|
</trim>
|
|
,gmt_modified = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<update id="updateCoverStaffRoleById" parameterType="StaffRole" >
|
|
update
|
|
lz_staff_role
|
|
set
|
|
is_delete = #{isDelete},
|
|
gmt_create = #{gmtCreate},
|
|
staff_id = #{staffId},
|
|
department_level = #{departmentLevel},
|
|
type_role_ids = #{typeRoleIds},
|
|
staff_name = #{staffName},
|
|
evaluation_group_id = #{evaluationGroupId}
|
|
,gmt_modified = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<update id="deleteStaffRoleById" parameterType="java.lang.Long">
|
|
update lz_staff_role set is_delete = 1 where id=#{id} limit 1
|
|
</update>
|
|
|
|
|
|
|
|
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.StaffRole">
|
|
select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} limit 1
|
|
</select>
|
|
|
|
<select id="selectByRole" resultType="com.lz.modules.flow.entity.StaffRole">
|
|
select * from lz_staff_role where is_delete = 0 and department_level = #{departmentLevel}
|
|
</select>
|
|
|
|
<select id="selectByCondition" resultType="com.lz.modules.flow.entity.StaffRole">
|
|
select * from lz_staff_role where is_delete = 0
|
|
<if test="params.name != null and params.name != '' ">
|
|
and staff_id in (select id from lz_staff where name like concat('%',#{params.name},'%'))
|
|
</if>
|
|
order by id desc
|
|
</select>
|
|
<select id="selectByGroupId" resultType="com.lz.modules.flow.entity.StaffRole">
|
|
select * from lz_staff_role where is_delete = 0 and evaluation_group_id = #{id}
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|