瀏覽代碼

线索通过客户级别排序

Guo1B0 11 月之前
父節點
當前提交
44d9e33626

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -166,6 +166,8 @@ public class Clue extends Model<Clue> {
     private List<UploadFile> files;
     @TableField(exist = false)
     private List<Task> taskList;
+    @TableField(exist = false)
+    private Integer isDesc;
 
 
     @Override

+ 48 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -57,6 +57,7 @@
                (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
                (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
             c.company_id = #{companyId} and is_delete = #{isDelete}
         <if test="inchargerId != null and inchargerId != ''  ">
@@ -83,7 +84,21 @@
         <if test="customerIndustryId != null">
         and  c.customer_industry_id =  #{customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="isDesc == null or isDesc == ''">
+                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="list1" resultType="com.management.platform.entity.Clue">
@@ -113,6 +128,7 @@
         (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
         (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and (c.incharger_id in
@@ -142,7 +158,21 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="isDesc == null or isDesc == ''">
+                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 #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="list2" resultType="com.management.platform.entity.Clue">
@@ -172,6 +202,7 @@
         (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
         (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and (c.incharger_id = #{userId} or c.incharger_id is null)
@@ -199,7 +230,21 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="isDesc == null or isDesc == ''">
+                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 #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="getTotal" resultType="java.lang.Integer">