mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
添加煤源信息和煤源报价
This commit is contained in:
@@ -9,6 +9,7 @@ import cn.lihongjie.coal.permission.entity.PermissionEntity;
|
||||
import cn.lihongjie.coal.resource.entity.ResourceEntity;
|
||||
import cn.lihongjie.coal.role.entity.RoleEntity;
|
||||
import cn.lihongjie.coal.script.entity.ScriptEntity;
|
||||
import cn.lihongjie.coal.supplier.entity.SupplierEntity;
|
||||
import cn.lihongjie.coal.syslog.entity.SysLogEntity;
|
||||
import cn.lihongjie.coal.user.entity.UserEntity;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -129,7 +130,17 @@ public interface CommonMapper {
|
||||
return e;
|
||||
|
||||
}
|
||||
public default SupplierEntity createSupplier(String id) {
|
||||
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
SupplierEntity e = new SupplierEntity();
|
||||
e.setId(id);
|
||||
return e;
|
||||
|
||||
}
|
||||
|
||||
public default String toString(Object o) {
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lihongjie.coal.coalInfo.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.coalInfo.dto.CoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.CreateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.UpdateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.service.CoalInfoService;
|
||||
import java.lang.Object;
|
||||
import java.lang.String;
|
||||
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("/coalInfo")
|
||||
@SysLog(
|
||||
module = "煤源信息"
|
||||
)
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class CoalInfoController {
|
||||
@Autowired
|
||||
private CoalInfoService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public CoalInfoDto create(@RequestBody CreateCoalInfoDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public CoalInfoDto update(@RequestBody UpdateCoalInfoDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
public CoalInfoDto getById(@RequestBody String request) {
|
||||
return this.service.getById(request)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<CoalInfoDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lihongjie.coal.coalInfo.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.supplier.entity.SupplierEntity;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CoalInfoDto extends OrgCommonDto {
|
||||
|
||||
@Comment("供应商")
|
||||
private SupplierEntity supplier;
|
||||
|
||||
|
||||
|
||||
@Comment("初始报价")
|
||||
private Double initPrice;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.lihongjie.coal.coalInfo.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CreateCoalInfoDto extends OrgCommonDto {
|
||||
|
||||
@Comment("供应商")
|
||||
private String supplier;
|
||||
|
||||
|
||||
|
||||
@Comment("初始报价")
|
||||
private Double initPrice;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.lihongjie.coal.coalInfo.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class UpdateCoalInfoDto extends OrgCommonDto {
|
||||
@Comment("供应商")
|
||||
private String supplier;
|
||||
|
||||
|
||||
|
||||
@Comment("初始报价")
|
||||
private Double initPrice;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.lihongjie.coal.coalInfo.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.supplier.entity.SupplierEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class CoalInfoEntity extends OrgCommonEntity {
|
||||
|
||||
@ManyToOne
|
||||
@Comment("供应商")
|
||||
private SupplierEntity supplier;
|
||||
|
||||
|
||||
|
||||
@Comment("初始报价")
|
||||
private Double initPrice;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lihongjie.coal.coalInfo.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.coalInfo.dto.CoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.CreateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.UpdateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface CoalInfoMapper extends BaseMapper<CoalInfoEntity, CoalInfoDto, CreateCoalInfoDto, UpdateCoalInfoDto> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.coalInfo.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CoalInfoRepository extends BaseRepository<CoalInfoEntity> {
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lihongjie.coal.coalInfo.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.coalInfo.dto.CoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.CreateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.dto.UpdateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import cn.lihongjie.coal.coalInfo.mapper.CoalInfoMapper;
|
||||
import cn.lihongjie.coal.coalInfo.repository.CoalInfoRepository;
|
||||
import java.lang.String;
|
||||
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;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CoalInfoService extends BaseService<CoalInfoEntity, CoalInfoRepository> {
|
||||
@Autowired
|
||||
private CoalInfoRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CoalInfoMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
public CoalInfoDto create(CreateCoalInfoDto request) {
|
||||
CoalInfoEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalInfoDto update(UpdateCoalInfoDto request) {
|
||||
CoalInfoEntity 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 CoalInfoDto getById(String id) {
|
||||
CoalInfoEntity entity = repository.get(id);
|
||||
|
||||
|
||||
return mapper.toDto(entity)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<CoalInfoDto> list(CommonQuery query) {
|
||||
Page<CoalInfoEntity> 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,60 @@
|
||||
package cn.lihongjie.coal.coalPrice.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.coalPrice.dto.CoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.CreateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.UpdateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.service.CoalPriceService;
|
||||
import java.lang.Object;
|
||||
import java.lang.String;
|
||||
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("/coalPrice")
|
||||
@SysLog(
|
||||
module = "煤源价格记录"
|
||||
)
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class CoalPriceController {
|
||||
@Autowired
|
||||
private CoalPriceService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public CoalPriceDto create(@RequestBody CreateCoalPriceDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public CoalPriceDto update(@RequestBody UpdateCoalPriceDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
public CoalPriceDto getById(@RequestBody String request) {
|
||||
return this.service.getById(request)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<CoalPriceDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lihongjie.coal.coalPrice.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CoalPriceDto extends OrgCommonDto {
|
||||
@Comment("煤源")
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
|
||||
|
||||
@Comment("价格")
|
||||
private Double price;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.lihongjie.coal.coalPrice.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CreateCoalPriceDto extends OrgCommonDto {
|
||||
@Comment("煤源")
|
||||
private String coalInfo;
|
||||
|
||||
|
||||
|
||||
@Comment("价格")
|
||||
private Double price;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.lihongjie.coal.coalPrice.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class UpdateCoalPriceDto extends OrgCommonDto {
|
||||
@Comment("煤源")
|
||||
private String coalInfo;
|
||||
|
||||
|
||||
|
||||
@Comment("价格")
|
||||
private Double price;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.lihongjie.coal.coalPrice.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class CoalPriceEntity extends OrgCommonEntity {
|
||||
|
||||
@Comment("煤源")
|
||||
@ManyToOne
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
|
||||
|
||||
@Comment("价格")
|
||||
private Double price;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lihongjie.coal.coalPrice.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.coalPrice.dto.CoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.CreateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.UpdateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.entity.CoalPriceEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface CoalPriceMapper extends BaseMapper<CoalPriceEntity, CoalPriceDto, CreateCoalPriceDto, UpdateCoalPriceDto> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.coalPrice.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.coalPrice.entity.CoalPriceEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CoalPriceRepository extends BaseRepository<CoalPriceEntity> {
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lihongjie.coal.coalPrice.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.coalPrice.dto.CoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.CreateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.dto.UpdateCoalPriceDto;
|
||||
import cn.lihongjie.coal.coalPrice.entity.CoalPriceEntity;
|
||||
import cn.lihongjie.coal.coalPrice.mapper.CoalPriceMapper;
|
||||
import cn.lihongjie.coal.coalPrice.repository.CoalPriceRepository;
|
||||
import java.lang.String;
|
||||
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;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CoalPriceService extends BaseService<CoalPriceEntity, CoalPriceRepository> {
|
||||
@Autowired
|
||||
private CoalPriceRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CoalPriceMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
public CoalPriceDto create(CreateCoalPriceDto request) {
|
||||
CoalPriceEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalPriceDto update(UpdateCoalPriceDto request) {
|
||||
CoalPriceEntity 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 CoalPriceDto getById(String id) {
|
||||
CoalPriceEntity entity = repository.get(id);
|
||||
|
||||
|
||||
return mapper.toDto(entity)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<CoalPriceDto> list(CommonQuery query) {
|
||||
Page<CoalPriceEntity> page = repository.findAll(query.specification(conversionService), PageRequest.of(query.getPageNo(), query.getPageSize(), Sort.by(query.getOrders())));
|
||||
|
||||
|
||||
return page.map(this.mapper::toDto)
|
||||
;
|
||||
}
|
||||
}
|
||||
15
src/main/resources/scripts/dict/enum/supplierDict.groovy
Normal file
15
src/main/resources/scripts/dict/enum/supplierDict.groovy
Normal file
@@ -0,0 +1,15 @@
|
||||
package scripts.dict
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery
|
||||
import cn.lihongjie.coal.supplier.controller.SupplierController
|
||||
import org.springframework.context.ApplicationContext
|
||||
|
||||
ApplicationContext ioc = ioc;
|
||||
|
||||
def controller = ioc.getBean(SupplierController.class)
|
||||
|
||||
|
||||
|
||||
|
||||
return controller.list(new CommonQuery())
|
||||
|
||||
Reference in New Issue
Block a user