Selaa lähdekoodia

controller方法位置迁移

syh 4 vuotta sitten
vanhempi
commit
4018b3d33a

+ 20 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/xml/AiKuaishouStrategyListPageMapper.xml

@@ -33,11 +33,15 @@
             ctop_kuaishou_strategy t1
                 LEFT JOIN ctop_ai_kuaishou_strategy_map_creative t2 on t1.id=t2.strategy_id
                 left join ctop_kuaishou_report_daily_campaign t3 on t2.campaign_id=t3.campaign_id
-        where t1.account_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
+        where
+        1=1
+        <if test="accountIds!=null">
+            and t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="strategyName != null">
             AND t1.strategy_name like '%${strategyName}%'
         </if>
@@ -47,12 +51,13 @@
         <if test="id != null">
             AND t1.id=#{id}
         </if>
+        group by t1.id
         order by t1.create_time desc
     </select>
 
     <select id="queryCampaignByStrategyId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.campaign_id as campaignId,
+        t2.campaign_id as campaignId,
         t1.campaign_name as campaignName,
         t1.status,
         t3.id as strategyId,
@@ -75,8 +80,8 @@
         IFNULL(sum(t1.event_next_day_stay),0) as nextDayOpen,
         CASE WHEN sum(t1.event_next_day_stay) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2),'%') end as nextDayOpenRate
         FROM
-        ctop_kuaishou_report_daily_campaign t1
-        LEFT JOIN ctop_ai_kuaishou_strategy_map_creative t2 on t1.campaign_id=t2.campaign_id
+        ctop_ai_kuaishou_strategy_map_creative t2
+        LEFT JOIN ctop_kuaishou_report_daily_campaign t1 on t1.campaign_id=t2.campaign_id
         left join ctop_kuaishou_strategy t3 on t2.strategy_id=t3.id
         where t3.id= #{strategyId}
         <if test="campaignName != null">
@@ -94,9 +99,9 @@
 
     <select id="queryUnitByCampaignId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.campaign_id as campaignId,
+        t2.campaign_id as campaignId,
         t1.campaign_name as campaignName,
-        t1.unit_id as unitId,
+        t2.unit_id as unitId,
         t1.unit_name as unitName,
         t1.status,
         t3.id as strategyId,
@@ -119,10 +124,10 @@
         IFNULL(sum(t1.event_next_day_stay),0) as nextDayOpen,
         CASE WHEN sum(t1.event_next_day_stay) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2),'%') end as nextDayOpenRate
         FROM
-        ctop_kuaishou_report_daily_group t1
-        LEFT JOIN ctop_ai_kuaishou_strategy_map_creative t2 on t1.unit_id=t2.unit_id
+        ctop_ai_kuaishou_strategy_map_creative t2
+        LEFT JOIN ctop_kuaishou_report_daily_group t1 on t1.unit_id=t2.unit_id
         left join ctop_kuaishou_strategy t3 on t2.strategy_id=t3.id
-        where t1.campaign_id= #{campaignId}
+        where t2.campaign_id= #{campaignId}
         <if test="unitName != null">
             and t1.unit_name like '%${unitName}}%'
         </if>
@@ -132,7 +137,7 @@
         <if test="status != null">
             AND t1.status=#{status}
         </if>
-        GROUP BY t1.unit_id
+        GROUP BY t2.unit_id
         order by t1.create_time desc
     </select>
-</mapper>
+</mapper>

+ 7 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/impl/AiKuaiShouStrategyListPageServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ads.service.impl;
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -10,6 +11,7 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ads.mapper.AiKuaiShouStrategyListPageMapper;
 import org.jeecg.modules.ads.service.IAiKuaiShouStrategyListPageService;
+import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,15 +26,14 @@ public class AiKuaiShouStrategyListPageServiceImpl implements IAiKuaiShouStrateg
 
     @Autowired
     IUserAllocationService userAllocationService;
+    @Autowired
+    private ISysRoleService sysRoleService;
 
     @Override
     public PageInfo<JSONObject> pageStrategy(JSONObject params) {
         JSONArray accountIds= params.getJSONArray("accountIds");
-        if(accountIds.isEmpty()){
-            accountIds=listToJSONArray(userAllocationService.getAccountIdsByUserId(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId()));
-        }
-        if(accountIds.isEmpty()){
-            return null;
+        if(null == accountIds||accountIds.isEmpty()){
+            accountIds = null;
         }
         String strategyName=params.getString("strategyName");
         Integer strategyState=params.getInteger("strategyState");
@@ -74,7 +75,7 @@ public class AiKuaiShouStrategyListPageServiceImpl implements IAiKuaiShouStrateg
         int pageNo=params.getInteger("pageNo");
         int pageSize=params.getInteger("pageSize");
         PageHelper.startPage(pageNo, pageSize);
-        List<JSONObject> list=aiKuaiShouStrategyListPageMapper.queryCampaignByStrategyId(campaignId,unitName,unitId,status);
+        List<JSONObject> list=aiKuaiShouStrategyListPageMapper.queryUnitByCampaignId(campaignId,unitName,unitId,status);
         return new PageInfo<>(list);
     }