wl_management/src/main/resources/mapper/flow/EvaluationGroupMapper.xml
杜建超 62f310d90f fix
2020-12-18 14:51:44 +08:00

169 lines
6.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.EvaluationGroupMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.EvaluationGroup">
<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="manager_ids" property="managerIds"/>
<result column="dep_ids" property="depIds"/>
<result column="staff_ids" property="staffIds"/>
<result column="out_ids" property="outIds"/>
<result column="copy_id" property="copyId"/>
<result column="start_id" property="startId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, manager_ids AS managerIds, dep_ids AS depIds, staff_ids AS staffIds, out_ids AS outIds, copy_id AS copyId, start_id AS startId
</sql>
<select id="selectEvaluationGroupById" resultType="EvaluationGroup" >
select * from lz_evaluation_group where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertEvaluationGroup" parameterType="EvaluationGroup" useGeneratedKeys="true" keyProperty="id" >
insert into lz_evaluation_group(
<if test="name != null">name, </if>
<if test="managerIds != null">manager_ids, </if>
<if test="depIds != null">dep_ids, </if>
<if test="staffIds != null">staff_ids, </if>
<if test="outIds != null">out_ids, </if>
<if test="copyId != null">copy_id, </if>
<if test="startId != null">start_id, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="name != null">#{ name}, </if>
<if test="managerIds != null">#{ managerIds}, </if>
<if test="depIds != null">#{ depIds}, </if>
<if test="staffIds != null">#{ staffIds}, </if>
<if test="outIds != null">#{ outIds}, </if>
<if test="copyId != null">#{ copyId}, </if>
<if test="startId != null">#{ startId}, </if>
0,
now(),
now()
)
</insert>
<update id="updateEvaluationGroupById" parameterType="EvaluationGroup" >
update
lz_evaluation_group
<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="managerIds != null">manager_ids = #{managerIds},</if>
<if test="depIds != null">dep_ids = #{depIds},</if>
<if test="staffIds != null">staff_ids = #{staffIds},</if>
<if test="outIds != null">out_ids = #{outIds},</if>
<if test="copyId != null">copy_id = #{copyId},</if>
<if test="startId != null">start_id = #{startId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverEvaluationGroupById" parameterType="EvaluationGroup" >
update
lz_evaluation_group
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
name = #{name},
manager_ids = #{managerIds},
dep_ids = #{depIds},
staff_ids = #{staffIds},
out_ids = #{outIds},
copy_id = #{copyId},
start_id = #{startId}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteEvaluationGroupById" parameterType="java.lang.Long">
update lz_evaluation_group set is_delete = 1 where id=#{id} limit 1
</update>
<select id="seleteEvaluationGroupByReq" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and copy_id = 0
<if test="req.startTime != null"><![CDATA[and gmt_create > #{req.startTime}]]></if>
<if test="req.endTime != null"><![CDATA[and gmt_create < #{req.endTime}]]></if>
<if test="req.name != null and req.name != ''">and name like concat('%', #{req.name} '%') </if>
<if test="list != null">
and id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</if>
group by id order by id desc
</select>
<select id="selectEvaluationGroupByIds" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</select>
<select id="selectEvaluationGroupByNotIds" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and copy_id = 0
<if test="ids!=null and ids.size()!=0">
and id not in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</if>
</select>
<select id="selectEvaluationGroupByName" resultType="EvaluationGroup" >
select * from lz_evaluation_group where name=#{name} and is_delete = 0 and copy_id = 0 limit 1
</select>
<update id="deleteByCopyIds">
update lz_evaluation_group set is_delete = 1 where is_delete=0
and start_id = #{startId}
and copy_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
<select id="selectIdsByCopyIds" resultType="long">
select id from lz_evaluation_group where is_delete = 0
and start_id = #{startId}
and copy_id in (
<foreach collection="copyIds.split(',')" item="copy_id" separator=",">
#{copy_id}
</foreach>
)
</select>
<select id="selectEvaluationGroupByCopyId" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and copy_id = #{copyId} and start_id = #{startId}
</select>
</mapper>