Feat: Code gen V2 ok
This commit is contained in:
parent
ea0c6d3e33
commit
a42bf5ce1d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -23,4 +23,7 @@ public interface ErrorCodeConstants {
|
|||
ErrorCode PRODUCT_LIMIT_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品限制条件不存在");
|
||||
ErrorCode PRODUCT_LIMIT_AREA_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品区域配置不存在");
|
||||
ErrorCode PRODUCT_TYPE_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品类型不存在");
|
||||
|
||||
|
||||
ErrorCode HAO_KA_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品/渠道不存在");
|
||||
}
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
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.ProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.product.ProductService;
|
||||
|
||||
@Tag(name = "管理后台 - 产品/渠道")
|
||||
@RestController
|
||||
@RequestMapping("/haoka/product")
|
||||
@Validated
|
||||
public class ProductController {
|
||||
|
||||
@Resource
|
||||
private ProductService productService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产品/渠道")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:create')")
|
||||
public CommonResult<Long> createProduct(@Valid @RequestBody ProductSaveReqVO createReqVO) {
|
||||
return success(productService.createProduct(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品/渠道")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:update')")
|
||||
public CommonResult<Boolean> updateProduct(@Valid @RequestBody ProductSaveReqVO updateReqVO) {
|
||||
productService.updateProduct(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产品/渠道")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:delete')")
|
||||
public CommonResult<Boolean> deleteProduct(@RequestParam("id") Long id) {
|
||||
productService.deleteProduct(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产品/渠道")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:query')")
|
||||
public CommonResult<ProductRespVO> getProduct(@RequestParam("id") Long id) {
|
||||
ProductDO product = productService.getProduct(id);
|
||||
return success(BeanUtils.toBean(product, ProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产品/渠道分页")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:query')")
|
||||
public CommonResult<PageResult<ProductRespVO>> getProductPage(@Valid ProductPageReqVO pageReqVO) {
|
||||
PageResult<ProductDO> pageResult = productService.getProductPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产品/渠道 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportProductExcel(@Valid ProductPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProductDO> list = productService.getProductPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品/渠道.xls", "数据", ProductRespVO.class,
|
||||
BeanUtils.toBean(list, ProductRespVO.class));
|
||||
}
|
||||
|
||||
// ==================== 子表(产品对接上游配置) ====================
|
||||
|
||||
@GetMapping("/superior-product-config/page")
|
||||
@Operation(summary = "获得产品对接上游配置分页")
|
||||
@Parameter(name = "haokaProductId", description = "产品ID")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:query')")
|
||||
public CommonResult<PageResult<SuperiorProductConfigDO>> getSuperiorProductConfigPage(PageParam pageReqVO,
|
||||
@RequestParam("haokaProductId") Long haokaProductId) {
|
||||
return success(productService.getSuperiorProductConfigPage(pageReqVO, haokaProductId));
|
||||
}
|
||||
|
||||
@PostMapping("/superior-product-config/create")
|
||||
@Operation(summary = "创建产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:create')")
|
||||
public CommonResult<Long> createSuperiorProductConfig(@Valid @RequestBody SuperiorProductConfigDO superiorProductConfig) {
|
||||
return success(productService.createSuperiorProductConfig(superiorProductConfig));
|
||||
}
|
||||
|
||||
@PutMapping("/superior-product-config/update")
|
||||
@Operation(summary = "更新产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:update')")
|
||||
public CommonResult<Boolean> updateSuperiorProductConfig(@Valid @RequestBody SuperiorProductConfigDO superiorProductConfig) {
|
||||
productService.updateSuperiorProductConfig(superiorProductConfig);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/superior-product-config/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除产品对接上游配置")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:delete')")
|
||||
public CommonResult<Boolean> deleteSuperiorProductConfig(@RequestParam("id") Long id) {
|
||||
productService.deleteSuperiorProductConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/superior-product-config/get")
|
||||
@Operation(summary = "获得产品对接上游配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product:query')")
|
||||
public CommonResult<SuperiorProductConfigDO> getSuperiorProductConfig(@RequestParam("id") Long id) {
|
||||
return success(productService.getSuperiorProductConfig(id));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
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 ProductPageReqVO 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;
|
||||
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
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 ProductRespVO {
|
||||
|
||||
@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;
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
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 ProductSaveReqVO {
|
||||
|
||||
@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;
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ public class ProductChannelDO extends BaseDO {
|
|||
/**
|
||||
* 产品类型ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品类型名称
|
||||
|
@ -36,4 +36,4 @@ public class ProductChannelDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
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 ProductDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
@TableId
|
||||
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;
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ public class ProductLimitAreaDO extends BaseDO {
|
|||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品限制ID
|
||||
|
@ -48,4 +48,4 @@ public class ProductLimitAreaDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ProductLimitCardDO extends BaseDO {
|
|||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品限制ID
|
||||
|
@ -40,4 +40,4 @@ public class ProductLimitCardDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ProductLimitDO extends BaseDO {
|
|||
/**
|
||||
* 产品类型ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品类型名称
|
||||
|
@ -64,4 +64,4 @@ public class ProductLimitDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ProductTypeDO extends BaseDO {
|
|||
/**
|
||||
* 产品类型ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品类型名称
|
||||
|
@ -36,4 +36,4 @@ public class ProductTypeDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.mysql.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.ProductLimitCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.ProductLimitAreaDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.ProductLimitCardDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
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.ProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
|
||||
/**
|
||||
* 产品/渠道 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductMapper extends BaseMapperX<ProductDO> {
|
||||
|
||||
default PageResult<ProductDO> selectPage(ProductPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductDO>()
|
||||
.eqIfPresent(ProductDO::getOperator, reqVO.getOperator())
|
||||
.likeIfPresent(ProductDO::getSku, reqVO.getSku())
|
||||
.likeIfPresent(ProductDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ProductDO::getHaokaProductTypeId, reqVO.getHaokaProductTypeId())
|
||||
.eqIfPresent(ProductDO::getBelongAreaCode, reqVO.getBelongAreaCode())
|
||||
.eqIfPresent(ProductDO::getHaokaProductChannelId, reqVO.getHaokaProductChannelId())
|
||||
.eqIfPresent(ProductDO::getHaokaProductLimitId, reqVO.getHaokaProductLimitId())
|
||||
.eqIfPresent(ProductDO::getIdCardNumVerify, reqVO.getIdCardNumVerify())
|
||||
.eqIfPresent(ProductDO::getIdCardImgVerify, reqVO.getIdCardImgVerify())
|
||||
.eqIfPresent(ProductDO::getProduceAddress, reqVO.getProduceAddress())
|
||||
.eqIfPresent(ProductDO::getNeedBlacklistFilter, reqVO.getNeedBlacklistFilter())
|
||||
.eqIfPresent(ProductDO::getEnableStockLimit, reqVO.getEnableStockLimit())
|
||||
.eqIfPresent(ProductDO::getStockNum, reqVO.getStockNum())
|
||||
.eqIfPresent(ProductDO::getStockWarnNum, reqVO.getStockWarnNum())
|
||||
.eqIfPresent(ProductDO::getProduceRemarks, reqVO.getProduceRemarks())
|
||||
.eqIfPresent(ProductDO::getSettlementRules, reqVO.getSettlementRules())
|
||||
.eqIfPresent(ProductDO::getEstimatedRevenue, reqVO.getEstimatedRevenue())
|
||||
.eqIfPresent(ProductDO::getOnSale, reqVO.getOnSale())
|
||||
.eqIfPresent(ProductDO::getIsTop, reqVO.getIsTop())
|
||||
.betweenIfPresent(ProductDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductDO::getId));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
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.ProductDO;
|
||||
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 ProductService {
|
||||
|
||||
/**
|
||||
* 创建产品/渠道
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProduct(@Valid ProductSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产品/渠道
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProduct(@Valid ProductSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产品/渠道
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品/渠道
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产品/渠道
|
||||
*/
|
||||
ProductDO getProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品/渠道分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产品/渠道分页
|
||||
*/
|
||||
PageResult<ProductDO> getProductPage(ProductPageReqVO 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);
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
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.ProductDO;
|
||||
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.ProductMapper;
|
||||
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 ProductServiceImpl implements ProductService {
|
||||
|
||||
@Resource
|
||||
private ProductMapper productMapper;
|
||||
@Resource
|
||||
private SuperiorProductConfigMapper superiorProductConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createProduct(ProductSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProductDO product = BeanUtils.toBean(createReqVO, ProductDO.class);
|
||||
productMapper.insert(product);
|
||||
// 返回
|
||||
return product.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProduct(ProductSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProductExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProductDO updateObj = BeanUtils.toBean(updateReqVO, ProductDO.class);
|
||||
productMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteProduct(Long id) {
|
||||
// 校验存在
|
||||
validateProductExists(id);
|
||||
// 删除
|
||||
productMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteSuperiorProductConfigByHaokaProductId(id);
|
||||
}
|
||||
|
||||
private void validateProductExists(Long id) {
|
||||
if (productMapper.selectById(id) == null) {
|
||||
throw exception(PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductDO getProduct(Long id) {
|
||||
return productMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProductDO> getProductPage(ProductPageReqVO pageReqVO) {
|
||||
return productMapper.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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.haoka.dal.mysql.product.ProductMapper">
|
||||
<mapper namespace="cn.iocoder.yudao.module.haoka.dal.mysql.product.HaoKaProductMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
@ -1,206 +0,0 @@
|
|||
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.ProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.product.ProductMapper;
|
||||
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 ProductServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(ProductServiceImpl.class)
|
||||
public class ProductServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private ProductServiceImpl productService;
|
||||
|
||||
@Resource
|
||||
private ProductMapper productMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateProduct_success() {
|
||||
// 准备参数
|
||||
ProductSaveReqVO createReqVO = randomPojo(ProductSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long productId = productService.createProduct(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(productId);
|
||||
// 校验记录的属性是否正确
|
||||
ProductDO product = productMapper.selectById(productId);
|
||||
assertPojoEquals(createReqVO, product, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateProduct_success() {
|
||||
// mock 数据
|
||||
ProductDO dbProduct = randomPojo(ProductDO.class);
|
||||
productMapper.insert(dbProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
ProductSaveReqVO updateReqVO = randomPojo(ProductSaveReqVO.class, o -> {
|
||||
o.setId(dbProduct.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
productService.updateProduct(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
ProductDO product = productMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, product);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateProduct_notExists() {
|
||||
// 准备参数
|
||||
ProductSaveReqVO updateReqVO = randomPojo(ProductSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> productService.updateProduct(updateReqVO), PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteProduct_success() {
|
||||
// mock 数据
|
||||
ProductDO dbProduct = randomPojo(ProductDO.class);
|
||||
productMapper.insert(dbProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbProduct.getId();
|
||||
|
||||
// 调用
|
||||
productService.deleteProduct(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(productMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteProduct_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> productService.deleteProduct(id), PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetProductPage() {
|
||||
// mock 数据
|
||||
ProductDO dbProduct = randomPojo(ProductDO.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);
|
||||
});
|
||||
productMapper.insert(dbProduct);
|
||||
// 测试 operator 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setOperator(null)));
|
||||
// 测试 sku 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setSku(null)));
|
||||
// 测试 name 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setName(null)));
|
||||
// 测试 haokaProductTypeId 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setHaokaProductTypeId(null)));
|
||||
// 测试 belongAreaCode 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setBelongAreaCode(null)));
|
||||
// 测试 haokaProductChannelId 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setHaokaProductChannelId(null)));
|
||||
// 测试 haokaProductLimitId 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setHaokaProductLimitId(null)));
|
||||
// 测试 idCardNumVerify 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setIdCardNumVerify(null)));
|
||||
// 测试 idCardImgVerify 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setIdCardImgVerify(null)));
|
||||
// 测试 produceAddress 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setProduceAddress(null)));
|
||||
// 测试 needBlacklistFilter 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setNeedBlacklistFilter(null)));
|
||||
// 测试 enableStockLimit 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setEnableStockLimit(null)));
|
||||
// 测试 stockNum 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setStockNum(null)));
|
||||
// 测试 stockWarnNum 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setStockWarnNum(null)));
|
||||
// 测试 produceRemarks 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setProduceRemarks(null)));
|
||||
// 测试 settlementRules 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setSettlementRules(null)));
|
||||
// 测试 estimatedRevenue 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setEstimatedRevenue(null)));
|
||||
// 测试 onSale 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setOnSale(null)));
|
||||
// 测试 isTop 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setIsTop(null)));
|
||||
// 测试 createTime 不匹配
|
||||
productMapper.insert(cloneIgnoreId(dbProduct, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
ProductPageReqVO reqVO = new ProductPageReqVO();
|
||||
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<ProductDO> pageResult = productService.getProductPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbProduct, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +1,31 @@
|
|||
-- 菜单 SQL
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status, component_name
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道管理', '', 2, 0, 2912,
|
||||
'product', '', 'haoka/product/index', 0, 'Product'
|
||||
);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status, component_name)
|
||||
VALUES ('产品/渠道管理', '', 2, 0, 2912,
|
||||
'hao-ka-product', '', 'haoka/product/index', 0, 'HaoKaProduct');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道查询', 'haoka:product:query', 3, 1, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道创建', 'haoka:product:create', 3, 2, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道更新', 'haoka:product:update', 3, 3, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道删除', 'haoka:product:delete', 3, 4, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(
|
||||
name, permission, type, sort, parent_id,
|
||||
path, icon, component, status
|
||||
)
|
||||
VALUES (
|
||||
'产品/渠道导出', 'haoka:product:export', 3, 5, @parentId,
|
||||
'', '', '', 0
|
||||
);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('产品/渠道查询', 'haoka:hao-ka-product:query', 3, 1, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('产品/渠道创建', 'haoka:hao-ka-product:create', 3, 2, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('产品/渠道更新', 'haoka:hao-ka-product:update', 3, 3, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('产品/渠道删除', 'haoka:hao-ka-product:delete', 3, 4, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('产品/渠道导出', 'haoka:hao-ka-product:export', 3, 5, @parentId,
|
||||
'', '', '', 0);
|
||||
|
|
|
@ -15,8 +15,8 @@ CREATE TABLE `haoka_product`
|
|||
`need_blacklist_filter` bit(1) NOT NULL DEFAULT b'1' COMMENT '黑名单过滤',
|
||||
|
||||
`enable_stock_limit` bit(1) COMMENT '是否启用库存限制',
|
||||
`stock_num` int(11) NOT NULL COMMENT '库存数量',
|
||||
`stock_warn_num` int(11) NOT NULL COMMENT '库存报警数量',
|
||||
`stock_num` int(11) COMMENT '库存数量',
|
||||
`stock_warn_num` int(11) COMMENT '库存报警数量',
|
||||
`produce_remarks` text COMMENT '生产备注',
|
||||
`settlement_rules` text COMMENT '结算规则',
|
||||
`estimated_revenue` text COMMENT '预估收益',
|
||||
|
|
Loading…
Reference in New Issue