Commit 1dcac903 authored by duanruiming's avatar duanruiming

优化新增路口主键冲突校验

优化路口管理中参数功能
查询新的设备状态表
parent 356545a3
......@@ -12,7 +12,7 @@ import java.util.List;
* @date 2022/10/27 14:25
*/
@Repository
@DS("webService")
//@DS("webService") 查询新数据库20221228
public interface AllDeviceStatusMapper {
List<AllDeviceStatusPO> selectAllDeviceStatus(String adCode);
}
......@@ -16,6 +16,7 @@ import net.wanji.web.po.PageResultPO;
import net.wanji.web.util.IdWorker;
import net.wanji.web.vo.BaseCrossInfoVO;
import net.wanji.web.vo.CrossInfoVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -67,6 +69,12 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
* @return {@link Result}<{@link String}>
*/
public Result<String> addOne(BaseCrossInfoVO crossInfoPO) {
if (StringUtils.isNoneBlank(crossInfoPO.getId())) {
TBaseCrossInfo tBaseCrossInfo = crossInfoMapper.selectByPrimaryKey(crossInfoPO.getId());
if (Objects.nonNull(tBaseCrossInfo)) {
return Result.error("路口编号重复,请重新设置!");
}
}
TBaseCrossInfo record = getBaseCrossInfo(crossInfoPO);
record.setGmtCreate(new Date());
int insert = crossInfoMapper.insertSelective(record);
......@@ -168,7 +176,7 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
}
}
}
infos = infos.stream().filter(po -> po.getParentCode() == null || po.getParentCode().equals(100000)).collect(Collectors.toList());
infos = infos.stream().filter(po -> po.getParentCode() != null).collect(Collectors.toList());
return Result.success(infos);
}
}
......@@ -11,7 +11,7 @@
<select id="selectAllDeviceStatus" resultMap="BaseResultMap">
select type, status, count(*) as statusCount
from t_base_device_info
from t_device_status_log
group by type, status
order by type
</select>
......
......@@ -197,13 +197,13 @@
<if test="areaName != null and areaName != ''">
and a.name = #{areaName}
</if>
<if test="isSignal != null and isSignal != ''">
<if test="isSignal != null">
and c.is_signal = #{isSignal}
</if>
<if test="isStart != null and isStart != ''">
<if test="isStart != null">
and c.is_start = #{isStart}
</if>
<if test="isSend != null and isSend != ''">
<if test="isSend != null">
and c.is_send = #{isSend}
</if>
</where>
......@@ -225,13 +225,13 @@
<if test="areaName != null and areaName != ''">
and a.name = #{areaName}
</if>
<if test="isSignal != null and isSignal != ''">
<if test="isSignal != null">
and c.is_signal = #{isSignal}
</if>
<if test="isStart != null and isStart != ''">
<if test="isStart != null">
and c.is_start = #{isStart}
</if>
<if test="isSend != null and isSend != ''">
<if test="isSend != null">
and c.is_send = #{isSend}
</if>
</where>
......
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