devicesmgt/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaSupplierInfoMapper.xml

120 lines
6.8 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.sgzb.base.mapper.MaSupplierInfoMapper">
<resultMap type="com.bonus.sgzb.base.domain.MaSupplierInfo" id="MaSupplierInfoResult">
<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="selectMaSupplierInfoVo">
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="selectMaSupplierInfoList" parameterType="com.bonus.sgzb.base.domain.MaSupplierInfo" resultMap="MaSupplierInfoResult">
<include refid="selectMaSupplierInfoVo"/>
<where>
<if test="supplier != null and supplier != ''"> and supplier like concat('%',#{supplier},'%') </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>
</where>
</select>
<select id="selectMaSupplierInfoBySupplierId" parameterType="Long" resultMap="MaSupplierInfoResult">
<include refid="selectMaSupplierInfoVo"/>
where supplier_id = #{supplierId}
</select>
<insert id="insertMaSupplierInfo" parameterType="com.bonus.sgzb.base.domain.MaSupplierInfo" 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="updateBy != null">update_by,</if>
<if test="updateTime != null">update_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="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateMaSupplierInfo" parameterType="com.bonus.sgzb.base.domain.MaSupplierInfo">
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="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">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="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="deleteMaSupplierInfoBySupplierId" parameterType="Long">
delete from ma_supplier_info where supplier_id = #{supplierId}
</delete>
<delete id="deleteMaSupplierInfoBySupplierIds" parameterType="String">
delete from ma_supplier_info where supplier_id in
<foreach item="supplierId" collection="array" open="(" separator="," close=")">
#{supplierId}
</foreach>
</delete>
</mapper>