大屏与收银机
This commit is contained in:
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.cashregisterinfo.CashRegisterInfoDO;
|
||||
import cn.iocoder.yudao.module.system.service.cashregisterinfo.CashRegisterInfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 收银机信息关联门店")
|
||||
@RestController
|
||||
@RequestMapping("/t/cash-register-info")
|
||||
@Validated
|
||||
public class CashRegisterInfoController {
|
||||
|
||||
@Resource
|
||||
private CashRegisterInfoService cashRegisterInfoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建收银机信息关联门店")
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:create')")
|
||||
public CommonResult<Long> createCashRegisterInfo(@Valid @RequestBody CashRegisterInfoSaveReqVO createReqVO) {
|
||||
return success(cashRegisterInfoService.createCashRegisterInfo(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新收银机信息关联门店")
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:update')")
|
||||
public CommonResult<Boolean> updateCashRegisterInfo(@Valid @RequestBody CashRegisterInfoSaveReqVO updateReqVO) {
|
||||
cashRegisterInfoService.updateCashRegisterInfo(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除收银机信息关联门店")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:delete')")
|
||||
public CommonResult<Boolean> deleteCashRegisterInfo(@RequestParam("id") Long id) {
|
||||
cashRegisterInfoService.deleteCashRegisterInfo(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得收银机信息关联门店")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:query')")
|
||||
public CommonResult<CashRegisterInfoRespVO> getCashRegisterInfo(@RequestParam("id") Long id) {
|
||||
CashRegisterInfoDO cashRegisterInfo = cashRegisterInfoService.getCashRegisterInfo(id);
|
||||
return success(BeanUtils.toBean(cashRegisterInfo, CashRegisterInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得收银机信息关联门店分页")
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:query')")
|
||||
public CommonResult<PageResult<CashRegisterInfoRespVO>> getCashRegisterInfoPage(@Valid CashRegisterInfoPageReqVO pageReqVO) {
|
||||
PageResult<CashRegisterInfoDO> pageResult = cashRegisterInfoService.getCashRegisterInfoPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CashRegisterInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出收银机信息关联门店 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('t:cash-register-info:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCashRegisterInfoExcel(@Valid CashRegisterInfoPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CashRegisterInfoDO> list = cashRegisterInfoService.getCashRegisterInfoPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "收银机信息关联门店.xls", "数据", CashRegisterInfoRespVO.class,
|
||||
BeanUtils.toBean(list, CashRegisterInfoRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 收银机信息关联门店分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CashRegisterInfoPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "设备码")
|
||||
private String equipmentCode;
|
||||
|
||||
@Schema(description = "门店编号", example = "21460")
|
||||
private Long carteenId;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "激活码")
|
||||
private String activationCode;
|
||||
|
||||
@Schema(description = "应用标识", example = "30074")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "密钥")
|
||||
private String sdkKey;
|
||||
|
||||
@Schema(description = "设备在线")
|
||||
private String alive;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 收银机信息关联门店 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CashRegisterInfoRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20675")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备码")
|
||||
@ExcelProperty("设备码")
|
||||
private String equipmentCode;
|
||||
|
||||
@Schema(description = "门店编号", example = "21460")
|
||||
@ExcelProperty("门店编号")
|
||||
private Long carteenId;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
@ExcelProperty("设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "激活码")
|
||||
@ExcelProperty("激活码")
|
||||
private String activationCode;
|
||||
|
||||
@Schema(description = "应用标识", example = "30074")
|
||||
@ExcelProperty("应用标识")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "密钥")
|
||||
@ExcelProperty("密钥")
|
||||
private String sdkKey;
|
||||
|
||||
@Schema(description = "设备在线")
|
||||
@ExcelProperty("设备在线")
|
||||
private String alive;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 收银机信息关联门店新增/修改 Request VO")
|
||||
@Data
|
||||
public class CashRegisterInfoSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20675")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备码")
|
||||
private String equipmentCode;
|
||||
|
||||
@Schema(description = "门店编号", example = "21460")
|
||||
private Long carteenId;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "激活码")
|
||||
private String activationCode;
|
||||
|
||||
@Schema(description = "应用标识", example = "30074")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "密钥")
|
||||
private String sdkKey;
|
||||
|
||||
@Schema(description = "设备在线")
|
||||
private String alive;
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.cashregisterinfo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 收银机信息关联门店 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("t_cash_register_info")
|
||||
@KeySequence("t_cash_register_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CashRegisterInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 设备码
|
||||
*/
|
||||
private String equipmentCode;
|
||||
/**
|
||||
* 门店编号
|
||||
*/
|
||||
private Long carteenId;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
/**
|
||||
* 激活码
|
||||
*/
|
||||
private String activationCode;
|
||||
/**
|
||||
* 应用标识
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
private String sdkKey;
|
||||
/**
|
||||
* 设备在线
|
||||
*/
|
||||
private String alive;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.cashregisterinfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoPageReqVO;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.cashregisterinfo.CashRegisterInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 收银机信息关联门店 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface CashRegisterInfoMapper extends BaseMapperX<CashRegisterInfoDO> {
|
||||
|
||||
default PageResult<CashRegisterInfoDO> selectPage(CashRegisterInfoPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CashRegisterInfoDO>()
|
||||
.eqIfPresent(CashRegisterInfoDO::getEquipmentCode, reqVO.getEquipmentCode())
|
||||
.eqIfPresent(CashRegisterInfoDO::getCarteenId, reqVO.getCarteenId())
|
||||
.likeIfPresent(CashRegisterInfoDO::getDeviceName, reqVO.getDeviceName())
|
||||
.eqIfPresent(CashRegisterInfoDO::getActivationCode, reqVO.getActivationCode())
|
||||
.eqIfPresent(CashRegisterInfoDO::getAppId, reqVO.getAppId())
|
||||
.eqIfPresent(CashRegisterInfoDO::getSdkKey, reqVO.getSdkKey())
|
||||
.eqIfPresent(CashRegisterInfoDO::getAlive, reqVO.getAlive())
|
||||
.betweenIfPresent(CashRegisterInfoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CashRegisterInfoDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.system.service.cashregisterinfo;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.cashregisterinfo.CashRegisterInfoDO;
|
||||
|
||||
/**
|
||||
* 收银机信息关联门店 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface CashRegisterInfoService {
|
||||
|
||||
/**
|
||||
* 创建收银机信息关联门店
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createCashRegisterInfo(@Valid CashRegisterInfoSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新收银机信息关联门店
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCashRegisterInfo(@Valid CashRegisterInfoSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除收银机信息关联门店
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteCashRegisterInfo(Long id);
|
||||
|
||||
/**
|
||||
* 获得收银机信息关联门店
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 收银机信息关联门店
|
||||
*/
|
||||
CashRegisterInfoDO getCashRegisterInfo(Long id);
|
||||
|
||||
/**
|
||||
* 获得收银机信息关联门店分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 收银机信息关联门店分页
|
||||
*/
|
||||
PageResult<CashRegisterInfoDO> getCashRegisterInfoPage(CashRegisterInfoPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.system.service.cashregisterinfo;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.cashregisterinfo.vo.CashRegisterInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.cashregisterinfo.CashRegisterInfoDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.deviceInfo.DeviceInfoDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.cashregisterinfo.CashRegisterInfoMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.CASH_REGISTER_INFO_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 收银机信息关联门店 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CashRegisterInfoServiceImpl implements CashRegisterInfoService {
|
||||
|
||||
@Resource
|
||||
private CashRegisterInfoMapper cashRegisterInfoMapper;
|
||||
|
||||
@Override
|
||||
public Long createCashRegisterInfo(CashRegisterInfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CashRegisterInfoDO cashRegisterInfo = BeanUtils.toBean(createReqVO, CashRegisterInfoDO.class);
|
||||
List<CashRegisterInfoDO> cashRegisterInfoDOS = cashRegisterInfoMapper.selectList(new LambdaQueryWrapper<CashRegisterInfoDO>()
|
||||
.eq(CashRegisterInfoDO::getEquipmentCode, createReqVO.getEquipmentCode()));
|
||||
if (CollectionUtil.isNotEmpty(cashRegisterInfoDOS)){
|
||||
throw exception(ErrorCodeConstants.CASH_REGISTER_INFO_EXISTS);
|
||||
}
|
||||
cashRegisterInfoMapper.insert(cashRegisterInfo);
|
||||
// 返回
|
||||
return cashRegisterInfo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCashRegisterInfo(CashRegisterInfoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCashRegisterInfoExists(updateReqVO.getId());
|
||||
List<CashRegisterInfoDO> cashRegisterInfoDOS = cashRegisterInfoMapper.selectList(new LambdaQueryWrapper<CashRegisterInfoDO>()
|
||||
.eq(CashRegisterInfoDO::getEquipmentCode, updateReqVO.getEquipmentCode())
|
||||
.ne(CashRegisterInfoDO::getId, updateReqVO.getId()));
|
||||
if (CollectionUtil.isNotEmpty(cashRegisterInfoDOS)){
|
||||
throw exception(ErrorCodeConstants.CASH_REGISTER_INFO_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
CashRegisterInfoDO updateObj = BeanUtils.toBean(updateReqVO, CashRegisterInfoDO.class);
|
||||
cashRegisterInfoMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCashRegisterInfo(Long id) {
|
||||
// 校验存在
|
||||
validateCashRegisterInfoExists(id);
|
||||
// 删除
|
||||
cashRegisterInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCashRegisterInfoExists(Long id) {
|
||||
if (cashRegisterInfoMapper.selectById(id) == null) {
|
||||
throw exception(CASH_REGISTER_INFO_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CashRegisterInfoDO getCashRegisterInfo(Long id) {
|
||||
return cashRegisterInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CashRegisterInfoDO> getCashRegisterInfoPage(CashRegisterInfoPageReqVO pageReqVO) {
|
||||
return cashRegisterInfoMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -64,6 +64,12 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
|
||||
public void updateDeviceInfo(DeviceInfoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeviceInfoExists(updateReqVO.getId());
|
||||
List<DeviceInfoDO> deviceInfoDOS = deviceInfoMapper.selectList(new LambdaQueryWrapper<DeviceInfoDO>()
|
||||
.eq(DeviceInfoDO::getDeviceIp, updateReqVO.getDeviceIp())
|
||||
.ne(DeviceInfoDO::getId, updateReqVO.getId()));
|
||||
if (CollectionUtil.isNotEmpty(deviceInfoDOS)){
|
||||
throw exception(ErrorCodeConstants.DEVUCE_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
DeviceInfoDO updateObj = BeanUtils.toBean(updateReqVO, DeviceInfoDO.class);
|
||||
deviceInfoMapper.updateById(updateObj);
|
||||
|
@ -290,7 +290,7 @@ public class DevuceServiceImpl implements DevuceService {
|
||||
List<DevuceDO> devuceDOS = devuceMapper.selectList(Wrappers.<DevuceDO>lambdaQuery()
|
||||
.eq(DevuceDO::getDeviceSn, hearder)
|
||||
.eq(DevuceDO::getBind, true));
|
||||
if(CollectionUtil.isEmpty(devuceDOS)){
|
||||
if(CollectionUtil.isNotEmpty(devuceDOS)){
|
||||
DevuceDO devuceDO = devuceDOS.get(0);
|
||||
devuceDO.setTotalWeight(devuceDO.getTotalWeight().add(addWeight));
|
||||
devuceDO.setRemWeight(devuceDO.getRemWeight().add(addWeight));
|
||||
|
@ -53,6 +53,13 @@ public class FaceDeviceInfoServiceImpl implements FaceDeviceInfoService {
|
||||
public void updateFaceDeviceInfo(FaceDeviceInfoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFaceDeviceInfoExists(updateReqVO.getId());
|
||||
|
||||
List<FaceDeviceInfoDO> faceDeviceInfoDOS = faceDeviceInfoMapper.selectList(new LambdaQueryWrapper<FaceDeviceInfoDO>()
|
||||
.eq(FaceDeviceInfoDO::getMac, updateReqVO.getMac())
|
||||
.ne(FaceDeviceInfoDO::getId, updateReqVO.getId()));
|
||||
if (CollectionUtil.isNotEmpty(faceDeviceInfoDOS)){
|
||||
throw exception(FACE_DEVICE_INFO_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
FaceDeviceInfoDO updateObj = BeanUtils.toBean(updateReqVO, FaceDeviceInfoDO.class);
|
||||
faceDeviceInfoMapper.updateById(updateObj);
|
||||
|
Reference in New Issue
Block a user