shixr 1 rok pred
rodič
commit
92c9cb34d2

+ 35 - 0
src/main/java/com/kexun/controller/CooperatorProductController.java

@@ -0,0 +1,35 @@
+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.CooperatorProduct;
+import com.kexun.service.CooperatorProductService;
+import lombok.extern.java.Log;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/admin/cooperator")
+@Log
+public class CooperatorProductController {
+
+    @Autowired
+    private CooperatorProductService CooperatorProductService;
+
+    // 获取合作产品信息
+    @GetMapping("cooperatorProductList")
+    public Result cooperatorProductList() {
+        System.out.println("aaaa");
+        JSONObject resJson=new JSONObject();
+        List<CooperatorProduct> list=CooperatorProductService.productList();
+        resJson.put("cooperator_Product_List",list);
+        System.out.println(list);
+
+        return Result.success("ok",resJson);
+    }
+
+}

+ 8 - 1
src/main/java/com/kexun/entity/CooperatorProduct.java

@@ -3,6 +3,7 @@ package com.kexun.entity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.springframework.data.annotation.Transient;
 
 import java.io.Serializable;
 
@@ -19,7 +20,13 @@ public class CooperatorProduct implements Serializable {
     @TableField(value = "product_status")
     private String productStatus;
 
-    private String modelName;
+    private transient String modelName;
+
+    @TableField(value = "cooperator_name")
+    private String cooperatorName;
+
+    @TableField(value = "model_id")
+    private String modelId;
 
     @TableField(value = "create_time")
     private String createTime;

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

@@ -0,0 +1,15 @@
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+
+import java.util.List;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface CooperatorProductMapper extends BaseMapper<CooperatorProduct> {
+
+    List<CooperatorProduct> Query();
+}

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

@@ -0,0 +1,15 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface CooperatorProductService extends IService<CooperatorProduct> {
+    List<CooperatorProduct> productList();
+}

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

@@ -0,0 +1,28 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.mapper.CooperatorMapper;
+import com.kexun.mapper.CooperatorProductMapper;
+import com.kexun.service.CooperatorProductService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ *
+ */
+@Service
+public class CooperatorProductServiceImpl extends ServiceImpl<CooperatorProductMapper, CooperatorProduct>
+        implements CooperatorProductService {
+
+    @Resource
+    CooperatorProductMapper cooperatorProductMapper;
+    @Override
+    public List<CooperatorProduct> productList() {
+        List<CooperatorProduct> l = cooperatorProductMapper.Query();
+        return l;
+    }
+}

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

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kexun.mapper.CooperatorProductMapper">
+
+    <resultMap id="BaseResultMap" type="com.kexun.entity.CooperatorInfo">
+            <result property="partnerName" column="partner_name" jdbcType="VARCHAR"/>
+            <result property="contactName" column="contact_name" jdbcType="VARCHAR"/>
+            <result property="mobileNo" column="mobile_no" jdbcType="VARCHAR"/>
+            <result property="rate1" column="rate_1" jdbcType="VARCHAR"/>
+            <result property="queryNumber1" column="query_number1" jdbcType="VARCHAR"/>
+            <result property="rate2" column="rate_2" jdbcType="VARCHAR"/>
+            <result property="queryNumber2" column="query_number2" jdbcType="VARCHAR"/>
+            <result property="rate3" column="rate_3" jdbcType="VARCHAR"/>
+            <result property="queryNumber3" column="query_number3" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
+            <result property="isEnable" column="is_enable" jdbcType="VARCHAR"/>
+
+
+    </resultMap>
+
+
+    <select id="Query" resultType="com.kexun.entity.CooperatorProduct">
+    SELECT DISTINCT
+           prd_product.product_num,
+           prd_product.product_name,
+           prd_product.product_status,
+            prd_product.cooperator_name,
+           prd_product.create_time,
+           model.model_name as modelName
+       FROM
+           prd_product
+               LEFT JOIN model ON model.model_no = prd_product.model_id
+    </select>
+
+
+</mapper>