Commit 1b959fb7 authored by fangxinjiang's avatar fangxinjiang

BUG修复

parent 61705ee2
......@@ -87,8 +87,8 @@ public class TMinSalaryController {
@SysLog("修改各地市最低工资标准")
@PutMapping
@PreAuthorize("@pms.hasPermission('wxhr:tminsalary_edit')")
public R update(@RequestBody TMinSalary tMinSalary) {
return new R<>(tMinSalaryService.updateById(tMinSalary));
public R<Boolean> update(@RequestBody TMinSalary tMinSalary) {
return tMinSalaryService.updateByIdDIy(tMinSalary);
}
/**
......
......@@ -24,4 +24,6 @@ public interface TMinSalaryService extends IService<TMinSalary> {
R<Boolean> saveDiy(TMinSalary tMinSalary);
R<Boolean> updateByIdDIy(TMinSalary tMinSalary);
}
......@@ -66,4 +66,38 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
return R.ok(true,CommonConstants.SAVE_SUCCESS);
}
@Override
public R<Boolean> updateByIdDIy(TMinSalary tMinSalary) {
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
return R.failed("获取登录用户信息失败!");
}
TMinSalary entity = baseMapper.selectById(tMinSalary.getId());
if (Common.isNotNull(entity)){
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(tMinSalary.getProvince())){
query.eq(TMinSalary::getProvince,tMinSalary.getProvince());
}
if (Common.isNotNull(tMinSalary.getCity())){
query.eq(TMinSalary::getCity,tMinSalary.getCity());
}
if (Common.isNotNull(tMinSalary.getTown())){
query.eq(TMinSalary::getTown,tMinSalary.getTown());
}
if (Common.isEmpty(tMinSalary.getTown())){
query.isNull(TMinSalary::getTown);
}
query.ne(TMinSalary::getId,tMinSalary.getId());
query.eq(TMinSalary::getStatus, CommonConstants.ONE_INT);
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT){
return R.failed("已存在对应区域在用的配置信息");
}
baseMapper.updateById(entity);
return R.ok(true,CommonConstants.UPDATE_SUCCESS);
}else {
return R.failed(false,CommonConstants.SAVE_FAILED);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment