提交 603a2938 作者: xiaowang

后台新增状态查询,小程序根据子分类数组查询

上级 1e10a7ee
......@@ -9,12 +9,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author LW
......@@ -45,9 +43,9 @@ public class AppMallGoodsController extends BaseController {
}
@ApiOperation(value = "根据子分类查询商品信息")
@GetMapping("queryGoodsInfoByCategorySub")
@PostMapping("queryGoodsInfoByCategorySub")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(@RequestParam Integer categorySubId) {
return appMallGoodsService.queryGoodsInfoByCategorySub(categorySubId);
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(@RequestBody List<Integer> categorySubIds) {
return appMallGoodsService.queryGoodsInfoByCategorySub(categorySubIds);
}
}
......@@ -13,5 +13,5 @@ import java.util.List;
*/
@Mapper
public interface AppMallGoodsDao {
List<MallGoodsDO> queryGoodsInfo(@Param("userAccountId") Integer userAccountId, @Param("categorySubId") Integer categorySubId);
List<MallGoodsDO> queryGoodsInfo(@Param("userAccountId") Integer userAccountId, @Param("categorySubIds") List<Integer> categorySubIds);
}
......@@ -29,6 +29,9 @@ public class MallGoodsQO {
@ApiModelProperty(value = "用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
......
......@@ -3,6 +3,8 @@ package com.mmc.pms.service.mall;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.mall.MallGoodsVO;
import java.util.List;
/**
* @Author LW
* @date 2023/7/26 14:55
......@@ -11,5 +13,5 @@ import com.mmc.pms.model.mall.MallGoodsVO;
public interface AppMallGoodsService {
ResultBody<MallGoodsVO> queryBrandGoods(Integer userAccountId);
ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(Integer categorySubId);
ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(List<Integer> categorySubIds);
}
......@@ -30,8 +30,8 @@ public class AppMallGoodsServiceImpl implements AppMallGoodsService {
@Override
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(Integer categorySubId) {
List<MallGoodsDO> mallGoodsList = appMallGoodsDao.queryGoodsInfo(null, categorySubId);
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(List<Integer> categorySubIds) {
List<MallGoodsDO> mallGoodsList = appMallGoodsDao.queryGoodsInfo(null, categorySubIds);
return checkGoodsInfo(mallGoodsList);
}
......
......@@ -26,8 +26,11 @@
<if test="userAccountId != null">
and mg.user_account_id = #{userAccountId}
</if>
<if test="categorySubId != null">
and mg.category_sub_id =#{categorySubId}
<if test="categorySubIds != null">
<foreach collection="categorySubIds" item="item" open="and mg.category_sub_id in (" close=")"
separator=",">
#{item}
</foreach>
</if>
</where>
</select>
......
......@@ -211,7 +211,10 @@
and category_primary_id = #{categoryPrimaryId}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
and mg.user_account_id = #{userAccountId}
</if>
<if test="shelfStatus != null">
and mg.shelf_status = #{shelfStatus}
</if>
</where>
</select>
......@@ -239,7 +242,10 @@
and mg.category_primary_id = #{categoryPrimaryId}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
and mg.user_account_id = #{userAccountId}
</if>
<if test="shelfStatus != null">
and mg.shelf_status = #{shelfStatus}
</if>
</where>
ORDER BY
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论