zhouhaibin
6 months ago
22 changed files with 1487 additions and 0 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,236 @@ |
|||||
|
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 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); |
||||
|
} |
||||
|
//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, |
||||
|
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 ModelDescription |
||||
|
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 ModelDescription |
||||
|
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 ModelDescription |
||||
|
FROM pmg_person_products |
||||
|
<include refid="getProductsPageByType_Query"/> |
||||
|
</if> |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,16 @@ |
|||||
|
package tech.abc.platform.costManagement.mapper; |
||||
|
|
||||
|
import tech.abc.platform.costManagement.entity.CostTable; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 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,32 @@ |
|||||
|
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 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); |
||||
|
} |
||||
|
|
@ -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,97 @@ |
|||||
|
package tech.abc.platform.costManagement.service.impl; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
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.time.LocalDateTime; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.HashMap; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
|
import tech.abc.platform.costManagement.vo.CostDetailViewVO; |
||||
|
import tech.abc.platform.costManagement.vo.CostItemDetailVO; |
||||
|
|
||||
|
/** |
||||
|
* 服务实现类 |
||||
|
* |
||||
|
* @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 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) { |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -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,90 @@ |
|||||
|
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 productIdentity; |
||||
|
|
||||
|
/** |
||||
|
* 产品价格 |
||||
|
*/ |
||||
|
@NotBlank(message = "【产品价格】不能为空") |
||||
|
private BigDecimal productPrice; |
||||
|
|
||||
|
/** |
||||
|
* 信息来源 |
||||
|
*/ |
||||
|
private String sourceInformation; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
/** |
||||
|
* 关联厂商产品id |
||||
|
*/ |
||||
|
private String supplierProductsId; |
||||
|
/** |
||||
|
* 产品描述 |
||||
|
*/ |
||||
|
private String ModelDescription; |
||||
|
|
||||
|
/** |
||||
|
* 产品类型 (-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; |
||||
|
} |
Loading…
Reference in new issue