|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
package org.springblade.desk.device.controller; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import io.swagger.v3.oas.annotations.Parameters; |
|
|
|
|
import io.swagger.v3.oas.annotations.enums.ParameterIn; |
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema; |
|
|
|
|
@ -16,6 +18,7 @@ import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.device.pojo.entity.FeiBaSetEntity; |
|
|
|
|
import org.springblade.desk.device.pojo.excel.RecorderTypeExcel; |
|
|
|
|
import org.springblade.desk.device.wrapper.RecorderCompareWrapper; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
@ -32,6 +35,7 @@ import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
@ -81,6 +85,13 @@ public class RecorderTypeController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "新增", description = "传入recorderType") |
|
|
|
|
public R save(@Valid @RequestBody RecorderTypeEntity recorderType) { |
|
|
|
|
LambdaQueryWrapper<RecorderTypeEntity> wrapper = Wrappers.<RecorderTypeEntity>lambdaQuery() |
|
|
|
|
.eq(Objects.nonNull(recorderType.getCrtCode()), RecorderTypeEntity::getCrtCode, recorderType.getCrtCode()) |
|
|
|
|
.eq(RecorderTypeEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
|
|
|
|
RecorderTypeEntity one = recorderTypeService.getOne(wrapper); |
|
|
|
|
if (null != one && !Objects.equals(one.getId(), recorderType.getId())) { |
|
|
|
|
return R.fail("记录仪编码重复"); |
|
|
|
|
} |
|
|
|
|
return R.status(recorderTypeService.save(recorderType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -91,6 +102,13 @@ public class RecorderTypeController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@Operation(summary = "修改", description = "传入recorderType") |
|
|
|
|
public R update(@Valid @RequestBody RecorderTypeEntity recorderType) { |
|
|
|
|
LambdaQueryWrapper<RecorderTypeEntity> wrapper = Wrappers.<RecorderTypeEntity>lambdaQuery() |
|
|
|
|
.eq(Objects.nonNull(recorderType.getCrtCode()), RecorderTypeEntity::getCrtCode, recorderType.getCrtCode()) |
|
|
|
|
.eq(RecorderTypeEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
|
|
|
|
RecorderTypeEntity one = recorderTypeService.getOne(wrapper); |
|
|
|
|
if (null != one && !Objects.equals(one.getId(), recorderType.getId())) { |
|
|
|
|
return R.fail("记录仪编码重复"); |
|
|
|
|
} |
|
|
|
|
return R.status(recorderTypeService.updateById(recorderType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -101,6 +119,13 @@ public class RecorderTypeController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@Operation(summary = "新增或修改", description = "传入recorderType") |
|
|
|
|
public R submit(@Valid @RequestBody RecorderTypeEntity recorderType) { |
|
|
|
|
LambdaQueryWrapper<RecorderTypeEntity> wrapper = Wrappers.<RecorderTypeEntity>lambdaQuery() |
|
|
|
|
.eq(Objects.nonNull(recorderType.getCrtCode()), RecorderTypeEntity::getCrtCode, recorderType.getCrtCode()) |
|
|
|
|
.eq(RecorderTypeEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
|
|
|
|
RecorderTypeEntity one = recorderTypeService.getOne(wrapper); |
|
|
|
|
if (null != one && !Objects.equals(one.getId(), recorderType.getId())) { |
|
|
|
|
return R.fail("记录仪编码重复"); |
|
|
|
|
} |
|
|
|
|
return R.status(recorderTypeService.saveOrUpdate(recorderType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|