Commit 0745eae1 authored by zhengyi's avatar zhengyi

商品列表返回值修正

parent 717846cc
......@@ -17,6 +17,12 @@ public class ProductBaseVO {
@NotNull(message = "商品类型id不能为空")
private Long typeId;
@ApiModelProperty(value = "商品类型中文名称")
private String typeTitleZh;
@ApiModelProperty(value = "商品类型英文名称")
private String typeTitleEn;
@ApiModelProperty(value = "商品特效id", required = true)
@NotNull(message = "商品属性id不能为空")
private String attrId;
......
......@@ -377,4 +377,5 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
})
List<ProductDO> randomTemplateProdData(@Param("num") Integer num);
List<ProductRespVO> getProductList(@Param("reqVO") ProductExportReqVO reqVO);
}
......@@ -90,7 +90,7 @@ public interface ProductService {
* @param exportReqVO 查询条件
* @return 产品列表
*/
List<ProductDO> getProductList(ProductExportReqVO exportReqVO);
List<ProductRespVO> getProductList(ProductExportReqVO reqVO);
List<ProductTypeNumVO> getProductTypeNumList(List<Long> typeIdList);
......
......@@ -437,11 +437,22 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public List<ProductDO> getProductList(ProductExportReqVO exportReqVO) {
if (exportReqVO.isFilter()) {
exportReqVO.setAuditStatus(2);
public List<ProductRespVO> getProductList(ProductExportReqVO reqVO) {
if (reqVO.isFilter()) {
reqVO.setAuditStatus(2);
}
return productMapper.selectList(exportReqVO);
reqVO.setStatus(0);
String ids = reqVO.getIds();
List<Long> idList = null;
if (StringUtils.isNotEmpty(ids)) {
String[] idArray = ids.split(",");
idList = Arrays.asList(idArray).stream()
.map(Long::valueOf)
.collect(Collectors.toList());
reqVO.setProdIds(idList);
}
// return productMapper.selectList(reqVO);
return productMapper.getProductList(reqVO);
}
@Override
......
......@@ -78,6 +78,10 @@ public class ProductExportReqVO {
@ApiModelProperty(value = "商品ID列表,多个以逗号分割")
private String ids;
@ApiModelProperty(value = "商品ID列表")
private List<Long> prodIds;
private boolean filter = true;
}
......@@ -13,5 +13,42 @@
and deleted=0
GROUP BY type_id
</select>
<select id="getProductList" resultType="cn.iocoder.yudao.module.product.vo.product.ProductRespVO">
SELECT p.*
t.title_zh as type_title_zh,
t.title_en as type_title_en
from ecw_product p left join ecw_product_type t on p.type_id = t.id
where
p.deleted=0
<if test="reqVO.typeId != null">
and p.type_id = #{reqVO.typeId}
</if>
<if test="reqVO.auditStatus != null">
and p.audit_status = #{reqVO.auditStatus}
</if>
<if test="reqVO.status != null">
and p.status = #{reqVO.status}
</if>
<if test="reqVO.productCode != null and reqVO.productCode != '' ">
and p.product_code like concat("%",concat(#{reqVO.productCode},"%"))
</if>
<if test="reqVO.customsCode != null and reqVO.customsCode != '' ">
and p.customs_code like concat("%",concat(#{reqVO.customsCode},"%"))
</if>
<if test="reqVO.typeIds != null and reqVO.typeIds.size() > 0">
and p.type_id in
<foreach item="typeId" collection="reqVO.typeIds" index="index" open="(" close=")" separator=",">
#{typeId}
</foreach>
</if>
<if test="reqVO.prodIds != null and reqVO.prodIds.size() > 0">
and p.id in
<foreach item="id" collection="reqVO.prodIds" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
GROUP BY type_id
</select>
</mapper>
\ No newline at end of file
......@@ -116,15 +116,14 @@ public class ProductController {
@ApiOperation("获得商品列表")
// @PreAuthorize("@ss.hasPermission('ecw:product:query')")
public CommonResult<List<ProductRespVO>> getProductList(ProductExportReqVO req) {
List<ProductDO> list = productService.getProductList(req);
List<ProductRespVO> productList = ProductConvert.INSTANCE.convertList(list);
List<ProductRespVO> list = productService.getProductList(req);
// if(CollectionUtil.isNotEmpty(productList)) {
// for (ProductRespVO productRespVO : productList) {
// productRespVO.setCreatorName(adminUserApi.getUserName(productRespVO.getCreator()));
// productRespVO.setUpdaterName(adminUserApi.getUserName(productRespVO.getUpdater()));
// }
// }
return success(productList);
return success(list);
}
@GetMapping("/page")
......
......@@ -51,8 +51,8 @@ public class AppProductController {
@ApiOperation("获得商品列表")
@PreAuthenticated
public CommonResult<List<ProductRespVO>> getProductList(ProductExportReqVO req) {
List<ProductDO> list = productService.getProductList(req);
return success(ProductConvert.INSTANCE.convertList(list));
List<ProductRespVO> list = productService.getProductList(req);
return success(list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment