Files
erp-next/ruoyi-system/src/main/resources/mapper/bid/BizApprovalConfigMapper.xml

78 lines
3.1 KiB
XML
Raw Normal View History

<?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.ruoyi.system.mapper.bid.BizApprovalConfigMapper">
<resultMap id="BaseRM" type="com.ruoyi.system.domain.bid.BizApprovalConfig">
<id property="id" column="id"/>
<result property="bizType" column="biz_type"/>
<result property="bizName" column="biz_name"/>
<result property="signType" column="sign_type"/>
<result property="enabled" column="enabled"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectList" resultMap="BaseRM">
SELECT * FROM biz_approval_config
<where>
<if test="bizType != null and bizType != ''"> AND biz_type LIKE CONCAT('%',#{bizType},'%')</if>
<if test="bizName != null and bizName != ''"> AND biz_name LIKE CONCAT('%',#{bizName},'%')</if>
<if test="enabled != null and enabled != ''"> AND enabled=#{enabled}</if>
</where>
ORDER BY id ASC
</select>
<select id="selectById" resultMap="BaseRM">
SELECT * FROM biz_approval_config WHERE id=#{id}
</select>
<select id="selectByBizType" resultMap="BaseRM">
SELECT * FROM biz_approval_config WHERE biz_type=#{bizType}
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO biz_approval_config(biz_type,biz_name,sign_type,enabled,remark,create_by,create_time)
VALUES(#{bizType},#{bizName},#{signType},#{enabled},#{remark},#{createBy},NOW())
</insert>
<update id="update">
UPDATE biz_approval_config
<set>
<if test="bizName != null">biz_name=#{bizName},</if>
<if test="signType != null">sign_type=#{signType},</if>
<if test="enabled != null">enabled=#{enabled},</if>
<if test="remark != null">remark=#{remark},</if>
update_by=#{updateBy}, update_time=NOW()
</set>
WHERE id=#{id}
</update>
<delete id="deleteById">DELETE FROM biz_approval_config WHERE id=#{id}</delete>
<select id="selectUserIds" resultType="java.lang.Long">
SELECT user_id FROM biz_approval_config_user WHERE config_id=#{configId} ORDER BY sort_no, id
</select>
<select id="selectUserNames" resultType="java.lang.String">
SELECT u.nick_name FROM biz_approval_config_user cu
JOIN sys_user u ON u.user_id=cu.user_id
WHERE cu.config_id=#{configId} ORDER BY cu.sort_no, cu.id
</select>
<delete id="deleteUsers">DELETE FROM biz_approval_config_user WHERE config_id=#{configId}</delete>
<insert id="insertUser">
INSERT INTO biz_approval_config_user(config_id,user_id,sort_no)
VALUES(#{configId},#{userId},#{sortNo})
</insert>
<select id="existsUser" resultType="int">
SELECT COUNT(1) FROM biz_approval_config c
JOIN biz_approval_config_user cu ON cu.config_id=c.id
WHERE c.biz_type=#{bizType} AND c.enabled='1' AND cu.user_id=#{userId}
</select>
</mapper>