This commit is contained in:
caixiang 2023-03-01 12:05:27 +08:00
commit 41207394e5
6 changed files with 42 additions and 11 deletions

View File

@ -10,6 +10,7 @@ import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup; import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.excel.WoPackagingBoxExcel; import com.cnbm.packing.excel.WoPackagingBoxExcel;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
@ -75,13 +76,11 @@ public class WoPackagingBoxController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:save')") @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:save')")
public Result<Long> save(@RequestBody WoPackagingBoxDTO dto){ public IdVo save(@RequestBody WoPackagingBoxDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
woPackagingBoxService.save(dto); return woPackagingBoxService.add(dto);
return new Result<Long>().ok(dto.getId());
} }
@PutMapping @PutMapping

View File

@ -171,7 +171,7 @@ public class WoPackagingBoxSubstrateController {
boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), WoPackagingBox.BOX_NO, packagingBoxId); boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), WoPackagingBox.BOX_NO, packagingBoxId);
WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0); WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0);
if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel()==box.getPowerLevel()) ) if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel().equals(box.getPowerLevel())) )
{ {
dto.setId(substrate.getId()); dto.setId(substrate.getId());
woPackagingBoxSubstrateService.insertSubstrate(dto); woPackagingBoxSubstrateService.insertSubstrate(dto);

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 主键对象
*
* @author jiff
* @date 2018/11/7
* @since 1.0
*/
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Data
@Builder
@ApiModel("主键视图对象")
public class IdVo {
@ApiModelProperty(value = "主键", required = true, example = "1", notes = "根据实际接口返回不同对象的主键")
private Long id;
}

View File

@ -2,7 +2,7 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
@ -21,7 +21,7 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
WoPackagingBoxDTO get(Long id); WoPackagingBoxDTO get(Long id);
void save(WoPackagingBoxDTO dto); IdVo add(WoPackagingBoxDTO dto);
void update(WoPackagingBoxDTO dto); void update(WoPackagingBoxDTO dto);

View File

@ -40,7 +40,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
wrapper.like(StringUtils.isNotBlank(name), PrintModel.NAME, name); wrapper.like(StringUtils.isNotBlank(name), PrintModel.NAME, name);
if(params.get("type")!=null) { if(params.get("type")!=null) {
Integer type = Integer.parseInt(params.get("type").toString()); Integer type = Integer.parseInt(params.get("type").toString());
wrapper.eq(ObjectUtils.isNotNull(type), PrintModel.LINE_BODY, type); wrapper.eq(ObjectUtils.isNotNull(type), PrintModel.TYPE, type);
} }
if(params.get("lineBody")!=null) { if(params.get("lineBody")!=null) {
Integer lineBody = Integer.parseInt(params.get("lineBody").toString()); Integer lineBody = Integer.parseInt(params.get("lineBody").toString());

View File

@ -6,11 +6,10 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxMapper; import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
@ -81,9 +80,10 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(WoPackagingBoxDTO dto) { public IdVo add(WoPackagingBoxDTO dto) {
WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class); WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
insert(entity); insert(entity);
return IdVo.builder().id(entity.getId()).build();
} }
@Override @Override