feat(box): 添加纸箱品牌和产品查询条件

- 在 BoxBrandListQry 和 BoxBrandPageQry 中新增 type 字段用于筛选品牌类型
- 在 BoxProductListQry 和 BoxProductPageQry 中新增 type 字段用于筛选产品品牌类型
- 更新 BoxBrandDO 和 BoxProductDO 实体类,增加 type 字段并映射数据库列
- 修改 BoxBrandGatewayImpl 和 BoxProductGatewayImpl 查询逻辑,支持按 type 过滤
- 在 BoxProductMapper.xml 中添加 type 字段的映射配置
This commit is contained in:
shenyifei 2025-11-09 14:40:52 +08:00
parent b164e5e26a
commit bc2c269e17
9 changed files with 54 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO; import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -36,6 +37,12 @@ public class BoxBrandDO extends BaseDO<BoxBrandDO> {
@TableField(value = "image") @TableField(value = "image")
private String image; private String image;
/**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@TableField(value = "type")
private BoxBrandTypeEnum type;
/** /**
* 备注 * 备注
*/ */

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxProductSpecTypeEnum; import com.xunhong.erp.turbo.api.biz.dto.enums.BoxProductSpecTypeEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO; import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data; import lombok.Data;
@ -61,6 +62,12 @@ public class BoxProductDO extends BaseDO<BoxProductDO> {
@TableField(value = "brand_id") @TableField(value = "brand_id")
private Long brandId; private Long brandId;
/**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@TableField(value = "type")
private BoxBrandTypeEnum type;
/** /**
* 备注 * 备注
*/ */
@ -74,4 +81,3 @@ public class BoxProductDO extends BaseDO<BoxProductDO> {
private Boolean status; private Boolean status;
} }

View File

@ -46,6 +46,9 @@ public class BoxBrandGatewayImpl implements BoxBrandGateway {
@Override @Override
public IPage<BoxBrand> page(BoxBrandPageQry boxBrandPageQry) { public IPage<BoxBrand> page(BoxBrandPageQry boxBrandPageQry) {
LambdaQueryWrapper<BoxBrandDO> queryWrapper = Wrappers.lambdaQuery(BoxBrandDO.class); LambdaQueryWrapper<BoxBrandDO> queryWrapper = Wrappers.lambdaQuery(BoxBrandDO.class);
queryWrapper.eq(Objects.nonNull(boxBrandPageQry.getStatus()), BoxBrandDO::getStatus, boxBrandPageQry.getStatus());
queryWrapper.eq(Objects.nonNull(boxBrandPageQry.getBrandId()), BoxBrandDO::getBrandId, boxBrandPageQry.getBrandId());
queryWrapper.eq(Objects.nonNull(boxBrandPageQry.getType()), BoxBrandDO::getType, boxBrandPageQry.getType());
queryWrapper.orderByDesc(BoxBrandDO::getCreatedAt); queryWrapper.orderByDesc(BoxBrandDO::getCreatedAt);
IPage<BoxBrandDO> page = new Page<>(boxBrandPageQry.getPageIndex(), boxBrandPageQry.getPageSize()); IPage<BoxBrandDO> page = new Page<>(boxBrandPageQry.getPageIndex(), boxBrandPageQry.getPageSize());
@ -58,6 +61,8 @@ public class BoxBrandGatewayImpl implements BoxBrandGateway {
public List<BoxBrand> list(BoxBrandListQry boxBrandListQry) { public List<BoxBrand> list(BoxBrandListQry boxBrandListQry) {
LambdaQueryWrapper<BoxBrandDO> queryWrapper = Wrappers.lambdaQuery(BoxBrandDO.class); LambdaQueryWrapper<BoxBrandDO> queryWrapper = Wrappers.lambdaQuery(BoxBrandDO.class);
queryWrapper.eq(Objects.nonNull(boxBrandListQry.getStatus()), BoxBrandDO::getStatus, boxBrandListQry.getStatus()); queryWrapper.eq(Objects.nonNull(boxBrandListQry.getStatus()), BoxBrandDO::getStatus, boxBrandListQry.getStatus());
queryWrapper.eq(Objects.nonNull(boxBrandListQry.getBrandId()), BoxBrandDO::getBrandId, boxBrandListQry.getBrandId());
queryWrapper.eq(Objects.nonNull(boxBrandListQry.getType()), BoxBrandDO::getType, boxBrandListQry.getType());
queryWrapper.orderByDesc(BoxBrandDO::getCreatedAt); queryWrapper.orderByDesc(BoxBrandDO::getCreatedAt);
List<BoxBrandDO> boxBrandDOList = boxBrandMapper.selectList(queryWrapper); List<BoxBrandDO> boxBrandDOList = boxBrandMapper.selectList(queryWrapper);

View File

@ -47,6 +47,7 @@ public class BoxProductGatewayImpl implements BoxProductGateway {
queryWrapper.eq(Objects.nonNull(boxProductPageQry.getStatus()), BoxProductDO::getStatus, boxProductPageQry.getStatus()); queryWrapper.eq(Objects.nonNull(boxProductPageQry.getStatus()), BoxProductDO::getStatus, boxProductPageQry.getStatus());
queryWrapper.eq(Objects.nonNull(boxProductPageQry.getBrandId()), BoxProductDO::getBrandId, boxProductPageQry.getBrandId()); queryWrapper.eq(Objects.nonNull(boxProductPageQry.getBrandId()), BoxProductDO::getBrandId, boxProductPageQry.getBrandId());
queryWrapper.eq(Objects.nonNull(boxProductPageQry.getSpecType()), BoxProductDO::getSpecType, boxProductPageQry.getSpecType()); queryWrapper.eq(Objects.nonNull(boxProductPageQry.getSpecType()), BoxProductDO::getSpecType, boxProductPageQry.getSpecType());
queryWrapper.eq(Objects.nonNull(boxProductPageQry.getType()), BoxProductDO::getType, boxProductPageQry.getType());
queryWrapper.orderByDesc(BoxProductDO::getCreatedAt); queryWrapper.orderByDesc(BoxProductDO::getCreatedAt);
@ -59,6 +60,7 @@ public class BoxProductGatewayImpl implements BoxProductGateway {
@Override @Override
public List<BoxProduct> list(BoxProductListQry boxProductListQry) { public List<BoxProduct> list(BoxProductListQry boxProductListQry) {
LambdaQueryWrapper<BoxProductDO> queryWrapper = Wrappers.lambdaQuery(BoxProductDO.class); LambdaQueryWrapper<BoxProductDO> queryWrapper = Wrappers.lambdaQuery(BoxProductDO.class);
queryWrapper.eq(Objects.nonNull(boxProductListQry.getType()), BoxProductDO::getType, boxProductListQry.getType());
List<BoxProductDO> boxProductDOList = boxProductMapper.selectList(queryWrapper); List<BoxProductDO> boxProductDOList = boxProductMapper.selectList(queryWrapper);
return boxProductDOList.stream().map(boxProductConvert::toBoxProduct).toList(); return boxProductDOList.stream().map(boxProductConvert::toBoxProduct).toList();
} }
@ -97,4 +99,3 @@ public class BoxProductGatewayImpl implements BoxProductGateway {
boxProductDO.deleteById(); boxProductDO.deleteById();
} }
} }

View File

@ -12,6 +12,7 @@
<result property="salePrice" column="sale_price"/> <result property="salePrice" column="sale_price"/>
<result property="specType" column="spec_type"/> <result property="specType" column="spec_type"/>
<result property="brandId" column="brand_id"/> <result property="brandId" column="brand_id"/>
<result property="type" column="type"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="createdAt" column="created_at"/> <result property="createdAt" column="created_at"/>
@ -21,4 +22,3 @@
<result property="version" column="version"/> <result property="version" column="version"/>
</resultMap> </resultMap>
</mapper> </mapper>

View File

@ -1,5 +1,6 @@
package com.xunhong.erp.turbo.api.biz.dto.qry; package com.xunhong.erp.turbo.api.biz.dto.qry;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.base.dto.Query; import com.xunhong.erp.turbo.base.dto.Query;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -21,5 +22,11 @@ public class BoxBrandListQry extends Query {
@Schema(title = "是否包含纸箱产品", type = "boolean") @Schema(title = "是否包含纸箱产品", type = "boolean")
private Boolean withProduct; private Boolean withProduct;
/**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@Schema(title = "品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱")
private BoxBrandTypeEnum type;
} }

View File

@ -1,5 +1,6 @@
package com.xunhong.erp.turbo.api.biz.dto.qry; package com.xunhong.erp.turbo.api.biz.dto.qry;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.base.dto.PageQuery; import com.xunhong.erp.turbo.base.dto.PageQuery;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -15,5 +16,11 @@ public class BoxBrandPageQry extends PageQuery {
@Schema(title = "纸箱品牌ID", type = "string") @Schema(title = "纸箱品牌ID", type = "string")
private Long brandId; private Long brandId;
/**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@Schema(title = "品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱")
private BoxBrandTypeEnum type;
} }

View File

@ -1,5 +1,6 @@
package com.xunhong.erp.turbo.api.biz.dto.qry; package com.xunhong.erp.turbo.api.biz.dto.qry;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.base.dto.Query; import com.xunhong.erp.turbo.base.dto.Query;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -15,5 +16,10 @@ public class BoxProductListQry extends Query {
@Schema(title = "纸箱产品ID", type = "string") @Schema(title = "纸箱产品ID", type = "string")
private Long productId; private Long productId;
}
/**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@Schema(title = "品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱")
private BoxBrandTypeEnum type;
}

View File

@ -1,5 +1,6 @@
package com.xunhong.erp.turbo.api.biz.dto.qry; package com.xunhong.erp.turbo.api.biz.dto.qry;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxBrandTypeEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.BoxProductSpecTypeEnum; import com.xunhong.erp.turbo.api.biz.dto.enums.BoxProductSpecTypeEnum;
import com.xunhong.erp.turbo.base.dto.PageQuery; import com.xunhong.erp.turbo.base.dto.PageQuery;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -29,5 +30,10 @@ public class BoxProductPageQry extends PageQuery {
@Schema(title = "规格1_2粒装2_4粒装") @Schema(title = "规格1_2粒装2_4粒装")
private BoxProductSpecTypeEnum specType; private BoxProductSpecTypeEnum specType;
} /**
* 品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱
*/
@Schema(title = "品牌类型1_我方纸箱2_瓜农纸箱3_第三方纸箱")
private BoxBrandTypeEnum type;
}