2023-12-16 20:55:40 +08:00
|
|
|
<?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.sgzb.system.mapper.PurchaseNoticePersonMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.bonus.sgzb.system.domain.PurchaseNoticePerson" id="PurchaseNoticePersonResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="userId" column="user_id" />
|
|
|
|
|
<result property="userName" column="user_name" />
|
|
|
|
|
<result property="telphone" column="telphone" />
|
2024-03-22 18:00:57 +08:00
|
|
|
<result property="nickName" column="nick_name" />
|
2023-12-16 20:55:40 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectPurchaseNoticePersonVo">
|
|
|
|
|
select id, user_id, user_name, telphone from purchase_notice_person
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseNoticePersonList" parameterType="com.bonus.sgzb.system.domain.PurchaseNoticePerson" resultMap="PurchaseNoticePersonResult">
|
2024-03-22 18:00:57 +08:00
|
|
|
SELECT
|
|
|
|
|
pnp.id,
|
|
|
|
|
pnp.user_id,
|
|
|
|
|
pnp.user_name,
|
|
|
|
|
u.nick_name,
|
|
|
|
|
telphone,
|
|
|
|
|
GROUP_CONCAT(r.role_name SEPARATOR '/') as role_name,
|
|
|
|
|
concat( d2.dept_name, '/', d1.dept_name, '/', d.dept_name ) deptName
|
|
|
|
|
FROM
|
|
|
|
|
purchase_notice_person pnp
|
|
|
|
|
LEFT JOIN sys_user u ON pnp.user_id = u.user_id
|
|
|
|
|
LEFT JOIN sys_user_role sur ON u.user_id = sur.user_id
|
|
|
|
|
LEFT JOIN sys_role r ON sur.role_id = r.role_id
|
|
|
|
|
LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
|
|
LEFT JOIN sys_dept d1 ON d.parent_id = d1.dept_id
|
|
|
|
|
LEFT JOIN sys_dept d2 ON d1.parent_id = d2.dept_id
|
|
|
|
|
WHERE
|
|
|
|
|
u.STATUS = '0'
|
|
|
|
|
GROUP BY pnp.user_id
|
2023-12-16 20:55:40 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseNoticePersonById" parameterType="Long" resultMap="PurchaseNoticePersonResult">
|
|
|
|
|
<include refid="selectPurchaseNoticePersonVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
2023-12-22 19:14:59 +08:00
|
|
|
<select id="getUserByRoleList" resultType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
|
2024-03-22 18:00:57 +08:00
|
|
|
SELECT
|
|
|
|
|
u.user_id userId,
|
|
|
|
|
u.dept_id deptId,
|
|
|
|
|
u.nick_name nickName,
|
|
|
|
|
u.user_name userName,
|
|
|
|
|
u.avatar,
|
|
|
|
|
u.phonenumber telphone,
|
|
|
|
|
concat( d2.dept_name, '/', d1.dept_name, '/', d.dept_name ) deptName,
|
|
|
|
|
GROUP_CONCAT(r.role_name SEPARATOR '/') as roleName
|
|
|
|
|
FROM
|
|
|
|
|
sys_user u
|
|
|
|
|
LEFT JOIN sys_user_role sur ON u.user_id = sur.user_id
|
|
|
|
|
LEFT JOIN sys_role r ON sur.role_id = r.role_id
|
|
|
|
|
LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
|
|
LEFT JOIN sys_dept d1 ON d.parent_id = d1.dept_id
|
|
|
|
|
LEFT JOIN sys_dept d2 ON d1.parent_id = d2.dept_id
|
|
|
|
|
WHERE
|
|
|
|
|
u.STATUS = '0'
|
|
|
|
|
AND u.del_flag = '0'
|
|
|
|
|
AND u.user_id NOT IN (
|
|
|
|
|
SELECT
|
|
|
|
|
user_id
|
|
|
|
|
FROM
|
|
|
|
|
purchase_notice_person)
|
|
|
|
|
GROUP BY u.user_id
|
2023-12-22 19:14:59 +08:00
|
|
|
</select>
|
|
|
|
|
|
2023-12-16 20:55:40 +08:00
|
|
|
<insert id="insertPurchaseNoticePerson" parameterType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
|
|
|
|
|
insert into purchase_notice_person
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null">user_id,</if>
|
|
|
|
|
<if test="userName != null">user_name,</if>
|
|
|
|
|
<if test="telphone != null">telphone,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
|
|
<if test="userName != null">#{userName},</if>
|
|
|
|
|
<if test="telphone != null">#{telphone},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updatePurchaseNoticePerson" parameterType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
|
|
|
|
|
update purchase_notice_person
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
|
|
|
<if test="userName != null">user_name = #{userName},</if>
|
|
|
|
|
<if test="telphone != null">telphone = #{telphone},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseNoticePersonById" parameterType="Long">
|
2023-12-22 19:14:59 +08:00
|
|
|
delete from purchase_notice_person where user_id = #{userId}
|
2023-12-16 20:55:40 +08:00
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseNoticePersonByIds" parameterType="String">
|
|
|
|
|
delete from purchase_notice_person where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|