devicesmgt/sgzb-modules/sgzb-system/src/main/resources/mapper/system/PurchaseNoticePersonMapper.xml

72 lines
3.2 KiB
XML
Raw Normal View History

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" />
</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">
select pnp.id, pnp.user_id, pnp.user_name, telphone,r.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 r.role_id = #{roleId} and u.status = '0'
</select>
<select id="selectPurchaseNoticePersonById" parameterType="Long" resultMap="PurchaseNoticePersonResult">
<include refid="selectPurchaseNoticePersonVo"/>
where id = #{id}
</select>
<insert id="insertPurchaseNoticePerson" parameterType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
insert into purchase_notice_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<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="id != null">#{id},</if>
<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">
delete from purchase_notice_person where id = #{id}
</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>