This commit is contained in:
2026-03-24 17:52:36 +08:00
parent 1179d90955
commit 3471faf2fb
7 changed files with 42 additions and 11 deletions

View File

@ -1,6 +1,7 @@
package com.xjrsoft.module.inventory.controller;
import java.util.List;
import java.util.Objects;
import javax.validation.Valid;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import com.pictc.constant.FieldNameConstants;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
@ -96,6 +98,7 @@ public class LngInventoryInController {
@ApiOperation(value = "新增LngInventoryIn")
@SaCheckPermission("lngInventoryIn:add")
public R add(@Valid @RequestBody UpdateLngInventoryInDto dto){
checkParams(dto);
UpdateLngInventoryInDto res = dataService.insert(dto,new DataOperationListener<UpdateLngInventoryInDto>() {
@Override
@ -133,6 +136,7 @@ public class LngInventoryInController {
@ApiOperation(value = "修改LngInventoryIn")
@SaCheckPermission("lngInventoryIn:edit")
public R update(@Valid @RequestBody UpdateLngInventoryInDto dto){
checkParams(dto);
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngInventoryInDto>() {
@Override
@ -197,5 +201,18 @@ public class LngInventoryInController {
}
private void checkParams(UpdateLngInventoryInDto dto){
if(dto.getOpsId() != null) {
Long nameCount = lngInventoryInService.selectCount(new LambdaQueryWrapper<LngInventoryIn>()
.eq(LngInventoryIn::getOpsId, dto.getOpsId())
.ne(!Objects.isNull(dto.getId()), LngInventoryIn::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
"采购执行"));
}
}
}
}

View File

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xjrsoft.module.inventory.entity.LngInventoryOut;
import com.xjrsoft.module.inventory.vo.LngInventoryInVo;
import com.xjrsoft.module.inventory.vo.LngInventoryOutVo;
/**
@ -19,13 +18,13 @@ import com.xjrsoft.module.inventory.vo.LngInventoryOutVo;
public interface LngInventoryOutMapper extends BaseMapper<LngInventoryOut> {
@Select("SELECT io.*, sl.full_name AS staName ,"+
" k.k_name as kName , bc.full_name as cat_name,"+
" cu.cu_name as cuName ,NVL(com.short_name,com.name) AS com_name "+
@Select("SELECT io.*, sl.full_name AS sta_name ,"+
" k.k_name, bc.full_name as cat_name,"+
" cu.cu_name as cu_name ,NVL(com.short_name,com.name) AS com_name "+
" FROM lng_inventory_out io "+
" LEFT JOIN lng_contract k ON k.id=io.k_id"+
" LEFT JOIN lng_customer cu ON cu.cu_code=io.cu_code "+
" LEFT JOIN lng_b_category bc on bc.code=ii.cat_code "+
" LEFT JOIN lng_b_category bc on bc.code=io.cat_code "+
" LEFT JOIN lng_b_station_lng sl ON sl.code=io.sta_code "+
" LEFT JOIN xjr_department com ON com.id=io.com_id "+
" WHERE io.id = #{id}")

View File

@ -1,5 +1,6 @@
package com.xjrsoft.module.inventory.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.inventory.entity.LngInventoryIn;
import com.xjrsoft.module.inventory.vo.LngInventoryInVo;
@ -14,4 +15,6 @@ import com.xjrsoft.module.inventory.vo.LngInventoryInVo;
public interface ILngInventoryInService extends IService<LngInventoryIn> {
LngInventoryInVo getInfoById(Long id);
Long selectCount(LambdaQueryWrapper<LngInventoryIn> qw);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.enums.BusinessCode;
import com.xjrsoft.common.exception.BusinessException;
@ -38,4 +39,10 @@ public class LngInventoryInServiceImpl extends ServiceImpl<LngInventoryInMapper,
vo.setLngFileUploadList(fileList);
return vo;
}
@Override
public Long selectCount(LambdaQueryWrapper<LngInventoryIn> qw) {
return this.baseMapper.selectCount(qw);
}
}

View File

@ -35,7 +35,7 @@ public class LngInventoryOutServiceImpl extends ServiceImpl<LngInventoryOutMappe
if (vo == null) {
throw new BusinessException(BusinessCode.of(10500, "找不到此数据!"));
}
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_inventory_in", "lngFileUploadList", vo.getId());
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_inventory_out", "lngFileUploadList", vo.getId());
vo.setLngFileUploadList(fileList);
return vo;
}