Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/develop' into develop

zishan-an 1 gadu atpakaļ
vecāks
revīzija
55084aa643

+ 3 - 0
src/main/java/com/kexun/entity/CooperatorField.java

@@ -29,6 +29,9 @@ public class CooperatorField implements Serializable {
     @TableField(value = "create_time")
     private String createTime;
 
+    @TableField(value = "template_name")
+    private String templateName;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 }

+ 3 - 0
src/main/java/com/kexun/entity/CooperatorInfo.java

@@ -50,6 +50,9 @@ public class CooperatorInfo implements Serializable {
     @TableField(value = "update_time")
     private String updateTime;
 
+    @TableField(value = "template_name")
+    private String templateName;
+
 
 
 

+ 1 - 1
src/main/java/com/kexun/mapper/CooperatorMapper.java

@@ -13,7 +13,7 @@ import java.util.List;
  */
 public interface CooperatorMapper extends BaseMapper<CooperatorInfo> {
 
-    List<CooperatorField> Query(@Param("cooperatorNum") String cooperatorNum);
+    List<CooperatorField> QueryField(@Param("cooperatorNum") String cooperatorNum);
 
     List<CooperatorProduct> QueryProduct(@Param("cooperatorNum") String cooperatorNum);
 

+ 1 - 1
src/main/java/com/kexun/service/impl/CooperatorServiceImpl.java

@@ -29,7 +29,7 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
     @Override
     public List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum) {
 //        System.out.println("aaa");
-        List<CooperatorField> l = cooperatorMapper.Query(cooperatorNum);
+        List<CooperatorField> l = cooperatorMapper.QueryField(cooperatorNum);
         return l;
     }
 

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

@@ -27,18 +27,19 @@
         create_time,is_enable
     </sql>
 
-    <select id="Query" resultType="com.kexun.entity.CooperatorField">
+    <select id="QueryField" resultType="com.kexun.entity.CooperatorField">
         SELECT DISTINCT
             field_define.field_no,
             field_define.`name`,
             field_define.name_zh,
             field_define.type,
-            field_template_ref.create_time
-
+            field_template_ref.create_time,
+            field_template.template_name
         FROM
             field_define
                 LEFT JOIN field_template_ref ON field_template_ref.field_no = field_define.field_no
                 LEFT JOIN cooperator_info ON cooperator_info.template_no = field_template_ref.template_no
+                LEFT JOIN field_template ON field_template.template_no = field_template_ref.template_no
         WHERE
             cooperator_info.cooperator_num = #{cooperatorNum};
 
@@ -46,7 +47,18 @@
     </select>
 
     <select id="selectAll" resultType="com.kexun.entity.CooperatorInfo">
-        select * from cooperator_info
+        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) AS sub_table LEFT JOIN field_template ON field_template.template_no = sub_table.template_no
+        WHERE  sub_table.is_deleted=0
+        ORDER BY sub_table.create_time DESC
+
     </select>
 
     <select id="selectCoop" resultType="com.kexun.entity.CooperatorInfo">

+ 1 - 0
src/main/resources/mapper/FieldDefineMapper.xml

@@ -52,6 +52,7 @@
     <select id="selectAll" resultType="com.kexun.entity.FieldDefineEntity">
         select * from field_define
         where category=#{cat} and is_deleted = 0
+        order by create_time desc
 
 
     </select>

+ 3 - 2
src/main/resources/mapper/FieldTemplateMapper.xml

@@ -15,8 +15,9 @@
     </sql>
 
     <select id="selectAll" resultType="com.kexun.entity.FieldTemplateEntity">
-            select * from field_template
-                    where is_deleted = 0
+            SELECT * from field_template
+            WHERE is_deleted = 0
+            ORDER BY create_time DESC
 
     </select>