浏览代码

fix:添加客户历史使用名

ly 10 月之前
父节点
当前提交
87969b0b52

+ 10 - 0
src/main/java/cn/ezhizao/project/business/company/controller/BizCompanyController.java

@@ -214,6 +214,16 @@ public class BizCompanyController extends BaseController
     public AjaxResult edit(@RequestBody BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
     {
         setTenantId(bizCompany);
+        if(null != bizCompany.getId()){
+            BizCompany company = bizCompanyService.query().eq("id", bizCompany.getId()).list().get(0);
+            if(!company.getName().equals(bizCompany.getName())){
+                if(bizCompany.getOldName().isEmpty()){
+                    bizCompany.setOldName(company.getName());
+                }else{
+                    bizCompany.setOldName(String.join(",", bizCompany.getName(),company.getOldName()));
+                }
+            }
+        }
         return bizCompanyService.updateById(bizCompany) ? success("保存成功", bizCompany) : error("保存失败");
     }
 

+ 2 - 1
src/main/java/cn/ezhizao/project/business/order/domain/BizArchiveInput.java

@@ -248,5 +248,6 @@ public class BizArchiveInput extends BaseEntity {
     private Long customerLabelId;
     private String boss;
     private String party;
-
+    @TableField(exist = false)
+    private String oldName;
 }

+ 2 - 0
src/main/java/cn/ezhizao/project/business/order/domain/vo/InputVo.java

@@ -3,6 +3,7 @@ package cn.ezhizao.project.business.order.domain.vo;
 import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
 import cn.ezhizao.framework.web.domain.BaseEntity;
 import cn.ezhizao.project.business.order.domain.BizArchiveInputDetail;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -187,4 +188,5 @@ public class InputVo extends BaseEntity {
     private List<Long> customerLabelId;
     private String boss;
     private String contactNo;
+    private String oldName;
 }

+ 4 - 0
src/main/resources/mybatis/business/BizArchiveInputMapper.xml

@@ -45,6 +45,7 @@
         SELECT
         t1.*,
         t2.name as company_name,
+        t2.old_name as oldName,
         t2.social_credit_code as social_credit_code,
         t3.nick_name as signer_name,
         t4.title as source_category_name,
@@ -58,6 +59,7 @@
             <if test="fromId != null">AND (t1.from_id = #{fromId} or t1.id = #{fromId})</if>
             <if test="id != null  and id != ''">AND t1.id = #{id}</if>
             <if test="companyName != null  and companyName != ''">AND t2.name like concat("%", #{companyName}, "%")</if>
+            <if test="oldName != null  and oldName != ''">AND t2.old_name like concat("%", #{oldName}, "%")</if>
             <if test="archiveTypeId != null">and archive_type_id = #{archiveTypeId}</if>
             <if test="companyId != null  and companyId != ''">AND t1.company_id = #{companyId}</if>
             <if test="archiveCode != null  and archiveCode != ''">AND t1.archive_code = #{archiveCode}</if>
@@ -109,6 +111,7 @@
         SELECT
         t1.*,
         t2.name as company_name,
+        t2.old_name as oldName,
         t2.customer_label_id as customerLabelId,
         t5.lable as customerLabelName,
         t2.social_credit_code as social_credit_code,
@@ -126,6 +129,7 @@
             <if test="id != null  and id != ''">AND t1.id = #{id}</if>
             <if test="contractNo!=null and contractNo != '' ">AND t1.contract_no like concat("%",#{contractNo}, "%")</if>
             <if test="companyName != null  and companyName != ''">AND t2.name like concat("%", #{companyName}, "%")</if>
+            <if test="oldName != null  and oldName != ''">AND t2.old_name like concat("%", #{oldName}, "%")</if>
             <if test="archiveTypeId != null">and archive_type_id = #{archiveTypeId}</if>
             <if test="companyId != null  and companyId != ''">AND t1.company_id = #{companyId}</if>
             <if test="archiveCode != null  and archiveCode != ''">AND t1.archive_code = #{archiveCode}</if>