Guo1B0 10 месяцев назад
Родитель
Сommit
8cc1eb80d2

+ 2 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Custom.java

@@ -254,7 +254,8 @@ public class Custom extends Model<Custom> {
     private List<ActionLog> actionLogs;
     @TableField(exist = false)
     private List<Contacts> contactsList;
-
+    @TableField(exist = false)
+    private Integer isDesc;
 
     @Override
     protected Serializable pkVal() {

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -127,7 +127,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
                 return msg;
             }
             if (customMapper.selectCount(new QueryWrapper<Custom>().eq("tel_phone", custom.getTelPhone())) > 0) {
-//                msg.setError("电话号码重复了");
+                msg.setError("电话号码重复了");
                 return msg;
             }
 

+ 88 - 51
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml

@@ -43,48 +43,66 @@
         id, company_id, custom_name, custom_source_id, customer_industry_id, customer_level_id, email, owner_id, custom_code, tel_phone, fax, country_billing, province_billing, city_billing, street_billing, country_delivery, province_delivery, city_delivery, street_delivery, create_time, plate1, plate2, plate3, plate4, plate5, creator_id, custom_desc, is_delete, company_phone, incharger_id, address, close_deal
     </sql>
     <select id="getList" resultType="com.management.platform.entity.Custom">
-        select id,
-        custom_name,
-        email,
-        company_phone,
-        create_time,
-        customer_level_id,
+        select
+        c.id,
+        c.contacts_name,
+        c.custom_name,
+        c.email,
+        c.company_phone,
+        c.create_time,
+        c.customer_level_id,
         (select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
-        customer_industry_id,
+        c.customer_industry_id,
         (select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
-        custom_source_id,
-        (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
-        incharger_id,
+        c.custom_source_id,
+        (select name from sys_dict where custom_source_id = id) customSourceValue,
+        c.incharger_id,
         (select `name` from `user` where id = incharger_id) inchargerName,
-        creator_id,
+        c.creator_id,
         (select `name` from `user` where id = creator_id) creatorName
-        from custom
-        where company_id = #{companyId}
-          and is_delete =#{isDelete}
+        from custom c
+        left join sys_dict sd on c.customer_level_id = sd.id
+        where c.company_id = #{companyId}
+          and c.is_delete =#{isDelete}
         <if test="inchargerId != null and inchargerId != ''  ">
-            and incharger_id =#{inchargerId}
+            and c.incharger_id =#{inchargerId}
         </if>
         <if test="startTime != null and endTime != null ">
-            and create_time BETWEEN #{startTime} and #{endTime}
+            and c.create_time BETWEEN #{startTime} and #{endTime}
         </if>
         <if test="customName != null and customName != '' ">
-            and custom_name = #{customName}
+            and c.custom_name = #{customName}
         </if>
         <if test="email != null and email != '' ">
-            and email = #{email}
+            and c.email = #{email}
         </if>
         <if test="companyPhone != null ">
-            and company_phone = #{companyPhone}
+            and c.company_phone = #{companyPhone}
         </if>
         <if test="customerLevelId != null ">
-            and customer_level_id = #{customerLevelId}
+            and c.customer_level_id = #{customerLevelId}
         </if>
         <if test="customSourceId != null ">
-            and custom_source_id = #{customSourceId}
+            and c.custom_source_id = #{customSourceId}
         </if>
           <if test="customerIndustryId != null ">
-            and customer_industry_id = #{customerIndustryId}
-        </if>
+            and c.customer_industry_id = #{customerIndustryId}
+        </if>
+        ORDER BY
+        <choose>
+            <when test="isDesc == null ">
+                c.id DESC
+            </when>
+            <when test="isDesc == 0">
+                sd.seq ASC, c.id DESC
+            </when>
+            <when test="isDesc == 1">
+                sd.seq DESC, c.id DESC
+            </when>
+            <otherwise>
+                c.id DESC
+            </otherwise>
+        </choose>
         Limit #{pageIndex},#{pageFrom}
     </select>
     <select id="getTotal" resultType="java.lang.Integer">
@@ -118,51 +136,67 @@
         </if>
     </select>
     <select id="getList1" resultType="com.management.platform.entity.Custom">
-        select id,
-        custom_name,
-        email,
-        company_phone,
-        create_time,
-        customer_level_id,
+        select c.id,
+        c.custom_name,
+        c.email,
+        c.company_phone,
+        c.create_time,
+        c.customer_level_id,
         (select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
-        customer_industry_id,
+        c.customer_industry_id,
         (select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
-        custom_source_id,
-        (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
-        incharger_id,
+        c.custom_source_id,
+        (select name from sys_dict where custom_source_id = id ) customSourceValue,
+        c.incharger_id,
         (select `name` from `user` where id = incharger_id) inchargerName,
-        creator_id,
+        c.creator_id,
         (select `name` from `user` where id = creator_id) creatorName
-        from custom
-        where company_id = #{companyId}
-        and is_delete =#{isDelete}
-        and incharger_id in
-        (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
-        or incharger_id is null
+        from custom c
+        left join sys_dict sd on c.customer_level_id = sd.id
+        where c.company_id = #{companyId}
+        and c.is_delete =#{isDelete}
+        and c.incharger_id in
+        (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERE id = #{userId}))
+        or c.incharger_id is null
         <if test="inchargerId != null and inchargerId != ''  ">
-            and incharger_id =#{inchargerId}
+            and c.incharger_id =#{inchargerId}
         </if>
         <if test="startTime != null and endTime != null ">
-            and create_time BETWEEN #{startTime} and #{endTime}
+            and c.create_time BETWEEN #{startTime} and #{endTime}
         </if>
         <if test="customName != null and customName != '' ">
-            and custom_name = #{customName}
+            and c.custom_name = #{customName}
         </if>
         <if test="email != null and email != '' ">
-            and email = #{email}
+            and c.email = #{email}
         </if>
         <if test="companyPhone != null ">
-            and company_phone = #{companyPhone}
+            and c.company_phone = #{companyPhone}
         </if>
         <if test="customerLevelId != null ">
-            and customer_level_id = #{customerLevelId}
+            and c.customer_level_id = #{customerLevelId}
         </if>
         <if test="customSourceId != null ">
-            and custom_source_id = #{customSourceId}
+            and c.custom_source_id = #{customSourceId}
         </if>
         <if test="customerIndustryId != null ">
-            and customer_industry_id = #{customerIndustryId}
-        </if>
+            and c.customer_industry_id = #{customerIndustryId}
+        </if>
+        ORDER BY
+        <choose>
+            <when test="isDesc == null ">
+                c.id DESC
+            </when>
+            <when test="isDesc == 0">
+                sd.seq ASC, c.id DESC
+            </when>
+            <when test="isDesc == 1">
+                sd.seq DESC, c.id DESC
+            </when>
+            <otherwise>
+                c.id DESC
+            </otherwise>
+        </choose>
         Limit #{pageIndex},#{pageFrom}
     </select>
     <select id="getTotal1" resultType="java.lang.Integer">
@@ -209,7 +243,7 @@
         customer_industry_id,
         (select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
         custom_source_id,
-        (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
+        (select name from sys_dict where custom_source_id = id ) customSourceValue,
         incharger_id,
         (select `name` from `user` where id = incharger_id) inchargerName,
         creator_id,
@@ -243,6 +277,7 @@
         <if test="customerIndustryId != null ">
             and customer_industry_id = #{customerIndustryId}
         </if>
+        ORDER BY id desc
         Limit #{pageIndex},#{pageFrom}
     </select>
     <select id="getTotal2" resultType="java.lang.Integer">
@@ -280,10 +315,12 @@
     <select id="getInfo" resultType="com.management.platform.entity.Custom">
         select id,
                custom_name,
+               contacts_name,
                custom_source_id,
                customer_industry_id,
                customer_level_id,
                email,
+               tel_phone,
                address,
                custom_code,
                tel_phone,
@@ -299,7 +336,7 @@
                is_delete,
                (select `name` from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
                (select `name` from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
-               (select `name` from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
+               (select `name` from sys_dict where custom_source_id = id ) customSourceValue,
                (select `name` from `user` where id = incharger_id) inchargerName,
                (select `name` from `user` where id = creator_id) creatorName
         from custom