#20230510 欣影管理平台装置信息查询代码

jni
18616268358 2 years ago
parent 3d351405cc
commit 34019e52fe

@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "通道对象", description = "通道对象描述")
@ApiModel(value = "添加通道对象", description = "添加通道对象描述")
public class TerminalChannelVo {
@NotNull(message = "装置列表不能缺少")

@ -5,6 +5,8 @@ import com.shxy.xymanager_common.dto.TermChannelAndMapperDto;
import com.shxy.xymanager_common.entity.TerminalChannels;
import com.shxy.xymanager_common.entity.TerminalScheduleMapper;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.vo.TerminalChannelVo;
import com.shxy.xymanager_common.vo.UpdateTerminalChannelVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@ -32,4 +34,8 @@ public interface TerminalChannelsDao {
int deleteList(@Param("list") List<TerminalChannels> list,@Param("status") Integer status,@Param("updateat") Date update);
int selectChannelCount(List<TerminalChannelVo.ChannelItem> list);
int selectChannelCountById(UpdateTerminalChannelVo vo);
}

@ -60,6 +60,29 @@
where status = #{status}
</select>
<select id="selectChannelCount" parameterType="com.shxy.xymanager_common.vo.TerminalChannelVo" resultType="java.lang.Integer">
select
count(1)
from terminal_channels
where
id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach> or
channel_name in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.channelname}
</foreach>
</select>
<select id="selectChannelCountById" parameterType="com.shxy.xymanager_common.vo.UpdateTerminalChannelVo" resultType="java.lang.Integer">
select
count(1)
from terminal_channels
where
id = #{id} and channel_name = #{channelname}
</select>
<select id="selectAllChannelList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
@ -81,7 +104,7 @@
<if test="termid != null">
and x.term_id = #{termid}
</if>
order by x.create_time desc
order by x.create_time asc
</select>
<select id="selectAllAndChannelByTermid" resultMap="LineAndTerminalMap">
SELECT

@ -3,6 +3,7 @@ package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.DyLineAndTerminalAndChannelDto;
@ -22,8 +23,11 @@ import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_service.service.TerminalChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -51,7 +55,13 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
public ServiceBody<String> addChannelList(TerminalChannelVo vo) {
List<TerminalChannels> list = BeanUtil.copyToList(vo.getList(), TerminalChannels.class, CopyOptions.create().ignoreCase());
Date date = new Date();
int count = terminalChannelsDao.selectChannelCount(vo.getList());
if(count>0){
return Asserts.success("通道重复");
}
int i = terminalChannelsDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
if (i != 0) {
return Asserts.success("录入成功");
} else {
@ -67,6 +77,10 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
*/
@Override
public ServiceBody<String> updateChannelList(UpdateTerminalChannelVo vo) {
int count = terminalChannelsDao.selectChannelCountById(vo);
if(count>0){
return Asserts.success("通道重复");
}
TerminalChannels bean = new TerminalChannels();
BeanUtil.copyProperties(vo, bean, CopyOptions.create().ignoreCase());
int i = terminalChannelsDao.updateByPrimaryKeySelective(bean, new Date());
@ -154,6 +168,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
public ServiceBody<TerminalChannelMapperListModel> getChannelByTermid(TerminalIdVo vo) {
TerminalChannelMapperListModel model = new TerminalChannelMapperListModel();
List<TermChannelAndMapperDto> list = terminalChannelsDao.selectByTermid(vo.getTermid(), CommonStatus.EFFECTIVE.value());
log.info("通道查出数据:{}", JSON.toJSONString(list));
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());
@ -165,6 +180,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
if (!BeanUtil.isEmpty(terminalStatus)) {
model.setGpsstatus(terminalStatus.getGpsStatus());
}
log.info("通道查出返回数据:{}", JSON.toJSONString(model));
return Asserts.success(model);
}

@ -58,7 +58,7 @@ public interface TerminalPhotoService {
ServiceBody<TerminalPhotosModel> getPhotoBanner(PageVo vo);
/**
*
*
*
* @return
*/

Loading…
Cancel
Save