4 Achegas 5937dd58eb ... b0c2e62466

Autor SHA1 Mensaxe Data
  maqingyang b0c2e62466 fixed bugs in model hai 1 ano
  maqingyang 6484c153de fixed page split in model hai 1 ano
  maqingyang bdf907f6e9 update modelcontroller hai 1 ano
  maqingyang 56659f0342 modified model hai 1 ano

+ 3 - 2
src/main/java/com/kexun/controller/CooperatorController.java

@@ -43,6 +43,8 @@ public class CooperatorController {
         JSONObject req = JSON.parseObject(json);
         int pageNum = req.getIntValue("pageNum");
         int pageSize = req.getIntValue("pageSize");
+        System.out.println(pageNum);
+        System.out.println(pageSize);
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         JSONObject resJson=new JSONObject();
         List<CooperatorInfo> list= CooperatorService.selectPage();
@@ -53,9 +55,8 @@ public class CooperatorController {
             list.get(i).setCreateTime(time);
         }
         PageInfo pageInfo=new PageInfo(list);
-
         resJson.put("cooperator_List",pageInfo);
-//        System.out.println(list);
+        System.out.println(resJson);
 
         return Result.success("ok",resJson);
     }

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

@@ -8,6 +8,7 @@ import com.kexun.common.utils.Result;
 import com.kexun.entity.CooperatorField;
 import com.kexun.entity.CooperatorInfo;
 import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.ModelEntity;
 import com.kexun.service.CooperatorProductService;
 import lombok.extern.java.Log;
 import org.apache.commons.lang.StringUtils;
@@ -39,9 +40,24 @@ public class CooperatorProductController {
         List<CooperatorProduct> list=CooperatorProductService.selectPage();
         PageInfo pageInfo=new PageInfo(list);
         resJson.put("cooperator_Product_List",pageInfo);
-        System.out.println(pageInfo);
+        return Result.success("ok",resJson);
+    }
 
+    @RequestMapping("getCooperatorByModel")
+    public Result getCooperatorByModel(@RequestBody String json) {
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
+        Long modelNo = req.getLongValue("modelNo");
+        System.out.println(modelNo);
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
+        JSONObject resJson=new JSONObject();
+        List<CooperatorProduct> list=CooperatorProductService.getCooperatorByModel(modelNo);
+        PageInfo pageInfo=new PageInfo(list);
+        resJson.put("cooperator_Product_List",pageInfo);
         return Result.success("ok",resJson);
+
+
     }
 
     // 获取合作产品字段

+ 31 - 9
src/main/java/com/kexun/controller/ModelController.java

@@ -3,6 +3,8 @@ 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.github.pagehelper.PageInfo;
 import com.kexun.common.JsonFile;
 import com.kexun.common.utils.Result;
 import com.kexun.entity.*;
@@ -11,7 +13,9 @@ import com.kexun.service.*;
 import org.apache.commons.io.FileUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
 import java.io.*;
 import java.util.*;
 
