基础管理调试
This commit is contained in:
parent
9385f88ae4
commit
3b608b044c
|
|
@ -71,5 +71,8 @@ public class TbBdDeviceRecord implements Serializable {
|
||||||
@Size(max = 128,message = "负责人电话-sm4加密最大长度要小于 128")
|
@Size(max = 128,message = "负责人电话-sm4加密最大长度要小于 128")
|
||||||
private String devUserPhone;
|
private String devUserPhone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="工程id")
|
||||||
|
private Long proId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
@ -27,9 +27,15 @@ public class TbDevice implements Serializable {
|
||||||
* 设备类型(码表)
|
* 设备类型(码表)
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="设备类型(码表)")
|
@ApiModelProperty(value="设备类型(码表)")
|
||||||
@Excel(name = "设备类型")
|
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(码表)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value="设备类型名称")
|
||||||
|
@Excel(name = "设备类型")
|
||||||
|
private String devTypeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备编码(唯一)
|
* 设备编码(唯一)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public interface TbBdDeviceRecordMapper {
|
||||||
|
|
||||||
int updateById(Long id);
|
int updateById(Long id);
|
||||||
|
|
||||||
TbBdDeviceRecord selectByName(TbBdDeviceRecord deviceRecord);
|
List<TbBdDeviceRecord> selectByName(TbBdDeviceRecord deviceRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 边带设备管理信息列表
|
* 边带设备管理信息列表
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package com.bonus.base.mapper;
|
package com.bonus.base.mapper;
|
||||||
|
|
||||||
import com.bonus.base.domain.TbBdDeviceRecord;
|
|
||||||
import com.bonus.base.domain.TbBdRecord;
|
import com.bonus.base.domain.TbBdRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public interface TbDeviceMapper {
|
||||||
* @param record
|
* @param record
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TbDevice selectByDevCode(TbDevice record);
|
List<TbDevice> selectByDevCode(TbDevice record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询
|
* 根据主键查询
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.bonus.base.service.impl;
|
package com.bonus.base.service.impl;
|
||||||
|
|
||||||
import com.bonus.base.vo.TbBdDeviceVo;
|
import com.bonus.base.vo.TbBdDeviceVo;
|
||||||
import com.bonus.base.vo.TbDeviceVo;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -73,7 +74,15 @@ public class TbBdDeviceRecordServiceImpl implements TbBdDeviceRecordService{
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TbBdDeviceVo> getDeviceList(TbBdDeviceVo tbBdDeviceVo) {
|
public List<TbBdDeviceVo> getDeviceList(TbBdDeviceVo tbBdDeviceVo) {
|
||||||
return tbBdDeviceRecordMapper.getDeviceList(tbBdDeviceVo);
|
List<TbBdDeviceVo> deviceList = tbBdDeviceRecordMapper.getDeviceList(tbBdDeviceVo);
|
||||||
|
if (deviceList != null && deviceList.size() > 0) {
|
||||||
|
for (TbBdDeviceVo bdDeviceVo : deviceList) {
|
||||||
|
if (StringUtils.isNotBlank(bdDeviceVo.getDevUserPhone())) {
|
||||||
|
bdDeviceVo.setDevUserPhone(Sm4Utils.decode(bdDeviceVo.getDevUserPhone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.bonus.base.domain.TbBdRecord;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.bonus.base.mapper.TbBdRecordMapper;
|
import com.bonus.base.mapper.TbBdRecordMapper;
|
||||||
|
|
@ -72,15 +73,16 @@ public class TbBdRecordServiceImpl implements TbBdRecordService{
|
||||||
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
||||||
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
||||||
deviceRecord.setRecordId(record.getId());
|
deviceRecord.setRecordId(record.getId());
|
||||||
|
deviceRecord.setProId(record.getProId());
|
||||||
if (StringUtils.isNotBlank(deviceRecord.getDevUserPhone())) {
|
if (StringUtils.isNotBlank(deviceRecord.getDevUserPhone())) {
|
||||||
deviceRecord.setDevUserPhone(Sm4Utils.encode(deviceRecord.getDevUserPhone()));
|
deviceRecord.setDevUserPhone(Sm4Utils.encode(deviceRecord.getDevUserPhone()));
|
||||||
}
|
}
|
||||||
//根据设备名称或编码唯一校验
|
//根据设备名称或编码唯一校验
|
||||||
TbBdDeviceRecord tbBdDeviceRecord = tbBdDeviceRecordMapper.selectByName(deviceRecord);
|
List<TbBdDeviceRecord> tbBdDeviceRecord = tbBdDeviceRecordMapper.selectByName(deviceRecord);
|
||||||
if (tbBdDeviceRecord != null) {
|
if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) {
|
||||||
return AjaxResult.error(tbBdDeviceRecord.getDevName() + "设备名称或编码重复,请勿重复添加");
|
return AjaxResult.error("设备名称或编码与库中重复,请勿重复添加");
|
||||||
}
|
}
|
||||||
result += tbBdDeviceRecordMapper.insert(deviceRecord);
|
result += tbBdDeviceRecordMapper.insertSelective(deviceRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
@ -120,10 +122,22 @@ public class TbBdRecordServiceImpl implements TbBdRecordService{
|
||||||
}
|
}
|
||||||
//校验内层设备名称或编码重复性
|
//校验内层设备名称或编码重复性
|
||||||
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
||||||
|
// 检查设备名称是否重复
|
||||||
|
long distinctNames = record.getRecordList().stream().map(TbBdDeviceRecord::getDevName).distinct().count();
|
||||||
|
if (distinctNames < record.getRecordList().size()) {
|
||||||
|
return AjaxResult.error("提交的数据中设备名称存在重复,请勿重复添加");
|
||||||
|
}
|
||||||
|
// 检查设备编码是否重复
|
||||||
|
long distinctCodes = record.getRecordList().stream().map(TbBdDeviceRecord::getDevCode).distinct().count();
|
||||||
|
if (distinctCodes < record.getRecordList().size()) {
|
||||||
|
return AjaxResult.error("提交的数据中设备编码存在重复,请勿重复添加");
|
||||||
|
}
|
||||||
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
||||||
TbBdDeviceRecord tbBdDeviceRecord = tbBdDeviceRecordMapper.selectByName(deviceRecord);
|
List<TbBdDeviceRecord> tbBdDeviceRecord = tbBdDeviceRecordMapper.selectByName(deviceRecord);
|
||||||
if (tbBdDeviceRecord != null && !tbBdDeviceRecord.getRecordId().equals(deviceRecord.getId())) {
|
if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) {
|
||||||
return AjaxResult.error(tbBdDeviceRecord.getDevName() + "设备名称或编码重复,请勿重复添加");
|
if (tbBdDeviceRecord.size() > 1) {
|
||||||
|
return AjaxResult.error("设备名称或编码与库中重复,请勿重复添加");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,10 +154,11 @@ public class TbBdRecordServiceImpl implements TbBdRecordService{
|
||||||
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
||||||
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
for (TbBdDeviceRecord deviceRecord : record.getRecordList()) {
|
||||||
deviceRecord.setRecordId(record.getId());
|
deviceRecord.setRecordId(record.getId());
|
||||||
|
deviceRecord.setProId(record.getProId());
|
||||||
if (StringUtils.isNotBlank(deviceRecord.getDevUserPhone())) {
|
if (StringUtils.isNotBlank(deviceRecord.getDevUserPhone())) {
|
||||||
deviceRecord.setDevUserPhone(Sm4Utils.encode(deviceRecord.getDevUserPhone()));
|
deviceRecord.setDevUserPhone(Sm4Utils.encode(deviceRecord.getDevUserPhone()));
|
||||||
}
|
}
|
||||||
result += tbBdDeviceRecordMapper.insert(deviceRecord);
|
result += tbBdDeviceRecordMapper.insertSelective(deviceRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.base.service.impl;
|
package com.bonus.base.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
import com.bonus.base.config.ExceptionEnum;
|
import com.bonus.base.config.ExceptionEnum;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -7,6 +8,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.bonus.base.mapper.TbDeviceMapper;
|
import com.bonus.base.mapper.TbDeviceMapper;
|
||||||
import com.bonus.base.domain.TbDevice;
|
import com.bonus.base.domain.TbDevice;
|
||||||
import com.bonus.base.service.TbDeviceService;
|
import com.bonus.base.service.TbDeviceService;
|
||||||
|
|
@ -32,10 +35,10 @@ public class TbDeviceServiceImpl implements TbDeviceService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult insertSelective(TbDevice record) {
|
public AjaxResult insertSelective(TbDevice record) {
|
||||||
//根据传入的devCode判重,确保唯一性
|
//根据传入的名称和编码判重,确保唯一性,同类型下名称或编码均不得重复
|
||||||
TbDevice tbDevice = tbDeviceMapper.selectByDevCode(record);
|
List<TbDevice> tbDevice = tbDeviceMapper.selectByDevCode(record);
|
||||||
if (tbDevice != null) {
|
if (CollectionUtils.isNotEmpty(tbDevice)) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), "设备编码与库中重复");
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), "设备名称或编码与库中重复");
|
||||||
}
|
}
|
||||||
int result = tbDeviceMapper.insertSelective(record);
|
int result = tbDeviceMapper.insertSelective(record);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
@ -51,10 +54,12 @@ public class TbDeviceServiceImpl implements TbDeviceService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult updateByPrimaryKeySelective(TbDevice record) {
|
public AjaxResult updateByPrimaryKeySelective(TbDevice record) {
|
||||||
//根据传入的devCode判重,确保唯一性
|
//根据传入的名称和编码判重,确保唯一性,同类型下名称或编码均不得重复
|
||||||
TbDevice tbDevice = tbDeviceMapper.selectByDevCode(record);
|
List<TbDevice> tbDevice = tbDeviceMapper.selectByDevCode(record);
|
||||||
if (tbDevice != null && !tbDevice.getId().equals(record.getId())) {
|
if (tbDevice != null) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), "设备编码与库中重复");
|
if (tbDevice.size() > 1) {
|
||||||
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), "设备名称或编码与库中重复");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int result = tbDeviceMapper.updateByPrimaryKeySelective(record);
|
int result = tbDeviceMapper.updateByPrimaryKeySelective(record);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import java.io.OutputStream;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,9 +155,11 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
||||||
}
|
}
|
||||||
//同名同身份证号判重
|
//同名同身份证号判重
|
||||||
TbPeople people = tbPeopleDao.queryByName(tbPeople);
|
TbPeople people = tbPeopleDao.queryByName(tbPeople);
|
||||||
if (people != null && !people.getId().equals(tbPeople.getId())) {
|
if (people != null) {
|
||||||
|
if (!Objects.equals(people.getId(), tbPeople.getId())) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tbPeople.setUpdateUser(SecurityUtils.getUserId());
|
tbPeople.setUpdateUser(SecurityUtils.getUserId());
|
||||||
tbPeople.setRelPhone(Sm4Utils.encode(tbPeople.getRelPhone()));
|
tbPeople.setRelPhone(Sm4Utils.encode(tbPeople.getRelPhone()));
|
||||||
int result = tbPeopleDao.update(tbPeople);
|
int result = tbPeopleDao.update(tbPeople);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import javax.annotation.Resource;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目部(TbProDepart)表服务实现类
|
* 项目部(TbProDepart)表服务实现类
|
||||||
|
|
@ -131,9 +132,11 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
||||||
}
|
}
|
||||||
//名称重复性校验,一个地区内不能重复
|
//名称重复性校验,一个地区内不能重复
|
||||||
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
||||||
if (depart != null && !depart.getId().equals(tbProDepart.getId())) {
|
if (depart != null) {
|
||||||
|
if (!Objects.equals(depart.getId(), tbProDepart.getId())) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (getObjectResultBean(tbProDepart)) {
|
if (getObjectResultBean(tbProDepart)) {
|
||||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import java.io.OutputStream;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工程杆塔表(TbProPower)表服务实现类
|
* 工程杆塔表(TbProPower)表服务实现类
|
||||||
|
|
@ -105,9 +106,11 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
||||||
}
|
}
|
||||||
//根据名称判重
|
//根据名称判重
|
||||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||||
if (power != null && !power.getId().equals(tbProPower.getId())) {
|
if (power != null) {
|
||||||
|
if (!Objects.equals(power.getId(), tbProPower.getId())) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int result = tbProPowerDao.update(tbProPower);
|
int result = tbProPowerDao.update(tbProPower);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success(ExceptionEnum.SUCCESS);
|
return AjaxResult.success(ExceptionEnum.SUCCESS);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import javax.annotation.Resource;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -100,9 +101,11 @@ public class TbProjectServiceImpl implements TbProjectService {
|
||||||
}
|
}
|
||||||
//工程名称判重
|
//工程名称判重
|
||||||
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
||||||
if (project != null && !project.getId().equals(tbProject.getId())) {
|
if (project != null) {
|
||||||
|
if (!Objects.equals(project.getId(), tbProject.getId())) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tbProject.setUpdateUser(SecurityUtils.getUserId());
|
tbProject.setUpdateUser(SecurityUtils.getUserId());
|
||||||
int result = tbProjectDao.update(tbProject);
|
int result = tbProjectDao.update(tbProject);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.bonus.base.mapper.TbWarnConfigMapper;
|
import com.bonus.base.mapper.TbWarnConfigMapper;
|
||||||
import com.bonus.base.service.TbWarnConfigService;
|
import com.bonus.base.service.TbWarnConfigService;
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,9 +75,11 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService{
|
||||||
}
|
}
|
||||||
//根据同类型,同名称规则判重
|
//根据同类型,同名称规则判重
|
||||||
TbWarnConfig tbWarnConfig = tbWarnConfigMapper.selectByName(record);
|
TbWarnConfig tbWarnConfig = tbWarnConfigMapper.selectByName(record);
|
||||||
if (tbWarnConfig != null && !tbWarnConfig.getId().equals(record.getId())) {
|
if (tbWarnConfig != null) {
|
||||||
|
if (!Objects.equals(tbWarnConfig.getId(), record.getId())) {
|
||||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
record.setUpdateUser(SecurityUtils.getUserId().intValue());
|
record.setUpdateUser(SecurityUtils.getUserId().intValue());
|
||||||
int result = tbWarnConfigMapper.updateByPrimaryKeySelective(record);
|
int result = tbWarnConfigMapper.updateByPrimaryKeySelective(record);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,15 @@
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into tb_bd_device_record (record_id, dev_name,
|
insert into tb_bd_device_record (record_id, dev_name,
|
||||||
dev_code, unit_name, area_name,
|
dev_code, unit_name, area_name,
|
||||||
dev_user, dev_user_phone)
|
dev_user, dev_user_phone, pro_id)
|
||||||
values (#{recordId,jdbcType=BIGINT}, #{devName,jdbcType=VARCHAR},
|
values (#{recordId,jdbcType=BIGINT}, #{devName,jdbcType=VARCHAR},
|
||||||
#{devCode,jdbcType=VARCHAR}, #{unitName,jdbcType=VARCHAR}, #{areaName,jdbcType=VARCHAR},
|
#{devCode,jdbcType=VARCHAR}, #{unitName,jdbcType=VARCHAR}, #{areaName,jdbcType=VARCHAR},
|
||||||
#{devUser,jdbcType=VARCHAR}, #{devUserPhone,jdbcType=VARCHAR})
|
#{devUser,jdbcType=VARCHAR}, #{devUserPhone,jdbcType=VARCHAR}, #{proId})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbBdDeviceRecord">
|
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbBdDeviceRecord">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into tb_bd_device_record
|
insert into tb_bd_device_record
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="recordId != null">
|
<if test="recordId != null">
|
||||||
record_id,
|
record_id,
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -68,34 +65,38 @@
|
||||||
<if test="devUserPhone != null and devUserPhone != ''">
|
<if test="devUserPhone != null and devUserPhone != ''">
|
||||||
dev_user_phone,
|
dev_user_phone,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="proId != null and proId != ''">
|
||||||
|
pro_id,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="recordId != null">
|
<if test="recordId != null">
|
||||||
#{recordId,jdbcType=BIGINT},
|
#{recordId},
|
||||||
</if>
|
</if>
|
||||||
<if test="devName != null and devName != ''">
|
<if test="devName != null and devName != ''">
|
||||||
#{devName,jdbcType=VARCHAR},
|
#{devName},
|
||||||
</if>
|
</if>
|
||||||
<if test="devCode != null and devCode != ''">
|
<if test="devCode != null and devCode != ''">
|
||||||
#{devCode,jdbcType=VARCHAR},
|
#{devCode},
|
||||||
</if>
|
</if>
|
||||||
<if test="unitName != null and unitName != ''">
|
<if test="unitName != null and unitName != ''">
|
||||||
#{unitName,jdbcType=VARCHAR},
|
#{unitName},
|
||||||
</if>
|
</if>
|
||||||
<if test="areaName != null and areaName != ''">
|
<if test="areaName != null and areaName != ''">
|
||||||
#{areaName,jdbcType=VARCHAR},
|
#{areaName},
|
||||||
</if>
|
</if>
|
||||||
<if test="devUser != null and devUser != ''">
|
<if test="devUser != null and devUser != ''">
|
||||||
#{devUser,jdbcType=VARCHAR},
|
#{devUser},
|
||||||
</if>
|
</if>
|
||||||
<if test="devUserPhone != null and devUserPhone != ''">
|
<if test="devUserPhone != null and devUserPhone != ''">
|
||||||
#{devUserPhone,jdbcType=VARCHAR},
|
#{devUserPhone},
|
||||||
|
</if>
|
||||||
|
<if test="proId != null and proId != ''">
|
||||||
|
#{proId},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbBdDeviceRecord">
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbBdDeviceRecord">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
update tb_bd_device_record
|
update tb_bd_device_record
|
||||||
|
|
@ -213,11 +214,18 @@
|
||||||
from tb_bd_device_record
|
from tb_bd_device_record
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="devName != null and devName != ''">
|
<if test="devName != null and devName != ''">
|
||||||
|
<if test="devCode != null and devCode != ''">
|
||||||
|
and (dev_name = #{devName} or dev_code = #{devCode})
|
||||||
|
</if>
|
||||||
|
<if test="devCode == null or devCode == ''">
|
||||||
and dev_name = #{devName}
|
and dev_name = #{devName}
|
||||||
</if>
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="devName == null or devName == ''">
|
||||||
<if test="devCode != null and devCode != ''">
|
<if test="devCode != null and devCode != ''">
|
||||||
and dev_code = #{devCode}
|
and dev_code = #{devCode}
|
||||||
</if>
|
</if>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeviceList" resultType="com.bonus.base.vo.TbBdDeviceVo">
|
<select id="getDeviceList" resultType="com.bonus.base.vo.TbBdDeviceVo">
|
||||||
|
|
|
||||||
|
|
@ -55,21 +55,21 @@
|
||||||
<if test="auditStatus != null and auditStatus != ''">
|
<if test="auditStatus != null and auditStatus != ''">
|
||||||
and tbr.audit_status = #{auditStatus}
|
and tbr.audit_status = #{auditStatus}
|
||||||
</if>
|
</if>
|
||||||
|
GROUP BY tbr.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByName" resultType="com.bonus.base.domain.TbBdRecord">
|
<select id="selectByName" resultType="com.bonus.base.domain.TbBdRecord">
|
||||||
select
|
select
|
||||||
tbr.id as id, tbr.depart_id as departId, tbr.depart_name as departName, tbr.pro_id as proId, tbr.pro_name as
|
id as id, depart_id as departId, depart_name as departName, pro_id as proId, pro_name as
|
||||||
proName, tbr.rel_user as relUser, tbr.rel_phone as relPhone, tbr.create_time as createTime,
|
proName, rel_user as relUser, rel_phone as relPhone, create_time as createTime,
|
||||||
tbr.audit_status as auditStatus,tbr.remarks as remarks, tbr.audit_user as auditUser, tbr.audit_time as auditTime
|
audit_status as auditStatus,remarks as remarks, audit_user as auditUser, audit_time as auditTime
|
||||||
from tb_bd_record tbr
|
from tb_bd_record
|
||||||
left join tb_bd_device_record tbd on tbd.record_id = tbr.id
|
|
||||||
where del_flag = 0
|
where del_flag = 0
|
||||||
<if test="departId != null">
|
<if test="departId != null">
|
||||||
and tbr.depart_id = #{departId}
|
and depart_id = #{departId}
|
||||||
</if>
|
</if>
|
||||||
<if test="proId != null">
|
<if test="proId != null">
|
||||||
and tbr.pro_id = #{proId}
|
and pro_id = #{proId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@
|
||||||
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
||||||
<result column="logo_url" jdbcType="VARCHAR" property="logoUrl" />
|
<result column="logo_url" jdbcType="VARCHAR" property="logoUrl" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, dev_type, dev_code, dev_name, bd_id, config_id, dev_status, dev_warn, del_flag,
|
id, dev_type, dev_code, dev_name, bd_id, config_id, dev_status, dev_warn, del_flag,
|
||||||
logo_url
|
logo_url
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
select
|
select
|
||||||
|
|
@ -27,10 +29,12 @@
|
||||||
from tb_device
|
from tb_device
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
update tb_device set del_flag = 1
|
update tb_device set del_flag = 1
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.bonus.base.domain.TbDevice">
|
<insert id="insert" parameterType="com.bonus.base.domain.TbDevice">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into tb_device (id, dev_type, dev_code,
|
insert into tb_device (id, dev_type, dev_code,
|
||||||
|
|
@ -106,6 +110,7 @@
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbDevice">
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbDevice">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
update tb_device
|
update tb_device
|
||||||
|
|
@ -140,6 +145,7 @@
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.TbDevice">
|
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.TbDevice">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
update tb_device
|
update tb_device
|
||||||
|
|
@ -154,16 +160,7 @@
|
||||||
logo_url = #{logoUrl,jdbcType=VARCHAR}
|
logo_url = #{logoUrl,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
<select id="getAll" resultMap="BaseResultMap">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List"/>
|
|
||||||
from tb_device
|
|
||||||
where del_flag = 0
|
|
||||||
</select>
|
|
||||||
<select id="selectByDevCode" resultType="com.bonus.base.domain.TbDevice">
|
|
||||||
select * from tb_device where dev_code = #{devCode}
|
|
||||||
</select>
|
|
||||||
<update id="updateBatch" parameterType="java.util.List">
|
<update id="updateBatch" parameterType="java.util.List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
update tb_device
|
update tb_device
|
||||||
|
|
@ -245,4 +242,71 @@
|
||||||
from tb_device
|
from tb_device
|
||||||
where del_flag = 0
|
where del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAll" resultType="com.bonus.base.domain.TbDevice">
|
||||||
|
SELECT
|
||||||
|
td.id as id,
|
||||||
|
td.dev_type as devType,
|
||||||
|
sda.dict_label as devTypeName,
|
||||||
|
td.dev_code as devCode,
|
||||||
|
td.dev_name as devName,
|
||||||
|
td.bd_id as bdId,
|
||||||
|
t1.dev_name as bdName,
|
||||||
|
td.config_id as configId,
|
||||||
|
t2.config_name as configName,
|
||||||
|
td.dev_status as devStatus,
|
||||||
|
CASE
|
||||||
|
WHEN td.dev_status = 0 THEN
|
||||||
|
'离线'
|
||||||
|
WHEN td.dev_status = 1 THEN
|
||||||
|
'在线'
|
||||||
|
ELSE
|
||||||
|
'未知状态'
|
||||||
|
END devStatusName,
|
||||||
|
td.dev_warn as devWarn,
|
||||||
|
td.del_flag as delFlag,
|
||||||
|
td.logo_url as logoUrl
|
||||||
|
FROM
|
||||||
|
tb_device td
|
||||||
|
LEFT JOIN sys_dict_data sda ON td.dev_type = sda.dict_code
|
||||||
|
LEFT JOIN tb_bd_device_record t1 on td.bd_id = t1.id
|
||||||
|
LEFT JOIN tb_warn_config t2 on t2.id = td.config_id and t2.del_flag = 0
|
||||||
|
WHERE
|
||||||
|
td.del_flag = 0
|
||||||
|
<if test="devType != null and devType != ''">
|
||||||
|
and td.dev_type = #{devType}
|
||||||
|
</if>
|
||||||
|
<if test="devName != null and devName != ''">
|
||||||
|
and td.dev_name like concat('%',#{devName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="devCode != null and devCode != ''">
|
||||||
|
and td.dev_code like concat('%',#{devCode},'%')
|
||||||
|
</if>
|
||||||
|
<if test="devStatus != null and devStatus != ''">
|
||||||
|
and td.dev_status = #{devStatus}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByDevCode" resultType="com.bonus.base.domain.TbDevice">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from tb_device
|
||||||
|
where 1=1
|
||||||
|
<if test="devName != null and devName != ''">
|
||||||
|
<if test="devCode != null and devCode != ''">
|
||||||
|
and (dev_name = #{devName} or dev_code = #{devCode})
|
||||||
|
</if>
|
||||||
|
<if test="devCode == null or devCode == ''">
|
||||||
|
and dev_name = #{devName}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="devName == null or devName == ''">
|
||||||
|
<if test="devCode != null and devCode != ''">
|
||||||
|
and dev_code = #{devCode}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="devType != null and devType != ''">
|
||||||
|
and dev_type = #{devType}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue