unis_sip/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml

145 lines
7.9 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.ruoyi.sip.mapper.CustomerInfoMapper">
<resultMap type="CustomerInfo" id="CustomerInfoResult">
<result property="id" column="id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="customerPostcode" column="customer_postcode" />
<result property="province" column="province" />
<result property="city" column="city" />
<result property="address" column="address" />
<result property="contactPerson" column="contact_person" />
<result property="contactPhone" column="contact_phone" />
<result property="contactEmail" column="contact_email" />
<result property="industryType" column="Industry_type" />
<result property="remark" column="remark" />
<result property="createAt" column="create_at" />
<result property="updateAt" column="update_at" />
<result property="deleteAt" column="delete_at" />
<result property="status" column="status" />
</resultMap>
<sql id="selectCustomerInfoVo">
select id, customer_code, customer_name, customer_postcode, province, city, address, contact_person,
contact_phone, contact_email, industry_type, remark, create_at, update_at, delete_at, status from customer_info
</sql>
<select id="selectCustomerInfoList" parameterType="CustomerInfo" resultMap="CustomerInfoResult">
<include refid="selectCustomerInfoVo"/>
<where>
<if test="customerCode != null and customerCode != ''">and customer_code like concat( '%',#{customerCode},'%')</if>
<if test="customerCodeList != null and customerCodeList.size>0">and customer_code in
<foreach collection="customerCodeList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName},
'%')
</if>
<if test="customerPostcode != null and customerPostcode != ''">and customer_postcode =
#{customerPostcode}
</if>
<if test="province != null and province != ''">and province = #{province}</if>
<if test="city != null and city != ''">and city = #{city}</if>
<if test="address != null and address != ''">and address = #{address}</if>
<if test="contactPerson != null and contactPerson != ''">and contact_person = #{contactPerson}</if>
<if test="contactPhone != null and contactPhone != ''">and contact_phone = #{contactPhone}</if>
<if test="contactEmail != null and contactEmail != ''">and contact_email = #{contactEmail}</if>
<if test="industryType != null and industryType != ''">and industry_type = #{industryType}</if>
<if test="createAt != null ">and create_at = #{createAt}</if>
<if test="updateAt != null ">and update_at = #{updateAt}</if>
<if test="deleteAt != null ">and delete_at = #{deleteAt}</if>
<if test="status != null ">and status = #{status}</if>
</where>
</select>
<select id="selectCustomerInfoById" parameterType="Long" resultMap="CustomerInfoResult">
<include refid="selectCustomerInfoVo"/>
where id = #{id}
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from customer_info where customer_code = #{customerCode} and status=0
<if test="id != null">and id != #{id}</if>
</select>
<insert id="insertCustomerInfo" parameterType="CustomerInfo">
insert into customer_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null">customer_name,</if>
<if test="customerPostcode != null">customer_postcode,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if>
<if test="address != null">address,</if>
<if test="contactPerson != null">contact_person,</if>
<if test="contactPhone != null">contact_phone,</if>
<if test="contactEmail != null">contact_email,</if>
<if test="industryType != null">industry_type,</if>
<if test="remark != null">remark,</if>
<if test="createAt != null">create_at,</if>
<if test="updateAt != null">update_at,</if>
<if test="deleteAt != null">delete_at,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy!=''">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="customerName != null">#{customerName},</if>
<if test="customerPostcode != null">#{customerPostcode},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if>
<if test="address != null">#{address},</if>
<if test="contactPerson != null">#{contactPerson},</if>
<if test="contactPhone != null">#{contactPhone},</if>
<if test="contactEmail != null">#{contactEmail},</if>
<if test="industryType != null">#{industryType},</if>
<if test="remark != null">#{remark},</if>
<if test="createAt != null">#{createAt},</if>
<if test="updateAt != null">#{updateAt},</if>
<if test="deleteAt != null">#{deleteAt},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy!=''">#{createBy},</if>
</trim>
</insert>
<update id="updateCustomerInfo" parameterType="CustomerInfo">
update customer_info
<trim prefix="SET" suffixOverrides=",">
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="customerPostcode != null">customer_postcode = #{customerPostcode},</if>
<if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if>
<if test="address != null">address = #{address},</if>
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="contactEmail != null">contact_email = #{contactEmail},</if>
<if test="industryType != null">industry_type = #{industryType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createAt != null">create_at = #{createAt},</if>
<if test="updateAt != null">update_at = #{updateAt},</if>
<if test="deleteAt != null">delete_at = #{deleteAt},</if>
<if test="status != null">status = #{status},</if>
<if test="updateBy != null and updateBy!=''">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerInfoById" parameterType="Long">
delete from customer_info where id = #{id}
</delete>
<delete id="deleteCustomerInfoByIds" parameterType="String">
delete from customer_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>