供应商增加名称唯一校验
This commit is contained in:
parent
4d0cc2b85e
commit
66855a182b
|
|
@ -24,4 +24,6 @@ public interface ISuppliersApi {
|
||||||
SuppliersApplyEntity getSupInfoByOpenId(String openId);
|
SuppliersApplyEntity getSupInfoByOpenId(String openId);
|
||||||
|
|
||||||
IPage<SuppliersOrgAllEntity> getSuppliersAuditLog(Integer pageNo, Integer pageSize, String openId);
|
IPage<SuppliersOrgAllEntity> getSuppliersAuditLog(Integer pageNo, Integer pageSize, String openId);
|
||||||
|
|
||||||
|
boolean nameDuplicateChecked(String suppliersName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -197,4 +198,16 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nameDuplicateChecked(String suppliersName) {
|
||||||
|
QueryWrapper<NuBizSuppliersApply> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("suppliers_name",suppliersName);
|
||||||
|
List<NuBizSuppliersApply> nuBizSuppliersApplies = baseMapper.selectList(queryWrapper);
|
||||||
|
if(CollectionUtils.isEmpty(nuBizSuppliersApplies)){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ public class SuppliersApi {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/addSuppliers")
|
@PostMapping(value = "/addSuppliers")
|
||||||
public Result<Object> addSuppliers(@RequestBody SuppliersApplyEntity suppliersApplyEntity) {
|
public Result<Object> addSuppliers(@RequestBody SuppliersApplyEntity suppliersApplyEntity) {
|
||||||
|
if(!suppliersApi.nameDuplicateChecked(suppliersApplyEntity.getSuppliersName())){
|
||||||
|
return Result.error("供应商名称重复");
|
||||||
|
}
|
||||||
SuppliersApplyEntity suppliersApplyEntity1 = suppliersApi.addSuppliers(suppliersApplyEntity);
|
SuppliersApplyEntity suppliersApplyEntity1 = suppliersApi.addSuppliers(suppliersApplyEntity);
|
||||||
return Result.OK(suppliersApplyEntity);
|
return Result.OK(suppliersApplyEntity);
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +46,9 @@ public class SuppliersApi {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/editSuppliers")
|
@PostMapping(value = "/editSuppliers")
|
||||||
public Result<Object> editSuppliers(@RequestBody SuppliersApplyEntity suppliersApplyEntity) {
|
public Result<Object> editSuppliers(@RequestBody SuppliersApplyEntity suppliersApplyEntity) {
|
||||||
|
if(!suppliersApi.nameDuplicateChecked(suppliersApplyEntity.getSuppliersName())){
|
||||||
|
return Result.error("供应商名称重复");
|
||||||
|
}
|
||||||
SuppliersApplyEntity suppliersApplyEntity1 = suppliersApi.editSuppliers(suppliersApplyEntity);
|
SuppliersApplyEntity suppliersApplyEntity1 = suppliersApi.editSuppliers(suppliersApplyEntity);
|
||||||
return Result.OK(suppliersApplyEntity);
|
return Result.OK(suppliersApplyEntity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue