Aslee 3 vuotta sitten
vanhempi
commit
44fa8b25dd

+ 5 - 4
src/main/java/com/caimei/controller/AuthProductApi.java

@@ -42,15 +42,16 @@ public class AuthProductApi {
             @ApiImplicitParam(name = "authId", required = true, value = "授权id"),
             @ApiImplicitParam(name = "productName", required = false, value = "商品名称"),
             @ApiImplicitParam(name = "snCode", required = false, value = "商品SN码"),
+            @ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus,
-                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return authProductService.getProductList(listType, authId, productName, snCode, auditStatus, pageNum, pageSize);
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer status, Integer auditStatus,
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authProductService.getProductList(listType, authId, productName, snCode, status, auditStatus, pageNum, pageSize);
     }
 
 

+ 1 - 1
src/main/java/com/caimei/mapper/AuthProductMapper.java

@@ -19,7 +19,7 @@ import java.util.List;
 @Mapper
 public interface AuthProductMapper {
 
-    List<ProductListVo> getProductList(@Param("listType") Integer listType, @Param("authId") Integer authId, @Param("productName") String productName, @Param("snCode") String snCode, @Param("auditStatus") Integer auditStatus);
+    List<ProductListVo> getProductList(@Param("listType") Integer listType, @Param("authId") Integer authId, @Param("productName") String productName, @Param("snCode") String snCode, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus);
 
     void updateProductStatusByProductId(@Param("productId") Integer productId, @Param("status") Integer status);
 

+ 2 - 1
src/main/java/com/caimei/service/AuthProductService.java

@@ -25,12 +25,13 @@ public interface AuthProductService {
      * @param authId        授权id
      * @param productName   商品名称
      * @param snCode        商品SN码
+     * @param status        上线状态:0下线,1上线,2待上线
      * @param auditStatus   审核状态:0审核未通过,1审核通过,2待审核
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return  ProductListVo
      */
-    ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 更新授权商品状态

+ 2 - 2
src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java

@@ -51,13 +51,13 @@ public class AuthProductServiceImpl implements AuthProductService {
     private String imageDomain;
 
     @Override
-    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer auditStatus, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
         if (null == authId) {
             return ResponseJson.error("参数异常,请输入授权id", null);
         }
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
-        List<ProductListVo> productList = authProductMapper.getProductList(listType, authId, productName, snCode, auditStatus);
+        List<ProductListVo> productList = authProductMapper.getProductList(listType, authId, productName, snCode, status, auditStatus);
         PageInfo<ProductListVo> pageData = new PageInfo<>(productList);
         return ResponseJson.success(pageData);
     }

+ 4 - 1
src/main/resources/mapper/AuthProductMapper.xml

@@ -79,8 +79,11 @@
         <if test="snCode != null and snCode != ''">
             and snCode like CONCAT('%',#{snCode},'%')
         </if>
+        <if test="status != null">
+            and p.status = #{auditStatus}
+        </if>
         <if test="auditStatus != null">
-            and auditStatus = #{auditStatus}
+            and p.auditStatus = #{auditStatus}
         </if>
         <if test="listType == 1">
             order by p.createTime desc