feat(InventoryCheck): add InventoryCheckDetailDto and update getById method to return detailed information

This commit is contained in:
2025-09-09 20:56:56 +08:00
parent 711f7e41ef
commit c504d8e4db
4 changed files with 74 additions and 8 deletions

View File

@@ -31,12 +31,12 @@ public class InventoryCheckController {
@Autowired private InventoryCheckService service;
@PostMapping("/create")
public InventoryCheckDto create(@RequestBody CreateInventoryCheckDto request) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto create(@RequestBody CreateInventoryCheckDto request) {
return this.service.create(request);
}
@PostMapping("/update")
public InventoryCheckDto update(@RequestBody UpdateInventoryCheckDto request) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto update(@RequestBody UpdateInventoryCheckDto request) {
return this.service.update(request);
}
@@ -47,7 +47,7 @@ public class InventoryCheckController {
}
@PostMapping("/getById")
public InventoryCheckDto getById(@RequestBody IdRequest request) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto getById(@RequestBody IdRequest request) {
return this.service.getById(request.getId());
}

View File

@@ -0,0 +1,63 @@
package cn.lihongjie.coal.inventoryCheck.dto;
import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.common.DictCode;
import cn.lihongjie.coal.inventoryCheckDetail.dto.CreateInventoryCheckDetailDto;
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
import lombok.Data;
import org.hibernate.annotations.Comment;
import java.time.LocalDateTime;
@Data
public class InventoryCheckDetailDto extends OrgCommonDto {
private LocalDateTime checkTime;
@Comment("盘点人员")
private String checkPerson;
@Comment("盘点类型")
private String checkType;
@Comment("盘点类型-名称")
@DictTranslate(dictKey = DictCode.INVENTORYCHECK_TYPE)
private String checkTypeName;
/**
* 精煤 合计
*/
private Long sum0;
/**
* 中煤 合计
*/
private Long sum1;
/**
* 原煤 合计
*/
private Long sum2;
/**
* 煤泥 合计
*/
private Long sum3;
/**
* 矸石 合计
*/
private Long sum4;
/**
* 其他 合计
*/
private Long sum5;
private java.util.List<CreateInventoryCheckDetailDto> details;
}

View File

@@ -2,6 +2,7 @@ package cn.lihongjie.coal.inventoryCheck.mapper;
import cn.lihongjie.coal.base.mapper.BaseMapper;
import cn.lihongjie.coal.inventoryCheck.dto.CreateInventoryCheckDto;
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto;
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDto;
import cn.lihongjie.coal.inventoryCheck.dto.UpdateInventoryCheckDto;
import cn.lihongjie.coal.inventoryCheck.entity.InventoryCheckEntity;
@@ -18,4 +19,6 @@ public interface InventoryCheckMapper
InventoryCheckEntity,
InventoryCheckDto,
CreateInventoryCheckDto,
UpdateInventoryCheckDto> {}
UpdateInventoryCheckDto> {
InventoryCheckDetailDto toDetailDto(InventoryCheckEntity entity);
}

View File

@@ -48,7 +48,7 @@ public class InventoryCheckService
@Autowired private InventoryCheckDetailRepository inventoryCheckDetailRepository;
public InventoryCheckDto create(CreateInventoryCheckDto request) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto create(CreateInventoryCheckDto request) {
InventoryCheckEntity entity = mapper.toEntity(request);
this.repository.save(entity);
@@ -83,7 +83,7 @@ public class InventoryCheckService
inventoryCheckDetailRepository.saveAll(list);
}
public InventoryCheckDto update(UpdateInventoryCheckDto request) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto update(UpdateInventoryCheckDto request) {
InventoryCheckEntity entity = this.repository.get(request.getId());
this.mapper.updateEntity(entity, request);
@@ -102,10 +102,10 @@ public class InventoryCheckService
inventoryCheckDetailService.deleteByInventoryCheckId(request.getIds());
}
public InventoryCheckDto getById(String id) {
public cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDetailDto getById(String id) {
InventoryCheckEntity entity = repository.get(id);
return mapper.toDto(entity);
return mapper.toDetailDto(entity);
}
public Page<InventoryCheckDto> list(CommonQuery query) {