wl_management/src/main/resources/mapper/flow/EvaluationStartStaffMapper.xml
杜建超 72c50b6272 fix
2020-10-28 18:02:53 +08:00

135 lines
5.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.EvaluationStartStaffMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.EvaluationStartStaff">
<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="evaluation_id" property="evaluationId"/>
<result column="start_id" property="startId"/>
<result column="staff_id" property="staffId"/>
<result column="type" property="type"/>
<result column="score" property="score"/>
<result column="evaluation_name" property="evaluationName"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, evaluation_id AS evaluationId, start_id AS startId, staff_id AS staffId, type AS type, score AS score, evaluation_name AS evaluationName
</sql>
<select id="selectEvaluationStartStaffById" resultType="EvaluationStartStaff" >
select * from lz_evaluation_start_staff where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertEvaluationStartStaff" parameterType="EvaluationStartStaff" useGeneratedKeys="true" keyProperty="id" >
insert into lz_evaluation_start_staff(
<if test="evaluationId != null">evaluation_id, </if>
<if test="startId != null">start_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="type != null">type, </if>
<if test="score != null">score, </if>
<if test="evaluationName != null">evaluation_name, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="evaluationId != null">#{ evaluationId}, </if>
<if test="startId != null">#{ startId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="type != null">#{ type}, </if>
<if test="score != null">#{ score}, </if>
<if test="evaluationName != null">#{ evaluationName}, </if>
0,
now(),
now()
)
</insert>
<update id="updateEvaluationStartStaffById" parameterType="EvaluationStartStaff" >
update
lz_evaluation_start_staff
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="evaluationId != null">evaluation_id = #{evaluationId},</if>
<if test="startId != null">start_id = #{startId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="type != null">type = #{type},</if>
<if test="score != null">score = #{score},</if>
<if test="evaluationName != null">evaluation_name = #{evaluationName}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverEvaluationStartStaffById" parameterType="EvaluationStartStaff" >
update
lz_evaluation_start_staff
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
evaluation_id = #{evaluationId},
start_id = #{startId},
staff_id = #{staffId},
type = #{type},
score = #{score},
evaluation_name = #{evaluationName}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteEvaluationStartStaffById" parameterType="java.lang.Long">
update lz_evaluation_start_staff set is_delete = 1 where id=#{id} limit 1
</update>
<insert id="insertEvaluationStartStaffs" parameterType="EvaluationStartStaff" useGeneratedKeys="true" keyProperty="id" >
insert into lz_evaluation_start_staff(
evaluation_id,
start_id,
staff_id,
type,
evaluation_name,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
#{ item.evaluationId},
#{ item.startId},
#{ item.staffId},
#{ item.type},
#{ item.evaluationName},
0
)
</foreach>
;
</insert>
<select id="selectOneByStartIdAndStaffId" resultType="EvaluationStartStaff">
select * from lz_evaluation_start_staff where start_id=#{startId} AND staff_id =#{staffId} and is_delete = 0 limit 1
</select>
<select id="selectManagerEvaluationStartStaff" resultType="EvaluationStartStaff">
select * from lz_evaluation_start_staff where evaluation_id=#{evaluationId}
AND staff_id =#{staffId} and type = 1 is_delete = 0 and limit 1
</select>
<select id="existByStartIdAndEvaluationId" resultType="Integer">
select count(1) from lz_evaluation_start_staff where is_delete = 0 and evaluation_id=#{evaluationId}
AND start_id =#{startId} and score = 1 limit 1
</select>
</mapper>