Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml

126 lines
6.7 KiB
XML

<?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.material.ma.mapper.SupplierInfoMapper">
<resultMap type="com.bonus.material.ma.domain.SupplierInfo" id="SupplierInfoResult">
<result property="supplierId" column="supplier_id" />
<result property="supplier" column="supplier" />
<result property="address" column="address" />
<result property="legalPerson" column="legal_person" />
<result property="primaryContact" column="primary_contact" />
<result property="phone" column="phone" />
<result property="businessScope" column="business_scope" />
<result property="businessLicense" column="business_license" />
<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="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="status" column="status" />
</resultMap>
<sql id="selectSupplierInfoVo">
select supplier_id, supplier, address, legal_person, primary_contact, phone, business_scope, business_license,
del_flag, create_by, create_time, update_by, update_time, remark, company_id, status
from ma_supplier_info
</sql>
<select id="selectSupplierInfoList" parameterType="com.bonus.material.ma.domain.SupplierInfo" resultMap="SupplierInfoResult">
<include refid="selectSupplierInfoVo"/>
<where>
<if test="supplier != null and supplier != ''">
and supplier like concat('%',#{supplier},'%')
</if>
<if test="companyId != null and companyId != ''">
and company_id=#{companyId}
</if>
<if test="keyWord != null and keyWord != ''">
and supplier like concat('%',#{keyWord},'%')
</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="legalPerson != null and legalPerson != ''"> and legal_person = #{legalPerson}</if>
<if test="primaryContact != null and primaryContact != ''"> and primary_contact = #{primaryContact}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="businessLicense != null and businessLicense != ''"> and business_license = #{businessLicense}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
<if test="status != null "> and `status` = #{status}</if>
and del_flag = '0'
</where>
</select>
<select id="selectSupplierInfoBySupplierId" parameterType="Long" resultMap="SupplierInfoResult">
<include refid="selectSupplierInfoVo"/>
where supplier_id = #{supplierId}
</select>
<insert id="insertSupplierInfo" parameterType="com.bonus.material.ma.domain.SupplierInfo" useGeneratedKeys="true" keyProperty="supplierId">
insert into ma_supplier_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="supplier != null and supplier != ''">supplier,</if>
<if test="address != null">address,</if>
<if test="legalPerson != null">legal_person,</if>
<if test="primaryContact != null">primary_contact,</if>
<if test="phone != null">phone,</if>
<if test="businessScope != null">business_scope,</if>
<if test="businessLicense != null">business_license,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="status != null">`status`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="supplier != null and supplier != ''">#{supplier},</if>
<if test="address != null">#{address},</if>
<if test="legalPerson != null">#{legalPerson},</if>
<if test="primaryContact != null">#{primaryContact},</if>
<if test="phone != null">#{phone},</if>
<if test="businessScope != null">#{businessScope},</if>
<if test="businessLicense != null">#{businessLicense},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateSupplierInfo" parameterType="com.bonus.material.ma.domain.SupplierInfo">
update ma_supplier_info
<trim prefix="SET" suffixOverrides=",">
<if test="supplier != null and supplier != ''">supplier = #{supplier},</if>
<if test="address != null">address = #{address},</if>
<if test="legalPerson != null">legal_person = #{legalPerson},</if>
<if test="primaryContact != null">primary_contact = #{primaryContact},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="businessScope != null">business_scope = #{businessScope},</if>
<if test="businessLicense != null">business_license = #{businessLicense},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="status != null">status = #{status},</if>
</trim>
where supplier_id = #{supplierId}
</update>
<delete id="deleteSupplierInfoBySupplierId" parameterType="Long">
delete from ma_supplier_info where supplier_id = #{supplierId}
</delete>
<delete id="deleteSupplierInfoBySupplierIds" parameterType="String">
delete from ma_supplier_info
where supplier_id in
<foreach item="supplierId" collection="array" open="(" separator="," close=")">
#{supplierId}
</foreach>
</delete>
</mapper>