unis_sip/ruoyi-sip/src/main/resources/mapper/system/VendorInfoMapper.xml

115 lines
6.4 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.sip.mapper.VendorInfoMapper">
<resultMap type="VendorInfo" id="VendorInfoResult">
<result property="vendorId" column="vendor_id" />
<result property="vendorCode" column="vendor_code" />
<result property="vendorName" column="vendor_name" />
<result property="vendorAddress" column="vendor_address" />
<result property="vendorUser" column="vendor_user" />
<result property="vendorEmail" column="vendor_email" />
<result property="vendorPhone" column="vendor_phone" />
<result property="vendorStatus" column="vendor_status" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectVendorInfoVo">
select t1.vendor_id, t1.vendor_code, t1.vendor_name, t1.vendor_address, t1.vendor_user, t1.vendor_email, t1.vendor_phone, t1.vendor_status
, t1.create_by, t1.update_by, t1.create_time, t1.update_time,t1.warehouse_id
,t2.warehouse_name
from oms_vendor_info t1
left join oms_warehouse_info t2 on t1.warehouse_id = t2.id
</sql>
<select id="selectVendorInfoList" parameterType="VendorInfo" resultMap="VendorInfoResult">
<include refid="selectVendorInfoVo"/>
<where>
<if test="vendorCode != null and vendorCode != ''"> and t1.vendor_code like concat('%', #{vendorCode}, '%')</if>
<if test="vendorName != null and vendorName != ''"> and t1.vendor_name like concat('%', #{vendorName}, '%')</if>
<if test="vendorAddress != null and vendorAddress != ''"> and t1.vendor_address like concat('%', #{vendorAddress}, '%')</if>
<if test="vendorUser != null and vendorUser != ''"> and t1.vendor_user = #{vendorUser}</if>
<if test="vendorStatus != null and vendorStatus != ''"> and t1.vendor_status = #{vendorStatus}</if>
<if test="vendorNameList != null and vendorNameList.size>0"> and t1.vendor_name in
<foreach item="item" index="index" collection="vendorNameList" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectVendorInfoByVendorId" parameterType="Long" resultMap="VendorInfoResult">
<include refid="selectVendorInfoVo"/>
where t1.vendor_id = #{vendorId}
</select>
<insert id="insertVendorInfo" parameterType="VendorInfo">
insert into oms_vendor_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vendorId != null">vendor_id,</if>
<if test="vendorCode != null and vendorCode != ''">vendor_code,</if>
<if test="vendorName != null and vendorName != ''">vendor_name,</if>
<if test="vendorAddress != null">vendor_address,</if>
<if test="vendorUser != null and vendorUser != ''">vendor_user,</if>
<if test="vendorEmail != null">vendor_email,</if>
<if test="vendorPhone != null and vendorPhone != ''">vendor_phone,</if>
<if test="warehouseId != null and warehouseId!=''">warehouse_id,</if>
<if test="vendorStatus != null">vendor_status,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vendorId != null">#{vendorId},</if>
<if test="vendorCode != null and vendorCode != ''">#{vendorCode},</if>
<if test="vendorName != null and vendorName != ''">#{vendorName},</if>
<if test="vendorAddress != null">#{vendorAddress},</if>
<if test="vendorUser != null and vendorUser != ''">#{vendorUser},</if>
<if test="vendorEmail != null">#{vendorEmail},</if>
<if test="vendorPhone != null and vendorPhone != ''">#{vendorPhone},</if>
<if test="warehouseId != null and warehouseId!=''"> #{warehouseId},</if>
<if test="vendorStatus != null">#{vendorStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateVendorInfo" parameterType="VendorInfo">
update oms_vendor_info
<trim prefix="SET" suffixOverrides=",">
<if test="vendorCode != null and vendorCode != ''">vendor_code = #{vendorCode},</if>
<if test="vendorName != null and vendorName != ''">vendor_name = #{vendorName},</if>
<if test="vendorAddress != null">vendor_address = #{vendorAddress},</if>
<if test="vendorUser != null and vendorUser != ''">vendor_user = #{vendorUser},</if>
<if test="vendorEmail != null">vendor_email = #{vendorEmail},</if>
<if test="vendorPhone != null and vendorPhone != ''">vendor_phone = #{vendorPhone},</if>
<if test="vendorStatus != null">vendor_status = #{vendorStatus},</if>
<if test="warehouseId != null and warehouseId!=''">warehouse_id = #{warehouseId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where vendor_id = #{vendorId}
</update>
<delete id="deleteVendorInfoByVendorId" parameterType="Long">
delete from oms_vendor_info where vendor_id = #{vendorId}
</delete>
<delete id="deleteVendorInfoByVendorIds" parameterType="String">
delete from oms_vendor_info where vendor_id in
<foreach item="vendorId" collection="array" open="(" separator="," close=")">
#{vendorId}
</foreach>
</delete>
</mapper>