|
@@ -0,0 +1,257 @@
|
|
|
|
+<?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.system.mapper.crm.CustomerMapper">
|
|
|
|
+
|
|
|
|
+ <resultMap type="Customer" id="CustomerResult">
|
|
|
|
+ <result property="id" column="id" />
|
|
|
|
+ <result property="customerId" column="customer_id" />
|
|
|
|
+ <result property="customerCode" column="customer_code" />
|
|
|
|
+ <result property="customerName" column="customer_name" />
|
|
|
|
+ <result property="status" column="status" />
|
|
|
|
+ <result property="website" column="website" />
|
|
|
|
+ <result property="yearBusiness" column="year_business" />
|
|
|
|
+ <result property="stockCode" column="stock_code" />
|
|
|
|
+ <result property="legalPerson" column="legalPerson" />
|
|
|
|
+ <result property="connectedEntities" column="connected_entities" />
|
|
|
|
+ <result property="trade" column="trade" />
|
|
|
|
+ <result property="workforce" column="workforce" />
|
|
|
|
+ <result property="customerType" column="customer_type" />
|
|
|
|
+ <result property="responsibleDept" column="responsible_dept" />
|
|
|
|
+ <result property="salesManager" column="sales_manager" />
|
|
|
|
+ <result property="mark" column="mark" />
|
|
|
|
+ <result property="createBy" column="createBy" />
|
|
|
|
+ <result property="createDate" column="createDate" />
|
|
|
|
+ <result property="updateBy" column="updateBy" />
|
|
|
|
+ <result property="updateDate" column="updateDate" />
|
|
|
|
+ <result property="isActive" column="is_Active" />
|
|
|
|
+ <result property="deleteDate" column="deleteDate" />
|
|
|
|
+ <result property="deleteBy" column="deleteBy" />
|
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
|
+ <result property="procInsId" column="proc_ins_id" />
|
|
|
|
+ <result property="deptId" column="deptId" />
|
|
|
|
+ <result property="dhrmCompanyId" column="dhrmCompanyId" />
|
|
|
|
+ <result property="customerNature" column="customer_nature" />
|
|
|
|
+ <result property="datefrom" column="datefrom" />
|
|
|
|
+ <result property="state" column="state" />
|
|
|
|
+ <result property="isDelete" column="is_delete" />
|
|
|
|
+ <result property="companyAddress" column="company_address" />
|
|
|
|
+ <result property="isOpen" column="is_open" />
|
|
|
|
+ <result property="otherNature" column="other_nature" />
|
|
|
|
+ <result property="otherCategory" column="other_category" />
|
|
|
|
+ <result property="capital" column="capital" />
|
|
|
|
+ <result property="currency" column="currency" />
|
|
|
|
+ <result property="registDate" column="registDate" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <sql id="selectCustomerVo">
|
|
|
|
+ select id, customer_id, customer_code, customer_name, status, website, year_business, stock_code, legalPerson, connected_entities, trade, workforce, customer_type, responsible_dept, sales_manager, mark, createBy, createDate, updateBy, updateDate, is_Active, deleteDate, deleteBy, company_id, proc_ins_id, deptId, dhrmCompanyId, customer_nature, datefrom, state, is_delete, company_address, is_open, other_nature, other_category, capital, currency, registDate from crm_customer_info
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="selectCustomerList" parameterType="Customer" resultMap="CustomerResult">
|
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
|
+ <where>
|
|
|
|
+ is_Active = 'Y' and state != 4 and (datefrom = '0'or datefrom='2') and is_delete=0
|
|
|
|
+ <if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
|
|
|
|
+ <if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
|
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
+ <if test="website != null and website != ''"> and website = #{website}</if>
|
|
|
|
+ <if test="yearBusiness != null "> and year_business = #{yearBusiness}</if>
|
|
|
|
+ <if test="stockCode != null and stockCode != ''"> and stock_code = #{stockCode}</if>
|
|
|
|
+ <if test="legalPerson != null and legalPerson != ''"> and legalPerson = #{legalPerson}</if>
|
|
|
|
+ <if test="connectedEntities != null and connectedEntities != ''"> and connected_entities = #{connectedEntities}</if>
|
|
|
|
+ <if test="trade != null and trade != ''"> and trade = #{trade}</if>
|
|
|
|
+ <if test="workforce != null "> and workforce = #{workforce}</if>
|
|
|
|
+ <if test="customerType != null and customerType != ''"> and customer_type = #{customerType}</if>
|
|
|
|
+ <if test="responsibleDept != null and responsibleDept != ''"> and responsible_dept = #{responsibleDept}</if>
|
|
|
|
+ <if test="salesManager != null and salesManager != ''"> and sales_manager = #{salesManager}</if>
|
|
|
|
+ <if test="mark != null and mark != ''"> and mark = #{mark}</if>
|
|
|
|
+ <if test="createBy != null and createBy != ''"> and createBy = #{createBy}</if>
|
|
|
|
+ <if test="createDate != null and createDate != ''"> and createDate = #{createDate}</if>
|
|
|
|
+ <if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
|
|
|
+ <if test="updateDate != null "> and updatedDate = #{updateDate}</if>
|
|
|
|
+ <if test="isActive != null and isActive != ''"> and is_Active = #{isActive}</if>
|
|
|
|
+ <if test="deleteDate != null and deleteDate != ''"> and deleteDate = #{deleteDate}</if>
|
|
|
|
+ <if test="deleteBy != null and deleteBy != ''"> and deleteBy = #{deleteBy}</if>
|
|
|
|
+ <if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
|
|
|
+ <if test="procInsId != null and procInsId != ''"> and proc_ins_id = #{procInsId}</if>
|
|
|
|
+ <if test="deptId != null and deptId != ''"> and deptId = #{deptId}</if>
|
|
|
|
+ <if test="dhrmCompanyId != null and dhrmCompanyId != ''"> and dhrmCompanyId = #{dhrmCompanyId}</if>
|
|
|
|
+ <if test="customerNature != null and customerNature != ''"> and customer_nature = #{customerNature}</if>
|
|
|
|
+ <if test="datefrom != null and datefrom != ''"> and datefrom = #{datefrom}</if>
|
|
|
|
+ <if test="state != null and state != ''"> and state = #{state}</if>
|
|
|
|
+ <if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
|
|
|
+ <if test="companyAddress != null and companyAddress != ''"> and company_address = #{companyAddress}</if>
|
|
|
|
+ <if test="isOpen != null and isOpen != ''"> and is_open = #{isOpen}</if>
|
|
|
|
+ <if test="otherNature != null and otherNature != ''"> and other_nature = #{otherNature}</if>
|
|
|
|
+ <if test="otherCategory != null and otherCategory != ''"> and other_category = #{otherCategory}</if>
|
|
|
|
+ <if test="capital != null "> and capital = #{capital}</if>
|
|
|
|
+ <if test="currency != null and currency != ''"> and currency = #{currency}</if>
|
|
|
|
+ <if test="registDate != null and registDate != ''"> and registDate = #{registDate}</if>
|
|
|
|
+ </where>
|
|
|
|
+ <!-- 数据范围过滤 -->
|
|
|
|
+ ${params.dataScope}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="selectCustomerById" parameterType="Long" resultMap="CustomerResult">
|
|
|
|
+ <include refid="selectCustomerVo"/>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
+ insert into crm_customer_info
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="customerId != null">customer_id,</if>
|
|
|
|
+ <if test="customerCode != null">customer_code,</if>
|
|
|
|
+ <if test="customerName != null">customer_name,</if>
|
|
|
|
+ <if test="status != null">status,</if>
|
|
|
|
+ <if test="website != null">website,</if>
|
|
|
|
+ <if test="yearBusiness != null">year_business,</if>
|
|
|
|
+ <if test="stockCode != null">stock_code,</if>
|
|
|
|
+ <if test="legalPerson != null">legalPerson,</if>
|
|
|
|
+ <if test="connectedEntities != null">connected_entities,</if>
|
|
|
|
+ <if test="trade != null">trade,</if>
|
|
|
|
+ <if test="workforce != null">workforce,</if>
|
|
|
|
+ <if test="customerType != null">customer_type,</if>
|
|
|
|
+ <if test="responsibleDept != null">responsible_dept,</if>
|
|
|
|
+ <if test="salesManager != null">sales_manager,</if>
|
|
|
|
+ <if test="mark != null">mark,</if>
|
|
|
|
+ <if test="createBy != null">createBy,</if>
|
|
|
|
+ <if test="createDate != null">createDate,</if>
|
|
|
|
+ <if test="updateBy != null">updateBy,</if>
|
|
|
|
+ <if test="updateDate != null">updateDate,</if>
|
|
|
|
+ <if test="isActive != null">is_Active,</if>
|
|
|
|
+ <if test="deleteDate != null">deleteDate,</if>
|
|
|
|
+ <if test="deleteBy != null">deleteBy,</if>
|
|
|
|
+ <if test="companyId != null">company_id,</if>
|
|
|
|
+ <if test="procInsId != null">proc_ins_id,</if>
|
|
|
|
+ <if test="deptId != null">deptId,</if>
|
|
|
|
+ <if test="dhrmCompanyId != null">dhrmCompanyId,</if>
|
|
|
|
+ <if test="customerNature != null">customer_nature,</if>
|
|
|
|
+ <if test="datefrom != null">datefrom,</if>
|
|
|
|
+ <if test="state != null">state,</if>
|
|
|
|
+ <if test="isDelete != null">is_delete,</if>
|
|
|
|
+ <if test="companyAddress != null">company_address,</if>
|
|
|
|
+ <if test="isOpen != null">is_open,</if>
|
|
|
|
+ <if test="otherNature != null">other_nature,</if>
|
|
|
|
+ <if test="otherCategory != null">other_category,</if>
|
|
|
|
+ <if test="capital != null">capital,</if>
|
|
|
|
+ <if test="currency != null">currency,</if>
|
|
|
|
+ <if test="registDate != null">registDate,</if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="customerId != null">#{customerId},</if>
|
|
|
|
+ <if test="customerCode != null">#{customerCode},</if>
|
|
|
|
+ <if test="customerName != null">#{customerName},</if>
|
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
|
+ <if test="website != null">#{website},</if>
|
|
|
|
+ <if test="yearBusiness != null">#{yearBusiness},</if>
|
|
|
|
+ <if test="stockCode != null">#{stockCode},</if>
|
|
|
|
+ <if test="legalPerson != null">#{legalPerson},</if>
|
|
|
|
+ <if test="connectedEntities != null">#{connectedEntities},</if>
|
|
|
|
+ <if test="trade != null">#{trade},</if>
|
|
|
|
+ <if test="workforce != null">#{workforce},</if>
|
|
|
|
+ <if test="customerType != null">#{customerType},</if>
|
|
|
|
+ <if test="responsibleDept != null">#{responsibleDept},</if>
|
|
|
|
+ <if test="salesManager != null">#{salesManager},</if>
|
|
|
|
+ <if test="mark != null">#{mark},</if>
|
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
|
+ <if test="createDate != null">#{createDate},</if>
|
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
|
+ <if test="updateDate != null">#{updateDate},</if>
|
|
|
|
+ <if test="isActive != null">#{isActive},</if>
|
|
|
|
+ <if test="deleteDate != null">#{deleteDate},</if>
|
|
|
|
+ <if test="deleteBy != null">#{deleteBy},</if>
|
|
|
|
+ <if test="companyId != null">#{companyId},</if>
|
|
|
|
+ <if test="procInsId != null">#{procInsId},</if>
|
|
|
|
+ <if test="deptId != null">#{deptId},</if>
|
|
|
|
+ <if test="dhrmCompanyId != null">#{dhrmCompanyId},</if>
|
|
|
|
+ <if test="customerNature != null">#{customerNature},</if>
|
|
|
|
+ <if test="datefrom != null">#{datefrom},</if>
|
|
|
|
+ <if test="state != null">#{state},</if>
|
|
|
|
+ <if test="isDelete != null">#{isDelete},</if>
|
|
|
|
+ <if test="companyAddress != null">#{companyAddress},</if>
|
|
|
|
+ <if test="isOpen != null">#{isOpen},</if>
|
|
|
|
+ <if test="otherNature != null">#{otherNature},</if>
|
|
|
|
+ <if test="otherCategory != null">#{otherCategory},</if>
|
|
|
|
+ <if test="capital != null">#{capital},</if>
|
|
|
|
+ <if test="currency != null">#{currency},</if>
|
|
|
|
+ <if test="registDate != null">#{registDate},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="updateCustomer" parameterType="Customer">
|
|
|
|
+ update crm_customer_info
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
+ <if test="customerId != null">customer_id = #{customerId},</if>
|
|
|
|
+ <if test="customerCode != null">customer_code = #{customerCode},</if>
|
|
|
|
+ <if test="customerName != null">customer_name = #{customerName},</if>
|
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
|
+ <if test="website != null">website = #{website},</if>
|
|
|
|
+ <if test="yearBusiness != null">year_business = #{yearBusiness},</if>
|
|
|
|
+ <if test="stockCode != null">stock_code = #{stockCode},</if>
|
|
|
|
+ <if test="legalPerson != null">legalPerson = #{legalPerson},</if>
|
|
|
|
+ <if test="connectedEntities != null">connected_entities = #{connectedEntities},</if>
|
|
|
|
+ <if test="trade != null">trade = #{trade},</if>
|
|
|
|
+ <if test="workforce != null">workforce = #{workforce},</if>
|
|
|
|
+ <if test="customerType != null">customer_type = #{customerType},</if>
|
|
|
|
+ <if test="responsibleDept != null">responsible_dept = #{responsibleDept},</if>
|
|
|
|
+ <if test="salesManager != null">sales_manager = #{salesManager},</if>
|
|
|
|
+ <if test="mark != null">mark = #{mark},</if>
|
|
|
|
+ <if test="createBy != null">createBy = #{createBy},</if>
|
|
|
|
+ <if test="createDate != null">createDate = #{createDate},</if>
|
|
|
|
+ <if test="updateBy != null">updateBy = #{updateBy},</if>
|
|
|
|
+ <if test="updateDate != null">updateDate = #{updateDate},</if>
|
|
|
|
+ <if test="isActive != null">is_Active = #{isActive},</if>
|
|
|
|
+ <if test="deleteDate != null">deleteDate = #{deleteDate},</if>
|
|
|
|
+ <if test="deleteBy != null">deleteBy = #{deleteBy},</if>
|
|
|
|
+ <if test="companyId != null">company_id = #{companyId},</if>
|
|
|
|
+ <if test="procInsId != null">proc_ins_id = #{procInsId},</if>
|
|
|
|
+ <if test="deptId != null">deptId = #{deptId},</if>
|
|
|
|
+ <if test="dhrmCompanyId != null">dhrmCompanyId = #{dhrmCompanyId},</if>
|
|
|
|
+ <if test="customerNature != null">customer_nature = #{customerNature},</if>
|
|
|
|
+ <if test="datefrom != null">datefrom = #{datefrom},</if>
|
|
|
|
+ <if test="state != null">state = #{state},</if>
|
|
|
|
+ <if test="isDelete != null">is_delete = #{isDelete},</if>
|
|
|
|
+ <if test="companyAddress != null">company_address = #{companyAddress},</if>
|
|
|
|
+ <if test="isOpen != null">is_open = #{isOpen},</if>
|
|
|
|
+ <if test="otherNature != null">other_nature = #{otherNature},</if>
|
|
|
|
+ <if test="otherCategory != null">other_category = #{otherCategory},</if>
|
|
|
|
+ <if test="capital != null">capital = #{capital},</if>
|
|
|
|
+ <if test="currency != null">currency = #{currency},</if>
|
|
|
|
+ <if test="registDate != null">registDate = #{registDate},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCustomerById" parameterType="Long">
|
|
|
|
+ delete from crm_customer_info where id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteCustomerByIds" parameterType="String">
|
|
|
|
+ delete from crm_customer_info where id in
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <select id="myTaskList" resultMap="CustomerResult">
|
|
|
|
+ select
|
|
|
|
+ distinct
|
|
|
|
+ m.*
|
|
|
|
+ from crm_customer_info m
|
|
|
|
+ where m.is_delete ='0'
|
|
|
|
+ <if test="customer.customerCode!=null and customer.customerCode!=''">
|
|
|
|
+ and m.customer_code like concat('%',#{customer.customerCode},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="customer.customerName!=null and customer.customerName!=''">
|
|
|
|
+ and m.customer_name like concat('%',#{customer.customerName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY applyTime DESC
|
|
|
|
+ <!-- 数据范围过滤 -->
|
|
|
|
+ ${params.dataScope}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+</mapper>
|