Compare commits
No commits in common. "ffc28af175a8b92f8b826c044f3d34873e590d7d" and "33a90bc2ec23c1e2ffee86b1338bf72bcee491a0" have entirely different histories.
ffc28af175
...
33a90bc2ec
@ -1,6 +1,5 @@
|
||||
package com.cnbm.packing.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
@ -11,11 +10,8 @@ import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.common.validator.group.UpdateGroup;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ProductLevelDTO;
|
||||
import com.cnbm.packing.entity.ProductLevel;
|
||||
import com.cnbm.packing.excel.ProductLevelExcel;
|
||||
import com.cnbm.packing.mapper.ProductLevelMapper;
|
||||
import com.cnbm.packing.service.ProductLevelServiceBiz;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -43,8 +39,6 @@ import java.util.Map;
|
||||
public class ProductLevelController {
|
||||
@Autowired
|
||||
private ProductLevelServiceBiz productLevelService;
|
||||
@Autowired
|
||||
private ProductLevelMapper productLevelMapper;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
@ -75,51 +69,26 @@ public class ProductLevelController {
|
||||
@ApiOperation("保存")
|
||||
@LogOperation("保存")
|
||||
// @PreAuthorize("@ex.hasAuthority('basic:productLevel:save')")
|
||||
public Result<IdVo> save(@RequestBody ProductLevelDTO dto){
|
||||
public Result<Long> save(@RequestBody ProductLevelDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
QueryWrapper<ProductLevel> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(ProductLevel.CODE, dto.getCode());
|
||||
if(productLevelMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<ProductLevel> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq(ProductLevel.PRODUCT_LEVEL, dto.getProductLevel());
|
||||
if(productLevelMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(productLevelService.add(dto));
|
||||
}
|
||||
productLevelService.save(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
@LogOperation("修改")
|
||||
// @PreAuthorize("@ex.hasAuthority('basic:productLevel:update')")
|
||||
public Result<IdVo> update(@RequestBody ProductLevelDTO dto){
|
||||
public Result<Long> update(@RequestBody ProductLevelDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
ProductLevelDTO entity = productLevelService.get(dto.getId());
|
||||
QueryWrapper<ProductLevel> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(ProductLevel.CODE, dto.getCode());
|
||||
if(entity.getCode()!=dto.getCode() && productLevelMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<ProductLevel> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq(ProductLevel.PRODUCT_LEVEL, dto.getProductLevel());
|
||||
if(entity.getProductLevel()!=dto.getProductLevel() && productLevelMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(productLevelService.edit(dto));
|
||||
}
|
||||
productLevelService.update(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.cnbm.packing.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
@ -11,11 +10,8 @@ import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.common.validator.group.UpdateGroup;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ScenesDTO;
|
||||
import com.cnbm.packing.entity.Scenes;
|
||||
import com.cnbm.packing.excel.ScenesExcel;
|
||||
import com.cnbm.packing.mapper.ScenesMapper;
|
||||
import com.cnbm.packing.service.ScenesServiceBiz;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -43,8 +39,6 @@ import java.util.Map;
|
||||
public class ScenesController {
|
||||
@Autowired
|
||||
private ScenesServiceBiz scenesService;
|
||||
@Autowired
|
||||
private ScenesMapper scenesMapper;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
@ -75,53 +69,26 @@ public class ScenesController {
|
||||
@ApiOperation("保存")
|
||||
@LogOperation("保存")
|
||||
// @PreAuthorize("@ex.hasAuthority('basic:scenes:save')")
|
||||
public Result<IdVo> save(@RequestBody ScenesDTO dto){
|
||||
public Result<Long> save(@RequestBody ScenesDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
QueryWrapper<Scenes> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(Scenes.CODE, dto.getCode());
|
||||
if(scenesMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<Scenes> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq(Scenes.SCENES_NAME, dto.getScenesName());
|
||||
System.out.println(scenesMapper.selectCount(wrapper2));
|
||||
if(scenesMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(scenesService.add(dto));
|
||||
}
|
||||
scenesService.save(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
@LogOperation("修改")
|
||||
// @PreAuthorize("@ex.hasAuthority('basic:scenes:update')")
|
||||
public Result<IdVo> update(@RequestBody ScenesDTO dto){
|
||||
public Result<Long> update(@RequestBody ScenesDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
ScenesDTO entity = scenesService.get(dto.getId());
|
||||
QueryWrapper<Scenes> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(Scenes.CODE, dto.getCode());
|
||||
if(entity.getCode()!=dto.getCode() && scenesMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<Scenes> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq(Scenes.SCENES_NAME, dto.getScenesName());
|
||||
System.out.println(scenesMapper.selectCount(wrapper2));
|
||||
if(entity.getScenesName()!=dto.getScenesName() && scenesMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(scenesService.edit(dto));
|
||||
}
|
||||
scenesService.update(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.cnbm.packing.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
@ -11,11 +10,8 @@ import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.common.validator.group.UpdateGroup;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.WorkingTimeDTO;
|
||||
import com.cnbm.packing.entity.WorkingTime;
|
||||
import com.cnbm.packing.excel.WorkingTimeExcel;
|
||||
import com.cnbm.packing.mapper.WorkingTimeMapper;
|
||||
import com.cnbm.packing.service.WorkingTimeServiceBiz;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -45,8 +41,6 @@ import java.util.Map;
|
||||
public class WorkingTimeController {
|
||||
@Autowired
|
||||
private WorkingTimeServiceBiz workingTimeService;
|
||||
@Autowired
|
||||
private WorkingTimeMapper workingTimeMapper;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
@ -74,50 +68,25 @@ public class WorkingTimeController {
|
||||
@PostMapping
|
||||
@ApiOperation("保存")
|
||||
@LogOperation("保存")
|
||||
public Result<IdVo> save(@RequestBody WorkingTimeDTO dto){
|
||||
public Result<Long> save(@RequestBody WorkingTimeDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
QueryWrapper<WorkingTime> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(WorkingTime.CODE, dto.getCode());
|
||||
if(workingTimeMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<WorkingTime> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq(WorkingTime.ORDER_NAME, dto.getOrderName());
|
||||
if(workingTimeMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(workingTimeService.add(dto));
|
||||
}
|
||||
workingTimeService.save(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
@LogOperation("修改")
|
||||
public Result<IdVo> update(@RequestBody WorkingTimeDTO dto){
|
||||
public Result<Long> update(@RequestBody WorkingTimeDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
//验证编码是否重名
|
||||
WorkingTimeDTO entity = workingTimeService.get(dto.getId());
|
||||
QueryWrapper<WorkingTime> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq(WorkingTime.CODE, dto.getCode());
|
||||
if(entity.getCode()!=dto.getCode() && workingTimeMapper.selectCount(wrapper1)!= 0){
|
||||
return new Result().error(1,"编码重复");
|
||||
}
|
||||
//验证名称是否重名
|
||||
QueryWrapper<WorkingTime> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq( WorkingTime.ORDER_NAME, dto.getOrderName());
|
||||
if(entity.getOrderName()!=dto.getOrderName() && workingTimeMapper.selectCount(wrapper2)!= 0){
|
||||
return new Result().error(1,"名称重复");
|
||||
}
|
||||
else {
|
||||
return new Result<IdVo>().ok(workingTimeService.edit(dto));
|
||||
}
|
||||
workingTimeService.update(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
@ -2,7 +2,6 @@ package com.cnbm.packing.service;
|
||||
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.CrudService;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ProductLevelDTO;
|
||||
import com.cnbm.packing.entity.ProductLevel;
|
||||
|
||||
@ -29,7 +28,4 @@ public interface ProductLevelServiceBiz extends CrudService<ProductLevel, Produc
|
||||
|
||||
List<ProductLevelDTO> list();
|
||||
|
||||
IdVo add(ProductLevelDTO dto);
|
||||
|
||||
IdVo edit(ProductLevelDTO dto);
|
||||
}
|
@ -2,7 +2,6 @@ package com.cnbm.packing.service;
|
||||
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.CrudService;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ScenesDTO;
|
||||
import com.cnbm.packing.entity.Scenes;
|
||||
|
||||
@ -23,12 +22,8 @@ public interface ScenesServiceBiz extends CrudService<Scenes, ScenesDTO> {
|
||||
|
||||
void save(ScenesDTO dto);
|
||||
|
||||
IdVo add(ScenesDTO dto);
|
||||
|
||||
void update(ScenesDTO dto);
|
||||
|
||||
IdVo edit(ScenesDTO dto);
|
||||
|
||||
void delete(Long[] ids);
|
||||
|
||||
List<ScenesDTO> list();
|
||||
|
@ -2,7 +2,6 @@ package com.cnbm.packing.service;
|
||||
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.CrudService;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.WorkingTimeDTO;
|
||||
import com.cnbm.packing.dto.WorkingTimeDTO;
|
||||
import com.cnbm.packing.entity.WorkingTime;
|
||||
@ -32,8 +31,4 @@ public interface WorkingTimeServiceBiz extends CrudService<WorkingTime, WorkingT
|
||||
List<WorkingTimeDTO> list();
|
||||
|
||||
String getOrderName(LocalDateTime time);
|
||||
|
||||
IdVo add(WorkingTimeDTO dto);
|
||||
|
||||
IdVo edit(WorkingTimeDTO dto);
|
||||
}
|
@ -6,7 +6,6 @@ import com.cnbm.admin.utils.BaseSupportUtils;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
import com.cnbm.common.utils.ConvertUtils;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ProductLevelDTO;
|
||||
import com.cnbm.packing.entity.ProductLevel;
|
||||
import com.cnbm.packing.mapper.ProductLevelMapper;
|
||||
@ -65,16 +64,6 @@ public class ProductLevelServiceBizImpl extends CrudServiceImpl<ProductLevelMapp
|
||||
insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo add(ProductLevelDTO dto) {
|
||||
ProductLevel entity = ConvertUtils.sourceToTarget(dto, ProductLevel.class);
|
||||
BaseSupportUtils.setCommonField(entity);
|
||||
insert(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ProductLevelDTO dto) {
|
||||
@ -83,15 +72,6 @@ public class ProductLevelServiceBizImpl extends CrudServiceImpl<ProductLevelMapp
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo edit(ProductLevelDTO dto) {
|
||||
ProductLevel entity = ConvertUtils.sourceToTarget(dto, ProductLevel.class);
|
||||
BaseSupportUtils.setUpdateCommonField(entity);
|
||||
updateById(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long[] ids) {
|
||||
|
@ -6,7 +6,6 @@ import com.cnbm.admin.utils.BaseSupportUtils;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
import com.cnbm.common.utils.ConvertUtils;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.ScenesDTO;
|
||||
import com.cnbm.packing.entity.Scenes;
|
||||
import com.cnbm.packing.mapper.ScenesMapper;
|
||||
@ -87,22 +86,5 @@ public class ScenesServiceBizImpl extends CrudServiceImpl<ScenesMapper, Scenes,
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo add(ScenesDTO dto) {
|
||||
Scenes entity = ConvertUtils.sourceToTarget(dto, Scenes.class);
|
||||
BaseSupportUtils.setCommonField(entity);
|
||||
insert(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo edit(ScenesDTO dto) {
|
||||
Scenes entity = ConvertUtils.sourceToTarget(dto, Scenes.class);
|
||||
BaseSupportUtils.setUpdateCommonField(entity);
|
||||
updateById(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
|
||||
import com.cnbm.common.utils.ConvertUtils;
|
||||
import com.cnbm.packing.dto.IdVo;
|
||||
import com.cnbm.packing.dto.WorkingTimeDTO;
|
||||
import com.cnbm.packing.entity.WorkingTime;
|
||||
import com.cnbm.packing.mapper.WorkingTimeMapper;
|
||||
@ -73,17 +72,6 @@ public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper
|
||||
insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo add(WorkingTimeDTO dto) {
|
||||
//验证时间段不重合
|
||||
timeOverlap(dto);
|
||||
WorkingTime entity = ConvertUtils.sourceToTarget(dto, WorkingTime.class);
|
||||
BaseSupportUtils.setCommonField(entity);
|
||||
insert(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
public void timeOverlap(WorkingTimeDTO newTime){
|
||||
List<WorkingTimeDTO> dtoList = list();
|
||||
LocalTime newBeginTime = newTime.getBeginTime().toLocalTime();
|
||||
@ -127,18 +115,6 @@ public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public IdVo edit(WorkingTimeDTO dto) {
|
||||
//验证时间段不重合
|
||||
timeOverlap(dto);
|
||||
WorkingTime entity = ConvertUtils.sourceToTarget(dto, WorkingTime.class);
|
||||
BaseSupportUtils.setUpdateCommonField(entity);
|
||||
updateById(entity);
|
||||
return IdVo.builder().id(entity.getId()).build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long[] ids) {
|
||||
@ -178,4 +154,5 @@ public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,7 +18,6 @@
|
||||
|
||||
<select id="list" resultType="com.cnbm.packing.dto.ProductLevelDTO">
|
||||
select * from t_product_level
|
||||
where valid = 1
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
<select id="list" resultType="com.cnbm.packing.dto.ScenesDTO">
|
||||
select * from t_scenes
|
||||
where valid = 1
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
<select id="list" resultType="com.cnbm.packing.dto.WorkingTimeDTO">
|
||||
select * from t_working_time
|
||||
where valid = 1
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user