提交 603a2938 作者: xiaowang

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

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