Просмотр исходного кода

收支明细列表接口优化

mac 2 лет назад
Родитель
Сommit
3e54ccadfe

+ 1 - 2
kxs-user/kxs-user-api/src/main/java/com/kxs/user/api/dto/kxsapp/userAccount/UserAmountVariationListDTO.java

@@ -20,7 +20,7 @@ public class UserAmountVariationListDTO {
     /**
     /**
      * 日志类型 add新增 sub减少
      * 日志类型 add新增 sub减少
      */
      */
-    @Schema(description = "日志类型 1新增 2减少")
+    @Schema(description = "日志类型 add新增 sub减少")
     private String kind;
     private String kind;
 
 
     /**
     /**
@@ -30,7 +30,6 @@ public class UserAmountVariationListDTO {
     private List<Integer> changeType;
     private List<Integer> changeType;
 
 
 
 
-
     /**
     /**
      * 月份 2023-08
      * 月份 2023-08
      */
      */

+ 6 - 0
kxs-user/kxs-user-api/src/main/java/com/kxs/user/api/vo/kxsapp/userAccount/UserAmountVariationListVO.java

@@ -61,6 +61,12 @@ public class UserAmountVariationListVO implements Serializable {
     @Schema(description = "原因")
     @Schema(description = "原因")
     private String variationCause;
     private String variationCause;
 
 
+    /**
+     * 来源创客
+     */
+    @Schema(description = "来源创客")
+    private String sourceUser;
+
 
 
     /**
     /**
      * 备注
      * 备注

+ 1 - 11
kxs-user/kxs-user-biz/src/main/java/com/kxs/user/biz/service/impl/KxsUserAmountLogServiceImpl.java

@@ -50,12 +50,7 @@ import java.util.Map;
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 public class KxsUserAmountLogServiceImpl extends ServiceImpl<KxsUserAmountLogMapper, KxsUserAmountLog> implements KxsUserAmountLogService {
 public class KxsUserAmountLogServiceImpl extends ServiceImpl<KxsUserAmountLogMapper, KxsUserAmountLog> implements KxsUserAmountLogService {
 
 
-    private final KxsChangeTypeKindMapper kxsChangeTypeKindMapper;
-
-    private final KxsLeaderAmountLogMapper kxsLeaderAmountLogMapper;
-
     private final KxsUserMapper userMapper;
     private final KxsUserMapper userMapper;
-    private final RemoteKxsProductService remoteKxsProductService;
 
 
     @Override
     @Override
     public IPage<UserAmountVariationListVO> getByPage(Page<UserAmountVariationListVO> page, UserAmountVariationListDTO param) {
     public IPage<UserAmountVariationListVO> getByPage(Page<UserAmountVariationListVO> page, UserAmountVariationListDTO param) {
@@ -64,12 +59,7 @@ public class KxsUserAmountLogServiceImpl extends ServiceImpl<KxsUserAmountLogMap
         //拼接表名
         //拼接表名
         String tableName = CommonConstants.KXS_USER_AMOUNT_LOG_PREFIX + param.getTradeMonth();
         String tableName = CommonConstants.KXS_USER_AMOUNT_LOG_PREFIX + param.getTradeMonth();
 
 
-        IPage<UserAmountVariationListVO> byPage = baseMapper.getByPage(page, param, tableName);
-        for (UserAmountVariationListVO record : byPage.getRecords()) {
-            KxsChangeTypeKind kxsChangeTypeKind = kxsChangeTypeKindMapper.selectById(record.getVariationType());
-            record.setVariationTypeName(kxsChangeTypeKind.getName());
-        }
-        return byPage;
+        return baseMapper.getByPage(page, param, tableName);
     }
     }
 
 
     @Override
     @Override

+ 10 - 18
kxs-user/kxs-user-biz/src/main/resources/mapper/KxsUserAmountLogMapper.xml

@@ -26,35 +26,27 @@
         CREATE  TABLE IF NOT EXISTS `${tableName}` LIKE kxs_user_amount_log;
         CREATE  TABLE IF NOT EXISTS `${tableName}` LIKE kxs_user_amount_log;
     </update>
     </update>
     <select id="getByPage" resultType="com.kxs.user.api.vo.kxsapp.userAccount.UserAmountVariationListVO">
     <select id="getByPage" resultType="com.kxs.user.api.vo.kxsapp.userAccount.UserAmountVariationListVO">
-        SELECT * FROM ${tableName}
+        SELECT *, c.name as variation_type_name,u.user_code as source_user
+        FROM  ${tableName} a
+        left join kxs_change_type_kind c on c.id = a.variation_type
+        left join kxs_user u on u.id = a.variation_cause
         <where>
         <where>
-            AND del_flag = 0
-            AND user_id = #{query.userId}
+            AND a.del_flag = 0
+            AND a.user_id = #{query.userId}
             <if test="query.kind != null and query.kind != ''">
             <if test="query.kind != null and query.kind != ''">
-                AND kind = #{query.kind}
+                AND a.kind = #{query.kind}
             </if>
             </if>
             <if test="query.brandIds != null">
             <if test="query.brandIds != null">
-                AND ${tableName}.brand_id IN
+                AND a.brand_id IN
                 <foreach item="brandId" index="index" collection="query.brandIds" open="(" separator="," close=")">
                 <foreach item="brandId" index="index" collection="query.brandIds" open="(" separator="," close=")">
                     #{brandId}
                     #{brandId}
                 </foreach>
                 </foreach>
             </if>
             </if>
-            <if test="query.changeType != null">
-                AND variation_type IN (
-                     SELECT
-                        kctk.id
-                    FROM
-                        kxs_change_type_kind kctk
-                        LEFT JOIN
-                            kxs_change_type kct
-                        ON
-                        kctk.change_type_id = kct.id
-                    WHERE
-                 kct.id In
+            <if test="query.changeType != null and query.changeType.size() > 0">
+                AND a.variation_type IN
                 <foreach item="ct" index="index" collection="query.changeType" open="(" separator="," close=")">
                 <foreach item="ct" index="index" collection="query.changeType" open="(" separator="," close=")">
                     #{ct}
                     #{ct}
                 </foreach>
                 </foreach>
-                 )
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>