@@ -48,7 +52,6 @@ public class ModelController {
 
 
     private JsonFile jsonFile = new JsonFile();
-
     @GetMapping("getModelNo")
     public Result getModelNo(){
         JSONObject resJson = new JSONObject();
@@ -451,12 +454,27 @@ public class ModelController {
     }
 
     //列举usermodel
-    @GetMapping("getUserModel")
-    public Result getUserModel(SysUser sysUser) {
+    @RequestMapping("getUserModel")
+    public Result getUserModel(@RequestBody String json) {
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
+//        System.out.println(pageNum);
+//        System.out.println(pageSize);
+        PageHelper.startPage(pageNum, pageSize);//设置分页信息
         JSONObject resJson = new JSONObject();
-        List<ModelEntity> model_list = userModelService.findAll();
-//        List<ModelEntity> model_Entity_list = userModelService.findByUserName(sysUser.getUserName());
-        resJson.put("modelData", model_list);
+
+        //List<ModelEntity> model_Entity_list = userModelService.findByUserName(sysUser.getUserName());
+        //写死
+//        List<ModelEntity> model_Entity_list = userModelService.findByUserName("1");
+//        System.out.println(model_Entity_list);
+        List<ModelEntity> model_Entity_list = userModelService.getUserModel();
+//        System.out.println(model_Entity_list.get(0).getCreateTime());
+
+        PageInfo pageInfo=new PageInfo(model_Entity_list);
+//        System.out.println(pageInfo);
+        resJson.put("modelData",pageInfo);
+
         return Result.success("ok", resJson);
     }
 
@@ -481,8 +499,8 @@ public class ModelController {
     }
 
 
-    @PostMapping("changeModelByID")
-    public Result changeModelByID(@RequestBody String json, SysUser sysUser) throws IOException {
+        @PostMapping("changeModelByID")
+        public Result changeModelByID(@RequestBody String json, SysUser sysUser) throws IOException {
         //获取参数
         JSONObject resJson = new JSONObject();
         JSONObject req = JSON.parseObject(json);
@@ -582,8 +600,12 @@ public class ModelController {
         String state = req.getString("modelstate");
 
         System.out.println(id);
+        System.out.println(state);
         ModelEntity modelEntity = userModelService.findByID(id);
 
+        System.out.println(modelEntity);
+
+
         modelEntity.setStatus(state);
 
         userModelService.updateById(modelEntity);

+ 4 - 0
src/main/java/com/kexun/entity/ModelEntity.java

@@ -50,4 +50,8 @@ public class ModelEntity extends BaseEntity implements Serializable {
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 
+    public Date getCreateTime(){
+        return super.getCreateTime();
+    }
+
 }

+ 2 - 0
src/main/java/com/kexun/mapper/CooperatorProductMapper.java

@@ -21,4 +21,6 @@ public interface CooperatorProductMapper extends BaseMapper<CooperatorProduct> {
     List<CooperatorField> findCooperatorFieldsQuery(@Param("cooperatorName") String cooperatorName);
 
     List<CooperatorProduct> selectProduct();
+
+    List<CooperatorProduct> getCooperatorByModelQuery(@Param("modelNo") Long modelNo);
 }

+ 4 - 1
src/main/java/com/kexun/mapper/UserModelMapper.java

@@ -3,9 +3,12 @@ package com.kexun.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.kexun.entity.ModelEntity;
 import org.springframework.data.repository.query.Param;
-
+import java.util.List;
 public interface UserModelMapper extends BaseMapper<ModelEntity> {
     void changeModelNameQuery(@Param("modelName") String modelName, @Param("modelNo") long modelNo);
 
+    List<ModelEntity> getUserModelQuery();
+
     String getModelNo();
+
 }

+ 2 - 0
src/main/java/com/kexun/service/CooperatorProductService.java

@@ -19,4 +19,6 @@ public interface CooperatorProductService extends IService<CooperatorProduct> {
     List<CooperatorField> findCooperatorFieldsByName(String cooperatorName);
 
     List<CooperatorProduct> selectPage();
+
+    List<CooperatorProduct> getCooperatorByModel(Long modelNo);
 }

+ 3 - 1
src/main/java/com/kexun/service/UserModelService.java

@@ -7,7 +7,6 @@ import java.util.List;
 
 public interface UserModelService extends IService<ModelEntity> {
 
-    List<ModelEntity> findAll();
     List<ModelEntity> findByUserName(String user_name);
     ModelEntity findByModelName(String model_name);
     ModelEntity findByUserAndModel(String user_name, String model_name);
@@ -16,5 +15,8 @@ public interface UserModelService extends IService<ModelEntity> {
 
     void changeModelName(String modelName,long modelNo);
 
+    List<ModelEntity> getUserModel();
+
     String getModelNo();
+
 }

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

@@ -55,4 +55,8 @@ public class CooperatorProductServiceImpl extends ServiceImpl<CooperatorProductM
         List<CooperatorProduct> l = cooperatorProductMapper.selectProduct();
         return l;
     }
+    @Override
+    public List<CooperatorProduct> getCooperatorByModel(Long modelNo){
+        return cooperatorProductMapper.getCooperatorByModelQuery(modelNo);
+    }
 }

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

@@ -41,7 +41,6 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
     }
 
     public List<CooperatorInfo> selectPage() {
-//        System.out.println("aaa");
         List<CooperatorInfo> l = cooperatorMapper.selectAll();
         return l;
     }

+ 4 - 6
src/main/java/com/kexun/service/impl/UserModelServiceImpl.java

@@ -31,12 +31,6 @@ public class UserModelServiceImpl extends ServiceImpl<UserModelMapper, ModelEnti
 //            return null; // or handle the case when no data is found
 //        }
 //    }
-    @Override
-    public List<ModelEntity> findAll(){
-        List<ModelEntity> model_list=list();
-        return model_list;
-    }
-
     @Override
     public List<ModelEntity> findByUserName(String user_name) {
 
@@ -78,6 +72,10 @@ public class UserModelServiceImpl extends ServiceImpl<UserModelMapper, ModelEnti
     public void changeModelName(String modelName,long modelNo){
         userModelMapper.changeModelNameQuery(modelName,modelNo);
     }
+    @Override
+    public List<ModelEntity> getUserModel(){
+        return userModelMapper.getUserModelQuery();
+    }
 
     @Override
     public String getModelNo(){

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

@@ -76,5 +76,10 @@
         WHERE cooperator_info.cooperator_name = #{cooperatorName}
     </select>
 
+    <select id="getCooperatorByModelQuery" resultType="com.kexun.entity.CooperatorProduct">
+       SELECT * FROM prd_product
+        WHERE model_id=#{modelNo}
+    </select>
+
 
 </mapper>

+ 7 - 0
src/main/resources/mapper/UserModelMapper.xml

@@ -31,6 +31,13 @@
         WHERE model.model_no=#{modelNo}
     </select>
 
+
+    <select id="getUserModelQuery" resultType="com.kexun.entity.ModelEntity">
+        SELECT * FROM model
+        WHERE is_deleted = 0
+        ORDER BY create_time DESC
+    </select>
+
     <resultMap id="modelNoMap" type="java.lang.String">
         <id property="modelNo" column="model_no"/>
     </resultMap>