Showing
20 changed files
with
1348 additions
and
2 deletions
| ... | ... | @@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS `customer_credit` |
| 115 | 115 | `credit_limit` varchar(20) DEFAULT NULL COMMENT '授信额度(万元)', |
| 116 | 116 | `investigator` varchar(50) DEFAULT NULL COMMENT '调查人', |
| 117 | 117 | `supervisor_review` varchar(50) DEFAULT NULL COMMENT '主管审核', |
| 118 | - `annual_total_sales` varchar(20) DEFAULT NULL COMMENT '年度总销量(万元)', | |
| 118 | + `annual_total_sales` varchar(100) DEFAULT NULL COMMENT '年度总销量(万元)', | |
| 119 | 119 | `main_industry` varchar(100) DEFAULT NULL COMMENT '主要行业', |
| 120 | 120 | `annual_material_overview` text COMMENT '年度款料概况', |
| 121 | 121 | `company_settlement_period` varchar(100) DEFAULT NULL COMMENT '结算期限', |
| ... | ... | @@ -198,7 +198,7 @@ CREATE TABLE IF NOT EXISTS `customer_credit_history` |
| 198 | 198 | `credit_limit` varchar(20) DEFAULT NULL COMMENT '授信额度(万元)', |
| 199 | 199 | `investigator` varchar(50) DEFAULT NULL COMMENT '调查人', |
| 200 | 200 | `supervisor_review` varchar(50) DEFAULT NULL COMMENT '主管审核', |
| 201 | - `annual_total_sales` varchar(20) DEFAULT NULL COMMENT '年度总销量(万元)', | |
| 201 | + `annual_total_sales` varchar(100) DEFAULT NULL COMMENT '年度总销量(万元)', | |
| 202 | 202 | `main_industry` varchar(100) DEFAULT NULL COMMENT '主要行业', |
| 203 | 203 | `annual_material_overview` text COMMENT '年度款料概况', |
| 204 | 204 | `company_settlement_period` varchar(100) DEFAULT NULL COMMENT '结算期限', |
| ... | ... | @@ -1610,3 +1610,36 @@ CREATE TABLE `base_data_breed_relationship` |
| 1610 | 1610 | KEY `idx_bdbr_code` (`code`), |
| 1611 | 1611 | KEY `idx_bdbr_create_time` (`create_time`) |
| 1612 | 1612 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='品种关系表'; |
| 1613 | + | |
| 1614 | +CREATE TABLE `base_data_price` | |
| 1615 | +( | |
| 1616 | + `id` varchar(32) NOT NULL COMMENT 'ID', | |
| 1617 | + `code` varchar(200) NOT NULL COMMENT '编号', | |
| 1618 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | |
| 1619 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | |
| 1620 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | |
| 1621 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | |
| 1622 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1623 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1624 | + PRIMARY KEY (`id`), | |
| 1625 | + UNIQUE KEY `uk_bdp_code` (`code`), | |
| 1626 | + KEY `idx_bdp_create_time` (`create_time`) | |
| 1627 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='价格表'; | |
| 1628 | + | |
| 1629 | +CREATE TABLE `base_data_price_sub_table` | |
| 1630 | +( | |
| 1631 | + `id` varchar(32) NOT NULL COMMENT 'ID', | |
| 1632 | + `price_id` varchar(32) NOT NULL COMMENT '价格表id', | |
| 1633 | + `product_id` varchar(32) NOT NULL COMMENT '品名id', | |
| 1634 | + `price` decimal(18, 10) NOT NULL COMMENT '价格', | |
| 1635 | + `item_id` varchar(32) NOT NULL COMMENT '前端用ID', | |
| 1636 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | |
| 1637 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | |
| 1638 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | |
| 1639 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | |
| 1640 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1641 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1642 | + PRIMARY KEY (`id`), | |
| 1643 | + KEY `idx_bdpst_product_id` (`product_id`), | |
| 1644 | + KEY `idx_bdpst_create_time` (`create_time`) | |
| 1645 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='价格表子表'; | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/price/QueryPriceBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.price; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import com.lframework.starter.common.constants.StringPool; | |
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 6 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 7 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import lombok.Data; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * <p> | |
| 15 | + * 价格表 QueryBo | |
| 16 | + * </p> | |
| 17 | + * | |
| 18 | + */ | |
| 19 | +@Data | |
| 20 | +public class QueryPriceBo extends BaseBo<Price> { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * ID | |
| 24 | + */ | |
| 25 | + @ApiModelProperty("ID") | |
| 26 | + private String id; | |
| 27 | + | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 编号 | |
| 31 | + */ | |
| 32 | + @ApiModelProperty("编号") | |
| 33 | + private String code; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 价格表子表 | |
| 37 | + */ | |
| 38 | + @ApiModelProperty("价格表子表") | |
| 39 | + private List<PriceSubTable> priceSubTableList; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 创建人ID | |
| 43 | + */ | |
| 44 | + @ApiModelProperty("创建人ID") | |
| 45 | + private String createById; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 创建人 | |
| 49 | + */ | |
| 50 | + @ApiModelProperty("创建人") | |
| 51 | + private String createBy; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 更新人ID | |
| 55 | + */ | |
| 56 | + @ApiModelProperty("更新人ID") | |
| 57 | + private String updateById; | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 更新人 | |
| 61 | + */ | |
| 62 | + @ApiModelProperty("更新人") | |
| 63 | + private String updateBy; | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 创建时间 | |
| 67 | + */ | |
| 68 | + @ApiModelProperty("创建时间") | |
| 69 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 70 | + private LocalDateTime createTime; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 更新时间 | |
| 74 | + */ | |
| 75 | + @ApiModelProperty("更新时间") | |
| 76 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 77 | + private LocalDateTime updateTime; | |
| 78 | + | |
| 79 | + | |
| 80 | + public QueryPriceBo() { | |
| 81 | + | |
| 82 | + } | |
| 83 | + | |
| 84 | + public QueryPriceBo(Price dto) { | |
| 85 | + | |
| 86 | + super(dto); | |
| 87 | + } | |
| 88 | + | |
| 89 | + @Override | |
| 90 | + public BaseBo<Price> convert(Price dto) { | |
| 91 | + return super.convert(dto); | |
| 92 | + } | |
| 93 | + | |
| 94 | + @Override | |
| 95 | + protected void afterInit(Price dto) { | |
| 96 | + | |
| 97 | + } | |
| 98 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/price/QueryPriceSubTableBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.price; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import java.math.BigDecimal; | |
| 5 | +import com.lframework.starter.common.constants.StringPool; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 8 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 9 | +import io.swagger.annotations.ApiModelProperty; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * <p> | |
| 14 | + * 价格表子表 QueryBo | |
| 15 | + * </p> | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Data | |
| 19 | +public class QueryPriceSubTableBo extends BaseBo<PriceSubTable> { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * ID | |
| 23 | + */ | |
| 24 | + @ApiModelProperty("ID") | |
| 25 | + private String id; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 品名id | |
| 29 | + */ | |
| 30 | + @ApiModelProperty("品名id") | |
| 31 | + private String productId; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 品名 | |
| 35 | + */ | |
| 36 | + @ApiModelProperty("品名") | |
| 37 | + private String productName; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 代号 | |
| 41 | + */ | |
| 42 | + @ApiModelProperty("代号") | |
| 43 | + private String code; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 类型 | |
| 47 | + */ | |
| 48 | + @ApiModelProperty("类型") | |
| 49 | + private String type; | |
| 50 | + | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 价格 | |
| 54 | + */ | |
| 55 | + @ApiModelProperty("价格") | |
| 56 | + private BigDecimal price; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 创建人ID | |
| 60 | + */ | |
| 61 | + @ApiModelProperty("创建人ID") | |
| 62 | + private String createById; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 创建人 | |
| 66 | + */ | |
| 67 | + @ApiModelProperty("创建人") | |
| 68 | + private String createBy; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 更新人ID | |
| 72 | + */ | |
| 73 | + @ApiModelProperty("更新人ID") | |
| 74 | + private String updateById; | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 更新人 | |
| 78 | + */ | |
| 79 | + @ApiModelProperty("更新人") | |
| 80 | + private String updateBy; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 创建时间 | |
| 84 | + */ | |
| 85 | + @ApiModelProperty("创建时间") | |
| 86 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 87 | + private LocalDateTime createTime; | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * 更新时间 | |
| 91 | + */ | |
| 92 | + @ApiModelProperty("更新时间") | |
| 93 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 94 | + private LocalDateTime updateTime; | |
| 95 | + | |
| 96 | + public QueryPriceSubTableBo() { | |
| 97 | + | |
| 98 | + } | |
| 99 | + | |
| 100 | + public QueryPriceSubTableBo(PriceSubTable dto) { | |
| 101 | + | |
| 102 | + super(dto); | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public BaseBo<PriceSubTable> convert(PriceSubTable dto) { | |
| 107 | + return super.convert(dto); | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Override | |
| 111 | + protected void afterInit(PriceSubTable dto) { | |
| 112 | + | |
| 113 | + } | |
| 114 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PriceController.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.controller; | |
| 2 | + | |
| 3 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 4 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 5 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | |
| 6 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | |
| 7 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | |
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 9 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | |
| 10 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 11 | +import com.lframework.xingyun.basedata.bo.price.QueryPriceBo; | |
| 12 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 13 | +import com.lframework.xingyun.basedata.service.price.PriceService; | |
| 14 | +import com.lframework.xingyun.basedata.vo.price.CreatePriceVo; | |
| 15 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceVo; | |
| 16 | +import com.lframework.xingyun.basedata.vo.price.UpdatePriceVo; | |
| 17 | +import io.swagger.annotations.Api; | |
| 18 | +import io.swagger.annotations.ApiImplicitParam; | |
| 19 | +import io.swagger.annotations.ApiOperation; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | +import javax.validation.Valid; | |
| 24 | +import javax.validation.constraints.NotBlank; | |
| 25 | +import java.util.List; | |
| 26 | +import java.util.stream.Collectors; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * 价格表 Controller | |
| 30 | + * | |
| 31 | + */ | |
| 32 | +@Api(tags = "价格表") | |
| 33 | +@Validated | |
| 34 | +@RestController | |
| 35 | +@RequestMapping("/baseData/price") | |
| 36 | +public class PriceController extends DefaultBaseController { | |
| 37 | + | |
| 38 | + @Autowired | |
| 39 | + private PriceService priceService; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 查询列表 | |
| 43 | + */ | |
| 44 | + @ApiOperation("查询列表") | |
| 45 | + @HasPermission({"base-data:price-table:query"}) | |
| 46 | + @GetMapping("/query") | |
| 47 | + public InvokeResult<PageResult<QueryPriceBo>> query(@Valid QueryPriceVo vo) { | |
| 48 | + | |
| 49 | + PageResult<Price> pageResult = priceService.query(getPageIndex(vo), getPageSize(vo), vo); | |
| 50 | + | |
| 51 | + List<Price> datas = pageResult.getDatas(); | |
| 52 | + List<QueryPriceBo> results = null; | |
| 53 | + | |
| 54 | + if (!CollectionUtil.isEmpty(datas)) { | |
| 55 | + results = datas.stream().map(QueryPriceBo::new).collect(Collectors.toList()); | |
| 56 | + } | |
| 57 | + | |
| 58 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 根据ID查询 | |
| 63 | + */ | |
| 64 | + @ApiOperation("根据ID查询") | |
| 65 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 66 | + @HasPermission({"base-data:price-table:query"}) | |
| 67 | + @GetMapping | |
| 68 | + public InvokeResult<QueryPriceBo> get(@NotBlank(message = "id不能为空!") String id) { | |
| 69 | + | |
| 70 | + Price data = priceService.findById(id); | |
| 71 | + if (data == null) { | |
| 72 | + throw new DefaultClientException("价格表不存在!"); | |
| 73 | + } | |
| 74 | + | |
| 75 | + QueryPriceBo result = new QueryPriceBo(data); | |
| 76 | + | |
| 77 | + return InvokeResultBuilder.success(result); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * 新增 | |
| 82 | + */ | |
| 83 | + @ApiOperation("新增") | |
| 84 | + @HasPermission({"base-data:price-table:add"}) | |
| 85 | + @PostMapping | |
| 86 | + public InvokeResult<Void> create(@RequestBody @Valid CreatePriceVo vo) { | |
| 87 | + | |
| 88 | + priceService.create(vo); | |
| 89 | + | |
| 90 | + return InvokeResultBuilder.success(); | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 修改 | |
| 95 | + */ | |
| 96 | + @ApiOperation("修改") | |
| 97 | + @HasPermission({"base-data:price-table:modify"}) | |
| 98 | + @PutMapping | |
| 99 | + public InvokeResult<Void> update(@RequestBody @Valid UpdatePriceVo vo) { | |
| 100 | + | |
| 101 | + priceService.update(vo); | |
| 102 | + | |
| 103 | + return InvokeResultBuilder.success(); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 根据ID删除 | |
| 108 | + */ | |
| 109 | + @ApiOperation("根据ID删除") | |
| 110 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 111 | + @HasPermission({"base-data:price-table:delete"}) | |
| 112 | + @DeleteMapping | |
| 113 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | |
| 114 | + | |
| 115 | + priceService.deleteById(id); | |
| 116 | + | |
| 117 | + return InvokeResultBuilder.success(); | |
| 118 | + } | |
| 119 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.basedata.entity; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | +import com.lframework.starter.web.core.entity.BaseEntity; | |
| 7 | +import com.lframework.starter.web.core.dto.BaseDto; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +import com.lframework.xingyun.basedata.bo.price.QueryPriceSubTableBo; | |
| 12 | +import com.lframework.xingyun.basedata.vo.price.UpdatePriceSubTableVo; | |
| 13 | +import io.swagger.annotations.ApiModelProperty; | |
| 14 | +import lombok.Data; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 价格表 | |
| 18 | + */ | |
| 19 | +@Data | |
| 20 | +@TableName("base_data_price") | |
| 21 | +public class Price extends BaseEntity implements BaseDto { | |
| 22 | + | |
| 23 | + public static final String CACHE_NAME = "Price"; | |
| 24 | + private static final long serialVersionUID = 1L; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * ID | |
| 28 | + */ | |
| 29 | + private String id; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 编号 | |
| 33 | + */ | |
| 34 | + private String code; | |
| 35 | + | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 价格表子表 | |
| 39 | + */ | |
| 40 | + @TableField(exist = false) | |
| 41 | + private List<PriceSubTable> priceSubTableList; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 创建人ID 新增时赋值 | |
| 45 | + */ | |
| 46 | + @TableField(fill = FieldFill.INSERT) | |
| 47 | + private String createById; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 创建人 新增时赋值 | |
| 51 | + */ | |
| 52 | + @TableField(fill = FieldFill.INSERT) | |
| 53 | + private String createBy; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 创建时间 新增时赋值 | |
| 57 | + */ | |
| 58 | + @TableField(fill = FieldFill.INSERT) | |
| 59 | + private LocalDateTime createTime; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 修改人 新增和修改时赋值 | |
| 63 | + */ | |
| 64 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 65 | + private String updateBy; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 修改人ID 新增和修改时赋值 | |
| 69 | + */ | |
| 70 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 71 | + private String updateById; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 修改时间 新增和修改时赋值 | |
| 75 | + */ | |
| 76 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 77 | + private LocalDateTime updateTime; | |
| 78 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.basedata.entity; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 4 | +import java.math.BigDecimal; | |
| 5 | +import com.lframework.starter.web.core.dto.BaseDto; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import com.baomidou.mybatisplus.annotation.FieldFill; | |
| 8 | +import com.lframework.starter.web.core.entity.BaseEntity; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 10 | +import io.swagger.annotations.ApiModelProperty; | |
| 11 | +import lombok.Data; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * <p> | |
| 15 | + * 价格表子表 | |
| 16 | + * </p> | |
| 17 | + * | |
| 18 | + */ | |
| 19 | +@Data | |
| 20 | +@TableName("base_data_price_sub_table") | |
| 21 | +public class PriceSubTable extends BaseEntity implements BaseDto { | |
| 22 | + | |
| 23 | + private static final long serialVersionUID = 1L; | |
| 24 | + | |
| 25 | + public static final String CACHE_NAME = "PriceSubTable"; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * ID | |
| 29 | + */ | |
| 30 | + private String id; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 价格表id | |
| 34 | + */ | |
| 35 | + private String priceId; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 品名id | |
| 39 | + */ | |
| 40 | + private String productId; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 品名 | |
| 44 | + * 非持久化字段 | |
| 45 | + */ | |
| 46 | + @TableField(exist = false) | |
| 47 | + private String productName; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 代号 | |
| 51 | + * 非持久化字段 | |
| 52 | + */ | |
| 53 | + @TableField(exist = false) | |
| 54 | + private String code; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 类型 | |
| 58 | + * 非持久化字段 | |
| 59 | + */ | |
| 60 | + @TableField(exist = false) | |
| 61 | + private String type; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 价格 | |
| 65 | + */ | |
| 66 | + private BigDecimal price; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 前端用ID | |
| 70 | + */ | |
| 71 | + private String itemId; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 创建人ID | |
| 75 | + */ | |
| 76 | + @TableField(fill = FieldFill.INSERT) | |
| 77 | + private String createById; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 创建人 | |
| 81 | + */ | |
| 82 | + @TableField(fill = FieldFill.INSERT) | |
| 83 | + private String createBy; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 更新人ID | |
| 87 | + */ | |
| 88 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 89 | + private String updateById; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 更新人 | |
| 93 | + */ | |
| 94 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 95 | + private String updateBy; | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * 创建时间 | |
| 99 | + */ | |
| 100 | + @TableField(fill = FieldFill.INSERT) | |
| 101 | + private LocalDateTime createTime; | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * 更新时间 | |
| 105 | + */ | |
| 106 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 107 | + private LocalDateTime updateTime; | |
| 108 | + | |
| 109 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/price/PriceServiceImpl.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.impl.price; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 5 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 6 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 7 | +import com.github.pagehelper.PageInfo; | |
| 8 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 9 | +import com.lframework.starter.common.utils.Assert; | |
| 10 | +import com.lframework.starter.common.utils.ObjectUtil; | |
| 11 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | |
| 12 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 13 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 14 | +import com.lframework.starter.web.core.utils.IdUtil; | |
| 15 | +import com.lframework.starter.web.core.utils.OpLogUtil; | |
| 16 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 17 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 18 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | |
| 19 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 20 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 21 | +import com.lframework.xingyun.basedata.mappers.PriceMapper; | |
| 22 | +import com.lframework.xingyun.basedata.service.price.PriceService; | |
| 23 | +import com.lframework.xingyun.basedata.service.price.PriceSubTableService; | |
| 24 | +import com.lframework.xingyun.basedata.vo.price.*; | |
| 25 | +import org.apache.commons.collections4.CollectionUtils; | |
| 26 | +import org.apache.commons.lang3.StringUtils; | |
| 27 | +import org.springframework.stereotype.Service; | |
| 28 | +import org.springframework.transaction.annotation.Transactional; | |
| 29 | +import javax.annotation.Resource; | |
| 30 | +import java.io.Serializable; | |
| 31 | +import java.util.ArrayList; | |
| 32 | +import java.util.List; | |
| 33 | +import java.util.stream.Collectors; | |
| 34 | + | |
| 35 | +@Service | |
| 36 | +public class PriceServiceImpl extends BaseMpServiceImpl<PriceMapper, Price> implements PriceService { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private PriceSubTableService priceSubTableService; | |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public PageResult<Price> query(Integer pageIndex, Integer pageSize, QueryPriceVo vo) { | |
| 43 | + | |
| 44 | + Assert.greaterThanZero(pageIndex); | |
| 45 | + Assert.greaterThanZero(pageSize); | |
| 46 | + | |
| 47 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 48 | + List<Price> datas = this.query(vo); | |
| 49 | + | |
| 50 | + return PageResultUtil.convert(new PageInfo<>(datas)); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public List<Price> query(QueryPriceVo vo) { | |
| 55 | + | |
| 56 | + return getBaseMapper().query(vo); | |
| 57 | + } | |
| 58 | + | |
| 59 | + @Override | |
| 60 | + public Price findById(String id) { | |
| 61 | + Price data = getBaseMapper().selectById(id); | |
| 62 | + QueryPriceSubTableVo vo = new QueryPriceSubTableVo(); | |
| 63 | + vo.setPriceId(id); | |
| 64 | + List<PriceSubTable> query = priceSubTableService.query(vo); | |
| 65 | + data.setPriceSubTableList(query); | |
| 66 | + | |
| 67 | + return data; | |
| 68 | + } | |
| 69 | + | |
| 70 | + @OpLog(type = OtherOpLogType.class, name = "新增价格表,ID:{}", params = {"#id"}) | |
| 71 | + @Transactional(rollbackFor = Exception.class) | |
| 72 | + @Override | |
| 73 | + public String create(CreatePriceVo vo) { | |
| 74 | + checkCodeUnique(vo.getCode(), null); | |
| 75 | + | |
| 76 | + Price data = new Price(); | |
| 77 | + data.setId(IdUtil.getId()); | |
| 78 | + data.setCode(vo.getCode()); | |
| 79 | + | |
| 80 | + getBaseMapper().insert(data); | |
| 81 | + | |
| 82 | + //新增价格表子表 | |
| 83 | + List<CreatePriceSubTableVo> priceSubTableList = vo.getPriceSubTableList(); | |
| 84 | + if (CollectionUtils.isNotEmpty(priceSubTableList)) { | |
| 85 | + for (CreatePriceSubTableVo createPriceSubTableVo : priceSubTableList) { | |
| 86 | + createPriceSubTableVo.setPriceId(data.getId()); | |
| 87 | + priceSubTableService.create(createPriceSubTableVo); | |
| 88 | + } | |
| 89 | + } | |
| 90 | + | |
| 91 | + OpLogUtil.setVariable("id", data.getId()); | |
| 92 | + OpLogUtil.setExtra(vo); | |
| 93 | + | |
| 94 | + return data.getId(); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @OpLog(type = OtherOpLogType.class, name = "修改价格表,ID:{}", params = {"#id"}) | |
| 98 | + @Transactional(rollbackFor = Exception.class) | |
| 99 | + @Override | |
| 100 | + public void update(UpdatePriceVo vo) { | |
| 101 | + | |
| 102 | + Price data = getBaseMapper().selectById(vo.getId()); | |
| 103 | + if (ObjectUtil.isNull(data)) { | |
| 104 | + throw new DefaultClientException("价格表不存在!"); | |
| 105 | + } | |
| 106 | + checkCodeUnique(vo.getCode(), vo.getId()); | |
| 107 | + | |
| 108 | + LambdaUpdateWrapper<Price> updateWrapper = Wrappers.lambdaUpdate(Price.class) | |
| 109 | + .set(Price::getCode, vo.getCode()) | |
| 110 | + .eq(Price::getId, vo.getId()); | |
| 111 | + | |
| 112 | + getBaseMapper().update(updateWrapper); | |
| 113 | + | |
| 114 | + //修改价格表子表 | |
| 115 | + if (CollectionUtils.isNotEmpty(vo.getPriceSubTableList())) { | |
| 116 | + dealWithPriceSubTable(data, vo); | |
| 117 | + } | |
| 118 | + | |
| 119 | + OpLogUtil.setVariable("id", data.getId()); | |
| 120 | + OpLogUtil.setExtra(vo); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @OpLog(type = OtherOpLogType.class, name = "删除价格表,ID:{}", params = {"#id"}) | |
| 124 | + @Transactional(rollbackFor = Exception.class) | |
| 125 | + @Override | |
| 126 | + public void deleteById(String id) { | |
| 127 | + | |
| 128 | + getBaseMapper().deleteById(id); | |
| 129 | + | |
| 130 | + //删除子表 | |
| 131 | + QueryPriceSubTableVo vo = new QueryPriceSubTableVo(); | |
| 132 | + vo.setPriceId(id); | |
| 133 | + List<PriceSubTable> query = priceSubTableService.query(vo); | |
| 134 | + if (CollectionUtils.isNotEmpty(query)) { | |
| 135 | + List<String> needDeleteIdList = query.stream() | |
| 136 | + .map(PriceSubTable::getId) | |
| 137 | + .collect(Collectors.toList()); | |
| 138 | + if (CollectionUtils.isNotEmpty(needDeleteIdList)) { | |
| 139 | + priceSubTableService.removeByIds(needDeleteIdList); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 校验编码唯一性 | |
| 146 | + * | |
| 147 | + * @param code 编码 | |
| 148 | + * @param excludeId 排除的价格表ID | |
| 149 | + */ | |
| 150 | + private void checkCodeUnique(String code, String excludeId) { | |
| 151 | + LambdaQueryWrapper<Price> queryWrapper = | |
| 152 | + Wrappers.lambdaQuery(Price.class) | |
| 153 | + .eq(Price::getCode, code); | |
| 154 | + if (StringUtils.isNotBlank(excludeId)) { | |
| 155 | + queryWrapper.ne(Price::getId, excludeId); | |
| 156 | + } | |
| 157 | + | |
| 158 | + Integer count = getBaseMapper().selectCount(queryWrapper); | |
| 159 | + if (count != null && count > 0) { | |
| 160 | + throw new DefaultClientException("价格表编号已存在,请重新输入!"); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + | |
| 164 | + private void dealWithPriceSubTable(Price data, UpdatePriceVo vo) { | |
| 165 | + Wrapper<PriceSubTable> lineWrapper = Wrappers.lambdaQuery(PriceSubTable.class) | |
| 166 | + .eq(PriceSubTable::getPriceId, data.getId()); | |
| 167 | + List<PriceSubTable> oldPriceSubTableList = priceSubTableService.list(lineWrapper); | |
| 168 | + List<String> oldIdList = CollectionUtils.emptyIfNull(oldPriceSubTableList) | |
| 169 | + .stream() | |
| 170 | + .map(PriceSubTable::getId).collect(Collectors.toList()); | |
| 171 | + List<String> existIdList = new ArrayList<>(oldIdList.size()); | |
| 172 | + for (int i = 0; i < vo.getPriceSubTableList().size(); i++) { | |
| 173 | + UpdatePriceSubTableVo updatePriceSubTableVo = vo.getPriceSubTableList().get(i); | |
| 174 | + if (StringUtils.isNotBlank(updatePriceSubTableVo.getId())) { | |
| 175 | + existIdList.add(updatePriceSubTableVo.getId()); | |
| 176 | + priceSubTableService.update(updatePriceSubTableVo); | |
| 177 | + } else { | |
| 178 | + CreatePriceSubTableVo createPriceSubTableVo = new CreatePriceSubTableVo(); | |
| 179 | + createPriceSubTableVo.setPriceId(data.getId()); | |
| 180 | + createPriceSubTableVo.setProductId(updatePriceSubTableVo.getProductId()); | |
| 181 | + createPriceSubTableVo.setPrice(updatePriceSubTableVo.getPrice()); | |
| 182 | + createPriceSubTableVo.setItemId(updatePriceSubTableVo.getItemId()); | |
| 183 | + | |
| 184 | + priceSubTableService.create(createPriceSubTableVo); | |
| 185 | + } | |
| 186 | + } | |
| 187 | + | |
| 188 | + List<String> needDeleteIdList = oldIdList.stream() | |
| 189 | + .filter(oldLineId -> !existIdList.contains(oldLineId)) | |
| 190 | + .collect(Collectors.toList()); | |
| 191 | + if (CollectionUtils.isNotEmpty(needDeleteIdList)) { | |
| 192 | + priceSubTableService.removeByIds(needDeleteIdList); | |
| 193 | + } | |
| 194 | + } | |
| 195 | + | |
| 196 | + @Override | |
| 197 | + public void cleanCacheByKey(Serializable key) { | |
| 198 | + | |
| 199 | + } | |
| 200 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.basedata.impl.price; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 5 | +import com.github.pagehelper.PageInfo; | |
| 6 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 7 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 9 | +import com.lframework.starter.web.core.utils.OpLogUtil; | |
| 10 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 11 | +import java.io.Serializable; | |
| 12 | +import com.lframework.starter.web.core.utils.IdUtil; | |
| 13 | +import com.lframework.starter.common.utils.ObjectUtil; | |
| 14 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | |
| 15 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 16 | +import com.lframework.starter.common.utils.Assert; | |
| 17 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | |
| 18 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 19 | +import com.lframework.xingyun.basedata.mappers.PriceSubTableMapper; | |
| 20 | +import com.lframework.xingyun.basedata.service.price.PriceSubTableService; | |
| 21 | +import com.lframework.xingyun.basedata.vo.price.CreatePriceSubTableVo; | |
| 22 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceSubTableVo; | |
| 23 | +import com.lframework.xingyun.basedata.vo.price.UpdatePriceSubTableVo; | |
| 24 | +import org.springframework.transaction.annotation.Transactional; | |
| 25 | +import org.springframework.stereotype.Service; | |
| 26 | +import java.util.List; | |
| 27 | + | |
| 28 | +@Service | |
| 29 | +public class PriceSubTableServiceImpl extends BaseMpServiceImpl<PriceSubTableMapper, PriceSubTable> implements PriceSubTableService { | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public PageResult<PriceSubTable> query(Integer pageIndex, Integer pageSize, QueryPriceSubTableVo vo) { | |
| 33 | + | |
| 34 | + Assert.greaterThanZero(pageIndex); | |
| 35 | + Assert.greaterThanZero(pageSize); | |
| 36 | + | |
| 37 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 38 | + List<PriceSubTable> datas = this.query(vo); | |
| 39 | + | |
| 40 | + return PageResultUtil.convert(new PageInfo<>(datas)); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public List<PriceSubTable> query(QueryPriceSubTableVo vo) { | |
| 45 | + | |
| 46 | + return getBaseMapper().query(vo); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public PriceSubTable findById(String id) { | |
| 51 | + | |
| 52 | + return getBaseMapper().selectById(id); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @OpLog(type = OtherOpLogType.class, name = "新增价格表子表,ID:{}", params = {"#id"}) | |
| 56 | + @Transactional(rollbackFor = Exception.class) | |
| 57 | + @Override | |
| 58 | + public String create(CreatePriceSubTableVo vo) { | |
| 59 | + | |
| 60 | + PriceSubTable data = new PriceSubTable(); | |
| 61 | + data.setId(IdUtil.getId()); | |
| 62 | + data.setPriceId(vo.getPriceId()); | |
| 63 | + data.setProductId(vo.getProductId()); | |
| 64 | + data.setPrice(vo.getPrice()); | |
| 65 | + data.setItemId(vo.getItemId()); | |
| 66 | + | |
| 67 | + getBaseMapper().insert(data); | |
| 68 | + | |
| 69 | + OpLogUtil.setVariable("id", data.getId()); | |
| 70 | + OpLogUtil.setExtra(vo); | |
| 71 | + | |
| 72 | + return data.getId(); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @OpLog(type = OtherOpLogType.class, name = "修改价格表子表,ID:{}", params = {"#id"}) | |
| 76 | + @Transactional(rollbackFor = Exception.class) | |
| 77 | + @Override | |
| 78 | + public void update(UpdatePriceSubTableVo vo) { | |
| 79 | + | |
| 80 | + PriceSubTable data = getBaseMapper().selectById(vo.getId()); | |
| 81 | + if (ObjectUtil.isNull(data)) { | |
| 82 | + throw new DefaultClientException("价格表子表不存在!"); | |
| 83 | + } | |
| 84 | + | |
| 85 | + LambdaUpdateWrapper<PriceSubTable> updateWrapper = Wrappers.lambdaUpdate(PriceSubTable.class) | |
| 86 | + .set(PriceSubTable::getProductId, vo.getProductId()) | |
| 87 | + .set(PriceSubTable::getPrice, vo.getPrice()) | |
| 88 | + .set(PriceSubTable::getItemId, vo.getPrice()) | |
| 89 | + .eq(PriceSubTable::getId, vo.getId()); | |
| 90 | + | |
| 91 | + getBaseMapper().update(updateWrapper); | |
| 92 | + | |
| 93 | + OpLogUtil.setVariable("id", data.getId()); | |
| 94 | + OpLogUtil.setExtra(vo); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @OpLog(type = OtherOpLogType.class, name = "删除价格表子表,ID:{}", params = {"#id"}) | |
| 98 | + @Transactional(rollbackFor = Exception.class) | |
| 99 | + @Override | |
| 100 | + public void deleteById(String id) { | |
| 101 | + | |
| 102 | + getBaseMapper().deleteById(id); | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public void cleanCacheByKey(Serializable key) { | |
| 107 | + | |
| 108 | + } | |
| 109 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.basedata.mappers; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 4 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 5 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceVo; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 价格表 Mapper 接口 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +public interface PriceMapper extends BaseMapper<Price> { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 查询列表 | |
| 20 | + * @param vo | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + List<Price> query(@Param("vo") QueryPriceVo vo); | |
| 24 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PriceSubTableMapper.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.mappers; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 4 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 5 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceSubTableVo; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 价格表子表 Mapper 接口 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +public interface PriceSubTableMapper extends BaseMapper<PriceSubTable> { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 查询列表 | |
| 20 | + * @param vo | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + List<PriceSubTable> query(@Param("vo") QueryPriceSubTableVo vo); | |
| 24 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/price/PriceService.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.service.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 4 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 5 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 6 | +import com.lframework.xingyun.basedata.vo.price.CreatePriceVo; | |
| 7 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceVo; | |
| 8 | +import com.lframework.xingyun.basedata.vo.price.UpdatePriceVo; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 价格表 Service | |
| 14 | + */ | |
| 15 | +public interface PriceService extends BaseMpService<Price> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 查询列表 | |
| 19 | + * @return | |
| 20 | + */ | |
| 21 | + PageResult<Price> query(Integer pageIndex, Integer pageSize, QueryPriceVo vo); | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 查询列表 | |
| 25 | + * @param vo | |
| 26 | + * @return | |
| 27 | + */ | |
| 28 | + List<Price> query(QueryPriceVo vo); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 根据ID查询 | |
| 32 | + * @param id | |
| 33 | + * @return | |
| 34 | + */ | |
| 35 | + Price findById(String id); | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 创建 | |
| 39 | + * @param vo | |
| 40 | + * @return | |
| 41 | + */ | |
| 42 | + String create(CreatePriceVo vo); | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 修改 | |
| 46 | + * @param vo | |
| 47 | + */ | |
| 48 | + void update(UpdatePriceVo vo); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 根据ID删除 | |
| 52 | + * @param id | |
| 53 | + * @return | |
| 54 | + */ | |
| 55 | + void deleteById(String id); | |
| 56 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.basedata.service.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 4 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 5 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 6 | +import com.lframework.xingyun.basedata.vo.price.CreatePriceSubTableVo; | |
| 7 | +import com.lframework.xingyun.basedata.vo.price.QueryPriceSubTableVo; | |
| 8 | +import com.lframework.xingyun.basedata.vo.price.UpdatePriceSubTableVo; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 价格表子表 Service | |
| 13 | + */ | |
| 14 | +public interface PriceSubTableService extends BaseMpService<PriceSubTable> { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 查询列表 | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + PageResult<PriceSubTable> query(Integer pageIndex, Integer pageSize, QueryPriceSubTableVo vo); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询列表 | |
| 24 | + * @param vo | |
| 25 | + * @return | |
| 26 | + */ | |
| 27 | + List<PriceSubTable> query(QueryPriceSubTableVo vo); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 根据ID查询 | |
| 31 | + * @param id | |
| 32 | + * @return | |
| 33 | + */ | |
| 34 | + PriceSubTable findById(String id); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 创建 | |
| 38 | + * @param vo | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + String create(CreatePriceSubTableVo vo); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 修改 | |
| 45 | + * @param vo | |
| 46 | + */ | |
| 47 | + void update(UpdatePriceSubTableVo vo); | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 根据ID删除 | |
| 51 | + * @param id | |
| 52 | + * @return | |
| 53 | + */ | |
| 54 | + void deleteById(String id); | |
| 55 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/CreatePriceSubTableVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.components.validation.IsNumberPrecision; | |
| 4 | +import java.math.BigDecimal; | |
| 5 | +import javax.validation.constraints.NotBlank; | |
| 6 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 7 | +import javax.validation.constraints.NotNull; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 10 | +import org.hibernate.validator.constraints.Length; | |
| 11 | +import java.io.Serializable; | |
| 12 | +import lombok.Data; | |
| 13 | + | |
| 14 | +@Data | |
| 15 | +public class CreatePriceSubTableVo implements BaseVo, Serializable { | |
| 16 | + | |
| 17 | + private static final long serialVersionUID = 1L; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 价格表id | |
| 21 | + */ | |
| 22 | + @ApiModelProperty("价格表id") | |
| 23 | + @Length(message = "品名id最多允许32个字符!") | |
| 24 | + private String priceId; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 品名id | |
| 28 | + */ | |
| 29 | + @ApiModelProperty(value = "品名id", required = true) | |
| 30 | + @NotBlank(message = "请输入品名id!") | |
| 31 | + @Length(message = "品名id最多允许32个字符!") | |
| 32 | + private String productId; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 价格 | |
| 36 | + */ | |
| 37 | + @ApiModelProperty(value = "价格", required = true) | |
| 38 | + @NotNull(message = "请输入价格!") | |
| 39 | + @TypeMismatch(message = "价格格式有误!") | |
| 40 | + @IsNumberPrecision(message = "价格最多允许10位小数!", value = 10) | |
| 41 | + private BigDecimal price; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 前端用ID | |
| 45 | + */ | |
| 46 | + @ApiModelProperty(value = "前端用ID") | |
| 47 | + private String itemId; | |
| 48 | + | |
| 49 | + | |
| 50 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/CreatePriceVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import org.hibernate.validator.constraints.Length; | |
| 7 | +import javax.validation.constraints.NotBlank; | |
| 8 | +import java.io.Serializable; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +@Data | |
| 12 | +public class CreatePriceVo implements BaseVo, Serializable { | |
| 13 | + | |
| 14 | + private static final long serialVersionUID = 1L; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 编号 | |
| 18 | + */ | |
| 19 | + @ApiModelProperty(value = "编号", required = true) | |
| 20 | + @NotBlank(message = "请输入编号!") | |
| 21 | + @Length(message = "编号最多允许200个字符!") | |
| 22 | + private String code; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 价格表子表 | |
| 26 | + */ | |
| 27 | + @ApiModelProperty("价格表子表") | |
| 28 | + private List<CreatePriceSubTableVo> priceSubTableList; | |
| 29 | + | |
| 30 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/QueryPriceSubTableVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | |
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 6 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 7 | +import io.swagger.annotations.ApiModelProperty; | |
| 8 | +import org.hibernate.validator.constraints.Length; | |
| 9 | + | |
| 10 | +import java.io.Serializable; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +public class QueryPriceSubTableVo extends PageVo implements BaseVo, Serializable { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 价格表id | |
| 19 | + */ | |
| 20 | + @ApiModelProperty("价格表id") | |
| 21 | + private String priceId; | |
| 22 | + | |
| 23 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/QueryPriceVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.io.Serializable; | |
| 9 | + | |
| 10 | +@Data | |
| 11 | +public class QueryPriceVo extends PageVo implements BaseVo, Serializable { | |
| 12 | + | |
| 13 | + private static final long serialVersionUID = 1L; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 编号 | |
| 17 | + */ | |
| 18 | + @ApiModelProperty("编号") | |
| 19 | + private String code; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建人 | |
| 23 | + */ | |
| 24 | + @ApiModelProperty("创建人") | |
| 25 | + private String createBy; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 创建时间 | |
| 29 | + */ | |
| 30 | + @ApiModelProperty("创建时间") | |
| 31 | + private String createTimeStart; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 创建时间 | |
| 35 | + */ | |
| 36 | + @ApiModelProperty("创建时间") | |
| 37 | + private String createTimeEnd; | |
| 38 | + | |
| 39 | + | |
| 40 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/UpdatePriceSubTableVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import com.lframework.starter.web.core.components.validation.IsNumberPrecision; | |
| 5 | +import java.math.BigDecimal; | |
| 6 | +import javax.validation.constraints.NotBlank; | |
| 7 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 10 | +import io.swagger.annotations.ApiModelProperty; | |
| 11 | +import org.hibernate.validator.constraints.Length; | |
| 12 | +import java.io.Serializable; | |
| 13 | + | |
| 14 | +@Data | |
| 15 | +public class UpdatePriceSubTableVo implements BaseVo, Serializable { | |
| 16 | + | |
| 17 | + private static final long serialVersionUID = 1L; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * ID | |
| 21 | + */ | |
| 22 | + @ApiModelProperty(value = "ID") | |
| 23 | + private String id; | |
| 24 | + | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 品名id | |
| 28 | + */ | |
| 29 | + @ApiModelProperty(value = "品名id", required = true) | |
| 30 | + @NotBlank(message = "请输入品名id!") | |
| 31 | + @Length(message = "品名id最多允许32个字符!") | |
| 32 | + private String productId; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 价格 | |
| 36 | + */ | |
| 37 | + @ApiModelProperty(value = "价格", required = true) | |
| 38 | + @TypeMismatch(message = "价格格式有误!") | |
| 39 | + @NotNull(message = "请输入价格!") | |
| 40 | + @IsNumberPrecision(message = "价格最多允许10位小数!", value = 10) | |
| 41 | + private BigDecimal price; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 前端用ID | |
| 45 | + */ | |
| 46 | + @ApiModelProperty(value = "前端用ID") | |
| 47 | + private String itemId; | |
| 48 | + | |
| 49 | + | |
| 50 | +} | ... | ... |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/price/UpdatePriceVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.price; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import org.hibernate.validator.constraints.Length; | |
| 7 | +import javax.validation.constraints.NotBlank; | |
| 8 | +import java.io.Serializable; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +@Data | |
| 12 | +public class UpdatePriceVo implements BaseVo, Serializable { | |
| 13 | + | |
| 14 | + private static final long serialVersionUID = 1L; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * ID | |
| 18 | + */ | |
| 19 | + @ApiModelProperty(value = "ID", required = true) | |
| 20 | + @NotBlank(message = "id不能为空!") | |
| 21 | + private String id; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 编号 | |
| 25 | + */ | |
| 26 | + @ApiModelProperty(value = "编号", required = true) | |
| 27 | + @NotBlank(message = "请输入编号!") | |
| 28 | + @Length(message = "编号最多允许200个字符!") | |
| 29 | + private String code; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 价格表子表 | |
| 33 | + */ | |
| 34 | + @ApiModelProperty("价格表子表") | |
| 35 | + private List<UpdatePriceSubTableVo> priceSubTableList; | |
| 36 | + | |
| 37 | + | |
| 38 | +} | ... | ... |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lframework.xingyun.basedata.mappers.PriceMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="PriceSubTable" type="com.lframework.xingyun.basedata.entity.Price"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="code" property="code"/> | |
| 8 | + <result column="create_by_id" property="createById"/> | |
| 9 | + <result column="create_by" property="createBy"/> | |
| 10 | + <result column="update_by_id" property="updateById"/> | |
| 11 | + <result column="update_by" property="updateBy"/> | |
| 12 | + <result column="create_time" property="createTime"/> | |
| 13 | + <result column="update_time" property="updateTime"/> | |
| 14 | + </resultMap> | |
| 15 | + | |
| 16 | + <sql id="PriceSubTable_sql"> | |
| 17 | + SELECT | |
| 18 | + tb.id, | |
| 19 | + tb.code, | |
| 20 | + tb.create_by_id, | |
| 21 | + tb.create_by, | |
| 22 | + tb.update_by_id, | |
| 23 | + tb.update_by, | |
| 24 | + tb.create_time, | |
| 25 | + tb.update_time | |
| 26 | + FROM base_data_price_sub_table AS tb | |
| 27 | + </sql> | |
| 28 | + | |
| 29 | + <select id="query" resultMap="PriceSubTable"> | |
| 30 | + <include refid="PriceSubTable_sql"/> | |
| 31 | + <where> | |
| 32 | + <if test="vo.code != null and vo.code != ''"> | |
| 33 | + AND tb.code =LIKE CONCAT('%', #{vo.code},'%') | |
| 34 | + </if> | |
| 35 | + <if test="vo.createBy != null and vo.createBy != ''"> | |
| 36 | + AND tb.create_by LIKE CONCAT('%', #{vo.createBy},'%') | |
| 37 | + </if> | |
| 38 | + <if test="vo.createTimeStart != null"> | |
| 39 | + AND tb.create_time >= #{vo.createTimeStart} | |
| 40 | + </if> | |
| 41 | + <if test="vo.createTimeEnd != null"> | |
| 42 | + <![CDATA[ | |
| 43 | + AND tb.create_time <= #{vo.createTimeEnd} | |
| 44 | + ]]> | |
| 45 | + </if> | |
| 46 | + </where> | |
| 47 | + </select> | |
| 48 | +</mapper> | ... | ... |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lframework.xingyun.basedata.mappers.PriceSubTableMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="PriceSubTable" type="com.lframework.xingyun.basedata.entity.PriceSubTable"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="price_id" property="priceId"/> | |
| 8 | + <result column="product_id" property="productId"/> | |
| 9 | + <result column="product_name" property="productName"/> | |
| 10 | + <result column="code" property="code"/> | |
| 11 | + <result column="type" property="type"/> | |
| 12 | + <result column="price" property="price"/> | |
| 13 | + <result column="create_by_id" property="createById"/> | |
| 14 | + <result column="create_by" property="createBy"/> | |
| 15 | + <result column="update_by_id" property="updateById"/> | |
| 16 | + <result column="update_by" property="updateBy"/> | |
| 17 | + <result column="create_time" property="createTime"/> | |
| 18 | + <result column="update_time" property="updateTime"/> | |
| 19 | + </resultMap> | |
| 20 | + | |
| 21 | + <sql id="PriceSubTable_sql"> | |
| 22 | + SELECT | |
| 23 | + tb.id, | |
| 24 | + tb.price_id, | |
| 25 | + tb.product_id, | |
| 26 | + br.product_name as product_name, | |
| 27 | + br.code as code, | |
| 28 | + br.type as type, | |
| 29 | + tb.price, | |
| 30 | + tb.create_by_id, | |
| 31 | + tb.create_by, | |
| 32 | + tb.update_by_id, | |
| 33 | + tb.update_by, | |
| 34 | + tb.create_time, | |
| 35 | + tb.update_time | |
| 36 | + FROM base_data_price_sub_table AS tb | |
| 37 | + LEFT JOIN base_data_breed_relationship br on br.id=tb.product_id | |
| 38 | + </sql> | |
| 39 | + | |
| 40 | + <select id="query" resultMap="PriceSubTable"> | |
| 41 | + <include refid="PriceSubTable_sql"/> | |
| 42 | + <where> | |
| 43 | + <if test="vo.priceId != null and vo.priceId != ''"> | |
| 44 | + AND tb.price_id = #{vo.priceId} | |
| 45 | + </if> | |
| 46 | + </where> | |
| 47 | + </select> | |
| 48 | +</mapper> | ... | ... |