mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
增加库存盘点接口
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.CreateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.UpdateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.service.InventoryCheckService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inventoryCheck")
|
||||
@SysLog(module = "库存盘点")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class InventoryCheckController {
|
||||
@Autowired private InventoryCheckService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public InventoryCheckDto create(@RequestBody CreateInventoryCheckDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public InventoryCheckDto update(@RequestBody UpdateInventoryCheckDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public InventoryCheckDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<InventoryCheckDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CreateInventoryCheckDto extends OrgCommonDto {
|
||||
|
||||
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@Comment("盘点类型")
|
||||
private String checkType;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckDto extends OrgCommonDto {
|
||||
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@Comment("盘点类型")
|
||||
private String checkType;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'inventoryCheck.type'\n"
|
||||
+ " and i.code = check_type)")
|
||||
@Comment("盘点类型-名称")
|
||||
private String checkTypeName;
|
||||
|
||||
/**
|
||||
* 精煤 合计
|
||||
*/
|
||||
|
||||
private Long sum0;
|
||||
/**
|
||||
* 中煤 合计
|
||||
*/
|
||||
|
||||
private Long sum1;
|
||||
/**
|
||||
* 原煤 合计
|
||||
*/
|
||||
|
||||
private Long sum2;
|
||||
/**
|
||||
* 煤泥 合计
|
||||
*/
|
||||
|
||||
private Long sum3;
|
||||
/**
|
||||
* 矸石 合计
|
||||
*/
|
||||
|
||||
private Long sum4;
|
||||
/**
|
||||
* 其他 合计
|
||||
*/
|
||||
|
||||
private Long sum5;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UpdateInventoryCheckDto extends OrgCommonDto {
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@Comment("盘点类型")
|
||||
private String checkType;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class InventoryCheckEntity extends OrgCommonEntity {
|
||||
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@Comment("盘点类型")
|
||||
private String checkType;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'inventoryCheck.type'\n"
|
||||
+ " and i.code = check_type)")
|
||||
@Comment("盘点类型-名称")
|
||||
private String checkTypeName;
|
||||
|
||||
/** 精煤 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '0' or p.coal_type = '0') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum0;
|
||||
|
||||
/** 中煤 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '1' or p.coal_type = '1') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum1;
|
||||
|
||||
/** 原煤 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '2' or p.coal_type = '2') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum2;
|
||||
|
||||
/** 煤泥 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '3' or p.coal_type = '3') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum3;
|
||||
|
||||
/** 矸石 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '4' or p.coal_type = '4') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum4;
|
||||
|
||||
/** 其他 合计 */
|
||||
@Formula(
|
||||
"""
|
||||
|
||||
select sum(amount) from t_inventory_check_detail d
|
||||
left join t_coal_info c on d.coal_info_id = c.id
|
||||
left join t_product p on d.product_id = p.id
|
||||
where (c.coal_type = '5' or p.coal_type = '5') and d.inventory_check_id = id
|
||||
""")
|
||||
private Long sum5;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.CreateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.UpdateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.entity.InventoryCheckEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface InventoryCheckMapper
|
||||
extends BaseMapper<
|
||||
InventoryCheckEntity,
|
||||
InventoryCheckDto,
|
||||
CreateInventoryCheckDto,
|
||||
UpdateInventoryCheckDto> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.inventoryCheck.entity.InventoryCheckEntity;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface InventoryCheckRepository extends BaseRepository<InventoryCheckEntity> {}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.lihongjie.coal.inventoryCheck.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.CreateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.UpdateInventoryCheckDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.entity.InventoryCheckEntity;
|
||||
import cn.lihongjie.coal.inventoryCheck.mapper.InventoryCheckMapper;
|
||||
import cn.lihongjie.coal.inventoryCheck.repository.InventoryCheckRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class InventoryCheckService
|
||||
extends BaseService<InventoryCheckEntity, InventoryCheckRepository> {
|
||||
@Autowired private InventoryCheckRepository repository;
|
||||
|
||||
@Autowired private InventoryCheckMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
public InventoryCheckDto create(CreateInventoryCheckDto request) {
|
||||
InventoryCheckEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public InventoryCheckDto update(UpdateInventoryCheckDto request) {
|
||||
InventoryCheckEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public InventoryCheckDto getById(String id) {
|
||||
InventoryCheckEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<InventoryCheckDto> list(CommonQuery query) {
|
||||
Page<InventoryCheckEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.CreateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.InventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.UpdateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.service.InventoryCheckDetailService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inventoryCheckDetail")
|
||||
@SysLog(module = "库存盘点明细")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class InventoryCheckDetailController {
|
||||
@Autowired private InventoryCheckDetailService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public InventoryCheckDetailDto create(@RequestBody CreateInventoryCheckDetailDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public InventoryCheckDetailDto update(@RequestBody UpdateInventoryCheckDetailDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public InventoryCheckDetailDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<InventoryCheckDetailDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateInventoryCheckDetailDto extends OrgCommonDto {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String inventoryCheck;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String coalInfo;
|
||||
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String product;
|
||||
|
||||
|
||||
|
||||
private Double amount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.CoalInfoDto;
|
||||
import cn.lihongjie.coal.inventoryCheck.dto.InventoryCheckDto;
|
||||
import cn.lihongjie.coal.product.dto.ProductDto;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckDetailDto extends OrgCommonDto {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private InventoryCheckDto inventoryCheck;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private CoalInfoDto coalInfo;
|
||||
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private ProductDto product;
|
||||
|
||||
|
||||
|
||||
private Double amount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateInventoryCheckDetailDto extends OrgCommonDto {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String inventoryCheck;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String coalInfo;
|
||||
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private String product;
|
||||
|
||||
|
||||
|
||||
private Double amount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import cn.lihongjie.coal.inventoryCheck.entity.InventoryCheckEntity;
|
||||
import cn.lihongjie.coal.product.entity.ProductEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class InventoryCheckDetailEntity extends OrgCommonEntity {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private InventoryCheckEntity inventoryCheck;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private ProductEntity product;
|
||||
|
||||
|
||||
|
||||
private Double amount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.CreateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.InventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.UpdateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.entity.InventoryCheckDetailEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface InventoryCheckDetailMapper
|
||||
extends BaseMapper<
|
||||
InventoryCheckDetailEntity,
|
||||
InventoryCheckDetailDto,
|
||||
CreateInventoryCheckDetailDto,
|
||||
UpdateInventoryCheckDetailDto> {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.entity.InventoryCheckDetailEntity;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface InventoryCheckDetailRepository
|
||||
extends BaseRepository<InventoryCheckDetailEntity> {}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.lihongjie.coal.inventoryCheckDetail.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.CreateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.InventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.dto.UpdateInventoryCheckDetailDto;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.entity.InventoryCheckDetailEntity;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.mapper.InventoryCheckDetailMapper;
|
||||
import cn.lihongjie.coal.inventoryCheckDetail.repository.InventoryCheckDetailRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class InventoryCheckDetailService
|
||||
extends BaseService<InventoryCheckDetailEntity, InventoryCheckDetailRepository> {
|
||||
@Autowired private InventoryCheckDetailRepository repository;
|
||||
|
||||
@Autowired private InventoryCheckDetailMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
public InventoryCheckDetailDto create(CreateInventoryCheckDetailDto request) {
|
||||
InventoryCheckDetailEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public InventoryCheckDetailDto update(UpdateInventoryCheckDetailDto request) {
|
||||
InventoryCheckDetailEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public InventoryCheckDetailDto getById(String id) {
|
||||
InventoryCheckDetailEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<InventoryCheckDetailDto> list(CommonQuery query) {
|
||||
Page<InventoryCheckDetailEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
}
|
||||
@@ -1914,9 +1914,37 @@
|
||||
{
|
||||
"code": "2",
|
||||
"name": "原煤"
|
||||
},
|
||||
{
|
||||
"code": "3",
|
||||
"name": "煤泥"
|
||||
},
|
||||
{
|
||||
"code": "4",
|
||||
"name": "矸石"
|
||||
},
|
||||
{
|
||||
"code": "5",
|
||||
"name": "其他"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"code": "inventoryCheck.type",
|
||||
"name": "库存盘点类型",
|
||||
"item": [
|
||||
{
|
||||
"code": "0",
|
||||
"name": "煤源"
|
||||
},
|
||||
{
|
||||
"code": "1",
|
||||
"name": "产品"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "coalParameter.inputType",
|
||||
"name": "煤参数录入方式",
|
||||
|
||||
Reference in New Issue
Block a user