shixr 1 рік тому
батько
коміт
ce2139f5ef

+ 33 - 5
src/main/java/com/kexun/controller/CooperatorController.java

@@ -6,8 +6,9 @@ package com.kexun.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.kexun.common.utils.Result;
+import com.kexun.entity.CooperatorField;
 import com.kexun.entity.CooperatorInfo;
-import com.kexun.service.CooperatorInfoService;
+import com.kexun.service.CooperatorService;
 import lombok.extern.java.Log;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,32 +25,59 @@ import java.util.List;
  */
 
 @RestController
-@RequestMapping("/admin/partner")
+@RequestMapping("/admin/cooperator")
 @Log
 public class CooperatorController {
 
     @Autowired
-    private CooperatorInfoService CooperatorInfoService;
+    private CooperatorService CooperatorService;
 
     // 获取合作方信息
     @GetMapping("cooperatorList")
     public Result cooperatorList() {
         JSONObject resJson=new JSONObject();
-        List<CooperatorInfo> list=CooperatorInfoService.list();
+        List<CooperatorInfo> list= CooperatorService.list();
         resJson.put("cooperator_List",list);
+//        System.out.println(list);
 
         return Result.success("ok",resJson);
+    }
+
+//    @GetMapping("findCooperatorListByName")
+//    public Result findCooperatorListByName(String partnerName) {
+//
+//        JSONObject result = new JSONObject();
+//        CooperatorInfo cooperatorInfo = CooperatorService.findByCooperatorNum(partnerName);
+//
+//        result.put("cooperatorName", cooperatorInfo.getCooperatorName());
+//        result.put("fieldCount", cooperatorInfo.getFieldCount());
+//        result.put("cooperatorNum", cooperatorInfo.getCooperatorNum());
+//        result.put("modelCount", cooperatorInfo.getModelCount());
+//        result.put("createTime", cooperatorInfo.getCreateTime());
+//        return Result.success("ok", result);
+//    }
+
+    @GetMapping("findCooperatorFieldByNum")
+    public Result findCooperatorFieldByNum(String cooperatorNum) {
 
+        JSONObject result = new JSONObject();
+        List<CooperatorField> list = CooperatorService.findCooperatorFieldByNum();
+//        System.out.println(list);
+        result.put("cooperator_field",list);
+
+        return Result.success("ok", result);
     }
 
+
     @GetMapping("list")
     public Result list(String partnerName) {
+
         QueryWrapper<CooperatorInfo> w = new QueryWrapper<>();
         if (!StringUtils.isEmpty(partnerName)) {
             w.like("partner_name", partnerName);
         }
 
-        List<CooperatorInfo> list = CooperatorInfoService.list(w);
+        List<CooperatorInfo> list = CooperatorService.list(w);
         return Result.success("ok", list);
     }
 

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

@@ -0,0 +1,28 @@
+package com.kexun.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+@TableName(value = "field_define")
+@Data
+public class CooperatorField implements Serializable {
+
+    @TableField(value = "field_no")
+    private String fieldNo;
+
+    @TableField(value = "name")
+    private String name;
+
+    @TableField(value = "name_zh")
+    private String nameZH;
+
+    @TableField(value = "type")
+    private String type;
+
+    private String createTime;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 1 - 1
src/main/java/com/kexun/entity/ParseAuto.java

@@ -12,7 +12,7 @@ import java.io.Serializable;
 /**
  * @TableName parse_auto
  */
-@TableName(value = "parse_auto")
+
 @Data
 public class ParseAuto implements Serializable {
     //作为注解id,数据库中相关表的id为主键lic

+ 0 - 16
src/main/java/com/kexun/mapper/CooperatorInfoMapper.java

@@ -1,16 +0,0 @@
-package com.kexun.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kexun.entity.CooperatorInfo;
-
-/**
- * @Entity com.kexun.entity.PartnerInfo
- */
-public interface CooperatorInfoMapper extends BaseMapper<CooperatorInfo> {
-
-
-}
-
-
-
-

+ 22 - 0
src/main/java/com/kexun/mapper/CooperatorMapper.java

@@ -0,0 +1,22 @@
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.CooperatorField;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface CooperatorMapper extends BaseMapper<CooperatorInfo> {
+
+    // List<CooperatorField> Query(@Param("cooperatorNum") String cooperatorNum);
+    List<CooperatorField> Query();
+
+}
+
+
+
+

+ 0 - 11
src/main/java/com/kexun/service/CooperatorInfoService.java

@@ -1,11 +0,0 @@
-package com.kexun.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import com.kexun.entity.CooperatorInfo;
-
-/**
- *
- */
-public interface CooperatorInfoService extends IService<CooperatorInfo> {
-}

+ 18 - 0
src/main/java/com/kexun/service/CooperatorService.java

@@ -0,0 +1,18 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.UserField;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface CooperatorService extends IService<CooperatorInfo> {
+    CooperatorInfo findByCooperatorNum(String partnerName);
+//    List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum);
+    List<CooperatorField> findCooperatorFieldByNum();
+}

+ 0 - 20
src/main/java/com/kexun/service/impl/CooperatorInfoServiceImpl.java

@@ -1,20 +0,0 @@
-package com.kexun.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kexun.entity.CooperatorInfo;
-import com.kexun.mapper.CooperatorInfoMapper;
-import com.kexun.service.CooperatorInfoService;
-import org.springframework.stereotype.Service;
-
-/**
- *
- */
-@Service
-public class CooperatorInfoServiceImpl extends ServiceImpl<CooperatorInfoMapper, CooperatorInfo>
-    implements CooperatorInfoService {
-
-}
-
-
-
-

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

@@ -0,0 +1,42 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.mapper.CooperatorMapper;
+import com.kexun.service.CooperatorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ *
+ */
+@Service
+public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, CooperatorInfo>
+    implements CooperatorService {
+    @Override
+    public CooperatorInfo findByCooperatorNum(String partnerName) {
+        QueryWrapper wrapper=new QueryWrapper();
+        wrapper.eq("cooperator_name",partnerName);
+        return getOne(wrapper);
+    }
+
+    @Resource
+    CooperatorMapper cooperatorMapper;
+
+    @Override
+    public List findCooperatorFieldByNum() {
+//        System.out.println("aaa");
+        List<CooperatorField> l = cooperatorMapper.Query();
+        return l;
+    }
+
+}
+
+
+
+

+ 19 - 1
src/main/resources/mapper/PartnerInfoMapper.xml → src/main/resources/mapper/CooperatorMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.kexun.mapper.CooperatorInfoMapper">
+<mapper namespace="com.kexun.mapper.CooperatorMapper">
 
     <resultMap id="BaseResultMap" type="com.kexun.entity.CooperatorInfo">
             <result property="partnerName" column="partner_name" jdbcType="VARCHAR"/>
@@ -26,4 +26,22 @@
         rate_3,query_number3,
         create_time,is_enable
     </sql>
+
+    <select id="Query" 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
+
+        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
+        WHERE
+            cooperator_info.cooperator_num = "HBJK20230509";
+
+
+    </select>
 </mapper>