|
@@ -0,0 +1,163 @@
|
|
|
+<?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.zkqy.business.mapper.CustomerMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.zkqy.business.domain.Customer" id="CustomerResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="customNo" column="custom_no" />
|
|
|
+ <result property="customName" column="custom_name" />
|
|
|
+ <result property="customPhoneNumber" column="custom_phone_number" />
|
|
|
+ <result property="customLandine" column="custom_landine" />
|
|
|
+ <result property="customMail" column="custom_mail" />
|
|
|
+ <result property="customType" column="custom_type" />
|
|
|
+ <result property="customGrade" column="custom_grade" />
|
|
|
+ <result property="customAddress" column="custom_address" />
|
|
|
+ <result property="customCountryType" column="custom_country_type" />
|
|
|
+ <result property="customDistrict" column="custom_district" />
|
|
|
+ <result property="salesman" column="salesman" />
|
|
|
+ <result property="contactPerson" column="contact_person" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="createById" column="create_by_id" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateById" column="update_by_id" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="taskProcessKey" column="task_process_key" />
|
|
|
+ <result property="taskNodeKey" column="task_node_key" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCustomerVo">
|
|
|
+ select id, custom_no, custom_name, custom_phone_number, custom_landine, custom_mail, custom_type, custom_grade, custom_address, custom_country_type, custom_district, salesman, contact_person, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key from {DBNAME}.customer
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCustomerList" parameterType="com.zkqy.business.domain.Customer" resultMap="CustomerResult">
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
+ where del_flag = '0'
|
|
|
+ <if test="customNo != null and customNo != ''"> and custom_no = #{customNo}</if>
|
|
|
+ <if test="customName != null and customName != ''"> and custom_name like concat('%', #{customName}, '%')</if>
|
|
|
+ <if test="customPhoneNumber != null and customPhoneNumber != ''"> and custom_phone_number = #{customPhoneNumber}</if>
|
|
|
+ <if test="customLandine != null and customLandine != ''"> and custom_landine = #{customLandine}</if>
|
|
|
+ <if test="customMail != null and customMail != ''"> and custom_mail = #{customMail}</if>
|
|
|
+ <if test="customType != null and customType != ''"> and custom_type = #{customType}</if>
|
|
|
+ <if test="customGrade != null and customGrade != ''"> and custom_grade = #{customGrade}</if>
|
|
|
+ <if test="customAddress != null and customAddress != ''"> and custom_address = #{customAddress}</if>
|
|
|
+ <if test="customCountryType != null and customCountryType != ''"> and custom_country_type = #{customCountryType}</if>
|
|
|
+ <if test="customDistrict != null and customDistrict != ''"> and custom_district = #{customDistrict}</if>
|
|
|
+ <if test="salesman != null and salesman != ''"> and salesman = #{salesman}</if>
|
|
|
+ <if test="contactPerson != null and contactPerson != ''"> and contact_person = #{contactPerson}</if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCustomerById" parameterType="Long" resultMap="CustomerResult">
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCustomer" parameterType="com.zkqy.business.domain.Customer" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into {DBNAME}.customer
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="customNo != null">custom_no,</if>
|
|
|
+ <if test="customName != null">custom_name,</if>
|
|
|
+ <if test="customPhoneNumber != null">custom_phone_number,</if>
|
|
|
+ <if test="customLandine != null">custom_landine,</if>
|
|
|
+ <if test="customMail != null">custom_mail,</if>
|
|
|
+ <if test="customType != null">custom_type,</if>
|
|
|
+ <if test="customGrade != null">custom_grade,</if>
|
|
|
+ <if test="customAddress != null">custom_address,</if>
|
|
|
+ <if test="customCountryType != null">custom_country_type,</if>
|
|
|
+ <if test="customDistrict != null">custom_district,</if>
|
|
|
+ <if test="salesman != null">salesman,</if>
|
|
|
+ <if test="contactPerson != null">contact_person,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="createById != null">create_by_id,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="taskProcessKey != null">task_process_key,</if>
|
|
|
+ <if test="taskNodeKey != null">task_node_key,</if>
|
|
|
+ del_flag
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="customNo != null">#{customNo},</if>
|
|
|
+ <if test="customName != null">#{customName},</if>
|
|
|
+ <if test="customPhoneNumber != null">#{customPhoneNumber},</if>
|
|
|
+ <if test="customLandine != null">#{customLandine},</if>
|
|
|
+ <if test="customMail != null">#{customMail},</if>
|
|
|
+ <if test="customType != null">#{customType},</if>
|
|
|
+ <if test="customGrade != null">#{customGrade},</if>
|
|
|
+ <if test="customAddress != null">#{customAddress},</if>
|
|
|
+ <if test="customCountryType != null">#{customCountryType},</if>
|
|
|
+ <if test="customDistrict != null">#{customDistrict},</if>
|
|
|
+ <if test="salesman != null">#{salesman},</if>
|
|
|
+ <if test="contactPerson != null">#{contactPerson},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="createById != null">#{createById},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="taskProcessKey != null">#{taskProcessKey},</if>
|
|
|
+ <if test="taskNodeKey != null">#{taskNodeKey},</if>
|
|
|
+ '0'
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCustomer" parameterType="com.zkqy.business.domain.Customer">
|
|
|
+ update {DBNAME}.customer
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="customNo != null">custom_no = #{customNo},</if>
|
|
|
+ <if test="customName != null">custom_name = #{customName},</if>
|
|
|
+ <if test="customPhoneNumber != null">custom_phone_number = #{customPhoneNumber},</if>
|
|
|
+ <if test="customLandine != null">custom_landine = #{customLandine},</if>
|
|
|
+ <if test="customMail != null">custom_mail = #{customMail},</if>
|
|
|
+ <if test="customType != null">custom_type = #{customType},</if>
|
|
|
+ <if test="customGrade != null">custom_grade = #{customGrade},</if>
|
|
|
+ <if test="customAddress != null">custom_address = #{customAddress},</if>
|
|
|
+ <if test="customCountryType != null">custom_country_type = #{customCountryType},</if>
|
|
|
+ <if test="customDistrict != null">custom_district = #{customDistrict},</if>
|
|
|
+ <if test="salesman != null">salesman = #{salesman},</if>
|
|
|
+ <if test="contactPerson != null">contact_person = #{contactPerson},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="updateById != null">update_by_id = #{updateById},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
|
|
|
+ <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCustomerById" parameterType="Long">
|
|
|
+ update {DBNAME}.customer set del_flag = '2' where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCustomerByIds" parameterType="String">
|
|
|
+ update {DBNAME}.customer set del_flag = '2' where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="customerList" parameterType="com.zkqy.business.domain.Customer" resultMap="CustomerResult">
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
+ WHERE
|
|
|
+ del_flag = '0'
|
|
|
+ <if test="queryParam != null and queryParam != ''">
|
|
|
+ AND CONCAT(
|
|
|
+ IFNULL(custom_no, '' ),
|
|
|
+ IFNULL(custom_name, '' ),
|
|
|
+ IFNULL(custom_phone_number, '' ),
|
|
|
+ IFNULL(salesman, '' ),
|
|
|
+ IFNULL(contact_person, '' )) LIKE concat('%', #{queryParam}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="createById != null "> and create_by_id = #{createById}</if>
|
|
|
+ ORDER BY
|
|
|
+ id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCustomerByCustomerNo" parameterType="string" resultMap="CustomerResult">
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
+ where custom_no = #{customerNo} and del_flag = '0'
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|