zwhui 1 년 전
부모
커밋
b1a2d076fe
1개의 변경된 파일12개의 추가작업 그리고 9개의 파일을 삭제
  1. 12 9
      wholesale/src/main/java/com/yhlxj/web/controller/login/WholesaleUserController.java

+ 12 - 9
wholesale/src/main/java/com/yhlxj/web/controller/login/WholesaleUserController.java

@@ -1,10 +1,13 @@
 package com.yhlxj.web.controller.login;
 
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.util.StringUtil;
 import com.cyksj.enums.GatewayApiCode;
 import com.yhlxj.dao.model.dto.Result;
 import com.yhlxj.dao.model.entity.WebInfo;
@@ -83,7 +86,7 @@ public class WholesaleUserController {
         if (wholesaleUser.getUsername() == null || !Validator.isEmail(wholesaleUser.getUsername())) {
             throw BusinessRuntimeException.getInstance("请输入正确邮箱");
         }
-         WholesaleUser login = wholesaleUserService.register(wholesaleUser.getWholesaleId(),wholesaleUser.getUsername(), wholesaleUser.getPassword());
+        WholesaleUser login = wholesaleUserService.register(wholesaleUser.getWholesaleId(), wholesaleUser.getUsername(), wholesaleUser.getPassword());
 
         //写回登陆信息
         StpUserUtil.login(login.getId());
@@ -105,7 +108,7 @@ public class WholesaleUserController {
         if (webInfo == null) {
             throw new BusinessRuntimeException("店铺不存在.");
         }
-        if (!webInfo.getStatus()){
+        if (!webInfo.getStatus()) {
             throw new BusinessRuntimeException("店铺已关闭.");
         }
         WebInfoView view = new WebInfoView();
@@ -152,15 +155,15 @@ public class WholesaleUserController {
     }
 
     /**
-     * 查询公告
+     * 查询公告列表
      */
     @GetMapping("/getNotice")
-    public Result<List<WholesaleNotice>> getNotice(Long wholesaleId,String platform) {
-        List<WholesaleNotice> list = wholesaleNoticeService.list(Wrappers.lambdaQuery(WholesaleNotice.class)
+    public Result<Page<WholesaleNotice>> getNotice(Long wholesaleId, String platform, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
+        Page<WholesaleNotice> page = wholesaleNoticeService.page(new Page<>(start, limit), Wrappers.lambdaQuery(WholesaleNotice.class)
                 .eq(WholesaleNotice::getWholesaleId, wholesaleId)
-                .eq(WholesaleNotice::getPlatform, platform)
-                .eq(WholesaleNotice::getStatus, true)
+                .like(StringUtil.isNotBlank(platform), WholesaleNotice::getPlatform, platform)
+                .eq(WholesaleNotice::getStatus, Boolean.TRUE)
                 .orderByDesc(WholesaleNotice::getId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(page);
     }
-}
+}