Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
|
019b4e1fd4 | 8 months ago |
|
6e23aaf129 | 9 months ago |
|
3879b288ce | 9 months ago |
|
0ed1b37a1f | 9 months ago |
|
76f7c4d569 | 9 months ago |
|
43100f0174 | 9 months ago |
|
1f7dbe9280 | 9 months ago |
126 changed files with 8894 additions and 58 deletions
@ -0,0 +1,77 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>abc-development-platform</artifactId> |
|||
<version>5.1.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>platform-boot-started-costManagement</artifactId> |
|||
<version>5.1.0</version> |
|||
<name>platform-boot-started-costManagement</name> |
|||
<description>造价管理模块</description> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>platform-common</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>platform-boot-started-productManagement</artifactId> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
<build> |
|||
<plugins> |
|||
<!--编译插件 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.8.1</version> |
|||
<configuration> |
|||
<!--指定JDK编译版本 --> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
<encoding>UTF-8</encoding> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- 测试插件 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-surefire-plugin</artifactId> |
|||
<version>2.22.2</version> |
|||
<configuration> |
|||
<!-- 跳过测试 --> |
|||
<skipTests>true</skipTests> |
|||
</configuration> |
|||
</plugin> |
|||
|
|||
</plugins> |
|||
<resources> |
|||
<!--处理mybatis的mapper.xml文件--> |
|||
<resource> |
|||
<directory>src/main/java</directory> |
|||
<includes> |
|||
<include>**/*.xml</include> |
|||
</includes> |
|||
</resource> |
|||
<!--处理其他资源文件--> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<!--系统配置文件--> |
|||
<include>*.yml</include> |
|||
<!--excel模板--> |
|||
<include>**/*.xlsx</include> |
|||
<!--其他配置文件--> |
|||
<include>*.xml</include> |
|||
</includes> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
</project> |
@ -0,0 +1,220 @@ |
|||
package tech.abc.platform.costManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.costManagement.entity.CostItemDetail; |
|||
import tech.abc.platform.costManagement.service.CostItemDetailService; |
|||
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import tech.abc.platform.costManagement.vo.ProductsVO; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/costManagement/costItemDetail") |
|||
@Slf4j |
|||
public class CostItemDetailController extends BaseController { |
|||
@Autowired |
|||
private CostItemDetailService costItemDetailService; |
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/getProductsPageByType") |
|||
@SystemLog(value = "-分页") |
|||
// @PreAuthorize("hasPermission(null,'costManagement:costItemDetail:query')")
|
|||
public ResponseEntity<Result> getProductsPageByType(ProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<ProductsVO> page = new Page<ProductsVO>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
//查询数据
|
|||
IPage<ProductsVO> pageVO =costItemDetailService.getProductsPageByType(page, queryVO); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
CostItemDetail entity=costItemDetailService.init(); |
|||
CostItemDetailVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody CostItemDetailVO vo) { |
|||
CostItemDetail entity=convert2Entity(vo); |
|||
costItemDetailService.add(entity); |
|||
CostItemDetailVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody CostItemDetailVO vo) { |
|||
CostItemDetail entity=convert2Entity(vo); |
|||
costItemDetailService.modify(entity); |
|||
CostItemDetailVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
costItemDetailService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:query')") |
|||
public ResponseEntity<Result> page(CostItemDetailVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<CostItemDetail> page = new Page<CostItemDetail>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<CostItemDetail> queryWrapper = QueryGenerator.generateQueryWrapper(CostItemDetail.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
costItemDetailService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<CostItemDetailVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<CostItemDetailVO> costItemDetailVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(costItemDetailVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:query')") |
|||
public ResponseEntity<Result> list(CostItemDetailVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<CostItemDetail> queryWrapper = QueryGenerator.generateQueryWrapper(CostItemDetail.class, queryVO,sortInfo); |
|||
List<CostItemDetail> list= costItemDetailService.list(queryWrapper); |
|||
//转换vo
|
|||
List<CostItemDetailVO> costItemDetailVOList=convert2VO(list); |
|||
return ResultUtil.success(costItemDetailVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
CostItemDetail entity = costItemDetailService.query(id); |
|||
CostItemDetailVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
costItemDetailService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costItemDetail:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
CostItemDetail entity = costItemDetailService.addSingleByCopy(id); |
|||
CostItemDetailVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CostItemDetailVO convert2VO(CostItemDetail entity){ |
|||
CostItemDetailVO vo=mapperFacade.map(entity,CostItemDetailVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<CostItemDetailVO> convert2VO(List<CostItemDetail> entityList) { |
|||
List<CostItemDetailVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CostItemDetailVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private CostItemDetail convert2Entity(CostItemDetailVO vo){ |
|||
CostItemDetail entity=mapperFacade.map(vo,CostItemDetail.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,248 @@ |
|||
package tech.abc.platform.costManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.costManagement.entity.CostTable; |
|||
import tech.abc.platform.costManagement.service.CostTableService; |
|||
import tech.abc.platform.costManagement.vo.CostDetailViewVO; |
|||
import tech.abc.platform.costManagement.vo.CostTableVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/costManagement/costTable") |
|||
@Slf4j |
|||
public class CostTableController extends BaseController { |
|||
@Autowired |
|||
private CostTableService costTableService; |
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/addCostTable") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:add')") |
|||
public ResponseEntity<Result> addCostTable(@Validated @RequestBody CostDetailViewVO vo) { |
|||
costTableService.addCostTable(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/modifyCostTable") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:modify')") |
|||
public ResponseEntity<Result> modifyCostTable(@Validated @RequestBody CostDetailViewVO vo) { |
|||
costTableService.modifyCostTable(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/getCostTableDetail/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:view')") |
|||
public ResponseEntity<Result> getCostTableDetail(@PathVariable("id") String id) { |
|||
CostDetailViewVO vo = costTableService.getCostTableDetail(id); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
/** |
|||
* 导出单条数据表格文件 |
|||
*/ |
|||
@GetMapping("/exportData/{id}") |
|||
@SystemLog(value = "-导出造价") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:view')") |
|||
public void exportData(@PathVariable("id") String id, HttpServletResponse response) throws IOException { |
|||
costTableService.exportData(id,response); |
|||
} |
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
CostTable entity=costTableService.init(); |
|||
CostTableVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody CostTableVO vo) { |
|||
CostTable entity=convert2Entity(vo); |
|||
costTableService.add(entity); |
|||
CostTableVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody CostTableVO vo) { |
|||
CostTable entity=convert2Entity(vo); |
|||
costTableService.modify(entity); |
|||
CostTableVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
costTableService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:query')") |
|||
public ResponseEntity<Result> page(CostTableVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<CostTable> page = new Page<CostTable>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<CostTable> queryWrapper = QueryGenerator.generateQueryWrapper(CostTable.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
costTableService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<CostTableVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<CostTableVO> costTableVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(costTableVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:query')") |
|||
public ResponseEntity<Result> list(CostTableVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<CostTable> queryWrapper = QueryGenerator.generateQueryWrapper(CostTable.class, queryVO,sortInfo); |
|||
List<CostTable> list= costTableService.list(queryWrapper); |
|||
//转换vo
|
|||
List<CostTableVO> costTableVOList=convert2VO(list); |
|||
return ResultUtil.success(costTableVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
CostTable entity = costTableService.query(id); |
|||
CostTableVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
costTableService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:costTable:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
CostTable entity = costTableService.addSingleByCopy(id); |
|||
CostTableVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CostTableVO convert2VO(CostTable entity){ |
|||
CostTableVO vo=mapperFacade.map(entity,CostTableVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<CostTableVO> convert2VO(List<CostTable> entityList) { |
|||
List<CostTableVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CostTableVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private CostTable convert2Entity(CostTableVO vo){ |
|||
CostTable entity=mapperFacade.map(vo,CostTable.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,105 @@ |
|||
package tech.abc.platform.costManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
|
|||
import java.math.BigDecimal; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import java.time.LocalDateTime; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("cmg_cost_item_detail") |
|||
public class CostItemDetail extends BaseEntity { |
|||
|
|||
/** |
|||
* 造价表id |
|||
*/ |
|||
@TableField("cost_table_id") |
|||
private String costTableId; |
|||
|
|||
/** |
|||
* 父类id |
|||
*/ |
|||
@TableField("parent_id") |
|||
private String parentId; |
|||
|
|||
/** |
|||
* 费用类型 |
|||
*/ |
|||
@TableField("cost_type") |
|||
private String costType; |
|||
|
|||
/** |
|||
* 建设内容 |
|||
*/ |
|||
@TableField("construct_content") |
|||
private String constructContent; |
|||
|
|||
/** |
|||
* 费用名称 |
|||
*/ |
|||
@TableField("cost_name") |
|||
private String costName; |
|||
|
|||
/** |
|||
* 费用描述 |
|||
*/ |
|||
@TableField("cost_describe") |
|||
private String costDescribe; |
|||
|
|||
/** |
|||
* 单位 |
|||
*/ |
|||
@TableField("unit") |
|||
private String unit; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
@TableField(value="quantity",updateStrategy= FieldStrategy.IGNORED) |
|||
private Integer quantity; |
|||
|
|||
/** |
|||
* 单价 |
|||
*/ |
|||
@TableField(value="unit_price",updateStrategy= FieldStrategy.IGNORED) |
|||
private BigDecimal unitPrice; |
|||
|
|||
/** |
|||
* 总价 |
|||
*/ |
|||
@TableField(value="total_price",updateStrategy= FieldStrategy.IGNORED) |
|||
private BigDecimal totalPrice; |
|||
|
|||
/** |
|||
* 是否明细 |
|||
*/ |
|||
@TableField("is_detail") |
|||
private String isDetail; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@TableField("remarks") |
|||
private String remarks; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@TableField("order_no") |
|||
private String orderNo; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,45 @@ |
|||
package tech.abc.platform.costManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.FieldStrategy; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("cmg_cost_table") |
|||
public class CostTable extends BaseEntity { |
|||
|
|||
/** |
|||
* 项目名称 |
|||
*/ |
|||
@TableField("project_name") |
|||
private String projectName; |
|||
|
|||
/** |
|||
* 造价日期 |
|||
*/ |
|||
@TableField(value="cost_date",updateStrategy= FieldStrategy.IGNORED) |
|||
private LocalDateTime costDate; |
|||
|
|||
/** |
|||
* 总投资 |
|||
*/ |
|||
@TableField(value="total_investment",updateStrategy= FieldStrategy.IGNORED) |
|||
private BigDecimal totalInvestment; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.costManagement.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import tech.abc.platform.costManagement.entity.CostItemDetail; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
|||
import tech.abc.platform.costManagement.vo.ProductsVO; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
*/ |
|||
public interface CostItemDetailMapper extends BaseMapper<CostItemDetail> { |
|||
|
|||
List<CostItemDetailVO> getCostItemDetailWithChildrenByCostTableId(String costTableId); |
|||
IPage<ProductsVO> getProductsPageByType(IPage<ProductsVO> page, @Param("queryVO") ProductsVO queryVO); |
|||
} |
|||
|
@ -0,0 +1,114 @@ |
|||
<?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="tech.abc.platform.costManagement.mapper.CostItemDetailMapper"> |
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="tech.abc.platform.costManagement.vo.CostItemDetailVO"> |
|||
<id property="id" column="id" /> |
|||
<result property="costTableId" column="cost_table_id" /> |
|||
<result property="parentId" column="parent_id" /> |
|||
<result property="costType" column="cost_type" /> |
|||
<result property="constructContent" column="construct_content" /> |
|||
<result property="costName" column="cost_name" /> |
|||
<result property="costDescribe" column="cost_describe" /> |
|||
<result property="unit" column="unit" /> |
|||
<result property="quantity" column="quantity" /> |
|||
<result property="unitPrice" column="unit_price" /> |
|||
<result property="totalPrice" column="total_price" /> |
|||
<result property="isDetail" column="is_detail" /> |
|||
<result property="remarks" column="remarks" /> |
|||
<result property="orderNo" column="order_no" /> |
|||
<collection property="children" select="getChildrenByParentId" column="id" /> |
|||
</resultMap> |
|||
<sql id="getProductsPageByType_Column_List"> |
|||
id, supplier_information_id, product_name, product_identity, |
|||
product_price, source_information, model_id, remarks,image, |
|||
delete_flag |
|||
</sql> |
|||
<sql id="getProductsPageByType_Query"> |
|||
<where> |
|||
delete_flag = 'NO' |
|||
<if test="queryVO.supplierInformationId!= null and queryVO.supplierInformationId!= ''"> |
|||
and supplier_information_id = #{queryVO.supplierInformationId} |
|||
</if> |
|||
<if test="queryVO.productName!= null and queryVO.productName!= ''"> |
|||
AND product_name LIKE CONCAT('%', #{queryVO.productName}, '%') |
|||
</if> |
|||
<if test="queryVO.productIdentity!= null and queryVO.productIdentity!= ''"> |
|||
AND product_identity LIKE CONCAT('%', #{queryVO.productIdentity}, '%') |
|||
</if> |
|||
<if test="queryVO.productPrice != null and queryVO.productPrice != ''"> |
|||
AND product_price = #{queryVO.productPrice} |
|||
</if> |
|||
<if test="queryVO.sourceInformation!= null and queryVO.sourceInformation!= ''"> |
|||
AND source_information LIKE CONCAT('%', #{queryVO.sourceInformation}, '%') |
|||
</if> |
|||
<if test="queryVO.modelId!= null and queryVO.modelId!= ''"> |
|||
AND model_id = #{queryVO.modelId} |
|||
</if> |
|||
<if test="queryVO.remarks!= null and queryVO.remarks!= ''"> |
|||
AND remarks LIKE CONCAT('%', #{queryVO.remarks}, '%') |
|||
</if> |
|||
|
|||
<!-- <if test="supplierInformationId!= null and supplierInformationId!= ''">--> |
|||
<!-- supplier_information_id = #{supplierInformationId}--> |
|||
<!-- </if>--> |
|||
<!-- <if test="productName!= null and productName!= ''">--> |
|||
<!-- AND product_name LIKE CONCAT('%', #{productName}, '%')--> |
|||
<!-- </if>--> |
|||
<!-- <if test="productIdentity!= null and productIdentity!= ''">--> |
|||
<!-- AND product_identity LIKE CONCAT('%', #{productIdentity}, '%')--> |
|||
<!-- </if>--> |
|||
<!-- <if test="productPrice != null and productPrice != ''">--> |
|||
<!-- AND product_price = #{productPrice}--> |
|||
<!-- </if>--> |
|||
<!-- <if test="sourceInformation!= null and sourceInformation!= ''">--> |
|||
<!-- AND source_information LIKE CONCAT('%', #{sourceInformation}, '%')--> |
|||
<!-- </if>--> |
|||
<!-- <if test="modelId!= null and modelId!= ''">--> |
|||
<!-- AND model_id = #{modelId}--> |
|||
<!-- </if>--> |
|||
<!-- <if test="remarks!= null and remarks!= ''">--> |
|||
<!-- AND remarks LIKE CONCAT('%', #{remarks}, '%')--> |
|||
<!-- </if>--> |
|||
<!-- <if test="deleteFlag!= null and deleteFlag!= ''">--> |
|||
<!-- AND delete_flag = #{deleteFlag}--> |
|||
<!-- </if>--> |
|||
</where> |
|||
</sql> |
|||
|
|||
<select id="getCostItemDetailWithChildrenByCostTableId" resultMap="BaseResultMap"> |
|||
SELECT * FROM cmg_cost_item_detail WHERE cost_table_id = #{costTableId} and parent_id is null and delete_flag = 'NO' ORDER BY order_no |
|||
</select> |
|||
<select id="getChildrenByParentId" resultMap="BaseResultMap"> |
|||
SELECT * FROM cmg_cost_item_detail WHERE parent_id = #{id} and delete_flag = 'NO' ORDER BY order_no |
|||
</select> |
|||
<select id="getProductsPageByType" resultType="tech.abc.platform.costManagement.vo.ProductsVO"> |
|||
<if test="queryVO.productType == '供应商产品库' or queryVO.productType == '全产品库' "> |
|||
SELECT |
|||
<include refid="getProductsPageByType_Column_List"/> |
|||
,'供应商产品库' as productType,(select description from pmg_supplier_product_model where id=model_id )as productSpecifications |
|||
FROM pmg_supplier_products |
|||
<include refid="getProductsPageByType_Query"/> |
|||
</if> |
|||
<if test="queryVO.productType == '公司产品库' or queryVO.productType == '全产品库' "> |
|||
<if test=" queryVO.productType == '全产品库' "> |
|||
union all |
|||
</if> |
|||
SELECT |
|||
<include refid="getProductsPageByType_Column_List"/> |
|||
,'公司产品库' as productType,(select description from pmg_company_product_model where id=model_id )as productSpecifications |
|||
FROM pmg_company_products |
|||
<include refid="getProductsPageByType_Query"/> |
|||
</if> |
|||
<if test="queryVO.productType == '个人产品库' or queryVO.productType == '全产品库' "> |
|||
<if test=" queryVO.productType == '全产品库' "> |
|||
union all |
|||
</if> |
|||
SELECT |
|||
<include refid="getProductsPageByType_Column_List"/> |
|||
,'个人产品库' as productType,(select description from pmg_person_product_model where id=model_id )as productSpecifications |
|||
FROM pmg_person_products |
|||
<include refid="getProductsPageByType_Query"/> |
|||
</if> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,19 @@ |
|||
package tech.abc.platform.costManagement.mapper; |
|||
|
|||
import tech.abc.platform.costManagement.entity.CostTable; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
*/ |
|||
public interface CostTableMapper extends BaseMapper<CostTable> { |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.costManagement.mapper.CostTableMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,38 @@ |
|||
package tech.abc.platform.costManagement.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import tech.abc.platform.costManagement.entity.CostItemDetail; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
|||
import tech.abc.platform.costManagement.vo.ProductsVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
*/ |
|||
public interface CostItemDetailService extends BaseService<CostItemDetail> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
void addCostItemDetail(List<CostItemDetailVO> costItemDetaiVOlList); |
|||
|
|||
List<CostItemDetailVO> getCostItemDetail(String costTableId); |
|||
|
|||
void modifyCostItemDetail(List<CostItemDetailVO> costItemDetaiVOlList); |
|||
|
|||
void removeByCostTableId(String costTableId); |
|||
|
|||
IPage<ProductsVO> getProductsPageByType(IPage<ProductsVO> page, ProductsVO queryVO); |
|||
} |
|||
|
@ -0,0 +1,36 @@ |
|||
package tech.abc.platform.costManagement.service; |
|||
|
|||
import tech.abc.platform.costManagement.entity.CostTable; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.costManagement.vo.CostDetailViewVO; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
*/ |
|||
public interface CostTableService extends BaseService<CostTable> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
void addCostTable(CostDetailViewVO vo); |
|||
|
|||
CostDetailViewVO getCostTableDetail(String id); |
|||
|
|||
void modifyCostTable(CostDetailViewVO vo); |
|||
|
|||
void exportData(String id,HttpServletResponse response) throws IOException; |
|||
} |
|||
|
@ -0,0 +1,145 @@ |
|||
package tech.abc.platform.costManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.costManagement.entity.CostItemDetail; |
|||
import tech.abc.platform.costManagement.mapper.CostItemDetailMapper; |
|||
import tech.abc.platform.costManagement.service.CostItemDetailService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import tech.abc.platform.common.exception.CommonException; |
|||
import tech.abc.platform.common.exception.CustomException; |
|||
import java.math.BigDecimal; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
|||
import tech.abc.platform.costManagement.vo.ProductsVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class CostItemDetailServiceImpl extends BaseServiceImpl<CostItemDetailMapper, CostItemDetail> implements CostItemDetailService { |
|||
@Autowired |
|||
private CostItemDetailMapper costItemDetailMapper; |
|||
@Override |
|||
public void addCostItemDetail(List<CostItemDetailVO> costItemDetaiVOlList) { |
|||
if (CollectionUtils.isEmpty(costItemDetaiVOlList)) { |
|||
return; |
|||
} |
|||
List<CostItemDetail> costItemDetailList = new ArrayList<>(); |
|||
for (CostItemDetailVO costItemDetailVO : costItemDetaiVOlList) { |
|||
//获取子类内容加入到List
|
|||
getChildAddToList(costItemDetailVO, costItemDetailList); |
|||
CostItemDetail costItemDetail = mapperFacade.map(costItemDetailVO, CostItemDetail.class); |
|||
costItemDetailList.add(costItemDetail); |
|||
|
|||
} |
|||
//批量保存
|
|||
saveBatch(costItemDetailList); |
|||
} |
|||
|
|||
@Override |
|||
public List<CostItemDetailVO> getCostItemDetail(String costTableId) { |
|||
List<CostItemDetailVO> costItemDetailList = costItemDetailMapper.getCostItemDetailWithChildrenByCostTableId(costTableId); |
|||
return costItemDetailList; |
|||
} |
|||
|
|||
@Override |
|||
public void modifyCostItemDetail(List<CostItemDetailVO> costItemDetaiVOlList) { |
|||
String costTableId = costItemDetaiVOlList.get(0).getCostTableId(); |
|||
removeByCostTableId(costTableId); |
|||
if (CollectionUtils.isEmpty(costItemDetaiVOlList)) { |
|||
return; |
|||
} |
|||
List<CostItemDetail> costItemDetailList = new ArrayList<>(); |
|||
for (CostItemDetailVO costItemDetailVO : costItemDetaiVOlList) { |
|||
//获取子类内容加入到List
|
|||
getChildAddToList(costItemDetailVO, costItemDetailList); |
|||
CostItemDetail costItemDetail = mapperFacade.map(costItemDetailVO, CostItemDetail.class); |
|||
costItemDetail.setUpdateId(null); |
|||
costItemDetail.setUpdateTime(null); |
|||
costItemDetailList.add(costItemDetail); |
|||
|
|||
} |
|||
//批量保存
|
|||
saveBatch(costItemDetailList); |
|||
} |
|||
|
|||
@Override |
|||
public void removeByCostTableId(String costTableId) { |
|||
LambdaUpdateWrapper<CostItemDetail> deleteWrapper = new LambdaUpdateWrapper<>(); |
|||
deleteWrapper.eq(CostItemDetail::getCostTableId, costTableId); |
|||
remove(deleteWrapper);//删除原有数据
|
|||
} |
|||
|
|||
@Override |
|||
public IPage<ProductsVO> getProductsPageByType(IPage<ProductsVO> page, ProductsVO queryVO) { |
|||
IPage<ProductsVO> productsPageByType = costItemDetailMapper.getProductsPageByType(page, queryVO); |
|||
return productsPageByType; |
|||
} |
|||
|
|||
/** |
|||
* 获取子类内容加入到List |
|||
* @param costItemDetailVO costItemDetailVO |
|||
* @param costItemDetailList costItemDetail保存容器 |
|||
*/ |
|||
protected void getChildAddToList(CostItemDetailVO costItemDetailVO, List<CostItemDetail> costItemDetailList) { |
|||
if (CollectionUtils.isEmpty(costItemDetailVO.getChildren())) { |
|||
return; |
|||
} |
|||
for (CostItemDetailVO child : costItemDetailVO.getChildren()) { |
|||
getChildAddToList(child, costItemDetailList); |
|||
//子类内容
|
|||
CostItemDetail childCostItemDetail = mapperFacade.map(child, CostItemDetail.class); |
|||
childCostItemDetail.setUpdateId(null); |
|||
childCostItemDetail.setUpdateTime(null); |
|||
costItemDetailList.add(childCostItemDetail); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public CostItemDetail init() { |
|||
CostItemDetail entity=new CostItemDetail(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(CostItemDetail entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(CostItemDetail entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(CostItemDetail entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,243 @@ |
|||
package tech.abc.platform.costManagement.service.impl; |
|||
|
|||
import cn.hutool.core.convert.NumberChineseFormatter; |
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.alibaba.excel.ExcelWriter; |
|||
import com.alibaba.excel.write.metadata.WriteSheet; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.poi.ss.formula.functions.T; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.common.extension.EasyExcelUtils; |
|||
import tech.abc.platform.common.extension.ExcelColumnMergeHandler; |
|||
import tech.abc.platform.common.extension.ExcelRowMergeHandler; |
|||
import tech.abc.platform.costManagement.entity.CostTable; |
|||
import tech.abc.platform.costManagement.mapper.CostTableMapper; |
|||
import tech.abc.platform.costManagement.service.CostItemDetailService; |
|||
import tech.abc.platform.costManagement.service.CostTableService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.time.LocalDateTime; |
|||
import java.util.*; |
|||
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.costManagement.vo.CostDetailViewVO; |
|||
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class CostTableServiceImpl extends BaseServiceImpl<CostTableMapper, CostTable> implements CostTableService { |
|||
@Autowired |
|||
private CostItemDetailService costItemDetailService; |
|||
@Override |
|||
public void addCostTable(CostDetailViewVO vo) { |
|||
vo.setCostDate(LocalDateTime.now()); |
|||
costItemDetailService.addCostItemDetail(vo.getCostItemDetailList());//保存造价明细
|
|||
CostTable costTable = mapperFacade.map(vo, CostTable.class); |
|||
save(costTable);//保存造价表
|
|||
} |
|||
|
|||
@Override |
|||
public CostDetailViewVO getCostTableDetail(String id) { |
|||
CostDetailViewVO costDetailViewVO = new CostDetailViewVO(); |
|||
CostTable costTable = query(id); |
|||
|
|||
costDetailViewVO.setId(id); |
|||
costDetailViewVO.setProjectName(costTable.getProjectName()); |
|||
costDetailViewVO.setTotalInvestment(costTable.getTotalInvestment()); |
|||
costDetailViewVO.setCostDate(costTable.getCostDate()); |
|||
List<CostItemDetailVO> costItemDetail = costItemDetailService.getCostItemDetail(costTable.getId()); |
|||
costDetailViewVO.setCostItemDetailList(costItemDetail); |
|||
|
|||
return costDetailViewVO; |
|||
} |
|||
|
|||
@Override |
|||
public void modifyCostTable(CostDetailViewVO vo) { |
|||
costItemDetailService.modifyCostItemDetail(vo.getCostItemDetailList());//保存造价明细
|
|||
CostTable costTable = mapperFacade.map(vo, CostTable.class); |
|||
updateById(costTable);//修改造价表
|
|||
} |
|||
|
|||
@Override |
|||
public void exportData(String id, HttpServletResponse response) throws IOException { |
|||
//导出数据
|
|||
//web设置
|
|||
response.setContentType("application/vnd.ms-excel"); |
|||
response.setCharacterEncoding("utf-8"); |
|||
String exportFileName = URLEncoder.encode("ces", "UTF-8").replaceAll("\\+", "%20"); |
|||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + exportFileName + ".xlsx"); |
|||
response.setHeader("filename", exportFileName + ".xlsx"); |
|||
response.setHeader("Access-Control-Expose-Headers", "filename"); |
|||
//1.查询数据
|
|||
CostTable costTable = query(id); |
|||
List<CostItemDetailVO> costItemDetail = costItemDetailService.getCostItemDetail(costTable.getId()); |
|||
List<String> heads = new ArrayList<>(); |
|||
heads.add("序号"); |
|||
heads.add("费用类型"); |
|||
heads.add("建设内容"); |
|||
heads.add("小计(元)"); |
|||
heads.add("备注"); |
|||
List<String> childHeads = new ArrayList<>(); |
|||
childHeads.add("序号"); |
|||
childHeads.add("设备名称"); |
|||
childHeads.add("主要技术参数"); |
|||
childHeads.add("数量"); |
|||
childHeads.add("单位"); |
|||
childHeads.add("单价"); |
|||
childHeads.add("小计"); |
|||
List<Object> otherCostData = new ArrayList<>(); |
|||
List<List<Object>> otherCostList= new ArrayList<>(); |
|||
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); |
|||
List<List<Object>> dataList = new ArrayList<>(); |
|||
ExcelColumnMergeHandler columnMergeHandler = new ExcelColumnMergeHandler(1, new int[]{0, 1}); |
|||
ExcelRowMergeHandler rowMergeHandler = new ExcelRowMergeHandler(); |
|||
Integer xuhao= 1; |
|||
Integer num=0; |
|||
for (int i = 0; i < costItemDetail.size(); i++) { |
|||
CostItemDetailVO costItemDetailVO = costItemDetail.get(i); |
|||
if(StringUtils.isBlank(costItemDetailVO.getCostType())){ |
|||
List<Object> objects = getChildDataList(costItemDetailVO, i); |
|||
otherCostList.add(objects); |
|||
continue; |
|||
} |
|||
List<Object> objectList = getDataList(costItemDetail, i, xuhao); |
|||
dataList.add(objectList); |
|||
|
|||
num = setChildDataSheet(costItemDetailVO,excelWriter,num,heads,childHeads,columnMergeHandler,rowMergeHandler); |
|||
|
|||
} |
|||
num=num+1; |
|||
WriteSheet sheet2 = EasyExcel.writerSheet(num,"未分类费用").head(EasyExcelUtils.head(childHeads)).registerWriteHandler(columnMergeHandler).registerWriteHandler(rowMergeHandler).build(); |
|||
excelWriter.write(otherCostList, sheet2); |
|||
WriteSheet sheet1 = EasyExcel.writerSheet(0, "项目投资概算总表").head(EasyExcelUtils.head(heads)).registerWriteHandler(columnMergeHandler).registerWriteHandler(rowMergeHandler).build(); |
|||
excelWriter.write(dataList, sheet1); |
|||
log.info(num+"个sheet已写入"); |
|||
excelWriter.finish(); |
|||
//3.返回结果
|
|||
} |
|||
|
|||
@Override |
|||
public void afterRemove(CostTable entity) { |
|||
costItemDetailService.removeByCostTableId(entity.getId()); |
|||
} |
|||
@Override |
|||
public CostTable init() { |
|||
CostTable entity=new CostTable(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(CostTable entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(CostTable entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(CostTable entity, String... value) { |
|||
} |
|||
private List<Object> getChildDataList(CostItemDetailVO children, Integer j) { |
|||
List<Object> childObject = new ArrayList<>(); |
|||
childObject.add(NumberChineseFormatter.format(j + 1, false, false)); |
|||
childObject.add(children.getCostName()); |
|||
childObject.add(children.getCostDescribe()); |
|||
childObject.add(children.getQuantity()); |
|||
childObject.add(children.getUnit()); |
|||
childObject.add(children.getUnitPrice()); |
|||
childObject.add(children.getTotalPrice()); |
|||
return childObject; |
|||
} |
|||
private List<Object> getDataList(List<CostItemDetailVO> costItemDetail, Integer i, Integer xuhao) { |
|||
CostItemDetailVO costItemDetailVO = costItemDetail.get(i); |
|||
List<Object> objectList = new ArrayList<>(); |
|||
if(i>=1){ |
|||
//比较后一个和前一个是否一样
|
|||
String newCostType = costItemDetailVO.getCostType(); |
|||
String lastCostType = costItemDetail.get(i-1).getCostType(); |
|||
if(!newCostType.equals(lastCostType)) { |
|||
xuhao=xuhao+1; |
|||
} |
|||
} |
|||
objectList.add(NumberChineseFormatter.format(xuhao,false,false)); |
|||
objectList.add(costItemDetailVO.getCostType()); |
|||
objectList.add(costItemDetailVO.getConstructContent()); |
|||
objectList.add(costItemDetailVO.getTotalPrice()); |
|||
objectList.add(costItemDetailVO.getRemarks()); |
|||
return objectList; |
|||
} |
|||
/** |
|||
* 递归获取子节点数据 |
|||
* @param costItemDetailVO |
|||
* @param num |
|||
* @return |
|||
*/ |
|||
private Integer setChildDataSheet(CostItemDetailVO costItemDetailVO, |
|||
ExcelWriter excelWriter, |
|||
Integer num, |
|||
List<String> heads, |
|||
List<String> childHeads, |
|||
ExcelColumnMergeHandler columnMergeHandler, |
|||
ExcelRowMergeHandler rowMergeHandler) { |
|||
List<CostItemDetailVO> childrenList = costItemDetailVO.getChildren(); |
|||
List<List<Object>> childDataList = new ArrayList<>(); |
|||
Boolean isDetail = true; |
|||
for (Integer j = 0; j < childrenList.size(); j++) { |
|||
CostItemDetailVO child = childrenList.get(j); |
|||
if(child.getIsDetail().equals("1")){ |
|||
isDetail=true; |
|||
List<Object> childObject = getChildDataList(child, j); |
|||
childDataList.add(childObject); |
|||
List<CostItemDetailVO> childChildren = child.getChildren(); |
|||
if(childChildren.size()>0){ |
|||
num = setChildDataSheet(child,excelWriter,num,heads,childHeads,columnMergeHandler,rowMergeHandler); |
|||
} |
|||
}else{ |
|||
isDetail=false; |
|||
Integer xuhao=1; |
|||
List<Object> childObject = getDataList(childrenList, j, xuhao); |
|||
childDataList.add(childObject); |
|||
List<CostItemDetailVO> childChildren = child.getChildren(); |
|||
if(childChildren.size()>0){ |
|||
num = setChildDataSheet(child,excelWriter,num,heads,childHeads,columnMergeHandler,rowMergeHandler); |
|||
} |
|||
} |
|||
|
|||
} |
|||
num=num+1; |
|||
if(!isDetail){ |
|||
WriteSheet sheet2 = EasyExcel.writerSheet(num,costItemDetailVO.getConstructContent()).head(EasyExcelUtils.head(heads)).registerWriteHandler(columnMergeHandler).registerWriteHandler(rowMergeHandler).build(); |
|||
excelWriter.write(childDataList, sheet2); |
|||
return num; |
|||
} |
|||
WriteSheet sheet2 = EasyExcel.writerSheet(num,costItemDetailVO.getConstructContent()).head(EasyExcelUtils.head(childHeads)).registerWriteHandler(columnMergeHandler).registerWriteHandler(rowMergeHandler).build(); |
|||
excelWriter.write(childDataList, sheet2); |
|||
return num; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,28 @@ |
|||
package tech.abc.platform.costManagement.vo; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import tech.abc.platform.common.base.BaseVO; |
|||
import tech.abc.platform.costManagement.entity.CostItemDetail; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CostDetailViewVO extends BaseVO { |
|||
@NotBlank(message = "【项目名称】不能为空") |
|||
private String projectName; |
|||
|
|||
private LocalDateTime costDate; |
|||
|
|||
|
|||
@NotNull(message = "【总投资】不能为空") |
|||
private BigDecimal totalInvestment; |
|||
private List<CostItemDetailVO> costItemDetailList; |
|||
} |
@ -0,0 +1,105 @@ |
|||
package tech.abc.platform.costManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
import java.time.LocalDateTime; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-22 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CostItemDetailVO extends BaseVO { |
|||
/** |
|||
* 造价表id |
|||
*/ |
|||
private String costTableId; |
|||
|
|||
/** |
|||
* 父类id |
|||
*/ |
|||
private String parentId; |
|||
|
|||
/** |
|||
* 费用类型 |
|||
*/ |
|||
private String costType; |
|||
|
|||
/** |
|||
* 建设内容 |
|||
*/ |
|||
private String constructContent; |
|||
|
|||
/** |
|||
* 费用名称 |
|||
*/ |
|||
private String costName; |
|||
|
|||
/** |
|||
* 费用描述 |
|||
*/ |
|||
private String costDescribe; |
|||
|
|||
/** |
|||
* 单位 |
|||
*/ |
|||
private String unit; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Integer quantity; |
|||
|
|||
/** |
|||
* 单价 |
|||
*/ |
|||
private BigDecimal unitPrice; |
|||
|
|||
/** |
|||
* 总价 |
|||
*/ |
|||
private BigDecimal totalPrice; |
|||
|
|||
/** |
|||
* 是否明细 |
|||
*/ |
|||
@NotBlank(message = "【是否明细】不能为空") |
|||
private String isDetail; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
private String orderNo; |
|||
private List<CostItemDetailVO> children; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package tech.abc.platform.costManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
import java.time.LocalDateTime; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.math.BigDecimal; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CostTableVO extends BaseVO { |
|||
/** |
|||
* 项目名称 |
|||
*/ |
|||
@NotBlank(message = "【项目名称】不能为空") |
|||
private String projectName; |
|||
|
|||
/** |
|||
* 造价日期 |
|||
*/ |
|||
@NotBlank(message = "【造价日期】不能为空") |
|||
private LocalDateTime costDate; |
|||
|
|||
/** |
|||
* 总投资 |
|||
*/ |
|||
@NotBlank(message = "【总投资】不能为空") |
|||
private BigDecimal totalInvestment; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package tech.abc.platform.costManagement.vo; |
|||
|
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class ProductsVO extends BaseVO { |
|||
/** |
|||
* 个人产品型号id |
|||
*/ |
|||
@NotBlank(message = "【个人产品型号id】不能为空") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
private String supplierInformationId; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@NotBlank(message = "【产品名称】不能为空") |
|||
private String productName; |
|||
|
|||
private String image; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@NotBlank(message = "【产品价格】不能为空") |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
|
|||
/** |
|||
* 关联厂商产品id |
|||
*/ |
|||
private String supplierProductsId; |
|||
/** |
|||
* 产品描述 |
|||
*/ |
|||
private String productSpecifications; |
|||
|
|||
/** |
|||
* 产品类型 (-1:全部, 0:供应商产品库, 1:公司产品库,2:个人产品库) |
|||
*/ |
|||
private String productType; |
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.costManagement.vo; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class QueryProductsVO extends BaseVO { |
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
private String productName; |
|||
/** |
|||
* 产品标识 |
|||
*/ |
|||
private String productIdentity; |
|||
/** |
|||
* 产品类型 (-1:全部, 0:供应商产品库, 1:公司产品库,2:个人产品库) |
|||
*/ |
|||
private String type; |
|||
} |
@ -0,0 +1,78 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>abc-development-platform</artifactId> |
|||
<version>5.1.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>platform-boot-started-productManagement</artifactId> |
|||
<version>5.1.0</version> |
|||
<name>platform-boot-started-productManagement</name> |
|||
<description>产品管理模块</description> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>platform-common</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>tech.abc</groupId> |
|||
<artifactId>platform-boot-starter-elasticsearch</artifactId> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<!--编译插件 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.8.1</version> |
|||
<configuration> |
|||
<!--指定JDK编译版本 --> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
<encoding>UTF-8</encoding> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- 测试插件 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-surefire-plugin</artifactId> |
|||
<version>2.22.2</version> |
|||
<configuration> |
|||
<!-- 跳过测试 --> |
|||
<skipTests>true</skipTests> |
|||
</configuration> |
|||
</plugin> |
|||
|
|||
</plugins> |
|||
<resources> |
|||
<!--处理mybatis的mapper.xml文件--> |
|||
<resource> |
|||
<directory>src/main/java</directory> |
|||
<includes> |
|||
<include>**/*.xml</include> |
|||
</includes> |
|||
</resource> |
|||
<!--处理其他资源文件--> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<!--系统配置文件--> |
|||
<include>*.yml</include> |
|||
<!--excel模板--> |
|||
<include>**/*.xlsx</include> |
|||
<!--其他配置文件--> |
|||
<include>*.xml</include> |
|||
</includes> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,238 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModel; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelService; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductModelVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/companyProductModel") |
|||
@Slf4j |
|||
public class CompanyProductModelController extends BaseController { |
|||
@Autowired |
|||
private CompanyProductModelService companyProductModelService; |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/addModel") |
|||
@SystemLog(value = "-新增型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:add')") |
|||
public ResponseEntity<Result> addModel(@Validated @RequestBody ProductModelViewVO<CompanyProductModelDetailsVO> vo) { |
|||
companyProductModelService.addModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/modifyModel") |
|||
@SystemLog(value = "-修改型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:modify')") |
|||
public ResponseEntity<Result> modifyModel(@Validated @RequestBody ProductModelViewVO<CompanyProductModelDetailsVO> vo) { |
|||
companyProductModelService.modifyModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/getModelDetails/{id}") |
|||
@SystemLog(value = "-获取型号详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:query')") |
|||
public ResponseEntity<Result> getModelDetails(@PathVariable("id") String id) { |
|||
List<CompanyProductModelDetailsVO> detailsList=companyProductModelService.getModelDetails(id); |
|||
return ResultUtil.success(detailsList); |
|||
} |
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
CompanyProductModel entity=companyProductModelService.init(); |
|||
CompanyProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody CompanyProductModelVO vo) { |
|||
CompanyProductModel entity=convert2Entity(vo); |
|||
companyProductModelService.add(entity); |
|||
CompanyProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody CompanyProductModelVO vo) { |
|||
CompanyProductModel entity=convert2Entity(vo); |
|||
companyProductModelService.modify(entity); |
|||
CompanyProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
companyProductModelService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:query')") |
|||
public ResponseEntity<Result> page(CompanyProductModelVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<CompanyProductModel> page = new Page<CompanyProductModel>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProductModel.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
companyProductModelService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<CompanyProductModelVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<CompanyProductModelVO> companyProductModelVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(companyProductModelVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:query')") |
|||
public ResponseEntity<Result> list(CompanyProductModelVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProductModel.class, queryVO,sortInfo); |
|||
List<CompanyProductModel> list= companyProductModelService.list(queryWrapper); |
|||
//转换vo
|
|||
List<CompanyProductModelVO> companyProductModelVOList=convert2VO(list); |
|||
return ResultUtil.success(companyProductModelVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
CompanyProductModel entity = companyProductModelService.query(id); |
|||
CompanyProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
companyProductModelService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
CompanyProductModel entity = companyProductModelService.addSingleByCopy(id); |
|||
CompanyProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CompanyProductModelVO convert2VO(CompanyProductModel entity){ |
|||
CompanyProductModelVO vo=mapperFacade.map(entity,CompanyProductModelVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<CompanyProductModelVO> convert2VO(List<CompanyProductModel> entityList) { |
|||
List<CompanyProductModelVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CompanyProductModelVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private CompanyProductModel convert2Entity(CompanyProductModelVO vo){ |
|||
CompanyProductModel entity=mapperFacade.map(vo,CompanyProductModel.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,206 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductModelDetailsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/companyProductModelDetails") |
|||
@Slf4j |
|||
public class CompanyProductModelDetailsController extends BaseController { |
|||
@Autowired |
|||
private CompanyProductModelDetailsService companyProductModelDetailsService; |
|||
|
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
CompanyProductModelDetails entity=companyProductModelDetailsService.init(); |
|||
CompanyProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody CompanyProductModelDetailsVO vo) { |
|||
CompanyProductModelDetails entity=convert2Entity(vo); |
|||
companyProductModelDetailsService.add(entity); |
|||
CompanyProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody CompanyProductModelDetailsVO vo) { |
|||
CompanyProductModelDetails entity=convert2Entity(vo); |
|||
companyProductModelDetailsService.modify(entity); |
|||
CompanyProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
companyProductModelDetailsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:query')") |
|||
public ResponseEntity<Result> page(CompanyProductModelDetailsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<CompanyProductModelDetails> page = new Page<CompanyProductModelDetails>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProductModelDetails.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
companyProductModelDetailsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<CompanyProductModelDetailsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<CompanyProductModelDetailsVO> companyProductModelDetailsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(companyProductModelDetailsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:query')") |
|||
public ResponseEntity<Result> list(CompanyProductModelDetailsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProductModelDetails.class, queryVO,sortInfo); |
|||
List<CompanyProductModelDetails> list= companyProductModelDetailsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<CompanyProductModelDetailsVO> companyProductModelDetailsVOList=convert2VO(list); |
|||
return ResultUtil.success(companyProductModelDetailsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
CompanyProductModelDetails entity = companyProductModelDetailsService.query(id); |
|||
CompanyProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
companyProductModelDetailsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
CompanyProductModelDetails entity = companyProductModelDetailsService.addSingleByCopy(id); |
|||
CompanyProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CompanyProductModelDetailsVO convert2VO(CompanyProductModelDetails entity){ |
|||
CompanyProductModelDetailsVO vo=mapperFacade.map(entity,CompanyProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<CompanyProductModelDetailsVO> convert2VO(List<CompanyProductModelDetails> entityList) { |
|||
List<CompanyProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CompanyProductModelDetailsVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private CompanyProductModelDetails convert2Entity(CompanyProductModelDetailsVO vo){ |
|||
CompanyProductModelDetails entity=mapperFacade.map(vo,CompanyProductModelDetails.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,214 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.CompanyProducts; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelService; |
|||
import tech.abc.platform.productManagement.service.CompanyProductsService; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/companyProducts") |
|||
@Slf4j |
|||
public class CompanyProductsController extends BaseController { |
|||
@Autowired |
|||
private CompanyProductsService companyProductsService; |
|||
@Autowired |
|||
private CompanyProductModelService companyProductModelService; |
|||
|
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
CompanyProducts entity=companyProductsService.init(); |
|||
CompanyProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody CompanyProductsVO vo) { |
|||
CompanyProducts entity=convert2Entity(vo); |
|||
companyProductsService.add(entity); |
|||
CompanyProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody CompanyProductsVO vo) { |
|||
CompanyProducts entity=convert2Entity(vo); |
|||
companyProductsService.modify(entity); |
|||
CompanyProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
companyProductsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:query')") |
|||
public ResponseEntity<Result> page(CompanyProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<CompanyProducts> page = new Page<CompanyProducts>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProducts> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProducts.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
companyProductsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<CompanyProductsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<CompanyProductsVO> companyProductsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(companyProductsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:query')") |
|||
public ResponseEntity<Result> list(CompanyProductsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<CompanyProducts> queryWrapper = QueryGenerator.generateQueryWrapper(CompanyProducts.class, queryVO,sortInfo); |
|||
List<CompanyProducts> list= companyProductsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<CompanyProductsVO> companyProductsVOList=convert2VO(list); |
|||
return ResultUtil.success(companyProductsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
CompanyProducts entity = companyProductsService.query(id); |
|||
CompanyProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
companyProductsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:companyProducts:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
CompanyProducts entity = companyProductsService.addSingleByCopy(id); |
|||
CompanyProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CompanyProductsVO convert2VO(CompanyProducts entity){ |
|||
CompanyProductsVO vo=mapperFacade.map(entity,CompanyProductsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<CompanyProductsVO> convert2VO(List<CompanyProducts> entityList) { |
|||
List<CompanyProductsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CompanyProductsVO vo = convert2VO(x); |
|||
if(StringUtils.isNotEmpty(vo.getModelId())){ |
|||
String description = companyProductModelService.getById(vo.getModelId()).getDescription(); |
|||
vo.setProductSpecifications(description); |
|||
} |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private CompanyProducts convert2Entity(CompanyProductsVO vo){ |
|||
CompanyProducts entity=mapperFacade.map(vo,CompanyProducts.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,238 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModel; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelService; |
|||
import tech.abc.platform.productManagement.vo.PersonProductModelVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
import tech.abc.platform.productManagement.vo.PersonProductModelDetailsVO; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/personProductModel") |
|||
@Slf4j |
|||
public class PersonProductModelController extends BaseController { |
|||
@Autowired |
|||
private PersonProductModelService personProductModelService; |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/addModel") |
|||
@SystemLog(value = "-新增型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:add')") |
|||
public ResponseEntity<Result> addModel(@Validated @RequestBody ProductModelViewVO<PersonProductModelDetailsVO> vo) { |
|||
personProductModelService.addModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/modifyModel") |
|||
@SystemLog(value = "-修改型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:modify')") |
|||
public ResponseEntity<Result> modifyModel(@Validated @RequestBody ProductModelViewVO<PersonProductModelDetailsVO> vo) { |
|||
personProductModelService.modifyModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/getModelDetails/{id}") |
|||
@SystemLog(value = "-获取型号详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:query')") |
|||
public ResponseEntity<Result> getModelDetails(@PathVariable("id") String id) { |
|||
List<PersonProductModelDetailsVO> detailsList=personProductModelService.getModelDetails(id); |
|||
return ResultUtil.success(detailsList); |
|||
} |
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
PersonProductModel entity=personProductModelService.init(); |
|||
PersonProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody PersonProductModelVO vo) { |
|||
PersonProductModel entity=convert2Entity(vo); |
|||
personProductModelService.add(entity); |
|||
PersonProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody PersonProductModelVO vo) { |
|||
PersonProductModel entity=convert2Entity(vo); |
|||
personProductModelService.modify(entity); |
|||
PersonProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
personProductModelService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:query')") |
|||
public ResponseEntity<Result> page(PersonProductModelVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<PersonProductModel> page = new Page<PersonProductModel>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<PersonProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProductModel.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
personProductModelService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<PersonProductModelVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<PersonProductModelVO> personProductModelVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(personProductModelVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:query')") |
|||
public ResponseEntity<Result> list(PersonProductModelVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<PersonProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProductModel.class, queryVO,sortInfo); |
|||
List<PersonProductModel> list= personProductModelService.list(queryWrapper); |
|||
//转换vo
|
|||
List<PersonProductModelVO> personProductModelVOList=convert2VO(list); |
|||
return ResultUtil.success(personProductModelVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
PersonProductModel entity = personProductModelService.query(id); |
|||
PersonProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
personProductModelService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
PersonProductModel entity = personProductModelService.addSingleByCopy(id); |
|||
PersonProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected PersonProductModelVO convert2VO(PersonProductModel entity){ |
|||
PersonProductModelVO vo=mapperFacade.map(entity,PersonProductModelVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<PersonProductModelVO> convert2VO(List<PersonProductModel> entityList) { |
|||
List<PersonProductModelVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
PersonProductModelVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private PersonProductModel convert2Entity(PersonProductModelVO vo){ |
|||
PersonProductModel entity=mapperFacade.map(vo,PersonProductModel.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,206 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.vo.PersonProductModelDetailsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/costManagement/personProductModelDetails") |
|||
@Slf4j |
|||
public class PersonProductModelDetailsController extends BaseController { |
|||
@Autowired |
|||
private PersonProductModelDetailsService personProductModelDetailsService; |
|||
|
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
PersonProductModelDetails entity=personProductModelDetailsService.init(); |
|||
PersonProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody PersonProductModelDetailsVO vo) { |
|||
PersonProductModelDetails entity=convert2Entity(vo); |
|||
personProductModelDetailsService.add(entity); |
|||
PersonProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody PersonProductModelDetailsVO vo) { |
|||
PersonProductModelDetails entity=convert2Entity(vo); |
|||
personProductModelDetailsService.modify(entity); |
|||
PersonProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
personProductModelDetailsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:query')") |
|||
public ResponseEntity<Result> page(PersonProductModelDetailsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<PersonProductModelDetails> page = new Page<PersonProductModelDetails>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<PersonProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProductModelDetails.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
personProductModelDetailsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<PersonProductModelDetailsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<PersonProductModelDetailsVO> personProductModelDetailsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(personProductModelDetailsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:query')") |
|||
public ResponseEntity<Result> list(PersonProductModelDetailsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<PersonProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProductModelDetails.class, queryVO,sortInfo); |
|||
List<PersonProductModelDetails> list= personProductModelDetailsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<PersonProductModelDetailsVO> personProductModelDetailsVOList=convert2VO(list); |
|||
return ResultUtil.success(personProductModelDetailsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
PersonProductModelDetails entity = personProductModelDetailsService.query(id); |
|||
PersonProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
personProductModelDetailsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'costManagement:personProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
PersonProductModelDetails entity = personProductModelDetailsService.addSingleByCopy(id); |
|||
PersonProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected PersonProductModelDetailsVO convert2VO(PersonProductModelDetails entity){ |
|||
PersonProductModelDetailsVO vo=mapperFacade.map(entity,PersonProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<PersonProductModelDetailsVO> convert2VO(List<PersonProductModelDetails> entityList) { |
|||
List<PersonProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
PersonProductModelDetailsVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private PersonProductModelDetails convert2Entity(PersonProductModelDetailsVO vo){ |
|||
PersonProductModelDetails entity=mapperFacade.map(vo,PersonProductModelDetails.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,216 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.PersonProducts; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelService; |
|||
import tech.abc.platform.productManagement.service.PersonProductsService; |
|||
import tech.abc.platform.productManagement.vo.PersonProductsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/personProducts") |
|||
@Slf4j |
|||
public class PersonProductsController extends BaseController { |
|||
@Autowired |
|||
private PersonProductsService personProductsService; |
|||
@Autowired |
|||
private PersonProductModelService personProductModelService; |
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
PersonProducts entity=personProductsService.init(); |
|||
PersonProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody PersonProductsVO vo) { |
|||
PersonProducts entity=convert2Entity(vo); |
|||
personProductsService.add(entity); |
|||
PersonProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody PersonProductsVO vo) { |
|||
PersonProducts entity=convert2Entity(vo); |
|||
personProductsService.modify(entity); |
|||
PersonProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
personProductsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:query')") |
|||
public ResponseEntity<Result> page(PersonProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<PersonProducts> page = new Page<PersonProducts>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<PersonProducts> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProducts.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
personProductsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<PersonProductsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<PersonProductsVO> personProductsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(personProductsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:query')") |
|||
public ResponseEntity<Result> list(PersonProductsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<PersonProducts> queryWrapper = QueryGenerator.generateQueryWrapper(PersonProducts.class, queryVO,sortInfo); |
|||
List<PersonProducts> list= personProductsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<PersonProductsVO> personProductsVOList=convert2VO(list); |
|||
return ResultUtil.success(personProductsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
PersonProducts entity = personProductsService.query(id); |
|||
PersonProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
personProductsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:personProducts:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
PersonProducts entity = personProductsService.addSingleByCopy(id); |
|||
PersonProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected PersonProductsVO convert2VO(PersonProducts entity){ |
|||
PersonProductsVO vo=mapperFacade.map(entity,PersonProductsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<PersonProductsVO> convert2VO(List<PersonProducts> entityList) { |
|||
List<PersonProductsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
PersonProductsVO vo = convert2VO(x); |
|||
String modelId = vo.getModelId(); |
|||
//获取型号描述信息
|
|||
if(StringUtils.isNotEmpty(modelId)){ |
|||
String description = personProductModelService.getById(modelId).getDescription(); |
|||
vo.setProductSpecifications(description); |
|||
} |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private PersonProducts convert2Entity(PersonProductsVO vo){ |
|||
PersonProducts entity=mapperFacade.map(vo,PersonProducts.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,214 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplate; |
|||
import tech.abc.platform.productManagement.service.ProductModelTemplateDetailsService; |
|||
import tech.abc.platform.productManagement.service.ProductModelTemplateService; |
|||
import tech.abc.platform.productManagement.vo.ProductModelTemplateVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/productModelTemplate") |
|||
@Slf4j |
|||
public class ProductModelTemplateController extends BaseController { |
|||
@Autowired |
|||
private ProductModelTemplateService productModelTemplateService; |
|||
@Autowired |
|||
private ProductModelTemplateDetailsService productModelTemplateDetailsService; |
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
ProductModelTemplate entity=productModelTemplateService.init(); |
|||
ProductModelTemplateVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody ProductModelTemplateVO vo) { |
|||
ProductModelTemplate entity=convert2Entity(vo); |
|||
productModelTemplateService.add(entity); |
|||
ProductModelTemplateVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody ProductModelTemplateVO vo) { |
|||
ProductModelTemplate entity=convert2Entity(vo); |
|||
productModelTemplateService.modify(entity); |
|||
ProductModelTemplateVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
productModelTemplateService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:query')") |
|||
public ResponseEntity<Result> page(ProductModelTemplateVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<ProductModelTemplate> page = new Page<ProductModelTemplate>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<ProductModelTemplate> queryWrapper = QueryGenerator.generateQueryWrapper(ProductModelTemplate.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
productModelTemplateService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<ProductModelTemplateVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<ProductModelTemplateVO> productModelTemplateVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(productModelTemplateVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:query')") |
|||
public ResponseEntity<Result> list(ProductModelTemplateVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<ProductModelTemplate> queryWrapper = QueryGenerator.generateQueryWrapper(ProductModelTemplate.class, queryVO,sortInfo); |
|||
List<ProductModelTemplate> list= productModelTemplateService.list(queryWrapper); |
|||
//转换vo
|
|||
List<ProductModelTemplateVO> productModelTemplateVOList=convert2VO(list); |
|||
return ResultUtil.success(productModelTemplateVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
ProductModelTemplate entity = productModelTemplateService.query(id); |
|||
ProductModelTemplateVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
productModelTemplateService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplate:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
ProductModelTemplate entity = productModelTemplateService.addSingleByCopy(id); |
|||
ProductModelTemplateVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected ProductModelTemplateVO convert2VO(ProductModelTemplate entity){ |
|||
ProductModelTemplateVO vo=mapperFacade.map(entity,ProductModelTemplateVO.class); |
|||
String id = vo.getId(); |
|||
String description = productModelTemplateDetailsService.getDetailsDescriptionByModelId(id); |
|||
vo.setTemplateDetailsDescription(description); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<ProductModelTemplateVO> convert2VO(List<ProductModelTemplate> entityList) { |
|||
List<ProductModelTemplateVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
ProductModelTemplateVO vo = convert2VO(x); |
|||
String id = vo.getId(); |
|||
String description = productModelTemplateDetailsService.getDetailsDescriptionByModelId(id); |
|||
vo.setTemplateDetailsDescription(description); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private ProductModelTemplate convert2Entity(ProductModelTemplateVO vo){ |
|||
ProductModelTemplate entity=mapperFacade.map(vo,ProductModelTemplate.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,225 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplateDetails; |
|||
import tech.abc.platform.productManagement.service.ProductModelTemplateDetailsService; |
|||
import tech.abc.platform.productManagement.vo.ProductModelTemplateDetailsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/productModelTemplateDetails") |
|||
@Slf4j |
|||
public class ProductModelTemplateDetailsController extends BaseController { |
|||
@Autowired |
|||
private ProductModelTemplateDetailsService productModelTemplateDetailsService; |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/addList") |
|||
@SystemLog(value = "-新增型号规格明细") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:add')") |
|||
public ResponseEntity<Result> addList(@Validated @RequestBody List<ProductModelTemplateDetailsVO> vo) { |
|||
productModelTemplateDetailsService.addList(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/modifyList") |
|||
@SystemLog(value = "-修改型号规格明细") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:modify')") |
|||
public ResponseEntity<Result> modifyList(@Validated @RequestBody List<ProductModelTemplateDetailsVO> vo) { |
|||
productModelTemplateDetailsService.modifyList(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
ProductModelTemplateDetails entity=productModelTemplateDetailsService.init(); |
|||
ProductModelTemplateDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody ProductModelTemplateDetailsVO vo) { |
|||
ProductModelTemplateDetails entity=convert2Entity(vo); |
|||
productModelTemplateDetailsService.add(entity); |
|||
ProductModelTemplateDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody ProductModelTemplateDetailsVO vo) { |
|||
ProductModelTemplateDetails entity=convert2Entity(vo); |
|||
productModelTemplateDetailsService.modify(entity); |
|||
ProductModelTemplateDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
productModelTemplateDetailsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:query')") |
|||
public ResponseEntity<Result> page(ProductModelTemplateDetailsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<ProductModelTemplateDetails> page = new Page<ProductModelTemplateDetails>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<ProductModelTemplateDetails> queryWrapper = QueryGenerator.generateQueryWrapper(ProductModelTemplateDetails.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
productModelTemplateDetailsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<ProductModelTemplateDetailsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<ProductModelTemplateDetailsVO> productModelTemplateDetailsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(productModelTemplateDetailsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:query')") |
|||
public ResponseEntity<Result> list(ProductModelTemplateDetailsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<ProductModelTemplateDetails> queryWrapper = QueryGenerator.generateQueryWrapper(ProductModelTemplateDetails.class, queryVO,sortInfo); |
|||
List<ProductModelTemplateDetails> list= productModelTemplateDetailsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<ProductModelTemplateDetailsVO> productModelTemplateDetailsVOList=convert2VO(list); |
|||
return ResultUtil.success(productModelTemplateDetailsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
ProductModelTemplateDetails entity = productModelTemplateDetailsService.query(id); |
|||
ProductModelTemplateDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
productModelTemplateDetailsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:productModelTemplateDetails:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
ProductModelTemplateDetails entity = productModelTemplateDetailsService.addSingleByCopy(id); |
|||
ProductModelTemplateDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected ProductModelTemplateDetailsVO convert2VO(ProductModelTemplateDetails entity){ |
|||
ProductModelTemplateDetailsVO vo=mapperFacade.map(entity,ProductModelTemplateDetailsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<ProductModelTemplateDetailsVO> convert2VO(List<ProductModelTemplateDetails> entityList) { |
|||
List<ProductModelTemplateDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
ProductModelTemplateDetailsVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private ProductModelTemplateDetails convert2Entity(ProductModelTemplateDetailsVO vo){ |
|||
ProductModelTemplateDetails entity=mapperFacade.map(vo,ProductModelTemplateDetails.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,206 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.SupplierInformation; |
|||
import tech.abc.platform.productManagement.service.SupplierInformationService; |
|||
import tech.abc.platform.productManagement.vo.SupplierInformationVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-07 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/supplierInformation") |
|||
@Slf4j |
|||
public class SupplierInformationController extends BaseController { |
|||
@Autowired |
|||
private SupplierInformationService supplierInformationService; |
|||
|
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
SupplierInformation entity=supplierInformationService.init(); |
|||
SupplierInformationVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody SupplierInformationVO vo) { |
|||
SupplierInformation entity=convert2Entity(vo); |
|||
supplierInformationService.add(entity); |
|||
SupplierInformationVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody SupplierInformationVO vo) { |
|||
SupplierInformation entity=convert2Entity(vo); |
|||
supplierInformationService.modify(entity); |
|||
SupplierInformationVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
supplierInformationService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:query')") |
|||
public ResponseEntity<Result> page(SupplierInformationVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<SupplierInformation> page = new Page<SupplierInformation>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<SupplierInformation> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierInformation.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
supplierInformationService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<SupplierInformationVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<SupplierInformationVO> supplierInformationVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(supplierInformationVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:query')") |
|||
public ResponseEntity<Result> list(SupplierInformationVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<SupplierInformation> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierInformation.class, queryVO,sortInfo); |
|||
List<SupplierInformation> list= supplierInformationService.list(queryWrapper); |
|||
//转换vo
|
|||
List<SupplierInformationVO> supplierInformationVOList=convert2VO(list); |
|||
return ResultUtil.success(supplierInformationVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
SupplierInformation entity = supplierInformationService.query(id); |
|||
SupplierInformationVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
supplierInformationService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierInformation:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
SupplierInformation entity = supplierInformationService.addSingleByCopy(id); |
|||
SupplierInformationVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierInformationVO convert2VO(SupplierInformation entity){ |
|||
SupplierInformationVO vo=mapperFacade.map(entity,SupplierInformationVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierInformationVO> convert2VO(List<SupplierInformation> entityList) { |
|||
List<SupplierInformationVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierInformationVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private SupplierInformation convert2Entity(SupplierInformationVO vo){ |
|||
SupplierInformation entity=mapperFacade.map(vo,SupplierInformation.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,238 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModel; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelService; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/supplierProductModel") |
|||
@Slf4j |
|||
public class SupplierProductModelController extends BaseController { |
|||
@Autowired |
|||
private SupplierProductModelService supplierProductModelService; |
|||
//拓展操作
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/addModel") |
|||
@SystemLog(value = "-新增型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:add')") |
|||
public ResponseEntity<Result> addModel(@Validated @RequestBody ProductModelViewVO<SupplierProductModelDetailsVO> vo) { |
|||
supplierProductModelService.addModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/modifyModel") |
|||
@SystemLog(value = "-修改型号与规格") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:modify')") |
|||
public ResponseEntity<Result> modifyModel(@Validated @RequestBody ProductModelViewVO<SupplierProductModelDetailsVO> vo) { |
|||
supplierProductModelService.modifyModel(vo); |
|||
return ResultUtil.success(); |
|||
} |
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/getModelDetails/{id}") |
|||
@SystemLog(value = "-获取型号详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:query')") |
|||
public ResponseEntity<Result> getModelDetails(@PathVariable("id") String id) { |
|||
List<SupplierProductModelDetailsVO> detailsList=supplierProductModelService.getModelDetails(id); |
|||
return ResultUtil.success(detailsList); |
|||
} |
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
SupplierProductModel entity=supplierProductModelService.init(); |
|||
SupplierProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody SupplierProductModelVO vo) { |
|||
SupplierProductModel entity=convert2Entity(vo); |
|||
supplierProductModelService.add(entity); |
|||
SupplierProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody SupplierProductModelVO vo) { |
|||
SupplierProductModel entity=convert2Entity(vo); |
|||
supplierProductModelService.modify(entity); |
|||
SupplierProductModelVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
supplierProductModelService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:query')") |
|||
public ResponseEntity<Result> page(SupplierProductModelVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<SupplierProductModel> page = new Page<SupplierProductModel>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProductModel.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
supplierProductModelService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<SupplierProductModelVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<SupplierProductModelVO> supplierProductModelVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(supplierProductModelVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:query')") |
|||
public ResponseEntity<Result> list(SupplierProductModelVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProductModel> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProductModel.class, queryVO,sortInfo); |
|||
List<SupplierProductModel> list= supplierProductModelService.list(queryWrapper); |
|||
//转换vo
|
|||
List<SupplierProductModelVO> supplierProductModelVOList=convert2VO(list); |
|||
return ResultUtil.success(supplierProductModelVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
SupplierProductModel entity = supplierProductModelService.query(id); |
|||
SupplierProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
supplierProductModelService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModel:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
SupplierProductModel entity = supplierProductModelService.addSingleByCopy(id); |
|||
SupplierProductModelVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierProductModelVO convert2VO(SupplierProductModel entity){ |
|||
SupplierProductModelVO vo=mapperFacade.map(entity,SupplierProductModelVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierProductModelVO> convert2VO(List<SupplierProductModel> entityList) { |
|||
List<SupplierProductModelVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierProductModelVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private SupplierProductModel convert2Entity(SupplierProductModelVO vo){ |
|||
SupplierProductModel entity=mapperFacade.map(vo,SupplierProductModel.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,205 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelDetailsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/supplierProductModelDetails") |
|||
@Slf4j |
|||
public class SupplierProductModelDetailsController extends BaseController { |
|||
@Autowired |
|||
private SupplierProductModelDetailsService supplierProductModelDetailsService; |
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
SupplierProductModelDetails entity=supplierProductModelDetailsService.init(); |
|||
SupplierProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody SupplierProductModelDetailsVO vo) { |
|||
SupplierProductModelDetails entity=convert2Entity(vo); |
|||
supplierProductModelDetailsService.add(entity); |
|||
SupplierProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody SupplierProductModelDetailsVO vo) { |
|||
SupplierProductModelDetails entity=convert2Entity(vo); |
|||
supplierProductModelDetailsService.modify(entity); |
|||
SupplierProductModelDetailsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
supplierProductModelDetailsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:query')") |
|||
public ResponseEntity<Result> page(SupplierProductModelDetailsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
//构造分页对象
|
|||
IPage<SupplierProductModelDetails> page = new Page<SupplierProductModelDetails>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProductModelDetails.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
supplierProductModelDetailsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
IPage<SupplierProductModelDetailsVO> pageVO = mapperFacade.map(page, IPage.class); |
|||
List<SupplierProductModelDetailsVO> supplierProductModelDetailsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(supplierProductModelDetailsVOList); |
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:query')") |
|||
public ResponseEntity<Result> list(SupplierProductModelDetailsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProductModelDetails> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProductModelDetails.class, queryVO,sortInfo); |
|||
List<SupplierProductModelDetails> list= supplierProductModelDetailsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<SupplierProductModelDetailsVO> supplierProductModelDetailsVOList=convert2VO(list); |
|||
return ResultUtil.success(supplierProductModelDetailsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
SupplierProductModelDetails entity = supplierProductModelDetailsService.query(id); |
|||
SupplierProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
supplierProductModelDetailsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProductModelDetails:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
SupplierProductModelDetails entity = supplierProductModelDetailsService.addSingleByCopy(id); |
|||
SupplierProductModelDetailsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierProductModelDetailsVO convert2VO(SupplierProductModelDetails entity){ |
|||
SupplierProductModelDetailsVO vo=mapperFacade.map(entity,SupplierProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierProductModelDetailsVO> convert2VO(List<SupplierProductModelDetails> entityList) { |
|||
List<SupplierProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierProductModelDetailsVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private SupplierProductModelDetails convert2Entity(SupplierProductModelDetailsVO vo){ |
|||
SupplierProductModelDetails entity=mapperFacade.map(vo,SupplierProductModelDetails.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,223 @@ |
|||
package tech.abc.platform.productManagement.controller; |
|||
|
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import tech.abc.platform.common.base.BaseController; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import tech.abc.platform.common.annotation.SystemLog; |
|||
import tech.abc.platform.common.query.QueryGenerator; |
|||
import tech.abc.platform.common.utils.ResultUtil; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.Result; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.SupplierProducts; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelService; |
|||
import tech.abc.platform.productManagement.service.SupplierProductsService; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductsVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 前端控制器类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-08 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productManagement/supplierProducts") |
|||
@Slf4j |
|||
public class SupplierProductsController extends BaseController { |
|||
@Autowired |
|||
private SupplierProductsService supplierProductsService; |
|||
|
|||
@Autowired |
|||
private SupplierProductModelService supplierProductModelService; |
|||
|
|||
//region 基本操作
|
|||
/** |
|||
* 初始化 |
|||
*/ |
|||
@GetMapping("/init") |
|||
public ResponseEntity<Result> init() { |
|||
SupplierProducts entity=supplierProductsService.init(); |
|||
SupplierProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@PostMapping("/") |
|||
@SystemLog(value = "-新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:add')") |
|||
public ResponseEntity<Result> add(@Validated @RequestBody SupplierProductsVO vo) { |
|||
SupplierProducts entity=convert2Entity(vo); |
|||
supplierProductsService.add(entity); |
|||
SupplierProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@PutMapping("/") |
|||
@SystemLog(value = "-修改") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:modify')") |
|||
public ResponseEntity<Result> modify(@Validated @RequestBody SupplierProductsVO vo) { |
|||
SupplierProducts entity=convert2Entity(vo); |
|||
supplierProductsService.modify(entity); |
|||
SupplierProductsVO newVO = convert2VO(entity); |
|||
return ResultUtil.success(newVO); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@DeleteMapping("/{id}") |
|||
@SystemLog(value = "-删除") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:remove')") |
|||
public ResponseEntity<Result> remove(@PathVariable("id") String id) { |
|||
supplierProductsService.remove(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
@GetMapping("/page") |
|||
@SystemLog(value = "-分页") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:query')") |
|||
public ResponseEntity<Result> page(SupplierProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
IPage<SupplierProductsVO> pageVO=null; |
|||
if (StringUtils.isBlank(queryVO.getProductName())) { |
|||
//构造分页对象
|
|||
IPage<SupplierProducts> page = new Page<SupplierProducts>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
|
|||
|
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProducts> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProducts.class,queryVO,sortInfo); |
|||
|
|||
//查询数据
|
|||
supplierProductsService.page(page, queryWrapper); |
|||
//转换vo
|
|||
pageVO = mapperFacade.map(page, IPage.class); |
|||
List<SupplierProductsVO> supplierProductsVOList=convert2VO(page.getRecords()); |
|||
pageVO.setRecords(supplierProductsVOList); |
|||
}else{ |
|||
pageVO = supplierProductsService.querypagebyes(queryVO, pageInfo, sortInfo); |
|||
} |
|||
|
|||
return ResultUtil.success(pageVO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
@SystemLog(value = "-列表") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:query')") |
|||
public ResponseEntity<Result> list(SupplierProductsVO queryVO, SortInfo sortInfo) { |
|||
//构造查询条件
|
|||
QueryWrapper<SupplierProducts> queryWrapper = QueryGenerator.generateQueryWrapper(SupplierProducts.class, queryVO,sortInfo); |
|||
List<SupplierProducts> list= supplierProductsService.list(queryWrapper); |
|||
//转换vo
|
|||
List<SupplierProductsVO> supplierProductsVOList=convert2VO(list); |
|||
return ResultUtil.success(supplierProductsVOList); |
|||
} |
|||
|
|||
/** |
|||
* 获取单条数据 |
|||
*/ |
|||
@GetMapping("/{id}") |
|||
@SystemLog(value = "-详情") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:view')") |
|||
public ResponseEntity<Result> get(@PathVariable("id") String id) { |
|||
SupplierProducts entity = supplierProductsService.query(id); |
|||
SupplierProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
|
|||
/** |
|||
* 复制新增数据,单条数据标识,或多条数据标识用逗号间隔拼成的字符串 |
|||
*/ |
|||
@PostMapping("/{id}") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:addByCopy')") |
|||
public ResponseEntity<Result> addByCopy(@PathVariable("id") String id) { |
|||
supplierProductsService.addByCopy(id); |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制新增单条数据,返回复制后的对象 |
|||
*/ |
|||
@PostMapping("/{id}/addSingleByCopy") |
|||
@SystemLog(value = "-复制新增") |
|||
@PreAuthorize("hasPermission(null,'productManagement:supplierProducts:addByCopy')") |
|||
public ResponseEntity<Result> addSingleByCopy(@PathVariable("id") String id) { |
|||
SupplierProducts entity = supplierProductsService.addSingleByCopy(id); |
|||
SupplierProductsVO vo = convert2VO(entity); |
|||
return ResultUtil.success(vo); |
|||
} |
|||
//endregion
|
|||
|
|||
//region 扩展操作
|
|||
|
|||
//endregion
|
|||
|
|||
//region 辅助操作
|
|||
|
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierProductsVO convert2VO(SupplierProducts entity){ |
|||
SupplierProductsVO vo=mapperFacade.map(entity,SupplierProductsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierProductsVO> convert2VO(List<SupplierProducts> entityList) { |
|||
List<SupplierProductsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierProductsVO vo = convert2VO(x); |
|||
String modelId = vo.getModelId(); |
|||
//获取型号描述信息
|
|||
if(StringUtils.isNotEmpty(modelId)){ |
|||
String description = supplierProductModelService.getById(modelId).getDescription(); |
|||
vo.setProductSpecifications(description); |
|||
} |
|||
|
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
|
|||
|
|||
private SupplierProducts convert2Entity(SupplierProductsVO vo){ |
|||
SupplierProducts entity=mapperFacade.map(vo,SupplierProducts.class); |
|||
return entity; |
|||
} |
|||
|
|||
//endregion
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_company_product_model") |
|||
public class CompanyProductModel extends BaseEntity { |
|||
|
|||
/** |
|||
* 产品规格 |
|||
*/ |
|||
@TableField("description") |
|||
private String description; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
|
|||
/** |
|||
* 产品型号模板id |
|||
*/ |
|||
@TableField("product_model_template_id") |
|||
private String productModelTemplateId; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,54 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_company_product_model_details") |
|||
public class CompanyProductModelDetails extends BaseEntity { |
|||
|
|||
/** |
|||
* 公司产品型号表id |
|||
*/ |
|||
@TableField("model_id") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@TableField("param_name") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 指标参数 |
|||
*/ |
|||
@TableField("parameter_value") |
|||
private String parameterValue; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@TableField("is_key_parameter") |
|||
private String isKeyParameter; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,108 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
|
|||
import java.math.BigDecimal; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_company_products") |
|||
public class CompanyProducts extends BaseEntity { |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
@TableField("supplier_information_id") |
|||
private String supplierInformationId; |
|||
/** |
|||
* 公司产品型号id |
|||
*/ |
|||
@TableField("model_id") |
|||
private String modelId; |
|||
/** |
|||
* 公司产品规格 |
|||
*/ |
|||
@TableField("product_specifications") |
|||
private String productSpecifications; |
|||
/** |
|||
* 供应商产品id |
|||
*/ |
|||
@TableField("supplier_products_id") |
|||
private String supplierProductsId; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@TableField("product_name") |
|||
private String productName; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
@TableField("product_identity") |
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@TableField(value="product_price",updateStrategy= FieldStrategy.IGNORED) |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
@TableField("source_information") |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@TableField("remarks") |
|||
private String remarks; |
|||
/** |
|||
* 产品图片 |
|||
*/ |
|||
@TableField("image") |
|||
private String image; |
|||
|
|||
/** |
|||
* 产品品牌 |
|||
*/ |
|||
@TableField("brand") |
|||
private String brand; |
|||
|
|||
/** |
|||
* 产品单位*/ |
|||
@TableField("unit") |
|||
private String unit; |
|||
|
|||
/** |
|||
* 除税价格 |
|||
*/ |
|||
@TableField("ex_tax_price") |
|||
private BigDecimal exTaxPrice; |
|||
|
|||
/** |
|||
* 税率 |
|||
*/ |
|||
@TableField("taxrate") |
|||
private BigDecimal taxrate; |
|||
/** |
|||
* 分类id |
|||
*/ |
|||
@TableField("category_id") |
|||
private String categoryId; |
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,41 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_person_product_model") |
|||
public class PersonProductModel extends BaseEntity { |
|||
|
|||
/** |
|||
* 个人产品指标描述 |
|||
*/ |
|||
@TableField("description") |
|||
private String description; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
/** |
|||
* 产品型号模板id |
|||
*/ |
|||
@TableField("product_model_template_id") |
|||
private String productModelTemplateId; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,54 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_person_product_model_details") |
|||
public class PersonProductModelDetails extends BaseEntity { |
|||
|
|||
/** |
|||
* 个人产品型号表id |
|||
*/ |
|||
@TableField("model_id") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@TableField("param_name") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 指标参数 |
|||
*/ |
|||
@TableField("parameter_value") |
|||
private String parameterValue; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@TableField("is_key_parameter") |
|||
private String isKeyParameter; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,109 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
|
|||
import java.math.BigDecimal; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_person_products") |
|||
public class PersonProducts extends BaseEntity { |
|||
/** |
|||
* 个人产品型号id |
|||
*/ |
|||
@TableField("model_id") |
|||
private String modelId; |
|||
/** |
|||
* 个人产品规格 |
|||
*/ |
|||
@TableField("product_specifications") |
|||
private String productSpecifications; |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
@TableField("supplier_information_id") |
|||
private String supplierInformationId; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@TableField("product_name") |
|||
private String productName; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
@TableField("product_identity") |
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@TableField(value="product_price",updateStrategy= FieldStrategy.IGNORED) |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
@TableField("source_information") |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@TableField("remarks") |
|||
private String remarks; |
|||
|
|||
/** |
|||
* 关联厂商产品id |
|||
*/ |
|||
@TableField("supplier_products_id") |
|||
private String supplierProductsId; |
|||
/** |
|||
* 产品图片 |
|||
*/ |
|||
@TableField("image") |
|||
private String image; |
|||
|
|||
/** |
|||
* 产品品牌 |
|||
*/ |
|||
@TableField("brand") |
|||
private String brand; |
|||
|
|||
/** |
|||
* 产品单位*/ |
|||
@TableField("unit") |
|||
private String unit; |
|||
|
|||
/** |
|||
* 除税价格 |
|||
*/ |
|||
@TableField("ex_tax_price") |
|||
private BigDecimal exTaxPrice; |
|||
|
|||
/** |
|||
* 税率 |
|||
*/ |
|||
@TableField("taxrate") |
|||
private BigDecimal taxrate; |
|||
/** |
|||
* 分类id |
|||
*/ |
|||
@TableField("category_id") |
|||
private String categoryId; |
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,42 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_product_model_template") |
|||
public class ProductModelTemplate extends BaseEntity { |
|||
|
|||
/** |
|||
* 模板名称 |
|||
*/ |
|||
@TableField("template_name") |
|||
private String templateName; |
|||
|
|||
/** |
|||
* 模板类型 |
|||
*/ |
|||
@TableField("template_type") |
|||
private String templateType; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@TableField("remarks") |
|||
private String remarks; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,47 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_product_model_template_details") |
|||
public class ProductModelTemplateDetails extends BaseEntity { |
|||
|
|||
/** |
|||
* 产品型号表id |
|||
*/ |
|||
@TableField("model_template_id") |
|||
private String modelTemplateId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@TableField("param_name") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@TableField("is_key_parameter") |
|||
private String isKeyParameter; |
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
|
|||
private String isTemporary; |
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,55 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-07 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_supplier_information") |
|||
public class SupplierInformation extends BaseEntity { |
|||
|
|||
/** |
|||
* 供应商名称 |
|||
*/ |
|||
@TableField("supplier_name") |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 供应商联系人 |
|||
*/ |
|||
@TableField("supplier_contacts") |
|||
private String supplierContacts; |
|||
/** |
|||
* 职位 |
|||
*/ |
|||
@TableField("position") |
|||
private String position; |
|||
|
|||
/** |
|||
* 供应商联系电话 |
|||
*/ |
|||
@TableField("supplier_contacts_phone") |
|||
private String supplierContactsPhone; |
|||
|
|||
/** |
|||
* 供应商类型 |
|||
*/ |
|||
@TableField("supplier_type") |
|||
private String supplierType; |
|||
|
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,41 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_supplier_product_model") |
|||
public class SupplierProductModel extends BaseEntity { |
|||
|
|||
/** |
|||
* 厂商产品参数描述 |
|||
*/ |
|||
@TableField("description") |
|||
private String description; |
|||
|
|||
/** |
|||
* 产品参数模板id |
|||
*/ |
|||
@TableField("product_model_template_id") |
|||
private String productModelTemplateId; |
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,53 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_supplier_product_model_details") |
|||
public class SupplierProductModelDetails extends BaseEntity { |
|||
|
|||
/** |
|||
* 厂商产品参数表id |
|||
*/ |
|||
@TableField("model_id") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 参数名称` |
|||
*/ |
|||
@TableField("param_name") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 参数指标 |
|||
*/ |
|||
@TableField("parameter_value") |
|||
private String parameterValue; |
|||
|
|||
/** |
|||
* 是否关键参数 |
|||
*/ |
|||
@TableField("is_key_parameter") |
|||
private String isKeyParameter; |
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
@TableField("is_temporary") |
|||
private String isTemporary; |
|||
|
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,123 @@ |
|||
package tech.abc.platform.productManagement.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
|
|||
import java.lang.annotation.Documented; |
|||
import java.math.BigDecimal; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import tech.abc.platform.common.base.BaseEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-08 |
|||
* |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
@TableName("pmg_supplier_products") |
|||
public class SupplierProducts extends BaseEntity { |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
@TableField("supplier_information_id") |
|||
@JsonProperty("supplier_information_id") |
|||
private String supplierInformationId; |
|||
|
|||
/** |
|||
* 厂商产品型号id |
|||
*/ |
|||
@TableField("model_id") |
|||
@JsonProperty("model_id") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 个人产品规格 |
|||
*/ |
|||
@TableField("product_specifications") |
|||
@JsonProperty("product_specifications") |
|||
private String productSpecifications; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@TableField("product_name") |
|||
@JsonProperty("product_name") |
|||
private String productName; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
@TableField("product_identity") |
|||
@JsonProperty("product_identity") |
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@TableField(value="product_price",updateStrategy= FieldStrategy.IGNORED) |
|||
@JsonProperty("product_price") |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
@TableField("source_information") |
|||
@JsonProperty("source_information") |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@TableField("remarks") |
|||
@JsonProperty("remarks") |
|||
private String remarks; |
|||
/** |
|||
* 产品图片 |
|||
*/ |
|||
@TableField("image") |
|||
@JsonProperty("image") |
|||
private String image; |
|||
|
|||
/** |
|||
* 产品品牌 |
|||
*/ |
|||
@TableField("brand") |
|||
@JsonProperty("brand") |
|||
private String brand; |
|||
|
|||
/** |
|||
* 产品单位*/ |
|||
@TableField("unit") |
|||
@JsonProperty("unit") |
|||
private String unit; |
|||
|
|||
/** |
|||
* 除税价格 |
|||
*/ |
|||
@TableField("ex_tax_price") |
|||
@JsonProperty("ex_tax_price") |
|||
private BigDecimal exTaxPrice; |
|||
|
|||
/** |
|||
* 税率 |
|||
*/ |
|||
@TableField("taxrate") |
|||
@JsonProperty("taxrate") |
|||
private BigDecimal taxrate; |
|||
/** |
|||
* 分类id |
|||
*/ |
|||
@TableField("category_id") |
|||
@JsonProperty("category_id") |
|||
private String categoryId; |
|||
/********非库表存储属性*****/ |
|||
} |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface CompanyProductModelDetailsMapper extends BaseMapper<CompanyProductModelDetails> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.CompanyProductModelDetailsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProductModel; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface CompanyProductModelMapper extends BaseMapper<CompanyProductModel> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.CompanyProductModelMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProducts; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
*/ |
|||
public interface CompanyProductsMapper extends BaseMapper<CompanyProducts> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.CompanyProductsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface PersonProductModelDetailsMapper extends BaseMapper<PersonProductModelDetails> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.PersonProductModelDetailsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProductModel; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface PersonProductModelMapper extends BaseMapper<PersonProductModel> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.PersonProductModelMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProducts; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface PersonProductsMapper extends BaseMapper<PersonProducts> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.PersonProductsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplateDetails; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
public interface ProductModelTemplateDetailsMapper extends BaseMapper<ProductModelTemplateDetails> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.ProductModelTemplateDetailsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplate; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
public interface ProductModelTemplateMapper extends BaseMapper<ProductModelTemplate> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.ProductModelTemplateMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierInformation; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-07 |
|||
*/ |
|||
public interface SupplierInformationMapper extends BaseMapper<SupplierInformation> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.SupplierInformationMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface SupplierProductModelDetailsMapper extends BaseMapper<SupplierProductModelDetails> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.SupplierProductModelDetailsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProductModel; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface SupplierProductModelMapper extends BaseMapper<SupplierProductModel> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.SupplierProductModelMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package tech.abc.platform.productManagement.mapper; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProducts; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
|
|||
/** |
|||
* Mapper 接口 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-08 |
|||
*/ |
|||
public interface SupplierProductsMapper extends BaseMapper<SupplierProducts> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
<?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="tech.abc.platform.productManagement.mapper.SupplierProductsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface CompanyProductModelDetailsService extends BaseService<CompanyProductModelDetails> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,33 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProductModel; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface CompanyProductModelService extends BaseService<CompanyProductModel> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
void addModel(ProductModelViewVO vo); |
|||
|
|||
void modifyModel(ProductModelViewVO vo); |
|||
|
|||
List<CompanyProductModelDetailsVO> getModelDetails(String id); |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProducts; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
*/ |
|||
public interface CompanyProductsService extends BaseService<CompanyProducts> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface PersonProductModelDetailsService extends BaseService<PersonProductModelDetails> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,33 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProductModel; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.vo.PersonProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
public interface PersonProductModelService extends BaseService<PersonProductModel> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
void addModel(ProductModelViewVO<PersonProductModelDetailsVO> vo); |
|||
|
|||
void modifyModel(ProductModelViewVO<PersonProductModelDetailsVO> vo); |
|||
|
|||
List<PersonProductModelDetailsVO> getModelDetails(String id); |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProducts; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface PersonProductsService extends BaseService<PersonProducts> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,37 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplateDetails; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.vo.ProductModelTemplateDetailsVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
public interface ProductModelTemplateDetailsService extends BaseService<ProductModelTemplateDetails> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
void addList(List<ProductModelTemplateDetailsVO> vo); |
|||
|
|||
void modifyList(List<ProductModelTemplateDetailsVO> vo); |
|||
|
|||
/** |
|||
* 根据产品型号id获取产品型号规格描述 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
String getDetailsDescriptionByModelId(String id); |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplate; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
public interface ProductModelTemplateService extends BaseService<ProductModelTemplate> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,25 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.entity.SupplierInformation; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-07 |
|||
*/ |
|||
public interface SupplierInformationService extends BaseService<SupplierInformation> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface SupplierProductModelDetailsService extends BaseService<SupplierProductModelDetails> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
} |
|||
|
@ -0,0 +1,46 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProductModel; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
public interface SupplierProductModelService extends BaseService<SupplierProductModel> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
/** |
|||
* 添加供应商产品型号与型号详情 |
|||
* @param vo 参数对象 |
|||
*/ |
|||
void addModel(ProductModelViewVO vo); |
|||
|
|||
/** |
|||
* 获取型号详情 |
|||
* @param id 型号ID |
|||
* @return 型号详情 |
|||
*/ |
|||
List<SupplierProductModelDetailsVO> getModelDetails(String id); |
|||
|
|||
/** |
|||
* 修改型号 |
|||
* @param vo 参数对象 |
|||
*/ |
|||
void modifyModel(ProductModelViewVO vo); |
|||
} |
|||
|
@ -0,0 +1,39 @@ |
|||
package tech.abc.platform.productManagement.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.productManagement.entity.SupplierProducts; |
|||
import tech.abc.platform.common.base.BaseService; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductsVO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 服务接口类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-08 |
|||
*/ |
|||
public interface SupplierProductsService extends BaseService<SupplierProducts> { |
|||
|
|||
/** |
|||
* 获取标识与名称的Map集合 |
|||
* |
|||
* @param idList 标识列表 |
|||
* @return 集合 |
|||
*/ |
|||
Map<String,String> getNameMap(List<String> idList); |
|||
|
|||
/** |
|||
* es分页查询 |
|||
* @param queryVO |
|||
* @param pageInfo |
|||
* @param sortInfo |
|||
* @return |
|||
*/ |
|||
|
|||
IPage<SupplierProductsVO> querypagebyes(SupplierProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo); |
|||
} |
|||
|
@ -0,0 +1,54 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.CompanyProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelDetailsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class CompanyProductModelDetailsServiceImpl extends BaseServiceImpl<CompanyProductModelDetailsMapper, CompanyProductModelDetails> implements CompanyProductModelDetailsService { |
|||
|
|||
@Override |
|||
public CompanyProductModelDetails init() { |
|||
CompanyProductModelDetails entity=new CompanyProductModelDetails(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(CompanyProductModelDetails entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(CompanyProductModelDetails entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(CompanyProductModelDetails entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,134 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModel; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.CompanyProductModelMapper; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.service.CompanyProductModelService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
import tech.abc.platform.productManagement.vo.CompanyProductModelDetailsVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class CompanyProductModelServiceImpl extends BaseServiceImpl<CompanyProductModelMapper, CompanyProductModel> implements CompanyProductModelService { |
|||
@Autowired |
|||
private CompanyProductModelDetailsService companyProductModelDetailsService; |
|||
@Override |
|||
public void addModel(ProductModelViewVO vo) { |
|||
List<CompanyProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (CompanyProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
CompanyProductModelDetails companyProductModelDetails = mapperFacade.map(item, CompanyProductModelDetails.class); |
|||
companyProductModelDetailsService.save(companyProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
CompanyProductModel companyProductModel = mapperFacade.map(vo, CompanyProductModel.class); |
|||
save(companyProductModel); |
|||
} |
|||
@Override |
|||
public void modifyModel(ProductModelViewVO vo) { |
|||
String id = vo.getId(); |
|||
//删除原型号指标参数
|
|||
LambdaQueryWrapper<CompanyProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(CompanyProductModelDetails::getModelId, id); |
|||
companyProductModelDetailsService.remove(queryWrapper); |
|||
List<CompanyProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (CompanyProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
item.setId(null); |
|||
item.setUpdateId(null); |
|||
item.setUpdateTime(null); |
|||
CompanyProductModelDetails companyProductModelDetails = mapperFacade.map(item, CompanyProductModelDetails.class); |
|||
companyProductModelDetails.setIsTemporary("0");//修改的化,将临时标记改为0,表示非临时
|
|||
companyProductModelDetailsService.save(companyProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
CompanyProductModel companyProductModel = mapperFacade.map(vo, CompanyProductModel.class); |
|||
updateById(companyProductModel); |
|||
} |
|||
@Override |
|||
public List<CompanyProductModelDetailsVO> getModelDetails(String id) { |
|||
//根据型号id查询型号详情规格指标
|
|||
LambdaQueryWrapper<CompanyProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(CompanyProductModelDetails::getModelId, id); |
|||
List<CompanyProductModelDetails> list = companyProductModelDetailsService.list(queryWrapper); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return new ArrayList<>(); |
|||
} |
|||
List<CompanyProductModelDetailsVO> result =convert2DetailsVO(list); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public CompanyProductModel init() { |
|||
CompanyProductModel entity=new CompanyProductModel(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(CompanyProductModel entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(CompanyProductModel entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(CompanyProductModel entity, String... value) { |
|||
} |
|||
protected List<CompanyProductModelDetailsVO> convert2DetailsVO(List<CompanyProductModelDetails> entityList) { |
|||
List<CompanyProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
CompanyProductModelDetailsVO vo = convert2DetailsVO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected CompanyProductModelDetailsVO convert2DetailsVO(CompanyProductModelDetails entity){ |
|||
CompanyProductModelDetailsVO vo=mapperFacade.map(entity,CompanyProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,95 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.CompanyProducts; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModel; |
|||
import tech.abc.platform.productManagement.entity.CompanyProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.CompanyProductsMapper; |
|||
import tech.abc.platform.productManagement.mapper.CompanyProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.mapper.CompanyProductModelMapper; |
|||
import tech.abc.platform.productManagement.service.CompanyProductsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class CompanyProductsServiceImpl extends BaseServiceImpl<CompanyProductsMapper, CompanyProducts> implements CompanyProductsService { |
|||
@Autowired |
|||
private CompanyProductModelMapper companyProductModelMapper; |
|||
@Autowired |
|||
private CompanyProductModelDetailsMapper companyProductModelDetailsMapper; |
|||
@Override |
|||
public CompanyProducts init() { |
|||
CompanyProducts entity=new CompanyProducts(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
@Override |
|||
public void afterAdd(CompanyProducts entity) { |
|||
// 新增供应商产品信息时,将厂商产品型号和型号规格参数变成的is_temporary标记为非临时数据
|
|||
String modelId = entity.getModelId(); |
|||
if (StringUtils.isNotBlank(modelId)) { |
|||
LambdaUpdateWrapper<CompanyProductModel> modelUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
modelUpdateWrapper.eq(CompanyProductModel::getId, modelId); |
|||
modelUpdateWrapper.set(CompanyProductModel::getIsTemporary, "0"); |
|||
companyProductModelMapper.update(null,modelUpdateWrapper); |
|||
// 更新型号规格参数的is_temporary标记为非临时数据
|
|||
LambdaUpdateWrapper<CompanyProductModelDetails> detailsUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
detailsUpdateWrapper.eq(CompanyProductModelDetails::getModelId, modelId); |
|||
detailsUpdateWrapper.set(CompanyProductModelDetails::getIsTemporary, "0"); |
|||
companyProductModelDetailsMapper.update(null,detailsUpdateWrapper); |
|||
} |
|||
|
|||
} |
|||
@Override |
|||
public void afterRemove(CompanyProducts entity) { |
|||
// 删除供应商产品信息时,将厂商产品型号和型号规格参数删除
|
|||
String modelId = entity.getModelId(); |
|||
if (StringUtils.isNotBlank(modelId)) { |
|||
LambdaUpdateWrapper<CompanyProductModel> modelUpdateWrapper = new LambdaUpdateWrapper<>(); // 临时数据标记
|
|||
modelUpdateWrapper.eq(CompanyProductModel::getId, modelId); |
|||
companyProductModelMapper.delete(modelUpdateWrapper); |
|||
// 更新型号规格参数的is_temporary标记为临时数据
|
|||
LambdaUpdateWrapper<CompanyProductModelDetails> detailsUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
detailsUpdateWrapper.eq(CompanyProductModelDetails::getModelId, modelId); |
|||
companyProductModelDetailsMapper.delete(detailsUpdateWrapper); |
|||
} |
|||
} |
|||
@Override |
|||
public void beforeAdd(CompanyProducts entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(CompanyProducts entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(CompanyProducts entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,54 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.PersonProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelDetailsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class PersonProductModelDetailsServiceImpl extends BaseServiceImpl<PersonProductModelDetailsMapper, PersonProductModelDetails> implements PersonProductModelDetailsService { |
|||
|
|||
@Override |
|||
public PersonProductModelDetails init() { |
|||
PersonProductModelDetails entity=new PersonProductModelDetails(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(PersonProductModelDetails entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(PersonProductModelDetails entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(PersonProductModelDetails entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,141 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModel; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.PersonProductModelMapper; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
|
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.service.PersonProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
import tech.abc.platform.productManagement.vo.PersonProductModelDetailsVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class PersonProductModelServiceImpl extends BaseServiceImpl<PersonProductModelMapper, PersonProductModel> implements PersonProductModelService { |
|||
@Autowired |
|||
private PersonProductModelDetailsService personProductModelDetailsService; |
|||
@Override |
|||
public void addModel(ProductModelViewVO vo) { |
|||
List<PersonProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (PersonProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
PersonProductModelDetails personProductModelDetails = mapperFacade.map(item, PersonProductModelDetails.class); |
|||
personProductModelDetailsService.save(personProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
PersonProductModel personProductModel = mapperFacade.map(vo, PersonProductModel.class); |
|||
save(personProductModel); |
|||
} |
|||
@Override |
|||
public void modifyModel(ProductModelViewVO vo) { |
|||
String id = vo.getId(); |
|||
//删除原型号指标参数
|
|||
LambdaQueryWrapper<PersonProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(PersonProductModelDetails::getModelId, id); |
|||
personProductModelDetailsService.remove(queryWrapper); |
|||
List<PersonProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (PersonProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
item.setId(null); |
|||
item.setUpdateId(null); |
|||
item.setUpdateTime(null); |
|||
PersonProductModelDetails personProductModelDetails = mapperFacade.map(item, PersonProductModelDetails.class); |
|||
personProductModelDetails.setIsTemporary("0");//修改的化,将临时标记改为0,表示非临时
|
|||
personProductModelDetailsService.save(personProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
PersonProductModel personProductModel = mapperFacade.map(vo, PersonProductModel.class); |
|||
updateById(personProductModel); |
|||
} |
|||
@Override |
|||
public List<PersonProductModelDetailsVO> getModelDetails(String id) { |
|||
//根据型号id查询型号详情规格指标
|
|||
LambdaQueryWrapper<PersonProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(PersonProductModelDetails::getModelId, id); |
|||
List<PersonProductModelDetails> list = personProductModelDetailsService.list(queryWrapper); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return new ArrayList<>(); |
|||
} |
|||
List<PersonProductModelDetailsVO> result =convert2DetailsVO(list); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public PersonProductModel init() { |
|||
PersonProductModel entity=new PersonProductModel(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(PersonProductModel entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(PersonProductModel entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(PersonProductModel entity, String... value) { |
|||
} |
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<PersonProductModelDetailsVO> convert2DetailsVO(List<PersonProductModelDetails> entityList) { |
|||
List<PersonProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
PersonProductModelDetailsVO vo = convert2DetailsVO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected PersonProductModelDetailsVO convert2DetailsVO(PersonProductModelDetails entity){ |
|||
PersonProductModelDetailsVO vo=mapperFacade.map(entity,PersonProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,95 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.PersonProducts; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModel; |
|||
import tech.abc.platform.productManagement.entity.PersonProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.PersonProductsMapper; |
|||
import tech.abc.platform.productManagement.mapper.PersonProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.mapper.PersonProductModelMapper; |
|||
import tech.abc.platform.productManagement.service.PersonProductsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class PersonProductsServiceImpl extends BaseServiceImpl<PersonProductsMapper, PersonProducts> implements PersonProductsService { |
|||
@Autowired |
|||
private PersonProductModelMapper personProductModelMapper; |
|||
@Autowired |
|||
private PersonProductModelDetailsMapper personProductModelDetailsMapper; |
|||
@Override |
|||
public PersonProducts init() { |
|||
PersonProducts entity=new PersonProducts(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
@Override |
|||
public void afterAdd(PersonProducts entity) { |
|||
// 新增供应商产品信息时,将厂商产品型号和型号规格参数变成的is_temporary标记为非临时数据
|
|||
String modelId = entity.getModelId(); |
|||
if (StringUtils.isNotBlank(modelId)) { |
|||
LambdaUpdateWrapper<PersonProductModel> modelUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
modelUpdateWrapper.eq(PersonProductModel::getId, modelId); |
|||
modelUpdateWrapper.set(PersonProductModel::getIsTemporary, "0"); |
|||
personProductModelMapper.update(null,modelUpdateWrapper); |
|||
// 更新型号规格参数的is_temporary标记为非临时数据
|
|||
LambdaUpdateWrapper<PersonProductModelDetails> detailsUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
detailsUpdateWrapper.eq(PersonProductModelDetails::getModelId, modelId); |
|||
detailsUpdateWrapper.set(PersonProductModelDetails::getIsTemporary, "0"); |
|||
personProductModelDetailsMapper.update(null,detailsUpdateWrapper); |
|||
} |
|||
|
|||
} |
|||
@Override |
|||
public void afterRemove(PersonProducts entity) { |
|||
// 删除供应商产品信息时,将厂商产品型号和型号规格参数删除
|
|||
String modelId = entity.getModelId(); |
|||
if (StringUtils.isNotBlank(modelId)) { |
|||
LambdaUpdateWrapper<PersonProductModel> modelUpdateWrapper = new LambdaUpdateWrapper<>(); // 临时数据标记
|
|||
modelUpdateWrapper.eq(PersonProductModel::getId, modelId); |
|||
personProductModelMapper.delete(modelUpdateWrapper); |
|||
// 更新型号规格参数的is_temporary标记为临时数据
|
|||
LambdaUpdateWrapper<PersonProductModelDetails> detailsUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
detailsUpdateWrapper.eq(PersonProductModelDetails::getModelId, modelId); |
|||
personProductModelDetailsMapper.delete(detailsUpdateWrapper); |
|||
} |
|||
} |
|||
@Override |
|||
public void beforeAdd(PersonProducts entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(PersonProducts entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(PersonProducts entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,93 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import tech.abc.platform.productManagement.entity.ProductModelTemplateDetails; |
|||
import tech.abc.platform.productManagement.mapper.ProductModelTemplateDetailsMapper; |
|||
import tech.abc.platform.productManagement.service.ProductModelTemplateDetailsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.vo.ProductModelTemplateDetailsVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class ProductModelTemplateDetailsServiceImpl extends BaseServiceImpl<ProductModelTemplateDetailsMapper, ProductModelTemplateDetails> implements ProductModelTemplateDetailsService { |
|||
@Override |
|||
public void addList(List<ProductModelTemplateDetailsVO> vo) { |
|||
for(ProductModelTemplateDetailsVO item:vo){ |
|||
ProductModelTemplateDetails productModelTemplateDetails = mapperFacade.map(item, ProductModelTemplateDetails.class); |
|||
save(productModelTemplateDetails); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void modifyList(List<ProductModelTemplateDetailsVO> vo) { |
|||
//先删后增
|
|||
LambdaQueryWrapper<ProductModelTemplateDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(ProductModelTemplateDetails::getModelTemplateId, vo.get(0).getModelTemplateId()); |
|||
remove(queryWrapper); |
|||
//增加
|
|||
for(ProductModelTemplateDetailsVO item:vo){ |
|||
ProductModelTemplateDetails productModelTemplateDetails = mapperFacade.map(item, ProductModelTemplateDetails.class); |
|||
productModelTemplateDetails.setId(null); |
|||
productModelTemplateDetails.setUpdateId(null); |
|||
productModelTemplateDetails.setUpdateTime(null); |
|||
productModelTemplateDetails.setIsTemporary("0");//修改的话,新数据为非临时数据
|
|||
save(productModelTemplateDetails); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public String getDetailsDescriptionByModelId(String id) { |
|||
LambdaQueryWrapper<ProductModelTemplateDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(ProductModelTemplateDetails::getModelTemplateId, id); |
|||
List<ProductModelTemplateDetails> list = list(queryWrapper); |
|||
String description = list.stream().map(ProductModelTemplateDetails::getParamName).collect(Collectors.joining(";")); |
|||
return description; |
|||
} |
|||
|
|||
@Override |
|||
public ProductModelTemplateDetails init() { |
|||
ProductModelTemplateDetails entity=new ProductModelTemplateDetails(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(ProductModelTemplateDetails entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(ProductModelTemplateDetails entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(ProductModelTemplateDetails entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,74 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.*; |
|||
import tech.abc.platform.productManagement.mapper.ProductModelTemplateDetailsMapper; |
|||
import tech.abc.platform.productManagement.mapper.ProductModelTemplateMapper; |
|||
import tech.abc.platform.productManagement.service.ProductModelTemplateService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class ProductModelTemplateServiceImpl extends BaseServiceImpl<ProductModelTemplateMapper, ProductModelTemplate> implements ProductModelTemplateService { |
|||
@Autowired |
|||
private ProductModelTemplateDetailsMapper productModelTemplateDetailsMapper; |
|||
@Override |
|||
public ProductModelTemplate init() { |
|||
ProductModelTemplate entity=new ProductModelTemplate(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(ProductModelTemplate entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
@Override |
|||
public void afterAdd(ProductModelTemplate entity) { |
|||
//新增后设置型号规格为非临时数据
|
|||
String id = entity.getId(); |
|||
LambdaUpdateWrapper<ProductModelTemplateDetails> updateWrapper = new LambdaUpdateWrapper<>(); |
|||
updateWrapper.eq(ProductModelTemplateDetails::getModelTemplateId, id).set(ProductModelTemplateDetails::getIsTemporary, "0"); |
|||
productModelTemplateDetailsMapper.update(null,updateWrapper); |
|||
} |
|||
@Override |
|||
public void afterRemove(ProductModelTemplate entity) { |
|||
// 删除供应商产品信息时,将厂商产品型号和型号规格参数删除
|
|||
String modelId = entity.getId(); |
|||
LambdaQueryWrapper<ProductModelTemplateDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(ProductModelTemplateDetails::getModelTemplateId, modelId); |
|||
productModelTemplateDetailsMapper.delete(queryWrapper); |
|||
} |
|||
@Override |
|||
public void beforeModify(ProductModelTemplate entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(ProductModelTemplate entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,56 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.entity.SupplierInformation; |
|||
import tech.abc.platform.productManagement.mapper.SupplierInformationMapper; |
|||
import tech.abc.platform.productManagement.service.SupplierInformationService; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-07 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SupplierInformationServiceImpl extends BaseServiceImpl<SupplierInformationMapper, SupplierInformation> implements SupplierInformationService { |
|||
|
|||
@Override |
|||
public SupplierInformation init() { |
|||
SupplierInformation entity=new SupplierInformation(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(SupplierInformation entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(SupplierInformation entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(SupplierInformation entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,54 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.SupplierProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelDetailsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SupplierProductModelDetailsServiceImpl extends BaseServiceImpl<SupplierProductModelDetailsMapper, SupplierProductModelDetails> implements SupplierProductModelDetailsService { |
|||
|
|||
@Override |
|||
public SupplierProductModelDetails init() { |
|||
SupplierProductModelDetails entity=new SupplierProductModelDetails(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(SupplierProductModelDetails entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(SupplierProductModelDetails entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(SupplierProductModelDetails entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,172 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModel; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import tech.abc.platform.productManagement.mapper.SupplierProductModelMapper; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelDetailsService; |
|||
import tech.abc.platform.productManagement.service.SupplierProductModelService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
|
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelDetailsVO; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductModelVO; |
|||
import tech.abc.platform.productManagement.vo.ProductModelViewVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SupplierProductModelServiceImpl extends BaseServiceImpl<SupplierProductModelMapper, SupplierProductModel> implements SupplierProductModelService { |
|||
@Autowired |
|||
private SupplierProductModelDetailsService supplierProductModelDetailsService; |
|||
@Override |
|||
public void addModel(ProductModelViewVO vo) { |
|||
List<SupplierProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (SupplierProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
SupplierProductModelDetails supplierProductModelDetails = mapperFacade.map(item, SupplierProductModelDetails.class); |
|||
supplierProductModelDetailsService.save(supplierProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
SupplierProductModel supplierProductModel = mapperFacade.map(vo, SupplierProductModel.class); |
|||
save(supplierProductModel); |
|||
} |
|||
@Override |
|||
public void modifyModel(ProductModelViewVO vo) { |
|||
String id = vo.getId(); |
|||
//删除原型号指标参数
|
|||
LambdaQueryWrapper<SupplierProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(SupplierProductModelDetails::getModelId, id); |
|||
supplierProductModelDetailsService.remove(queryWrapper); |
|||
List<SupplierProductModelDetailsVO> modelDeatilOV = vo.getModelDeatils(); |
|||
//给型号指标设置型号id,并保存
|
|||
for (SupplierProductModelDetailsVO item :modelDeatilOV |
|||
) { |
|||
item.setModelId(vo.getId()); |
|||
item.setId(null); |
|||
item.setUpdateId(null); |
|||
item.setUpdateTime(null); |
|||
SupplierProductModelDetails supplierProductModelDetails = mapperFacade.map(item, SupplierProductModelDetails.class); |
|||
supplierProductModelDetails.setIsTemporary("0");//修改的化,将临时标记改为0,表示非临时
|
|||
supplierProductModelDetailsService.save(supplierProductModelDetails); |
|||
} |
|||
//保存型号
|
|||
SupplierProductModel supplierProductModel = mapperFacade.map(vo, SupplierProductModel.class); |
|||
updateById(supplierProductModel); |
|||
} |
|||
@Override |
|||
public List<SupplierProductModelDetailsVO> getModelDetails(String id) { |
|||
//根据型号id查询型号详情规格指标
|
|||
// QueryWrapper<SupplierProductModelDetails> queryWrapper = new QueryWrapper<>();
|
|||
// queryWrapper.lambda().eq(SupplierProductModelDetails::getModelId, id);
|
|||
LambdaQueryWrapper<SupplierProductModelDetails> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(SupplierProductModelDetails::getModelId, id); |
|||
List<SupplierProductModelDetails> list = supplierProductModelDetailsService.list(queryWrapper); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return new ArrayList<>(); |
|||
} |
|||
List<SupplierProductModelDetailsVO> result =convert2DetailsVO(list); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@Override |
|||
public SupplierProductModel init() { |
|||
SupplierProductModel entity=new SupplierProductModel(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
|
|||
@Override |
|||
public void beforeAdd(SupplierProductModel entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(SupplierProductModel entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(SupplierProductModel entity, String... value) { |
|||
} |
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierProductModelVO> convert2VO(List<SupplierProductModel> entityList) { |
|||
List<SupplierProductModelVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierProductModelVO vo = convert2VO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierProductModelVO convert2VO(SupplierProductModel entity){ |
|||
SupplierProductModelVO vo=mapperFacade.map(entity,SupplierProductModelVO.class); |
|||
return vo; |
|||
} |
|||
/** |
|||
* 将实体列表转换为视图对象列表 |
|||
* |
|||
* @param entityList 实体列表 |
|||
* @return {@link List}<{@link EntityVO}> 视图对象列表 |
|||
*/ |
|||
protected List<SupplierProductModelDetailsVO> convert2DetailsVO(List<SupplierProductModelDetails> entityList) { |
|||
List<SupplierProductModelDetailsVO> voList = new ArrayList<>(entityList.size()); |
|||
|
|||
entityList.stream().forEach(x -> { |
|||
SupplierProductModelDetailsVO vo = convert2DetailsVO(x); |
|||
voList.add(vo); |
|||
}); |
|||
return voList; |
|||
} |
|||
/** |
|||
* 将单条实体转换为视图对象 |
|||
* |
|||
* @param entity 实体 |
|||
* @return {@link EntityVO} 视图对象 |
|||
*/ |
|||
protected SupplierProductModelDetailsVO convert2DetailsVO(SupplierProductModelDetails entity){ |
|||
SupplierProductModelDetailsVO vo=mapperFacade.map(entity,SupplierProductModelDetailsVO.class); |
|||
return vo; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,164 @@ |
|||
package tech.abc.platform.productManagement.service.impl; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.google.gson.Gson; |
|||
import com.google.gson.GsonBuilder; |
|||
import org.elasticsearch.action.search.SearchRequest; |
|||
import org.elasticsearch.action.search.SearchResponse; |
|||
import org.elasticsearch.client.RequestOptions; |
|||
import org.elasticsearch.client.RestHighLevelClient; |
|||
import org.elasticsearch.index.query.QueryBuilders; |
|||
import org.elasticsearch.search.SearchHit; |
|||
import org.elasticsearch.search.SearchHits; |
|||
import org.elasticsearch.search.builder.SearchSourceBuilder; |
|||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import tech.abc.platform.common.exception.CommonException; |
|||
import tech.abc.platform.common.exception.CustomException; |
|||
import tech.abc.platform.common.vo.PageInfo; |
|||
import tech.abc.platform.common.vo.SortInfo; |
|||
import tech.abc.platform.elasticsearch.entity.SupplierProductsDTO; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModel; |
|||
import tech.abc.platform.productManagement.entity.SupplierProductModelDetails; |
|||
import tech.abc.platform.productManagement.entity.SupplierProducts; |
|||
import tech.abc.platform.productManagement.mapper.SupplierProductModelDetailsMapper; |
|||
import tech.abc.platform.productManagement.mapper.SupplierProductModelMapper; |
|||
import tech.abc.platform.productManagement.mapper.SupplierProductsMapper; |
|||
import tech.abc.platform.productManagement.service.SupplierProductsService; |
|||
import tech.abc.platform.common.base.BaseServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import java.util.HashMap; |
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|||
import tech.abc.platform.productManagement.vo.SupplierProductsVO; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-08 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SupplierProductsServiceImpl extends BaseServiceImpl<SupplierProductsMapper, SupplierProducts> implements SupplierProductsService { |
|||
@Autowired |
|||
private SupplierProductModelMapper supplierProductModelMapper; |
|||
@Autowired |
|||
private SupplierProductModelDetailsMapper supplierProductModelDetailsMapper; |
|||
@Autowired |
|||
private RestHighLevelClient client; |
|||
|
|||
@Override |
|||
public SupplierProducts init() { |
|||
SupplierProducts entity=new SupplierProducts(); |
|||
// 预先分配标识
|
|||
entity.setId(IdWorker.getIdStr()); |
|||
//默认值处理
|
|||
return entity; |
|||
} |
|||
@Override |
|||
public void afterAdd(SupplierProducts entity) { |
|||
// 新增供应商产品信息时,将厂商产品型号和型号规格参数变成的is_temporary标记为非临时数据
|
|||
String modelId = entity.getModelId(); |
|||
if (StringUtils.isNotBlank(modelId)) { |
|||
LambdaUpdateWrapper<SupplierProductModel> modelUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
modelUpdateWrapper.eq(SupplierProductModel::getId, modelId); |
|||
modelUpdateWrapper.set(SupplierProductModel::getIsTemporary, "0"); |
|||
supplierProductModelMapper.update(null,modelUpdateWrapper); |
|||
// 更新型号规格参数的is_temporary标记为非临时数据
|
|||
LambdaUpdateWrapper<SupplierProductModelDetails> detailsUpdateWrapper = new LambdaUpdateWrapper<>(); |
|||
detailsUpdateWrapper.eq(SupplierProductModelDetails::getModelId, modelId); |
|||
detailsUpdateWrapper.set(SupplierProductModelDetails::getIsTemporary, "0"); |
|||
supplierProductModelDetailsMapper.update(null,detailsUpdateWrapper); |
|||
} |
|||
|
|||
} |
|||
@Override |
|||
public void afterRemove(SupplierProducts entity) { |
|||
} |
|||
@Override |
|||
public void beforeAdd(SupplierProducts entity) { |
|||
//唯一性验证
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void beforeModify(SupplierProducts entity) { |
|||
//唯一性验证
|
|||
} |
|||
|
|||
@Override |
|||
public Map<String, String> getNameMap(List<String> idList) { |
|||
Map<String, String> result = new HashMap<>(5); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public IPage<SupplierProductsVO> querypagebyes(SupplierProductsVO queryVO, PageInfo pageInfo, SortInfo sortInfo) { |
|||
// 执行查询
|
|||
Page<SupplierProductsVO> supplierProductsVOPage = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize()); |
|||
List<SupplierProductsVO> supplierProductsVOList =new ArrayList<>(); |
|||
String productName = queryVO.getProductName(); |
|||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); |
|||
SearchRequest searchRequest = new SearchRequest("pmg_supplier_products"); |
|||
// //高亮器
|
|||
HighlightBuilder highlightBuilder = new HighlightBuilder(); |
|||
highlightBuilder.requireFieldMatch(false)//多字段时,需要设置为false//因为高亮查询默认是对查询字段即description就行高亮,可以关闭字段匹配,这样就可以对查询到的多个字段(前提是有关键词并且改字段可以分词)进行高亮显示
|
|||
.field("product_name")//若有关键字切可以分词,则可以高亮,写*可以匹配所有字段
|
|||
.field("product_specifications")//若有关键字切可以分词,则可以高亮,写*可以匹配所有字段
|
|||
.preTags("<span style=\"color: red;\">")//手动前缀标签
|
|||
.postTags("</span>"); |
|||
searchSourceBuilder |
|||
.query(QueryBuilders.multiMatchQuery(productName, "product_name", "product_specifications")) |
|||
.highlighter(highlightBuilder) |
|||
.from(pageInfo.getPageNum()-1) //起始位置:start=(page-1)*size
|
|||
.size(pageInfo.getPageSize()); //每页显示条数;
|
|||
|
|||
searchRequest.source(searchSourceBuilder); |
|||
try { |
|||
SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT); |
|||
// 解析结果
|
|||
SearchHits hits = response.getHits(); |
|||
|
|||
|
|||
supplierProductsVOPage.setTotal(response.getHits().getTotalHits().value); |
|||
SearchHit[] searchHits = hits.getHits(); |
|||
Gson gson =new Gson(); |
|||
for (SearchHit hit : searchHits) { |
|||
String json = gson.toJson(hit.getSourceAsMap()); |
|||
SupplierProductsDTO supplierProductsDTO = gson.fromJson(json, SupplierProductsDTO.class); |
|||
SupplierProductsVO supplierProductsVO =mapperFacade.map(supplierProductsDTO, SupplierProductsVO.class); |
|||
if(hit.getHighlightFields().get("product_name")!=null){ |
|||
supplierProductsVO.setProductName(hit.getHighlightFields().get("product_name").getFragments()[0].toString()); |
|||
|
|||
} |
|||
if(hit.getHighlightFields().get("product_specifications")!=null){ |
|||
supplierProductsVO.setProductSpecifications(hit.getHighlightFields().get("product_specifications").getFragments()[0].toString()); |
|||
|
|||
} |
|||
supplierProductsVOList.add(supplierProductsVO); |
|||
} |
|||
supplierProductsVOPage.setRecords(supplierProductsVOList); |
|||
return supplierProductsVOPage; |
|||
} catch (IOException e) { |
|||
throw new CustomException(CommonException.ELASTICSEARCH_ERROR,"查询失败"); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
protected void copyPropertyHandle(SupplierProducts entity, String... value) { |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,69 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CompanyProductModelDetailsVO extends BaseVO { |
|||
/** |
|||
* 公司产品型号表id |
|||
*/ |
|||
@NotBlank(message = "【公司产品型号表id】不能为空") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@NotBlank(message = "【指标名称】不能为空") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 指标参数 |
|||
*/ |
|||
@NotBlank(message = "【指标参数】不能为空") |
|||
private String parameterValue; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@NotBlank(message = "【是否关键指标】不能为空") |
|||
private String isKeyParameter; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
private String isTemporary; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,52 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CompanyProductModelVO extends BaseVO { |
|||
/** |
|||
* 产品规格 |
|||
*/ |
|||
@NotBlank(message = "【产品规格】不能为空") |
|||
private String description; |
|||
|
|||
/** |
|||
* 产品型号模板id |
|||
*/ |
|||
@NotBlank(message = "【产品型号】不能为空") |
|||
private String productModelTemplateId; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-09 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class CompanyProductsVO extends BaseVO { |
|||
/** |
|||
* 公司产品型号id |
|||
*/ |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 供应商ID |
|||
*/ |
|||
private String supplierInformationId; |
|||
/** |
|||
* 供应商名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@NotBlank(message = "【产品名称】不能为空") |
|||
private String productName; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
|
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@NotNull(message = "【产品价格】不能为空") |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
/** |
|||
* 产品规格 |
|||
*/ |
|||
private String productSpecifications; |
|||
/** |
|||
* 供应商产品id |
|||
*/ |
|||
private String supplierProductsId; |
|||
/** |
|||
* 产品图片 |
|||
*/ |
|||
private String image; |
|||
|
|||
/** |
|||
* 产品品牌 |
|||
*/ |
|||
private String brand; |
|||
|
|||
/** |
|||
* 产品单位*/ |
|||
private String unit; |
|||
|
|||
/** |
|||
* 除税价格 |
|||
*/ |
|||
private BigDecimal exTaxPrice; |
|||
|
|||
/** |
|||
* 税率 |
|||
*/ |
|||
private BigDecimal taxrate; |
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class PersonProductModelDetailsVO extends BaseVO { |
|||
/** |
|||
* 个人产品型号表id |
|||
*/ |
|||
@NotBlank(message = "【个人产品型号表id】不能为空") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@NotBlank(message = "【指标名称】不能为空") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 指标参数 |
|||
*/ |
|||
@NotBlank(message = "【指标参数】不能为空") |
|||
private String parameterValue; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@NotBlank(message = "【是否关键指标】不能为空") |
|||
private String isKeyParameter; |
|||
|
|||
/** |
|||
* 是否临时数据 |
|||
*/ |
|||
private String isTemporary; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,52 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class PersonProductModelVO extends BaseVO { |
|||
/** |
|||
* 个人产品指标描述 |
|||
*/ |
|||
@NotBlank(message = "【个人产品指标描述】不能为空") |
|||
private String description; |
|||
|
|||
/** |
|||
* 产品型号模板id |
|||
*/ |
|||
@NotBlank(message = "【产品型号模板id】不能为空") |
|||
private String productModelTemplateId; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,109 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class PersonProductsVO extends BaseVO { |
|||
/** |
|||
* 个人产品型号id |
|||
*/ |
|||
@NotBlank(message = "【个人产品型号id】不能为空") |
|||
private String modelId; |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
private String supplierInformationId; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
@NotBlank(message = "【产品名称】不能为空") |
|||
private String productName; |
|||
|
|||
/** |
|||
* 产品标识(型号) |
|||
*/ |
|||
private String productIdentity; |
|||
|
|||
/** |
|||
* 产品价格 |
|||
*/ |
|||
@NotNull(message = "【产品价格】不能为空") |
|||
private BigDecimal productPrice; |
|||
|
|||
/** |
|||
* 信息来源 |
|||
*/ |
|||
private String sourceInformation; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
|
|||
/** |
|||
* 关联厂商产品id |
|||
*/ |
|||
private String supplierProductsId; |
|||
/** |
|||
* 产品规格 |
|||
*/ |
|||
private String productSpecifications; |
|||
/** |
|||
* 产品图片 |
|||
*/ |
|||
private String image; |
|||
|
|||
/** |
|||
* 产品品牌 |
|||
*/ |
|||
private String brand; |
|||
|
|||
/** |
|||
* 产品单位*/ |
|||
private String unit; |
|||
|
|||
/** |
|||
* 除税价格 |
|||
*/ |
|||
private BigDecimal exTaxPrice; |
|||
/** |
|||
* 税率 |
|||
*/ |
|||
private BigDecimal taxrate; |
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class ProductModelTemplateDetailsVO extends BaseVO { |
|||
/** |
|||
* 产品型号表id |
|||
*/ |
|||
@NotBlank(message = "【产品型号表id】不能为空") |
|||
private String modelTemplateId; |
|||
|
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
@NotBlank(message = "【指标名称】不能为空") |
|||
private String paramName; |
|||
|
|||
/** |
|||
* 是否关键指标 |
|||
*/ |
|||
@NotBlank(message = "【是否关键指标】不能为空") |
|||
private String isKeyParameter; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class ProductModelTemplateVO extends BaseVO { |
|||
/** |
|||
* 模板名称 |
|||
*/ |
|||
@NotBlank(message = "【模板名称】不能为空") |
|||
private String templateName; |
|||
private String templateDetailsDescription; |
|||
|
|||
/** |
|||
* 模板类型 |
|||
*/ |
|||
private String templateType; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
// /**
|
|||
// * 模型详情
|
|||
// */
|
|||
// private String templateDetails;
|
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package tech.abc.platform.productManagement.vo; |
|||
|
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import tech.abc.platform.common.base.BaseVO; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 视图对象类 |
|||
* |
|||
* @author ZHB |
|||
* @date 2024-05-14 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Accessors(chain = true) |
|||
public class ProductModelViewVO<T> extends BaseVO { |
|||
/** |
|||
* 厂商产品型号描述 |
|||
*/ |
|||
@NotBlank(message = "【厂商产品型号描述】不能为空") |
|||
private String description; |
|||
|
|||
/** |
|||
* 产品型号模板id |
|||
*/ |
|||
private String productModelTemplateId; |
|||
|
|||
private List<T> modelDeatils; |
|||
|
|||
|
|||
/********非库表存储属性*****/ |
|||
|
|||
|
|||
|
|||
/********字典类*****/ |
|||
|
|||
/********实体类、用户单选、组织机构单选*****/ |
|||
|
|||
/********范围查询*****/ |
|||
|
|||
/********自定义扩展*****/ |
|||
|
|||
/********子对象*****/ |
|||
|
|||
|
|||
|
|||
|
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue