会员列表

This commit is contained in:
wangw 2024-05-16 15:17:45 +08:00
parent f8ed4fe16b
commit eb450106c6
4 changed files with 29 additions and 2 deletions

View File

@ -15,7 +15,6 @@
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
@ -27,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/**
@ -57,7 +58,13 @@ public class TbShopUserController {
@GetMapping("queryAllShopUser")
@ApiOperation("查询商家用户")
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopUserService.queryAllShopUser(criteria,pageable),HttpStatus.OK);
Map<String, Object> stringObjectMap=new HashMap<>();
if (criteria.getShopId().equals("1")) {
stringObjectMap = tbShopUserService.queryAllShopUser(criteria, pageable);
}else {
stringObjectMap = tbShopUserService.queryShopUser(criteria, pageable);
}
return new ResponseEntity<>(stringObjectMap,HttpStatus.OK);
}

View File

@ -45,6 +45,14 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
"AND su.shopId = :shopId")
Page<ShopUserInfoVo> findShopUserJoinUserInfo(String shopId,Integer isVip,String phone, Pageable pageable);
@Query("SELECT NEW cn.ysk.cashier.vo.ShopUserInfoVo(su.id, su.isVip, u.nickName, u.headImg, u.telephone, su.updatedAt) " +
"FROM TbShopUser su " +
"LEFT JOIN TbUserInfo u " +
"on su.userId = CAST(u.id AS string) " +
"WHERE su.isVip = IFNULL(:isVip, su.isVip)" +
"AND (u.telephone = IFNULL(:phone, u.telephone))")
Page<ShopUserInfoVo> findAllShopUserJoinUserInfo(Integer isVip,String phone, Pageable pageable);
@Query("SELECT count(0) from TbShopUser user where user.shopId = :shopId")
Tuple searchByCount(@Param("shopId") String shopId);

View File

@ -63,6 +63,16 @@ public class TbShopUserServiceImpl implements TbShopUserService {
return PageUtil.toPage(shopUserJoinUserInfo);
}
@Override
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
Page<ShopUserInfoVo> shopUserJoinUserInfo =
tbShopUserRepository.findAllShopUserJoinUserInfo(
criteria.getIsVip(),
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
}
@Override
public Map<String, Object> queryAll(TbShopUserQueryCriteria criteria, Pageable pageable) {
criteria.setIsVip(1);

View File

@ -39,6 +39,8 @@ public interface TbShopUserService {
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
/**