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>