Feat: Code gen V3 ok
This commit is contained in:
parent
97e3380e3a
commit
0fe9c39bb3
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -26,4 +26,6 @@ public interface ErrorCodeConstants {
|
|||
|
||||
|
||||
ErrorCode HAO_KA_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_005, "产品/渠道不存在");
|
||||
|
||||
ErrorCode ON_SALE_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_021, "在售产品不存在");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct;
|
||||
|
||||
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.onsaleproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
|
||||
@Tag(name = "管理后台 - 在售产品")
|
||||
@RestController
|
||||
@RequestMapping("/haoka/on-sale-product")
|
||||
@Validated
|
||||
public class OnSaleProductController {
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建在售产品")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:create')")
|
||||
public CommonResult<Long> createOnSaleProduct(@Valid @RequestBody OnSaleProductSaveReqVO createReqVO) {
|
||||
return success(onSaleProductService.createOnSaleProduct(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新在售产品")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:update')")
|
||||
public CommonResult<Boolean> updateOnSaleProduct(@Valid @RequestBody OnSaleProductSaveReqVO updateReqVO) {
|
||||
onSaleProductService.updateOnSaleProduct(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除在售产品")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:delete')")
|
||||
public CommonResult<Boolean> deleteOnSaleProduct(@RequestParam("id") Long id) {
|
||||
onSaleProductService.deleteOnSaleProduct(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得在售产品")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:query')")
|
||||
public CommonResult<OnSaleProductRespVO> getOnSaleProduct(@RequestParam("id") Long id) {
|
||||
OnSaleProductDO onSaleProduct = onSaleProductService.getOnSaleProduct(id);
|
||||
return success(BeanUtils.toBean(onSaleProduct, OnSaleProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得在售产品分页")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:query')")
|
||||
public CommonResult<PageResult<OnSaleProductRespVO>> getOnSaleProductPage(@Valid OnSaleProductPageReqVO pageReqVO) {
|
||||
PageResult<OnSaleProductDO> pageResult = onSaleProductService.getOnSaleProductPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OnSaleProductRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出在售产品 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:on-sale-product:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOnSaleProductExcel(@Valid OnSaleProductPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OnSaleProductDO> list = onSaleProductService.getOnSaleProductPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "在售产品.xls", "数据", OnSaleProductRespVO.class,
|
||||
BeanUtils.toBean(list, OnSaleProductRespVO.class));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.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 OnSaleProductPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "产品", example = "17875")
|
||||
private Long parentProductId;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商家编码")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "上架")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.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 OnSaleProductRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10064")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "17875")
|
||||
@ExcelProperty("产品")
|
||||
private Long parentProductId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("商品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商家编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("商家编码")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "商品注意点")
|
||||
@ExcelProperty("商品注意点")
|
||||
private String precautions;
|
||||
|
||||
@Schema(description = "卖点,使用逗号隔开")
|
||||
@ExcelProperty("卖点,使用逗号隔开")
|
||||
private String sellingPoints;
|
||||
|
||||
@Schema(description = "承接佣金规则")
|
||||
@ExcelProperty("承接佣金规则")
|
||||
private String acceptanceRules;
|
||||
|
||||
@Schema(description = "结算要求")
|
||||
@ExcelProperty("结算要求")
|
||||
private String settlementRequirement;
|
||||
|
||||
@Schema(description = "佣金结算规则(内部)")
|
||||
@ExcelProperty("佣金结算规则(内部)")
|
||||
private String settlementRulesInner;
|
||||
|
||||
@Schema(description = "销售页上传照片", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "销售页上传照片", converter = DictConvert.class)
|
||||
@DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Boolean needSaleUploadImage;
|
||||
|
||||
@Schema(description = "产品主图")
|
||||
@ExcelProperty("产品主图")
|
||||
private String mainImg;
|
||||
|
||||
@Schema(description = "商品分享图")
|
||||
@ExcelProperty("商品分享图")
|
||||
private String shareImg;
|
||||
|
||||
@Schema(description = "商品详情")
|
||||
@ExcelProperty("商品详情")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "其他备注")
|
||||
@ExcelProperty("其他备注")
|
||||
private String otherNote;
|
||||
|
||||
@Schema(description = "月租")
|
||||
@ExcelProperty("月租")
|
||||
private String monthlyRent;
|
||||
|
||||
@Schema(description = "语言通话")
|
||||
@ExcelProperty("语言通话")
|
||||
private String voiceCall;
|
||||
|
||||
@Schema(description = "通用流量")
|
||||
@ExcelProperty("通用流量")
|
||||
private String universalTraffic;
|
||||
|
||||
@Schema(description = "定向流量")
|
||||
@ExcelProperty("定向流量")
|
||||
private String targetedTraffic;
|
||||
|
||||
@Schema(description = "归属地")
|
||||
@ExcelProperty("归属地")
|
||||
private String belongArea;
|
||||
|
||||
@Schema(description = "套餐详情")
|
||||
@ExcelProperty("套餐详情")
|
||||
private String packageDetails;
|
||||
|
||||
@Schema(description = "套餐优惠期")
|
||||
@ExcelProperty("套餐优惠期")
|
||||
private Integer packageDiscountPeriod;
|
||||
|
||||
@Schema(description = "优惠期起始时间:当月,次月,三月")
|
||||
@ExcelProperty("优惠期起始时间:当月,次月,三月")
|
||||
private Integer packageDiscountPeriodStart;
|
||||
|
||||
@Schema(description = "上架", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("上架")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "是否顶置")
|
||||
@ExcelProperty("是否顶置")
|
||||
private Boolean isTop;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 在售产品新增/修改 Request VO")
|
||||
@Data
|
||||
public class OnSaleProductSaveReqVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10064")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "17875")
|
||||
@NotNull(message = "产品不能为空")
|
||||
private Long parentProductId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商家编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "商家编码不能为空")
|
||||
private String sku;
|
||||
|
||||
@Schema(description = "商品注意点")
|
||||
private String precautions;
|
||||
|
||||
@Schema(description = "卖点,使用逗号隔开")
|
||||
private String sellingPoints;
|
||||
|
||||
@Schema(description = "承接佣金规则")
|
||||
private String acceptanceRules;
|
||||
|
||||
@Schema(description = "结算要求")
|
||||
private String settlementRequirement;
|
||||
|
||||
@Schema(description = "佣金结算规则(内部)")
|
||||
private String settlementRulesInner;
|
||||
|
||||
@Schema(description = "销售页上传照片", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "销售页上传照片不能为空")
|
||||
private Boolean needSaleUploadImage;
|
||||
|
||||
@Schema(description = "产品主图")
|
||||
private String mainImg;
|
||||
|
||||
@Schema(description = "商品分享图")
|
||||
private String shareImg;
|
||||
|
||||
@Schema(description = "商品详情")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "其他备注")
|
||||
private String otherNote;
|
||||
|
||||
@Schema(description = "月租")
|
||||
private String monthlyRent;
|
||||
|
||||
@Schema(description = "语言通话")
|
||||
private String voiceCall;
|
||||
|
||||
@Schema(description = "通用流量")
|
||||
private String universalTraffic;
|
||||
|
||||
@Schema(description = "定向流量")
|
||||
private String targetedTraffic;
|
||||
|
||||
@Schema(description = "归属地")
|
||||
private String belongArea;
|
||||
|
||||
@Schema(description = "套餐详情")
|
||||
private String packageDetails;
|
||||
|
||||
@Schema(description = "套餐优惠期")
|
||||
private Integer packageDiscountPeriod;
|
||||
|
||||
@Schema(description = "优惠期起始时间:当月,次月,三月")
|
||||
private Integer packageDiscountPeriodStart;
|
||||
|
||||
@Schema(description = "上架", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "上架不能为空")
|
||||
private Boolean onSale;
|
||||
|
||||
@Schema(description = "是否顶置")
|
||||
private Boolean isTop;
|
||||
|
||||
}
|
|
@ -181,6 +181,16 @@ public class SuperiorApiController {
|
|||
return success(superiorApiService.getSuperiorApiSkuConfig(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/superior-api-sku-config/getAll")
|
||||
@Operation(summary = "获得上游API接口SKU要求配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:superior-api-sku-config:query')")
|
||||
public CommonResult<List<SuperiorApiSkuConfigRespVO>> getAllSuperiorApiSkuConfig(@RequestParam("superiorApiId") Long superiorApiId) {
|
||||
List<SuperiorApiSkuConfigDO> superiorApiSkuConfig = superiorApiService.getAllSuperiorApiSkuConfig(superiorApiId);
|
||||
return success(BeanUtils.toBean(superiorApiSkuConfig, SuperiorApiSkuConfigRespVO.class));
|
||||
}
|
||||
|
||||
// ==================== 子表(产品对接上游配置) ====================
|
||||
|
||||
@GetMapping("/superior-product-config/page")
|
||||
|
@ -224,4 +234,4 @@ public class SuperiorApiController {
|
|||
return success(superiorApiService.getSuperiorProductConfig(id));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,4 +92,4 @@ public class SuperiorApiSkuConfigController {
|
|||
BeanUtils.toBean(list, SuperiorApiSkuConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -18,6 +19,9 @@ public class SuperiorProductConfigPageReqVO extends PageParam {
|
|||
@Schema(description = "上游接口ID", example = "31755")
|
||||
private Long haokaSuperiorApiId;
|
||||
|
||||
@Schema(description = "对应上游编码", example = "31755")
|
||||
private String superiorCode;
|
||||
|
||||
@Schema(description = "产品ID", example = "320")
|
||||
private Long haokaProductId;
|
||||
|
||||
|
@ -34,4 +38,4 @@ public class SuperiorProductConfigPageReqVO extends PageParam {
|
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ public class SuperiorProductConfigRespVO {
|
|||
@ExcelProperty("上游接口ID")
|
||||
private Long haokaSuperiorApiId;
|
||||
|
||||
@Schema(description = "对应上游编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "31755")
|
||||
@ExcelProperty("对应上游编码")
|
||||
private String superiorCode;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "320")
|
||||
@ExcelProperty("产品ID")
|
||||
private Long haokaProductId;
|
||||
|
@ -43,4 +47,4 @@ public class SuperiorProductConfigRespVO {
|
|||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ public class SuperiorProductConfigSaveReqVO {
|
|||
@NotNull(message = "上游接口ID不能为空")
|
||||
private Long haokaSuperiorApiId;
|
||||
|
||||
@Schema(description = "对应上游编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "31755")
|
||||
@NotNull(message = "上游编码不能为空")
|
||||
private String superiorCode;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "320")
|
||||
@NotNull(message = "产品ID不能为空")
|
||||
private Long haokaProductId;
|
||||
|
@ -31,4 +35,4 @@ public class SuperiorProductConfigSaveReqVO {
|
|||
@Schema(description = "说明")
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct;
|
||||
|
||||
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_on_sale_product")
|
||||
@KeySequence("haoka_on_sale_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OnSaleProductDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 产品
|
||||
*/
|
||||
private Long parentProductId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商家编码
|
||||
*/
|
||||
private String sku;
|
||||
/**
|
||||
* 商品注意点
|
||||
*/
|
||||
private String precautions;
|
||||
/**
|
||||
* 卖点,使用逗号隔开
|
||||
*/
|
||||
private String sellingPoints;
|
||||
/**
|
||||
* 承接佣金规则
|
||||
*/
|
||||
private String acceptanceRules;
|
||||
/**
|
||||
* 结算要求
|
||||
*/
|
||||
private String settlementRequirement;
|
||||
/**
|
||||
* 佣金结算规则(内部)
|
||||
*/
|
||||
private String settlementRulesInner;
|
||||
/**
|
||||
* 销售页上传照片
|
||||
*
|
||||
* 枚举 {@link TODO infra_boolean_string 对应的类}
|
||||
*/
|
||||
private Boolean needSaleUploadImage;
|
||||
/**
|
||||
* 产品主图
|
||||
*/
|
||||
private String mainImg;
|
||||
/**
|
||||
* 商品分享图
|
||||
*/
|
||||
private String shareImg;
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
private String detail;
|
||||
/**
|
||||
* 其他备注
|
||||
*/
|
||||
private String otherNote;
|
||||
/**
|
||||
* 月租
|
||||
*/
|
||||
private String monthlyRent;
|
||||
/**
|
||||
* 语言通话
|
||||
*/
|
||||
private String voiceCall;
|
||||
/**
|
||||
* 通用流量
|
||||
*/
|
||||
private String universalTraffic;
|
||||
/**
|
||||
* 定向流量
|
||||
*/
|
||||
private String targetedTraffic;
|
||||
/**
|
||||
* 归属地
|
||||
*/
|
||||
private String belongArea;
|
||||
/**
|
||||
* 套餐详情
|
||||
*/
|
||||
private String packageDetails;
|
||||
/**
|
||||
* 套餐优惠期
|
||||
*/
|
||||
private Integer packageDiscountPeriod;
|
||||
/**
|
||||
* 优惠期起始时间:当月,次月,三月
|
||||
*/
|
||||
private Integer packageDiscountPeriodStart;
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
private Boolean onSale;
|
||||
/**
|
||||
* 是否顶置
|
||||
*/
|
||||
private Boolean isTop;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -31,6 +32,11 @@ public class SuperiorProductConfigDO extends BaseDO {
|
|||
* 上游接口ID
|
||||
*/
|
||||
private Long haokaSuperiorApiId;
|
||||
/**
|
||||
* 对应上游编码
|
||||
*/
|
||||
private String superiorCode;
|
||||
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.mysql.onsaleproduct;
|
||||
|
||||
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.onsaleproduct.OnSaleProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.*;
|
||||
|
||||
/**
|
||||
* 在售产品 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnSaleProductMapper extends BaseMapperX<OnSaleProductDO> {
|
||||
|
||||
default PageResult<OnSaleProductDO> selectPage(OnSaleProductPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OnSaleProductDO>()
|
||||
.eqIfPresent(OnSaleProductDO::getParentProductId, reqVO.getParentProductId())
|
||||
.likeIfPresent(OnSaleProductDO::getName, reqVO.getName())
|
||||
.likeIfPresent(OnSaleProductDO::getSku, reqVO.getSku())
|
||||
.eqIfPresent(OnSaleProductDO::getOnSale, reqVO.getOnSale())
|
||||
.betweenIfPresent(OnSaleProductDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(OnSaleProductDO::getId));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.mysql.superiorproductconfig;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
|
@ -22,6 +20,7 @@ public interface SuperiorProductConfigMapper extends BaseMapperX<SuperiorProduct
|
|||
return selectPage(reqVO, new LambdaQueryWrapperX<SuperiorProductConfigDO>()
|
||||
.eqIfPresent(SuperiorProductConfigDO::getHaokaSuperiorApiId, reqVO.getHaokaSuperiorApiId())
|
||||
.eqIfPresent(SuperiorProductConfigDO::getHaokaProductId, reqVO.getHaokaProductId())
|
||||
.likeIfPresent(SuperiorProductConfigDO::getSuperiorCode, reqVO.getSuperiorCode())
|
||||
.eqIfPresent(SuperiorProductConfigDO::getIsConfined, reqVO.getIsConfined())
|
||||
.eqIfPresent(SuperiorProductConfigDO::getConfig, reqVO.getConfig())
|
||||
.eqIfPresent(SuperiorProductConfigDO::getRemarks, reqVO.getRemarks())
|
||||
|
@ -46,7 +45,7 @@ public interface SuperiorProductConfigMapper extends BaseMapperX<SuperiorProduct
|
|||
.orderByDesc(SuperiorProductConfigDO::getId));
|
||||
}
|
||||
|
||||
default int deleteByHaokaProductId(Long haokaProductId) {
|
||||
return delete(SuperiorProductConfigDO::getHaokaProductId, haokaProductId);
|
||||
default void deleteByHaokaProductId(Long haokaProductId) {
|
||||
delete(SuperiorProductConfigDO::getHaokaProductId, haokaProductId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.onsaleproduct;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 在售产品 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface OnSaleProductService {
|
||||
|
||||
/**
|
||||
* 创建在售产品
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOnSaleProduct(@Valid OnSaleProductSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新在售产品
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateOnSaleProduct(@Valid OnSaleProductSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除在售产品
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOnSaleProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得在售产品
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 在售产品
|
||||
*/
|
||||
OnSaleProductDO getOnSaleProduct(Long id);
|
||||
|
||||
/**
|
||||
* 获得在售产品分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 在售产品分页
|
||||
*/
|
||||
PageResult<OnSaleProductDO> getOnSaleProductPage(OnSaleProductPageReqVO pageReqVO);
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.onsaleproduct;
|
||||
|
||||
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.onsaleproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO;
|
||||
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.onsaleproduct.OnSaleProductMapper;
|
||||
|
||||
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 OnSaleProductServiceImpl implements OnSaleProductService {
|
||||
|
||||
@Resource
|
||||
private OnSaleProductMapper onSaleProductMapper;
|
||||
|
||||
@Override
|
||||
public Long createOnSaleProduct(OnSaleProductSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
OnSaleProductDO onSaleProduct = BeanUtils.toBean(createReqVO, OnSaleProductDO.class);
|
||||
onSaleProductMapper.insert(onSaleProduct);
|
||||
// 返回
|
||||
return onSaleProduct.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnSaleProduct(OnSaleProductSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateOnSaleProductExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OnSaleProductDO updateObj = BeanUtils.toBean(updateReqVO, OnSaleProductDO.class);
|
||||
onSaleProductMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOnSaleProduct(Long id) {
|
||||
// 校验存在
|
||||
validateOnSaleProductExists(id);
|
||||
// 删除
|
||||
onSaleProductMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateOnSaleProductExists(Long id) {
|
||||
if (onSaleProductMapper.selectById(id) == null) {
|
||||
throw exception(ON_SALE_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnSaleProductDO getOnSaleProduct(Long id) {
|
||||
return onSaleProductMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OnSaleProductDO> getOnSaleProductPage(OnSaleProductPageReqVO pageReqVO) {
|
||||
return onSaleProductMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
|
@ -178,4 +178,5 @@ public interface SuperiorApiService {
|
|||
*/
|
||||
SuperiorProductConfigDO getSuperiorProductConfig(Long id);
|
||||
|
||||
}
|
||||
List<SuperiorApiSkuConfigDO> getAllSuperiorApiSkuConfig(Long superiorApiId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.superiorapi;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -214,6 +215,12 @@ public class SuperiorApiServiceImpl implements SuperiorApiService {
|
|||
return superiorProductConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SuperiorApiSkuConfigDO> getAllSuperiorApiSkuConfig(Long superiorApiId) {
|
||||
return superiorApiSkuConfigMapper.selectList(new LambdaQueryWrapperX<SuperiorApiSkuConfigDO>()
|
||||
.eqIfPresent(SuperiorApiSkuConfigDO::getHaokaSuperiorApiId, superiorApiId));
|
||||
}
|
||||
|
||||
private void validateSuperiorProductConfigExists(Long id) {
|
||||
if (superiorProductConfigMapper.selectById(id) == null) {
|
||||
throw exception(SUPERIOR_PRODUCT_CONFIG_NOT_EXISTS);
|
||||
|
|
|
@ -52,4 +52,5 @@ public interface SuperiorApiSkuConfigService {
|
|||
*/
|
||||
PageResult<SuperiorApiSkuConfigDO> getSuperiorApiSkuConfigPage(SuperiorApiSkuConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
List<SuperiorApiSkuConfigDO> getAllSuperiorApiSkuConfig(Long superiorApiId);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.superiorapi;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.superiorapi.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiSkuConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
@ -71,4 +74,10 @@ public class SuperiorApiSkuConfigServiceImpl implements SuperiorApiSkuConfigServ
|
|||
return superiorApiSkuConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<SuperiorApiSkuConfigDO> getAllSuperiorApiSkuConfig(Long superiorApiId) {
|
||||
return superiorApiSkuConfigMapper.selectList(new LambdaQueryWrapperX<SuperiorApiSkuConfigDO>()
|
||||
.eqIfPresent(SuperiorApiSkuConfigDO::getHaokaSuperiorApiId, superiorApiId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?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.onsaleproduct.OnSaleProductMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,146 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.onsaleproduct;
|
||||
|
||||
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.onsaleproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.onsaleproduct.OnSaleProductDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.mysql.onsaleproduct.OnSaleProductMapper;
|
||||
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 OnSaleProductServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(OnSaleProductServiceImpl.class)
|
||||
public class OnSaleProductServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private OnSaleProductServiceImpl onSaleProductService;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductMapper onSaleProductMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateOnSaleProduct_success() {
|
||||
// 准备参数
|
||||
OnSaleProductSaveReqVO createReqVO = randomPojo(OnSaleProductSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long onSaleProductId = onSaleProductService.createOnSaleProduct(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(onSaleProductId);
|
||||
// 校验记录的属性是否正确
|
||||
OnSaleProductDO onSaleProduct = onSaleProductMapper.selectById(onSaleProductId);
|
||||
assertPojoEquals(createReqVO, onSaleProduct, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOnSaleProduct_success() {
|
||||
// mock 数据
|
||||
OnSaleProductDO dbOnSaleProduct = randomPojo(OnSaleProductDO.class);
|
||||
onSaleProductMapper.insert(dbOnSaleProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
OnSaleProductSaveReqVO updateReqVO = randomPojo(OnSaleProductSaveReqVO.class, o -> {
|
||||
o.setId(dbOnSaleProduct.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
onSaleProductService.updateOnSaleProduct(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
OnSaleProductDO onSaleProduct = onSaleProductMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, onSaleProduct);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOnSaleProduct_notExists() {
|
||||
// 准备参数
|
||||
OnSaleProductSaveReqVO updateReqVO = randomPojo(OnSaleProductSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> onSaleProductService.updateOnSaleProduct(updateReqVO), ON_SALE_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOnSaleProduct_success() {
|
||||
// mock 数据
|
||||
OnSaleProductDO dbOnSaleProduct = randomPojo(OnSaleProductDO.class);
|
||||
onSaleProductMapper.insert(dbOnSaleProduct);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbOnSaleProduct.getId();
|
||||
|
||||
// 调用
|
||||
onSaleProductService.deleteOnSaleProduct(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(onSaleProductMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOnSaleProduct_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> onSaleProductService.deleteOnSaleProduct(id), ON_SALE_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetOnSaleProductPage() {
|
||||
// mock 数据
|
||||
OnSaleProductDO dbOnSaleProduct = randomPojo(OnSaleProductDO.class, o -> { // 等会查询到
|
||||
o.setParentProductId(null);
|
||||
o.setName(null);
|
||||
o.setSku(null);
|
||||
o.setOnSale(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
onSaleProductMapper.insert(dbOnSaleProduct);
|
||||
// 测试 parentProductId 不匹配
|
||||
onSaleProductMapper.insert(cloneIgnoreId(dbOnSaleProduct, o -> o.setParentProductId(null)));
|
||||
// 测试 name 不匹配
|
||||
onSaleProductMapper.insert(cloneIgnoreId(dbOnSaleProduct, o -> o.setName(null)));
|
||||
// 测试 sku 不匹配
|
||||
onSaleProductMapper.insert(cloneIgnoreId(dbOnSaleProduct, o -> o.setSku(null)));
|
||||
// 测试 onSale 不匹配
|
||||
onSaleProductMapper.insert(cloneIgnoreId(dbOnSaleProduct, o -> o.setOnSale(null)));
|
||||
// 测试 createTime 不匹配
|
||||
onSaleProductMapper.insert(cloneIgnoreId(dbOnSaleProduct, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
OnSaleProductPageReqVO reqVO = new OnSaleProductPageReqVO();
|
||||
reqVO.setParentProductId(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setSku(null);
|
||||
reqVO.setOnSale(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<OnSaleProductDO> pageResult = onSaleProductService.getOnSaleProductPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbOnSaleProduct, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
|
@ -3,18 +3,19 @@ CREATE TABLE `haoka_superior_product_config`
|
|||
(
|
||||
`id` bigint(20) NOT NULL PRIMARY KEY COMMENT 'ID',
|
||||
`haoka_superior_api_id` bigint(20) NOT NULL COMMENT '上游接口ID',
|
||||
`superior_code` varchar(512) NOT NULL COMMENT '对应上游编码',
|
||||
`haoka_product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||||
|
||||
`is_confined` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已配置',
|
||||
`config` text NOT NULL COMMENT '值',
|
||||
`remarks` text COMMENT '说明',
|
||||
`is_confined` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已配置',
|
||||
`config` text NOT NULL COMMENT '值',
|
||||
`remarks` text COMMENT '说明',
|
||||
|
||||
`dept_id` bigint(20) COMMENT '部门ID',
|
||||
`creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) NOT NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) NOT NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
UNIQUE (haoka_superior_api_id, haoka_product_id)
|
||||
) COMMENT = '产品对接上游配置';
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
DROP TABLE IF EXISTS `haoka_on_sale_product`;
|
||||
CREATE TABLE `haoka_on_sale_product`
|
||||
(
|
||||
`id` bigint(20) NOT NULL PRIMARY KEY COMMENT 'ID',
|
||||
`parent_product_id` bigint(20) NOT NULL COMMENT '产品',
|
||||
`name` varchar(512) NOT NULL COMMENT '商品名称',
|
||||
`sku` varchar(512) NOT NULL COMMENT '商家编码',
|
||||
`precautions` varchar(1024) COMMENT '商品注意点',
|
||||
`selling_points` varchar(1024) COMMENT '卖点,使用逗号隔开',
|
||||
`acceptance_rules` varchar(512) COMMENT '承接佣金规则',
|
||||
`settlement_requirement` varchar(512) COMMENT '结算要求',
|
||||
`settlement_rules_inner` varchar(512) COMMENT '佣金结算规则(内部)',
|
||||
`need_sale_upload_image` bit(1) NOT NULL DEFAULT b'0' COMMENT '销售页上传照片',
|
||||
`main_img` varchar(2048) COMMENT '产品主图',
|
||||
`share_img` varchar(2048) COMMENT '商品分享图',
|
||||
`detail` longtext COMMENT '商品详情',
|
||||
`other_note` longtext COMMENT '其他备注',
|
||||
`monthly_rent` varchar(512) COMMENT '月租',
|
||||
`voice_call` varchar(512) COMMENT '语言通话',
|
||||
`universal_traffic` varchar(512) COMMENT '通用流量',
|
||||
`targeted_traffic` varchar(512) COMMENT '定向流量',
|
||||
`belong_area` text COMMENT '归属地',
|
||||
`package_details` longtext COMMENT '套餐详情',
|
||||
`package_discount_period` int(11) COMMENT '套餐优惠期',
|
||||
`package_discount_period_start` int(11) COMMENT '优惠期起始时间:当月,次月,三月',
|
||||
`on_sale` bit(1) NOT NULL DEFAULT b'1' COMMENT '上架',
|
||||
`is_top` bit(1) DEFAULT b'0' COMMENT '是否顶置',
|
||||
`dept_id` bigint(20) COMMENT '部门ID',
|
||||
`creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) NOT NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
UNIQUE (tenant_id, sku)
|
||||
) COMMENT = '在售产品';
|
|
@ -0,0 +1,31 @@
|
|||
-- 菜单 SQL
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status, component_name)
|
||||
VALUES ('在售产品管理', '', 2, 0, 2912,
|
||||
'on-sale-product', '', 'haoka/onsaleproduct/index', 0, 'OnSaleProduct');
|
||||
|
||||
-- 按钮父菜单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:on-sale-product:query', 3, 1, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('在售产品创建', 'haoka:on-sale-product:create', 3, 2, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('在售产品更新', 'haoka:on-sale-product:update', 3, 3, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('在售产品删除', 'haoka:on-sale-product:delete', 3, 4, @parentId,
|
||||
'', '', '', 0);
|
||||
INSERT INTO system_menu(name, permission, type, sort, parent_id,
|
||||
path, icon, component, status)
|
||||
VALUES ('在售产品导出', 'haoka:on-sale-product:export', 3, 5, @parentId,
|
||||
'', '', '', 0);
|
Loading…
Reference in New Issue