瀏覽代碼

add:平台端用户查询

lyx 3 月之前
父節點
當前提交
aea4cd2f69

+ 0 - 4
alien-entity/src/main/java/shop/alien/mapper/LifeUserMapper.java

@@ -8,13 +8,10 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeUser;
-import shop.alien.entity.store.StoreImg;
 import shop.alien.entity.store.vo.LifeFansVo;
-import shop.alien.entity.store.vo.LifeUserOrderVo;
 import shop.alien.entity.store.vo.LifeUserVo;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 用户
@@ -38,7 +35,6 @@ public interface LifeUserMapper extends BaseMapper<LifeUser> {
 
     LifeFansVo getUserInfoByPhoneIdList(@Param("phoneId") String phoneId);
 
-    List<LifeUserOrderVo> getUserOrderDetail(Integer userId);
 
     @Select("select * from ( " +
             "    select store.id, concat('store_', user.phone) phoneId, img.img_url imgUrl, store_blurb blurb, store.store_name storeUserName " +

+ 1 - 54
alien-entity/src/main/resources/mapper/LifeUserMapper.xml

@@ -4,60 +4,7 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="shop.alien.mapper.LifeUserMapper">
 
-    <!-- 查询用户列表,支持分页和动态条件 -->
-    <select id="getUserOrderDetail" resultType="shop.alien.entity.store.vo.LifeUserOrderVo">
-        WITH OrderDetails AS (
-        SELECT
-        uo.user_id,
-        coupon.id AS couponId,
-        coupon.NAME AS couponName,
-        store.store_name,
-        su.phone,
-        uo.buy_time,
-        uo.used_time,
-        uo.final_price,
-        uo.status,
-        CASE
-        WHEN coupon.type = 1 THEN '代金券'
-        WHEN coupon.type = 2 THEN '团购(套餐)'
-        ELSE '其他类型'
-        END AS type
-        FROM
-        life_user_order uo
-        LEFT JOIN life_coupon coupon ON uo.quan_id = coupon.id
-        LEFT JOIN store_info store ON coupon.store_id = store.id
-        LEFT JOIN store_user su ON su.store_id = store.id
-        WHERE
-        1 = 1
-        <if test="userId != null and userId != ''">
-            and uo.user_id = #{userId}
-        </if>
-        )
-        SELECT
-        COUNT(1) AS purchaseQuantity,
-        user_id,
-        couponId,
-        couponName,
-        store_name,
-        phone as user_phone,
-        buy_time,
-        status,
-        used_time,
-        ROUND(SUM(final_price), 2) AS total_final_price,
-        type
-        FROM
-        OrderDetails
-        GROUP BY
-        user_id,
-        couponId,
-        couponName,
-        store_name,
-        phone,
-        buy_time,
-        status,
-        used_time,
-        type;
-    </select>
+
 
     <!-- 查询已删除的用户 -->
     <select id="getRemoveUser" resultType="shop.alien.entity.store.vo.LifeUserVo">

+ 2 - 4
alien-store/src/main/java/shop/alien/store/controller/PlatformLifeUserController.java

@@ -9,12 +9,10 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import shop.alien.entity.result.R;
-import shop.alien.entity.store.vo.LifeUserOrderVo;
+import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.store.service.PlatformLifeUserService;
 
-import java.util.List;
-
 @Api(tags = {"平台-用户管理"})
 @Slf4j
 @RestController
@@ -42,7 +40,7 @@ public class PlatformLifeUserController {
     @ApiOperationSupport(order = 2)
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "用户id", dataType = "Integer", paramType = "query", required = true)})
     @GetMapping("/getUserById")
-    public R<List<LifeUserOrderVo>> getUserById(Integer id) {
+    public R<LifeUser> getUserById(Integer id) {
         log.info("PlatformLifeUserController.getUserById?id={}", id);
         return R.data(platformLifeUserService.getUserById(id));
     }

+ 2 - 4
alien-store/src/main/java/shop/alien/store/service/PlatformLifeUserService.java

@@ -1,15 +1,13 @@
 package shop.alien.store.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import shop.alien.entity.store.vo.LifeUserOrderVo;
+import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
 
-import java.util.List;
-
 public interface PlatformLifeUserService {
 
     IPage<LifeUserVo> getUserList(Integer page, Integer size, String name, String phone);
 
-    List<LifeUserOrderVo> getUserById(Integer id);
+    LifeUser getUserById(Integer id);
 
 }

+ 4 - 10
alien-store/src/main/java/shop/alien/store/service/impl/PlatformLifeUserServiceImpl.java

@@ -1,22 +1,16 @@
 package shop.alien.store.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
-import shop.alien.entity.store.LifeLikeRecord;
-import shop.alien.entity.store.LifeUserDynamics;
-import shop.alien.entity.store.StoreComment;
-import shop.alien.entity.store.vo.LifeUserOrderVo;
+import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.mapper.*;
 import shop.alien.store.service.PlatformLifeUserService;
 
-import java.util.List;
-
 @Service
 @RequiredArgsConstructor
 public class PlatformLifeUserServiceImpl implements PlatformLifeUserService {
@@ -67,8 +61,8 @@ public class PlatformLifeUserServiceImpl implements PlatformLifeUserService {
     }
 
     @Override
-    public List<LifeUserOrderVo> getUserById(Integer id) {
-        List<LifeUserOrderVo> userOrderDetail = lifeUserMapper.getUserOrderDetail(id);
-        return userOrderDetail;
+    public LifeUser getUserById(Integer id) {
+        LifeUser lifeUser = lifeUserMapper.selectById(id);
+        return lifeUser;
     }
 }