商品增加绑定设备IMEI

This commit is contained in:
zhangji committed 2025-09-04 16:43:51 +08:00
1 parent 6c9ecebbb3
commit c59a491bb7
9 files changed
+31 -3

No files matched your search

@@ -55,6 +55,9 @@ public class ProductSpuPageReqVO extends PageParam {
@Schema(description = "商品类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer types;
@Schema(description = "设备IMEI", example = "371")
private String deviceId;
@Schema(description = "创建人id", example = "1")
private String creator;
@@ -45,6 +45,10 @@ public class ProductSpuRespVO {
@ExcelProperty("商品品牌编号")
private Long brandId;
@Schema(description = "设备IMEI", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
@ExcelProperty("设备IMEI")
private String deviceId;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
@ExcelProperty("商品封面图")
private String picUrl;
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuTypesEnum;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -36,6 +37,9 @@ public class ProductSpuSaveReqVO {
@NotNull(message = "商品分类不能为空")
private Long categoryId;
@Schema(description = "设备IMEI", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
private String deviceId;
@Schema(description = "商品品牌编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "商品品牌不能为空")
private Long brandId;
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.product.controller.app.spu.vo;
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -27,6 +28,9 @@ public class AppProductSpuDetailRespVO {
@Schema(description = "商品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long categoryId;
@Schema(description = "设备IMEI", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
private String deviceId;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED)
private String picUrl;
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.product.controller.app.spu.vo;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuTypesEnum;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -22,6 +23,9 @@ public class AppProductSpuRespVO {
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long categoryId;
@Schema(description = "设备IMEI", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
private String deviceId;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED)
private String picUrl;
@@ -68,6 +68,11 @@ public class ProductSpuDO extends BaseDO {
* 关联 {@link ProductBrandDO#getId()}
*/
private Long brandId;
/**
* 设备IMEI
*/
private String deviceId;
/**
* 商品封面图
*/
@@ -64,7 +64,9 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
default PageResult<ProductSpuDO> selectPage(AppProductSpuPageReqVO pageReqVO, Set<Long> categoryIds) {
LambdaQueryWrapperX<ProductSpuDO> query = new LambdaQueryWrapperX<ProductSpuDO>()
//根据创建人查询商品
.eqIfPresent(ProductSpuDO::getCreator, pageReqVO.getCreator())
// .eqIfPresent(ProductSpuDO::getCreator, pageReqVO.getCreator())
//根据设备id查询商品
.eqIfPresent(ProductSpuDO::getDeviceId, pageReqVO.getDeviceId())
//根据类型查询商品
.eqIfPresent(ProductSpuDO::getTypes, pageReqVO.getTypes())
// 关键字匹配,目前只匹配商品名
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.framework.web.config;
import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
import cn.iocoder.yudao.module.product.dal.dataobject.device.DeviceDO;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@@ -33,6 +34,7 @@ public class ProductWebConfiguration {
// rule.addDeptColumn(DeptDO.class, "id");
// user
rule.addUserColumn(ProductSpuDO.class, "creator");
rule.addUserColumn(DeviceDO.class, "creator");
};
}
@@ -271,11 +271,11 @@ public class ProductSpuServiceImpl implements ProductSpuService {
.setStatus(CommonStatusEnum.ENABLE.getStatus()).setParentIds(pageReqVO.getCategoryIds()));
categoryIds.addAll(convertList(categoryChildren, ProductCategoryDO::getId));
}
if (null!=pageReqVO.getDeviceId()){
/*if (null!=pageReqVO.getDeviceId()){
//查询用户
AdminUserRespDTO user = adminUserApi.getUserByDeviceid(pageReqVO.getDeviceId());
pageReqVO.setCreator(user.getId().toString());
}
}*/
// 分页查询
return productSpuMapper.selectPage(pageReqVO, categoryIds);
}