瀏覽代碼

fixed bug 34

maqingyang 1 年之前
父節點
當前提交
a3f7765af8
共有 1 個文件被更改,包括 16 次插入2 次删除
  1. 16 2
      src/main/resources/mapper/CooperatorMapper.xml

+ 16 - 2
src/main/resources/mapper/CooperatorMapper.xml

@@ -46,8 +46,22 @@
     </select>
 
     <select id="selectAll" resultType="com.kexun.entity.CooperatorInfo">
-        select * from cooperator_info
-        order by create_time desc
+
+        SELECT *
+        FROM (
+            SELECT *
+            FROM (
+                SELECT *,row_number()
+                OVER (PARTITION BY cooperator_name ORDER BY cooperator_name DESC)num
+                FROM 	cooperator_info)A
+            WHERE A.num=1 AND is_deleted=0) AS coo
+        LEFT JOIN (
+            SELECT template_no
+            FROM field_template
+            WHERE is_deleted=0
+        ) tno
+        ON coo.template_no=tno.template_no
+        ORDER BY coo.create_time DESC
 
 
     </select>