Feat: Code gen V2 ok
This commit is contained in:
parent
a42bf5ce1d
commit
8b5603a1f4
|
|
@ -0,0 +1,139 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.product;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.product.HaoKaProductService;
|
||||
|
||||
@Tag(name = "管理后台 - 产品/渠道")
|
||||
@RestController
|
||||
@RequestMapping("/haoka/hao-ka-product")
|
||||
@Validated
|
||||
public class HaoKaProductController {
|
||||
|
||||
@Resource
|
||||
private HaoKaProductService haoKaProductService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产品/渠道")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:create')")
|
||||
public CommonResult<Long> createHaoKaProduct(@Valid @RequestBody HaoKaProductSaveReqVO createReqVO) {
|
||||
return success(haoKaProductService.createHaoKaProduct(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品/渠道")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:update')")
|
||||
public CommonResult<Boolean> updateHaoKaProduct(@Valid @RequestBody HaoKaProductSaveReqVO updateReqVO) {
|
||||
haoKaProductService.updateHaoKaProduct(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产品/渠道")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:delete')")
|
||||
public CommonResult<Boolean> deleteHaoKaProduct(@RequestParam("id") Long id) {
|
||||
haoKaProductService.deleteHaoKaProduct(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产品/渠道")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:query')")
|
||||
public CommonResult<HaoKaProductRespVO> getHaoKaProduct(@RequestParam("id") Long id) {
|
||||
HaoKaProductDO haoKaProduct = haoKaProductService.getHaoKaProduct(id);
|
||||
return success(BeanUtils.toBean(haoKaProduct, HaoKaProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产品/渠道分页")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:query')")
|
||||
public CommonResult<PageResult<HaoKaProductRespVO>> getHaoKaProductPage(@Valid HaoKaProductPageReqVO pageReqVO) {
|
||||
PageResult<HaoKaProductDO> pageResult = haoKaProductService.getHaoKaProductPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, HaoKaProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产品/渠道 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportHaoKaProductExcel(@Valid HaoKaProductPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<HaoKaProductDO> list = haoKaProductService.getHaoKaProductPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品/渠道.xls", "数据", HaoKaProductRespVO.class,
|
||||
BeanUtils.toBean(list, HaoKaProductRespVO.class));
|
||||
}
|
||||
|
||||
// ==================== 子表(产品对接上游配置) ====================
|
||||
|
||||
@GetMapping("/superior-product-config/page")
|
||||
@Operation(summary = "获得产品对接上游配置分页")
|
||||
@Parameter(name = "haokaProductId", description = "产品ID")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:query')")
|
||||
public CommonResult<PageResult<SuperiorProductConfigDO>> getSuperiorProductConfigPage(PageParam pageReqVO,
|
||||
@RequestParam("haokaProductId") Long haokaProductId) {
|
||||
return success(haoKaProductService.getSuperiorProductConfigPage(pageReqVO, haokaProductId));
|
||||
}
|
||||
|
||||
@PostMapping("/superior-product-config/create")
|
||||
@Operation(summary = "创建产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:create')")
|
||||
public CommonResult<Long> createSuperiorProductConfig(@Valid @RequestBody SuperiorProductConfigDO superiorProductConfig) {
|
||||
return success(haoKaProductService.createSuperiorProductConfig(superiorProductConfig));
|
||||
}
|
||||
|
||||
@PutMapping("/superior-product-config/update")
|
||||
@Operation(summary = "更新产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:update')")
|
||||
public CommonResult<Boolean> updateSuperiorProductConfig(@Valid @RequestBody SuperiorProductConfigDO superiorProductConfig) {
|
||||
haoKaProductService.updateSuperiorProductConfig(superiorProductConfig);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/superior-product-config/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:delete')")
|
||||
public CommonResult<Boolean> deleteSuperiorProductConfig(@RequestParam("id") Long id) {
|
||||
haoKaProductService.deleteSuperiorProductConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/superior-product-config/get")
|
||||
@Operation(summary = "获得产品对接上游配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:hao-ka-product:query')")
|
||||
public CommonResult<SuperiorProductConfigDO> getSuperiorProductConfig(@RequestParam("id") Long id) {
|
||||
return success(haoKaProductService.getSuperiorProductConfig(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.product.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 产品/渠道分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class HaoKaProductPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "运营商")
|
||||
private Integer operator;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "产品名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "产品类型", example = "21014")
|
||||
private Long haokaProductTypeId;
|
||||
|
||||
@Schema(description = "归属地")
|
||||
private Integer belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
private Long haokaProductChannelId;
|
||||
|
||||
@Schema(description = "产品限制", example = "31322")
|
||||
private Long haokaProductLimitId;
|
||||
|
||||
@Schema(description = "身份证号码验证")
|
||||
private Integer idCardNumVerify;
|
||||
|
||||
@Schema(description = "身份证图片验证")
|
||||
private Integer idCardImgVerify;
|
||||
|
||||
@Schema(description = "生产地址")
|
||||
private String produceAddress;
|
||||
|
||||
@Schema(description = "黑名单过滤")
|
||||
private Boolean needBlacklistFilter;
|
||||
|
||||
@Schema(description = "是否启用库存限制")
|
||||
private Boolean enableStockLimit;
|
||||
|
||||
@Schema(description = "库存数量")
|
||||
private Integer stockNum;
|
||||
|
||||
@Schema(description = "库存报警数量")
|
||||
private Integer stockWarnNum;
|
||||
|
||||
@Schema(description = "生产备注")
|
||||
private String produceRemarks;
|
||||
|
||||
@Schema(description = "结算规则")
|
||||
private String settlementRules;
|
||||
|
||||
@Schema(description = "预估收益")
|
||||
private String estimatedRevenue;
|
||||
|
||||
@Schema(description = "上架")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "是否顶置")
|
||||
private Boolean isTop;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.product.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - 产品/渠道 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HaoKaProductRespVO {
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3973")
|
||||
@ExcelProperty("产品ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "运营商", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "运营商", converter = DictConvert.class)
|
||||
@DictFormat("haoka_operator") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer operator;
|
||||
|
||||
@Schema(description = "产品编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("产品编码")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("产品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "产品类型", example = "21014")
|
||||
@ExcelProperty("产品类型")
|
||||
private Long haokaProductTypeId;
|
||||
|
||||
@Schema(description = "归属地", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("归属地")
|
||||
private Integer belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
@ExcelProperty("产品渠道")
|
||||
private Long haokaProductChannelId;
|
||||
|
||||
@Schema(description = "产品限制", requiredMode = Schema.RequiredMode.REQUIRED, example = "31322")
|
||||
@ExcelProperty("产品限制")
|
||||
private Long haokaProductLimitId;
|
||||
|
||||
@Schema(description = "身份证号码验证", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "身份证号码验证", converter = DictConvert.class)
|
||||
@DictFormat("id_card_num_verify") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer idCardNumVerify;
|
||||
|
||||
@Schema(description = "身份证图片验证", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "身份证图片验证", converter = DictConvert.class)
|
||||
@DictFormat("id_card_img_verify") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer idCardImgVerify;
|
||||
|
||||
@Schema(description = "生产地址")
|
||||
@ExcelProperty("生产地址")
|
||||
private String produceAddress;
|
||||
|
||||
@Schema(description = "黑名单过滤", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("黑名单过滤")
|
||||
private Boolean needBlacklistFilter;
|
||||
|
||||
@Schema(description = "是否启用库存限制")
|
||||
@ExcelProperty("是否启用库存限制")
|
||||
private Boolean enableStockLimit;
|
||||
|
||||
@Schema(description = "库存数量")
|
||||
@ExcelProperty("库存数量")
|
||||
private Integer stockNum;
|
||||
|
||||
@Schema(description = "库存报警数量")
|
||||
@ExcelProperty("库存报警数量")
|
||||
private Integer stockWarnNum;
|
||||
|
||||
@Schema(description = "生产备注")
|
||||
@ExcelProperty("生产备注")
|
||||
private String produceRemarks;
|
||||
|
||||
@Schema(description = "结算规则")
|
||||
@ExcelProperty("结算规则")
|
||||
private String settlementRules;
|
||||
|
||||
@Schema(description = "预估收益")
|
||||
@ExcelProperty("预估收益")
|
||||
private String estimatedRevenue;
|
||||
|
||||
@Schema(description = "上架")
|
||||
@ExcelProperty("上架")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "是否顶置")
|
||||
@ExcelProperty("是否顶置")
|
||||
private Boolean isTop;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.product.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
|
||||
@Schema(description = "管理后台 - 产品/渠道新增/修改 Request VO")
|
||||
@Data
|
||||
public class HaoKaProductSaveReqVO {
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3973")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "运营商", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "运营商不能为空")
|
||||
private Integer operator;
|
||||
|
||||
@Schema(description = "产品编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "产品编码不能为空")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "产品名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "产品类型", example = "21014")
|
||||
private Long haokaProductTypeId;
|
||||
|
||||
@Schema(description = "归属地", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "归属地不能为空")
|
||||
private Integer belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
private Long haokaProductChannelId;
|
||||
|
||||
@Schema(description = "产品限制", requiredMode = Schema.RequiredMode.REQUIRED, example = "31322")
|
||||
@NotNull(message = "产品限制不能为空")
|
||||
private Long haokaProductLimitId;
|
||||
|
||||
@Schema(description = "身份证号码验证", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "身份证号码验证不能为空")
|
||||
private Integer idCardNumVerify;
|
||||
|
||||
@Schema(description = "身份证图片验证", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "身份证图片验证不能为空")
|
||||
private Integer idCardImgVerify;
|
||||
|
||||
@Schema(description = "生产地址")
|
||||
private String produceAddress;
|
||||
|
||||
@Schema(description = "黑名单过滤", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "黑名单过滤不能为空")
|
||||
private Boolean needBlacklistFilter;
|
||||
|
||||
@Schema(description = "是否启用库存限制")
|
||||
private Boolean enableStockLimit;
|
||||
|
||||
@Schema(description = "库存数量")
|
||||
private Integer stockNum;
|
||||
|
||||
@Schema(description = "库存报警数量")
|
||||
private Integer stockWarnNum;
|
||||
|
||||
@Schema(description = "生产备注")
|
||||
private String produceRemarks;
|
||||
|
||||
@Schema(description = "结算规则")
|
||||
private String settlementRules;
|
||||
|
||||
@Schema(description = "预估收益")
|
||||
private String estimatedRevenue;
|
||||
|
||||
@Schema(description = "上架")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "是否顶置")
|
||||
private Boolean isTop;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.dataobject.product;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 产品/渠道 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("haoka_product")
|
||||
@KeySequence("haoka_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HaoKaProductDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 运营商
|
||||
*
|
||||
* 枚举 {@link TODO haoka_operator 对应的类}
|
||||
*/
|
||||
private Integer operator;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String sku;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 产品类型
|
||||
*/
|
||||
private Long haokaProductTypeId;
|
||||
/**
|
||||
* 归属地
|
||||
*/
|
||||
private Integer belongAreaCode;
|
||||
/**
|
||||
* 产品渠道
|
||||
*/
|
||||
private Long haokaProductChannelId;
|
||||
/**
|
||||
* 产品限制
|
||||
*/
|
||||
private Long haokaProductLimitId;
|
||||
/**
|
||||
* 身份证号码验证
|
||||
*
|
||||
* 枚举 {@link TODO id_card_num_verify 对应的类}
|
||||
*/
|
||||
private Integer idCardNumVerify;
|
||||
/**
|
||||
* 身份证图片验证
|
||||
*
|
||||
* 枚举 {@link TODO id_card_img_verify 对应的类}
|
||||
*/
|
||||
private Integer idCardImgVerify;
|
||||
/**
|
||||
* 生产地址
|
||||
*/
|
||||
private String produceAddress;
|
||||
/**
|
||||
* 黑名单过滤
|
||||
*/
|
||||
private Boolean needBlacklistFilter;
|
||||
/**
|
||||
* 是否启用库存限制
|
||||
*/
|
||||
private Boolean enableStockLimit;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 库存报警数量
|
||||
*/
|
||||
private Integer stockWarnNum;
|
||||
/**
|
||||
* 生产备注
|
||||
*/
|
||||
private String produceRemarks;
|
||||
/**
|
||||
* 结算规则
|
||||
*/
|
||||
private String settlementRules;
|
||||
/**
|
||||
* 预估收益
|
||||
*/
|
||||
private String estimatedRevenue;
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
private Boolean onSale;
|
||||
/**
|
||||
* 是否顶置
|
||||
*/
|
||||
private Boolean isTop;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.mysql.product;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
|
||||
/**
|
||||
* 产品/渠道 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface HaoKaProductMapper extends BaseMapperX<HaoKaProductDO> {
|
||||
|
||||
default PageResult<HaoKaProductDO> selectPage(HaoKaProductPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<HaoKaProductDO>()
|
||||
.eqIfPresent(HaoKaProductDO::getOperator, reqVO.getOperator())
|
||||
.likeIfPresent(HaoKaProductDO::getSku, reqVO.getSku())
|
||||
.likeIfPresent(HaoKaProductDO::getName, reqVO.getName())
|
||||
.eqIfPresent(HaoKaProductDO::getHaokaProductTypeId, reqVO.getHaokaProductTypeId())
|
||||
.eqIfPresent(HaoKaProductDO::getBelongAreaCode, reqVO.getBelongAreaCode())
|
||||
.eqIfPresent(HaoKaProductDO::getHaokaProductChannelId, reqVO.getHaokaProductChannelId())
|
||||
.eqIfPresent(HaoKaProductDO::getHaokaProductLimitId, reqVO.getHaokaProductLimitId())
|
||||
.eqIfPresent(HaoKaProductDO::getIdCardNumVerify, reqVO.getIdCardNumVerify())
|
||||
.eqIfPresent(HaoKaProductDO::getIdCardImgVerify, reqVO.getIdCardImgVerify())
|
||||
.eqIfPresent(HaoKaProductDO::getProduceAddress, reqVO.getProduceAddress())
|
||||
.eqIfPresent(HaoKaProductDO::getNeedBlacklistFilter, reqVO.getNeedBlacklistFilter())
|
||||
.eqIfPresent(HaoKaProductDO::getEnableStockLimit, reqVO.getEnableStockLimit())
|
||||
.eqIfPresent(HaoKaProductDO::getStockNum, reqVO.getStockNum())
|
||||
.eqIfPresent(HaoKaProductDO::getStockWarnNum, reqVO.getStockWarnNum())
|
||||
.eqIfPresent(HaoKaProductDO::getProduceRemarks, reqVO.getProduceRemarks())
|
||||
.eqIfPresent(HaoKaProductDO::getSettlementRules, reqVO.getSettlementRules())
|
||||
.eqIfPresent(HaoKaProductDO::getEstimatedRevenue, reqVO.getEstimatedRevenue())
|
||||
.eqIfPresent(HaoKaProductDO::getOnSale, reqVO.getOnSale())
|
||||
.eqIfPresent(HaoKaProductDO::getIsTop, reqVO.getIsTop())
|
||||
.betweenIfPresent(HaoKaProductDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(HaoKaProductDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.product;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 产品/渠道 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface HaoKaProductService {
|
||||
|
||||
/**
|
||||
* 创建产品/渠道
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createHaoKaProduct(@Valid HaoKaProductSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产品/渠道
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateHaoKaProduct(@Valid HaoKaProductSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产品/渠道
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteHaoKaProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品/渠道
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产品/渠道
|
||||
*/
|
||||
HaoKaProductDO getHaoKaProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品/渠道分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产品/渠道分页
|
||||
*/
|
||||
PageResult<HaoKaProductDO> getHaoKaProductPage(HaoKaProductPageReqVO pageReqVO);
|
||||
|
||||
// ==================== 子表(产品对接上游配置) ====================
|
||||
|
||||
/**
|
||||
* 获得产品对接上游配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param haokaProductId 产品ID
|
||||
* @return 产品对接上游配置分页
|
||||
*/
|
||||
PageResult<SuperiorProductConfigDO> getSuperiorProductConfigPage(PageParam pageReqVO, Long haokaProductId);
|
||||
|
||||
/**
|
||||
* 创建产品对接上游配置
|
||||
*
|
||||
* @param superiorProductConfig 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSuperiorProductConfig(@Valid SuperiorProductConfigDO superiorProductConfig);
|
||||
|
||||
/**
|
||||
* 更新产品对接上游配置
|
||||
*
|
||||
* @param superiorProductConfig 更新信息
|
||||
*/
|
||||
void updateSuperiorProductConfig(@Valid SuperiorProductConfigDO superiorProductConfig);
|
||||
|
||||
/**
|
||||
* 删除产品对接上游配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSuperiorProductConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品对接上游配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产品对接上游配置
|
||||
*/
|
||||
SuperiorProductConfigDO getSuperiorProductConfig(Long id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.product;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.product.HaoKaProductMapper;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.superiorproductconfig.SuperiorProductConfigMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 产品/渠道 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class HaoKaProductServiceImpl implements HaoKaProductService {
|
||||
|
||||
@Resource
|
||||
private HaoKaProductMapper haoKaProductMapper;
|
||||
@Resource
|
||||
private SuperiorProductConfigMapper superiorProductConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createHaoKaProduct(HaoKaProductSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
HaoKaProductDO haoKaProduct = BeanUtils.toBean(createReqVO, HaoKaProductDO.class);
|
||||
haoKaProductMapper.insert(haoKaProduct);
|
||||
// 返回
|
||||
return haoKaProduct.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHaoKaProduct(HaoKaProductSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateHaoKaProductExists(updateReqVO.getId());
|
||||
// 更新
|
||||
HaoKaProductDO updateObj = BeanUtils.toBean(updateReqVO, HaoKaProductDO.class);
|
||||
haoKaProductMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteHaoKaProduct(Long id) {
|
||||
// 校验存在
|
||||
validateHaoKaProductExists(id);
|
||||
// 删除
|
||||
haoKaProductMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteSuperiorProductConfigByHaokaProductId(id);
|
||||
}
|
||||
|
||||
private void validateHaoKaProductExists(Long id) {
|
||||
if (haoKaProductMapper.selectById(id) == null) {
|
||||
throw exception(HAO_KA_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HaoKaProductDO getHaoKaProduct(Long id) {
|
||||
return haoKaProductMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HaoKaProductDO> getHaoKaProductPage(HaoKaProductPageReqVO pageReqVO) {
|
||||
return haoKaProductMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(产品对接上游配置) ====================
|
||||
|
||||
@Override
|
||||
public PageResult<SuperiorProductConfigDO> getSuperiorProductConfigPage(PageParam pageReqVO, Long haokaProductId) {
|
||||
return superiorProductConfigMapper.selectPageByHaokaProductId(pageReqVO, haokaProductId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createSuperiorProductConfig(SuperiorProductConfigDO superiorProductConfig) {
|
||||
superiorProductConfigMapper.insert(superiorProductConfig);
|
||||
return superiorProductConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSuperiorProductConfig(SuperiorProductConfigDO superiorProductConfig) {
|
||||
// 校验存在
|
||||
validateSuperiorProductConfigExists(superiorProductConfig.getId());
|
||||
// 更新
|
||||
superiorProductConfig.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
|
||||
superiorProductConfigMapper.updateById(superiorProductConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSuperiorProductConfig(Long id) {
|
||||
// 校验存在
|
||||
validateSuperiorProductConfigExists(id);
|
||||
// 删除
|
||||
superiorProductConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperiorProductConfigDO getSuperiorProductConfig(Long id) {
|
||||
return superiorProductConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void validateSuperiorProductConfigExists(Long id) {
|
||||
if (superiorProductConfigMapper.selectById(id) == null) {
|
||||
throw exception(SUPERIOR_PRODUCT_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSuperiorProductConfigByHaokaProductId(Long haokaProductId) {
|
||||
superiorProductConfigMapper.deleteByHaokaProductId(haokaProductId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.product;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.product.HaoKaProductMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link HaoKaProductServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(HaoKaProductServiceImpl.class)
|
||||
public class HaoKaProductServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private HaoKaProductServiceImpl haoKaProductService;
|
||||
|
||||
@Resource
|
||||
private HaoKaProductMapper haoKaProductMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateHaoKaProduct_success() {
|
||||
// 准备参数
|
||||
HaoKaProductSaveReqVO createReqVO = randomPojo(HaoKaProductSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long haoKaProductId = haoKaProductService.createHaoKaProduct(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(haoKaProductId);
|
||||
// 校验记录的属性是否正确
|
||||
HaoKaProductDO haoKaProduct = haoKaProductMapper.selectById(haoKaProductId);
|
||||
assertPojoEquals(createReqVO, haoKaProduct, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateHaoKaProduct_success() {
|
||||
// mock 数据
|
||||
HaoKaProductDO dbHaoKaProduct = randomPojo(HaoKaProductDO.class);
|
||||
haoKaProductMapper.insert(dbHaoKaProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
HaoKaProductSaveReqVO updateReqVO = randomPojo(HaoKaProductSaveReqVO.class, o -> {
|
||||
o.setId(dbHaoKaProduct.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
haoKaProductService.updateHaoKaProduct(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
HaoKaProductDO haoKaProduct = haoKaProductMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, haoKaProduct);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateHaoKaProduct_notExists() {
|
||||
// 准备参数
|
||||
HaoKaProductSaveReqVO updateReqVO = randomPojo(HaoKaProductSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> haoKaProductService.updateHaoKaProduct(updateReqVO), HAO_KA_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteHaoKaProduct_success() {
|
||||
// mock 数据
|
||||
HaoKaProductDO dbHaoKaProduct = randomPojo(HaoKaProductDO.class);
|
||||
haoKaProductMapper.insert(dbHaoKaProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbHaoKaProduct.getId();
|
||||
|
||||
// 调用
|
||||
haoKaProductService.deleteHaoKaProduct(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(haoKaProductMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteHaoKaProduct_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> haoKaProductService.deleteHaoKaProduct(id), HAO_KA_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetHaoKaProductPage() {
|
||||
// mock 数据
|
||||
HaoKaProductDO dbHaoKaProduct = randomPojo(HaoKaProductDO.class, o -> { // 等会查询到
|
||||
o.setOperator(null);
|
||||
o.setSku(null);
|
||||
o.setName(null);
|
||||
o.setHaokaProductTypeId(null);
|
||||
o.setBelongAreaCode(null);
|
||||
o.setHaokaProductChannelId(null);
|
||||
o.setHaokaProductLimitId(null);
|
||||
o.setIdCardNumVerify(null);
|
||||
o.setIdCardImgVerify(null);
|
||||
o.setProduceAddress(null);
|
||||
o.setNeedBlacklistFilter(null);
|
||||
o.setEnableStockLimit(null);
|
||||
o.setStockNum(null);
|
||||
o.setStockWarnNum(null);
|
||||
o.setProduceRemarks(null);
|
||||
o.setSettlementRules(null);
|
||||
o.setEstimatedRevenue(null);
|
||||
o.setOnSale(null);
|
||||
o.setIsTop(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
haoKaProductMapper.insert(dbHaoKaProduct);
|
||||
// 测试 operator 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setOperator(null)));
|
||||
// 测试 sku 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setSku(null)));
|
||||
// 测试 name 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setName(null)));
|
||||
// 测试 haokaProductTypeId 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setHaokaProductTypeId(null)));
|
||||
// 测试 belongAreaCode 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setBelongAreaCode(null)));
|
||||
// 测试 haokaProductChannelId 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setHaokaProductChannelId(null)));
|
||||
// 测试 haokaProductLimitId 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setHaokaProductLimitId(null)));
|
||||
// 测试 idCardNumVerify 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setIdCardNumVerify(null)));
|
||||
// 测试 idCardImgVerify 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setIdCardImgVerify(null)));
|
||||
// 测试 produceAddress 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setProduceAddress(null)));
|
||||
// 测试 needBlacklistFilter 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setNeedBlacklistFilter(null)));
|
||||
// 测试 enableStockLimit 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setEnableStockLimit(null)));
|
||||
// 测试 stockNum 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setStockNum(null)));
|
||||
// 测试 stockWarnNum 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setStockWarnNum(null)));
|
||||
// 测试 produceRemarks 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setProduceRemarks(null)));
|
||||
// 测试 settlementRules 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setSettlementRules(null)));
|
||||
// 测试 estimatedRevenue 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setEstimatedRevenue(null)));
|
||||
// 测试 onSale 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setOnSale(null)));
|
||||
// 测试 isTop 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setIsTop(null)));
|
||||
// 测试 createTime 不匹配
|
||||
haoKaProductMapper.insert(cloneIgnoreId(dbHaoKaProduct, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
HaoKaProductPageReqVO reqVO = new HaoKaProductPageReqVO();
|
||||
reqVO.setOperator(null);
|
||||
reqVO.setSku(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setHaokaProductTypeId(null);
|
||||
reqVO.setBelongAreaCode(null);
|
||||
reqVO.setHaokaProductChannelId(null);
|
||||
reqVO.setHaokaProductLimitId(null);
|
||||
reqVO.setIdCardNumVerify(null);
|
||||
reqVO.setIdCardImgVerify(null);
|
||||
reqVO.setProduceAddress(null);
|
||||
reqVO.setNeedBlacklistFilter(null);
|
||||
reqVO.setEnableStockLimit(null);
|
||||
reqVO.setStockNum(null);
|
||||
reqVO.setStockWarnNum(null);
|
||||
reqVO.setProduceRemarks(null);
|
||||
reqVO.setSettlementRules(null);
|
||||
reqVO.setEstimatedRevenue(null);
|
||||
reqVO.setOnSale(null);
|
||||
reqVO.setIsTop(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<HaoKaProductDO> pageResult = haoKaProductService.getHaoKaProductPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbHaoKaProduct, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue