Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/countersign/SignConfigMapper.xml

96 lines
3.5 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.bonus.material.countersign.mapper.SignConfigMapper">
<select id="getList" resultType="com.bonus.material.countersign.domain.SignConfigVo">
select
sc.id as id,sc.process_id as processId,sc.sign_type as signType,sc.people_id as peopleId,
su.nick_name as peopleName,sdd.dict_label as processName,sdd2.dict_label as signTypeName
from sign_config sc
left join sys_dict_data sdd on sc.process_id = sdd.dict_value
left join sys_dict_data sdd2 on sc.sign_type = sdd2.dict_value
left join sys_user su on sc.people_id = su.user_id and su.del_flag = 0
<where>
sc.del_flag = 0
and sdd.dict_type = 'countersign_process_name' and sdd.status = 0
and sdd2.dict_type = 'countersign_type_name' and sdd2.status = 0
<if test="keyWord != null and keyWord != ''">
and (sdd.dict_label like concat('%', #{keyWord}, '%') or sdd2.dict_label like concat('%', #{keyWord}, '%')
or su.user_name like concat('%', #{keyWord}, '%'))
</if>
</where>
</select>
<select id="selectConfigRepeat" resultType="int">
select
count(id)
from sign_config sc
<where>
sc.del_flag = 0
<if test="processId != null">
and sc.process_id = #{processId}
</if>
<if test="signType != null">
and sc.sign_type = #{signType}
</if>
</where>
</select>
<insert id="insertConfigInfo" parameterType="com.bonus.material.countersign.domain.SignConfigVo">
insert into sign_config(
<if test="processId != null">process_id,</if>
<if test="signType != null">sign_type,</if>
<if test="peopleId != null">people_id,</if>
del_flag
)values(
<if test="processId != null">#{processId},</if>
<if test="signType != null">#{signType},</if>
<if test="peopleId != null">#{peopleId},</if>
0
)
</insert>
<select id="selectConfigInfoById" parameterType="Long" resultType="com.bonus.material.countersign.domain.SignConfigVo">
select
sc.id as id,sc.process_id as processId,sc.sign_type as signType,sc.people_id as peopleId
from sign_config sc
where sc.id = #{id} and sc.del_flag = 0
</select>
<select id="selectConfigRepeatEdit" resultType="int">
select
count(id)
from sign_config sc
<where>
sc.del_flag = 0
<if test="id != null">
and sc.id != #{id}
</if>
<if test="processId != null">
and sc.process_id = #{processId}
</if>
<if test="signType != null">
and sc.sign_type = #{signType}
</if>
</where>
</select>
<update id="updateConfigInfo" parameterType="com.bonus.material.countersign.domain.SignConfigVo">
update sign_config
<set>
<if test="processId != null">process_id = #{processId},</if>
<if test="signType != null">sign_type = #{signType},</if>
<if test="peopleId != null">people_id = #{peopleId}</if>
</set>
where id = #{id} and del_flag = 0
</update>
<update id="delConfig" parameterType="Long">
update sign_config
set del_flag = 1
where id = #{id} and del_flag = 0
</update>
</mapper>