This commit is contained in:
YY
2025-07-17 10:12:04 +08:00
8 changed files with 639 additions and 2 deletions

View File

@ -0,0 +1,210 @@
<?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.chinaunicom.zyhy.ebtp.supplier.coscosupplier.dao.mapper.CoscoSupplierUserMapper">
<resultMap type="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser" id="CoscoSupplierUserResult">
<result property="id" column="id"/>
<result property="supplierId" column="supplier_id"/>
<result property="userId" column="user_id"/>
<result property="contactsName" column="contacts_name"/>
<result property="contactsPhone" column="contacts_phone"/>
<result property="contactsEmail" column="contacts_email"/>
<result property="type" column="type"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="lastUpdateTime" column="last_update_time"/>
</resultMap>
<sql id="selectCoscoSupplierUserVo">
SELECT
id,
supplier_id,
user_id,
contacts_name,
contacts_phone,
contacts_email,
type,
del_flag,
create_by,
create_time,
update_by,
update_time,
last_update_time
FROM
cosco_supplier_user
</sql>
<select id="selectCoscoSupplierUserList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser" resultMap="CoscoSupplierUserResult">
<include refid="selectCoscoSupplierUserVo"/>
<where>
and del_flag = 'normal'
<if test="supplierId != null and supplierId != ''">
and supplier_id = #{supplierId}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="contactsName != null and contactsName != ''">
and contacts_name like concat('%', #{contactsName}, '%')
</if>
<if test="contactsPhone != null and contactsPhone != ''">
and contacts_phone = #{contactsPhone}
</if>
<if test="contactsEmail != null and contactsEmail != ''">
and contacts_email = #{contactsEmail}
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="lastUpdateTime != null ">
and last_update_time = #{lastUpdateTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectCoscoSupplierUserPage" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser" resultMap="CoscoSupplierUserResult">
<include refid="selectCoscoSupplierUserVo"/>
<where>
and del_flag = 'normal'
<if test="vo.supplierId != null and vo.supplierId != ''">
and supplier_id = #{vo.supplierId}
</if>
<if test="vo.userId != null and vo.userId != ''">
and user_id = #{vo.userId}
</if>
<if test="vo.contactsName != null and vo.contactsName != ''">
and contacts_name like concat('%', #{vo.contactsName}, '%')
</if>
<if test="vo.contactsPhone != null and vo.contactsPhone != ''">
and contacts_phone = #{vo.contactsPhone}
</if>
<if test="vo.contactsEmail != null and vo.contactsEmail != ''">
and contacts_email = #{vo.contactsEmail}
</if>
<if test="vo.type != null ">
and type = #{vo.type}
</if>
</where>
order by create_time desc
</select>
<select id="selectCoscoSupplierUserById" parameterType="String"
resultMap="CoscoSupplierUserResult">
<include refid="selectCoscoSupplierUserVo"/>
where id = #{id}
</select>
<insert id="insertCoscoSupplierUser" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser">
insert into cosco_supplier_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="supplierId != null and supplierId != ''">supplier_id,</if>
<if test="userId != null and userId != ''">user_id,</if>
<if test="contactsName != null and contactsName != ''">contacts_name,</if>
<if test="contactsPhone != null and contactsPhone != ''">contacts_phone,</if>
<if test="contactsEmail != null and contactsEmail != ''">contacts_email,</if>
<if test="type != null">type,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="lastUpdateTime != null">last_update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="supplierId != null and supplierId != ''">#{supplierId},</if>
<if test="userId != null and userId != ''">#{userId},</if>
<if test="contactsName != null and contactsName != ''">#{contactsName},</if>
<if test="contactsPhone != null and contactsPhone != ''">#{contactsPhone},</if>
<if test="contactsEmail != null and contactsEmail != ''">#{contactsEmail},</if>
<if test="type != null">#{type},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="lastUpdateTime != null">#{lastUpdateTime},</if>
</trim>
</insert>
<insert id="batchCoscoSupplierUser" parameterType="java.util.List">
insert into cosco_supplier_user
( id, supplier_id, user_id, contacts_name, contacts_phone, contacts_email, type, del_flag, create_by, create_time, update_by, update_time, last_update_time)
values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.supplierId}, #{item.userId}, #{item.contactsName}, #{item.contactsPhone}, #{item.contactsEmail}, #{item.type}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
</foreach>
</insert>
<update id="updateCoscoSupplierUser" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser">
update cosco_supplier_user
<trim prefix="SET" suffixOverrides=",">
<if test="supplierId != null and supplierId != ''">supplier_id =
#{supplierId},
</if>
<if test="userId != null and userId != ''">user_id =
#{userId},
</if>
<if test="contactsName != null and contactsName != ''">contacts_name =
#{contactsName},
</if>
<if test="contactsPhone != null and contactsPhone != ''">contacts_phone =
#{contactsPhone},
</if>
<if test="contactsEmail != null and contactsEmail != ''">contacts_email =
#{contactsEmail},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="delFlag != null and delFlag != ''">del_flag =
#{delFlag},
</if>
<if test="createBy != null and createBy != ''">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="lastUpdateTime != null">last_update_time =
#{lastUpdateTime},
</if>
</trim>
where id = #{id}
</update>
<update id="updateCoscoSupplierUserType" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierUser">
UPDATE cosco_supplier_user
SET type = CASE
WHEN id = #{id} THEN 1
ELSE 0
END,
update_time = NOW(),
last_update_time = NOW()
WHERE supplier_id = #{supplierId}
</update>
<update id="deleteCoscoSupplierUserById" parameterType="String">
update cosco_supplier_user set del_flag = 'deleted'
where id = #{id}
</update>
<update id="deleteCoscoSupplierUserByIds" parameterType="String">
update cosco_supplier_user set del_flag = 'deleted' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>