Browse Source

字段总表及字段模板分页组件

zishan-an 1 year ago
parent
commit
842c356aa8

+ 4 - 0
src/main/java/com/kexun/controller/BusinessController.java

@@ -6,6 +6,7 @@ package com.kexun.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
 import com.kexun.common.utils.Result;
 import com.kexun.entity.*;
 import com.kexun.service.BusinessService;
@@ -35,6 +36,7 @@ public class BusinessController {
     // 获取待办业务列表
     @GetMapping("businessToDoList")
     public Result businessToDoList() {
+
         JSONObject resJson=new JSONObject();
         List<BusinessInfo> list= BusinessService.queryToDoList();
         for(int i=0; i<list.size(); i++)
@@ -43,6 +45,8 @@ public class BusinessController {
             String time = list.get(i).getCreateTime().replace(".0","");
             list.get(i).setCreateTime(time);
         }
+
+
         resJson.put("business_todo_list",list);
 
         System.out.println(list);

+ 68 - 6
src/main/java/com/kexun/controller/FieldDefineController.java

@@ -3,10 +3,13 @@ package com.kexun.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.kexun.common.utils.Result;
 import com.kexun.entity.BusInfoModifyHis;
 import com.kexun.entity.CooperatorInfo;
 import com.kexun.entity.FieldDefineEntity;
+import com.kexun.entity.FieldTemplateEntity;
 import com.kexun.hander.PageBean;
 import com.kexun.model.ro.FiledRO;
 import com.kexun.model.ro.FiledUpdateRO;
@@ -19,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -39,15 +44,72 @@ public class FieldDefineController {
      *
      * @return
      */
-    @GetMapping("fieldListNew")
-    public Result fieldListNew() {
-        JSONObject resJson=new JSONObject();
-        List<FieldDefineEntity> list= fieldDefineService.list();
-        resJson.put("fieldListNew",list);
+//    @GetMapping("fieldListNew")
+//    public Result fieldListNew() {
+//        JSONObject resJson=new JSONObject();
+//        List<FieldDefineEntity> list= fieldDefineService.list();
+//        resJson.put("fieldListNew",list);
+//
+//        return Result.success("ok",resJson);
+//    }
 
-        return Result.success("ok",resJson);
+    @RequestMapping("/fieldListNew")
+    @ResponseBody
+    public Result findAll(@RequestParam int pageNum){
+        int pageSize = 10;
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+        List<FieldDefineEntity> list = fieldDefineService.selectPage();
+
+        List<FieldDefineEntity> list2 = fieldDefineService.selectPage2();
+
+        PageInfo pageInfo=new PageInfo(list);
+        PageInfo pageInfo2=new PageInfo(list2);
+
+        System.out.println(pageInfo);
+        JSONObject resJson = new JSONObject();
+
+        resJson.put("fieldListNew", pageInfo);
+
+
+        resJson.put("fieldListDerive", pageInfo2);
+
+        return Result.success("ok", resJson);
     }
 
+    @RequestMapping("/fieldListBase")
+    @ResponseBody
+    public Result fieldListBase(@RequestParam int pageNum){
+        int pageSize = 10;
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+        List<FieldDefineEntity> list = fieldDefineService.selectPage();
+
+        PageInfo pageInfo=new PageInfo(list);
+
+        System.out.println(pageInfo);
+        JSONObject resJson = new JSONObject();
+        resJson.put("fieldListBase", pageInfo);
+
+
+        return Result.success("ok", resJson);
+    }
+
+    @RequestMapping("/fieldListDerive")
+    @ResponseBody
+    public Result fieldListDerive(@RequestParam int pageNum){
+        int pageSize = 10;
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+
+        List<FieldDefineEntity> list2 = fieldDefineService.selectPage2();
+
+        PageInfo pageInfo2=new PageInfo(list2);
+
+        System.out.println(pageInfo2);
+        JSONObject resJson = new JSONObject();
+
+        resJson.put("fieldListDerive", pageInfo2);
+
+        return Result.success("ok", resJson);
+    }
     /**
      * 字段列表查询
      *

+ 17 - 1
src/main/java/com/kexun/controller/FieldTemplateController.java

@@ -3,9 +3,10 @@ package com.kexun.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.kexun.common.utils.Result;
 import com.kexun.entity.*;
-import com.kexun.model.ro.FiledTemplateCreateRO;
 import com.kexun.model.ro.FiledTemplateRO;
 import com.kexun.model.ro.FiledTemplateUpdateRO;
 import com.kexun.model.vo.FiledTemplateVO;
@@ -54,6 +55,21 @@ public class FieldTemplateController {
         return result;
     }
 
+    @RequestMapping("/findAll")
+    @ResponseBody
+    public Result findAll(@RequestParam int pageNum){
+        int pageSize = 10;
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+        List<FieldTemplateEntity> list = fieldTemplateService.selectPage();
+        PageInfo pageInfo=new PageInfo(list);
+        System.out.println(pageInfo);
+        JSONObject resJson = new JSONObject();
+
+        resJson.put("field_template_list", pageInfo);
+
+        return Result.success("ok", resJson);
+    }
+
     /**
      * 字段模板详情
      *

+ 5 - 0
src/main/java/com/kexun/mapper/FieldDefineMapper.java

@@ -4,6 +4,8 @@ import com.kexun.entity.FieldDefineEntity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  * 字段定义表 Mapper 接口
@@ -23,4 +25,7 @@ public interface FieldDefineMapper extends BaseMapper<FieldDefineEntity> {
      */
     void updateStatus(@Param("id") Long id, @Param("status") String status);
 
+    List<FieldDefineEntity> selectAll(String cat);
+
+
 }

+ 3 - 0
src/main/java/com/kexun/mapper/FieldTemplateMapper.java

@@ -19,6 +19,9 @@ public interface FieldTemplateMapper extends BaseMapper<FieldTemplateEntity> {
      */
     void updateStatus(@Param("id") Long id, @Param("status") String status);
 
+    List<FieldTemplateEntity> selectAll();
+
+//    List<FieldTemplateEntity> selectAll();
 }
 
 

+ 4 - 0
src/main/java/com/kexun/service/FieldDefineService.java

@@ -51,4 +51,8 @@ public interface FieldDefineService extends IService<FieldDefineEntity> {
     FieldDefineEntity findByID(long id);
 
 
+    List<FieldDefineEntity> selectPage();
+
+    List<FieldDefineEntity> selectPage2();
+
 }

+ 4 - 0
src/main/java/com/kexun/service/FieldTemplateService.java

@@ -9,6 +9,8 @@ import com.kexun.model.ro.FiledTemplateRO;
 import com.kexun.model.ro.FiledTemplateUpdateRO;
 import com.kexun.model.vo.FiledTemplateVO;
 
+import java.util.List;
+
 /**
  *
  */
@@ -23,6 +25,8 @@ public interface FieldTemplateService extends IService<FieldTemplateEntity> {
      */
     IPage<FieldTemplateEntity> listPage(FiledTemplateRO filedTemplateRO);
 
+    List<FieldTemplateEntity> selectPage();
+
     /**
      * 保存模板关系表
      * @param filedTemplateCreateRO

+ 15 - 0
src/main/java/com/kexun/service/impl/FieldDefineServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.kexun.entity.BusInfoModifyHis;
 import com.kexun.entity.CooperatorInfo;
 import com.kexun.entity.FieldDefineEntity;
+import com.kexun.entity.FieldTemplateEntity;
 import com.kexun.hander.PageBean;
 import com.kexun.mapper.BusInfoModifyHisMapper;
 import com.kexun.mapper.FieldDefineMapper;
@@ -76,6 +77,20 @@ public class FieldDefineServiceImpl extends ServiceImpl<FieldDefineMapper, Field
         return list;
     }
 
+    public List<FieldDefineEntity> selectPage() {
+//        System.out.println("aaa");
+        String cat = "1";
+        List<FieldDefineEntity> l = fieldDefineMapper.selectAll(cat);
+        return l;
+    }
+
+    public List<FieldDefineEntity> selectPage2() {
+//        System.out.println("aaa");
+        String cat = "2";
+        List<FieldDefineEntity> l = fieldDefineMapper.selectAll(cat);
+        return l;
+    }
+
     /**
      * 保存或者修改字段定义
      * @param filedUpdateRO

+ 8 - 0
src/main/java/com/kexun/service/impl/FieldTemplateServiceImpl.java

@@ -41,6 +41,8 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
     @Autowired
     FieldTemplateRefService fieldTemplateRefService;
 
+
+
     /**
      * 分页查询模板字段
      * @param filedTemplateRO
@@ -62,6 +64,12 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
         return pageList;
     }
 
+    public List<FieldTemplateEntity> selectPage() {
+//        System.out.println("aaa");
+        List<FieldTemplateEntity> l = fieldTemplateMapper.selectAll();
+        return l;
+    }
+
     /**
      * 保存模板字段
      *

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

@@ -48,6 +48,14 @@
         remarks,
         field_no, name, name_zh, category, type, fetch_logic, formula_expr, formula_class, formula_method, formula_desc, three_level, three_level_zh, two_level, two_level_zh, one_level, one_level_zh, json_key, type_no, status
     </sql>
+
+    <select id="selectAll" resultType="com.kexun.entity.FieldDefineEntity">
+        select * from field_define
+        where category=#{cat}
+    </select>
+
+
+
     <update id="updateStatus">
         update field_define
         set status = #{status}

+ 5 - 0
src/main/resources/mapper/FieldTemplateMapper.xml

@@ -14,6 +14,11 @@
         id,template_no,template_name
     </sql>
 
+    <select id="selectAll" resultType="com.kexun.entity.FieldTemplateEntity">
+            select * from field_template
+    </select>
+
+
     <update id="updateStatus">
         update field_template
         set status = #{status}