Browse Source

添加查询模板接口

zhaoxian 4 năm trước cách đây
mục cha
commit
a593007aaf

+ 11 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouTemplateController.java

@@ -55,6 +55,17 @@ public class KuaishouTemplateController {
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
 
+
+    @AutoLog(value = "快手-定向模板-分页列表查询")
+    @ApiOperation(value = "快手-定向模板-分页列表查询", notes = "快手-定向模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<JSONObject>> list(Long accountId) {
+        Result<List<JSONObject>> result = new Result<>();
+        List<JSONObject> list = kuaishouTemplateService.getJsonArrByAccountId(accountId);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
     /**
      * 分页列表查询
      *

+ 5 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouTemplateMapper.java

@@ -1,7 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 快手-定向模板
@@ -11,5 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @cersion: V1.0
  */
 public interface KuaishouTemplateMapper extends BaseMapper<KuaishouTemplate> {
-
+    List<JSONObject> getJsonArrByAccountId(@Param("accountId") Long accountId);
 }

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouTemplateMapper.xml

@@ -2,4 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouTemplateMapper">
 
+    <select id="getJsonArrByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            t1.account_id AS 'accountId',
+            t1.template_id AS 'templateId',
+            t1.template_name AS 'templateName',
+            t1.unit_count AS 'unitCount',
+            t2.platform_os AS 'platformOs'
+        FROM
+            ctop_kuaishou_template t1
+                LEFT JOIN ctop_kuaishou_template_target t2 ON t1.template_id = t2.template_id
+        WHERE
+            t1.account_id = #{accountId};
+
+    </select>
+
 </mapper>

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouTemplateService.java

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 快手-定向模板
  * @Author: jeecg-boot
@@ -17,4 +19,6 @@ public interface IKuaishouTemplateService extends IService<KuaishouTemplate> {
     JSONObject createTemplate(Long accountId, String accessToken, JSONObject requestJson);
 
     JSONObject updateTemplate(Long accountId, String accessToken, JSONObject requestJson);
+
+    List<JSONObject> getJsonArrByAccountId(Long accountId);
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -31,8 +32,14 @@ import java.util.Map;
 public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMapper, KuaishouTemplate> implements IKuaishouTemplateService {
     @Autowired
     private IKuaishouTemplateTargetService templateTargetService;
+ @Autowired
+    private KuaishouTemplateMapper templateMapper;
 
     @Override
+    public List<JSONObject> getJsonArrByAccountId(Long accountId) {
+        return templateMapper.getJsonArrByAccountId(accountId);
+    }
+    @Override
     public void getTemplateByAccountId(Long accountId, String accessToken, Integer page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.TEMPLATE_LIST;
         JSONObject param = new JSONObject();