Commit b169ed88 authored by chenying's avatar chenying

3.9添加通道模板和主题模板的增删改查

parent 8e19bce4
This diff is collapsed.
...@@ -31,6 +31,8 @@ public class RedisConfig extends CachingConfigurerSupport { ...@@ -31,6 +31,8 @@ public class RedisConfig extends CachingConfigurerSupport {
@Value("${spring.redis.host}") @Value("${spring.redis.host}")
private String host; private String host;
// @Value("${spring.redis.password}")
// private String password;
@Value("${spring.redis.port}") @Value("${spring.redis.port}")
private int port; private int port;
@Value("${spring.redis.timeout}") @Value("${spring.redis.timeout}")
...@@ -85,6 +87,7 @@ public class RedisConfig extends CachingConfigurerSupport { ...@@ -85,6 +87,7 @@ public class RedisConfig extends CachingConfigurerSupport {
public JedisConnectionFactory tokenConnectionFactory() { public JedisConnectionFactory tokenConnectionFactory() {
JedisConnectionFactory factory = new JedisConnectionFactory(); JedisConnectionFactory factory = new JedisConnectionFactory();
factory.setHostName(host); factory.setHostName(host);
// factory.setPassword(password);
factory.setPort( Integer.valueOf(port)); factory.setPort( Integer.valueOf(port));
factory.setDatabase(0); factory.setDatabase(0);
factory.setTimeout(10000); // 设置连接超时时间 factory.setTimeout(10000); // 设置连接超时时间
......
package com.example.tdl.domain.vo;
public class AddProbesModelInfoVo {
private String probesModelName;
private int port;
private String unit;
private String description;
private String alias;
private String type;
private int alarmUp;
private int alarmDown;
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAlarmUp() {
return alarmUp;
}
public void setAlarmUp(int alarmUp) {
this.alarmUp = alarmUp;
}
public int getAlarmDown() {
return alarmDown;
}
public void setAlarmDown(int alarmDown) {
this.alarmDown = alarmDown;
}
}
package com.example.tdl.domain.vo;
public class AddProbesModelVo {
private String probesModelName;
private int countNum;
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
}
package com.example.tdl.domain.vo;
public class AddTopicModelInfoVo {
private String topicModelName;
private String topicName;
private int type;
private int intervalTime;
private int frequency;
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getIntervalTime() {
return intervalTime;
}
public void setIntervalTime(int intervalTime) {
this.intervalTime = intervalTime;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
}
package com.example.tdl.domain.vo;
import java.util.List;
public class AddTopicModelVo {
private String topicModelName;
private String prefixName;
private List<String> topicName;
public List<String> getTopicName() {
return topicName;
}
public void setTopicName(List<String> topicName) {
this.topicName = topicName;
}
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getPrefixName() {
return prefixName;
}
public void setPrefixName(String prefixName) {
this.prefixName = prefixName;
}
}
package com.example.tdl.domain.vo;
public class DelTopicModelInfoVo {
private String topicModelName;
private String topicName;
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
}
...@@ -6,6 +6,14 @@ public class LoginUserVo { ...@@ -6,6 +6,14 @@ public class LoginUserVo {
private String password; private String password;
public LoginUserVo() {
}
public LoginUserVo(String userName, String password) {
this.userName = userName;
this.password = password;
}
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
......
package com.example.tdl.domain.vo;
public class ResultGatewayVo {
private String SN;
private String name;
private String type;
private boolean state;
private boolean bConfig;
private int useScene;
public int getUseScene() {
return useScene;
}
public void setUseScene(int useScene) {
this.useScene = useScene;
}
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public boolean isbConfig() {
return bConfig;
}
public void setbConfig(boolean bConfig) {
this.bConfig = bConfig;
}
}
package com.example.tdl.domain.vo;
public class ResultProbesModelInfoVo {
private String probesModelName;
private int port;
private String unit;
private String description;
private String alias;
private String type;
private int alarmUp;
private int alarmDown;
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAlarmUp() {
return alarmUp;
}
public void setAlarmUp(int alarmUp) {
this.alarmUp = alarmUp;
}
public int getAlarmDown() {
return alarmDown;
}
public void setAlarmDown(int alarmDown) {
this.alarmDown = alarmDown;
}
}
package com.example.tdl.domain.vo;
public class ResultProbesModelVo {
private String probesModelName;
private int countNum;
private String createTime;
private String updateTime;
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}
...@@ -7,7 +7,7 @@ public class ResultTDLDeviceVo { ...@@ -7,7 +7,7 @@ public class ResultTDLDeviceVo {
private String counts; private String counts;
private Long lastTime; private String lastTime;
private int useScene; private int useScene;
...@@ -15,6 +15,26 @@ public class ResultTDLDeviceVo { ...@@ -15,6 +15,26 @@ public class ResultTDLDeviceVo {
private String transportationNo; private String transportationNo;
private String gatewaySN;
private String gatewayType;
public String getGatewaySN() {
return gatewaySN;
}
public void setGatewaySN(String gatewaySN) {
this.gatewaySN = gatewaySN;
}
public String getGatewayType() {
return gatewayType;
}
public void setGatewayType(String gatewayType) {
this.gatewayType = gatewayType;
}
public String getTDLSN() { public String getTDLSN() {
return TDLSN; return TDLSN;
} }
...@@ -31,11 +51,11 @@ public class ResultTDLDeviceVo { ...@@ -31,11 +51,11 @@ public class ResultTDLDeviceVo {
this.counts = counts; this.counts = counts;
} }
public Long getLastTime() { public String getLastTime() {
return lastTime; return lastTime;
} }
public void setLastTime(Long lastTime) { public void setLastTime(String lastTime) {
this.lastTime = lastTime; this.lastTime = lastTime;
} }
......
package com.example.tdl.domain.vo;
public class ResultTopicModelInfoVo {
private String topicModelName;
private String topicName;
private int type;
private int intervalTime;
private int frequency;
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getIntervalTime() {
return intervalTime;
}
public void setIntervalTime(int intervalTime) {
this.intervalTime = intervalTime;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
}
package com.example.tdl.domain.vo;
public class ResultTopicModelVo {
private String topicModelName;
private String prefixName;
private String createTime;
private String updateTime;
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getPrefixName() {
return prefixName;
}
public void setPrefixName(String prefixName) {
this.prefixName = prefixName;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.domain.vo;
public class UpdateProbesModelVo {
private String probesModelName;
private Long updateTime;
private String oldProbesModelName;
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getOldProbesModelName() {
return oldProbesModelName;
}
public void setOldProbesModelName(String oldProbesModelName) {
this.oldProbesModelName = oldProbesModelName;
}
}
package com.example.tdl.domain.vo;
public class UpdateTopicModelInfoVo {
private String topicModelName;
private String topicName;
private int type;
private int intervalTime;
private int frequency;
private String oldTopicName;
public String getOldTopicName() {
return oldTopicName;
}
public void setOldTopicName(String oldTopicName) {
this.oldTopicName = oldTopicName;
}
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getIntervalTime() {
return intervalTime;
}
public void setIntervalTime(int intervalTime) {
this.intervalTime = intervalTime;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
}
package com.example.tdl.domain.vo;
public class UpdateTopicModelVo {
private String topicModelName;
private String prefixName;
private String oldTopicModelName;
private Long updateTime;
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getPrefixName() {
return prefixName;
}
public void setPrefixName(String prefixName) {
this.prefixName = prefixName;
}
public String getOldTopicModelName() {
return oldTopicModelName;
}
public void setOldTopicModelName(String oldTopicModelName) {
this.oldTopicModelName = oldTopicModelName;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.entity;
public class Gateway {
private int id;
private String SN;
private String type;
private boolean state;
private boolean bConfig;
private Long createTime;
private Long updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public boolean isbConfig() {
return bConfig;
}
public void setbConfig(boolean bConfig) {
this.bConfig = bConfig;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.entity;
public class GatewayPrefixName {
private int id;
private Gateway gateway;
private String prefixName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Gateway getGateway() {
return gateway;
}
public void setGateway(Gateway gateway) {
this.gateway = gateway;
}
public String getPrefixName() {
return prefixName;
}
public void setPrefixName(String prefixName) {
this.prefixName = prefixName;
}
}
package com.example.tdl.entity;
public class Model {
private int id;
private String modelName;
private Long createTime;
private Long updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.entity;
public class ModelInfo {
private int id;
private TopicModelInfo topicModelInfo;
private ProbesModelInfo probesModelInfo;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public TopicModelInfo getTopicModelInfo() {
return topicModelInfo;
}
public void setTopicModelInfo(TopicModelInfo topicModelInfo) {
this.topicModelInfo = topicModelInfo;
}
public ProbesModelInfo getProbesModelInfo() {
return probesModelInfo;
}
public void setProbesModelInfo(ProbesModelInfo probesModelInfo) {
this.probesModelInfo = probesModelInfo;
}
}
package com.example.tdl.entity;
public class Probes {
private int id;
private int port;
private String unit;
private String description;
private String alias;
private String type;
private int alarmUp;
private int alarmDown;
private Gateway gateway;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAlarmUp() {
return alarmUp;
}
public void setAlarmUp(int alarmUp) {
this.alarmUp = alarmUp;
}
public int getAlarmDown() {
return alarmDown;
}
public void setAlarmDown(int alarmDown) {
this.alarmDown = alarmDown;
}
public Gateway getGateway() {
return gateway;
}
public void setGateway(Gateway gateway) {
this.gateway = gateway;
}
}
package com.example.tdl.entity;
public class ProbesModel {
private int id;
private String probesModelName;
private int countNum;
private Long createTime;
private Long updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getProbesModelName() {
return probesModelName;
}
public void setProbesModelName(String probesModelName) {
this.probesModelName = probesModelName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.entity;
public class ProbesModelInfo {
private int id;
private ProbesModel probesModel;
private int port;
private String unit;
private String description;
private String alias;
private String type;
private int alarmUp;
private int alarmDown;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public ProbesModel getProbesModel() {
return probesModel;
}
public void setProbesModel(ProbesModel probesModel) {
this.probesModel = probesModel;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAlarmUp() {
return alarmUp;
}
public void setAlarmUp(int alarmUp) {
this.alarmUp = alarmUp;
}
public int getAlarmDown() {
return alarmDown;
}
public void setAlarmDown(int alarmDown) {
this.alarmDown = alarmDown;
}
}
package com.example.tdl.entity;
public class TDLGatewayLog {
private int id;
private String TDLSN;
private String gatewaySN;
private Long createTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getGatewaySN() {
return gatewaySN;
}
public void setGatewaySN(String gatewaySN) {
this.gatewaySN = gatewaySN;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}
package com.example.tdl.entity;
public class Topic {
private int id;
private String topicName;
private int type;
private int intervalTime;
private int frequency;
private Gateway gateway;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getIntervalTime() {
return intervalTime;
}
public void setIntervalTime(int intervalTime) {
this.intervalTime = intervalTime;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
public Gateway getGateway() {
return gateway;
}
public void setGateway(Gateway gateway) {
this.gateway = gateway;
}
}
package com.example.tdl.entity;
public class TopicConfig {
private int id;
private Probes probes;
private Topic topic;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Probes getProbes() {
return probes;
}
public void setProbes(Probes probes) {
this.probes = probes;
}
public Topic getTopic() {
return topic;
}
public void setTopic(Topic topic) {
this.topic = topic;
}
}
package com.example.tdl.entity;
public class TopicModel {
private int id;
private String topicModelName;
private String prefixName;
private Long createTime;
private Long updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTopicModelName() {
return topicModelName;
}
public void setTopicModelName(String topicModelName) {
this.topicModelName = topicModelName;
}
public String getPrefixName() {
return prefixName;
}
public void setPrefixName(String prefixName) {
this.prefixName = prefixName;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}
package com.example.tdl.entity;
public class TopicModelInfo {
private int id;
private TopicModel topicModel;
private String topicName;
private int type;
private int intervalTime;
private int frequency;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public TopicModel getTopicModel() {
return topicModel;
}
public void setTopicModel(TopicModel topicModel) {
this.topicModel = topicModel;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getIntervalTime() {
return intervalTime;
}
public void setIntervalTime(int intervalTime) {
this.intervalTime = intervalTime;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
}
package com.example.tdl.mapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CircuitMapper {
}
package com.example.tdl.mapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface GatewayMapper {
}
package com.example.tdl.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProbesModelInfoMapper {
// List<DevChannelModuleVo> getAll(@Param("companyName") String companyName, @Param("name") String moduleName);
//
// int getCountById(Integer id);
//
// int addADevChannelModule(Map<String, Object> map);
//
// int delAllDevChannelModule(Map<String, String> map);
//
// int delDevChannelModule(Map<String, Object> map);
//
// int updateDevChannelModule(UpdateDevChannelModule updateDevChannelModule);
//
// DevChannelModuleVo getByAlias(@Param("companyName") String companyName, @Param("name") String moduleName, @Param("alias") String alias);
//
// DevChannelModuleVo getByPort(@Param("companyName") String companyName, @Param("name") String moduleName, @Param("port") int port);
// int updateMoreDevChannelModule(Map<String,Object> map);
}
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.ResultProbesModelVo;
import com.example.tdl.domain.vo.UpdateProbesModelVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProbesModelMapper {
List<ResultProbesModelVo> getAll();
int addProbesModel(Map<String, Object> map);
ResultProbesModelVo getByProbesModelName(String probesModelName);
int delProbesModel(Map<String, Object> map);
int updateProbesModel(UpdateProbesModelVo updateChannelModuleVo);
int getProbesModelCount();
}
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.AddTopicModelInfoVo;
import com.example.tdl.domain.vo.ResultTopicModelInfoVo;
import com.example.tdl.domain.vo.UpdateTopicModelInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface TopicModelInfoMapper {
List<ResultTopicModelInfoVo> getAll(String topicModelName);
int addTopicModelInfo(AddTopicModelInfoVo addTopicModelInfoVo);
int updateTopicModelInfo(UpdateTopicModelInfoVo updateTopicModelInfoVo);
int delTopicModelInfo(Map<String, Object> map);
ResultTopicModelInfoVo getByTopicModelNameAndTopicName(@Param("topicModelName") String topicModelName, @Param("topicName") String topicName);
}
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.ResultTopicModelVo;
import com.example.tdl.domain.vo.UpdateTopicModelVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface TopicModelMapper {
List<ResultTopicModelVo> getAll();
int addTopicModel(Map<String, Object> map);
int updateTopicModel(UpdateTopicModelVo updateTopicModelVo);
int delTopicModel(Map<String, Object> map);
ResultTopicModelVo getByTopicModelName(String topicModelName);
int getTopicModelCount();
}
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.DelAlarmVo;
import com.example.tdl.domain.vo.ResultWarehouseVo; import com.example.tdl.domain.vo.ResultWarehouseVo;
import com.example.tdl.domain.vo.UpdateWarehouseVo; import com.example.tdl.domain.vo.UpdateWarehouseVo;
import com.example.tdl.domain.vo.WarehouseTermVo; import com.example.tdl.domain.vo.WarehouseTermVo;
...@@ -23,4 +24,6 @@ public interface WarehouseMapper { ...@@ -23,4 +24,6 @@ public interface WarehouseMapper {
int delWarehouse(String warehouseNo); int delWarehouse(String warehouseNo);
ResultWarehouseVo getByWarehouseName(String warehouseName); ResultWarehouseVo getByWarehouseName(String warehouseName);
List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo);
} }
package com.example.tdl.service;
import com.example.tdl.mapper.CircuitMapper;
import com.example.tdl.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CircuitService {
@Autowired
private CircuitMapper circuitMapper;
}
package com.example.tdl.service;
import com.example.tdl.mapper.GatewayMapper;
import com.example.tdl.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GatewayService {
@Autowired
private GatewayMapper gatewayMapper;
}
package com.example.tdl.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class ProbesModelInfoService {
// @Autowired
// private DevChannelModuleMapper devChannelModuleMapper;
//
//
// //根据模板名获取所有的通道
//
// public List<DevChannelModuleVo> queryByPage(String companyName, String moduleName){
// return devChannelModuleMapper.getAll(companyName,moduleName);
// }
//// public PageInfo<DevChannelModule> queryByPage(String companyName,String moduleName,Integer page,Integer rows){
//// PageHelper.startPage(page,rows);
//// List<DevChannelModule> list = devChannelModuleMapper.getAll(companyName,moduleName);
//// return new PageInfo<DevChannelModule>(list);
////
//// }
//
//
// public int addADevChannelModule(Map<String,Object> map){
// return devChannelModuleMapper.addADevChannelModule(map);
// }
//
// public int getCountById(Integer id){
// return devChannelModuleMapper.getCountById(id);
// }
//
// public int delDevChannelModule(Map<String,Object> map){
// return devChannelModuleMapper.delDevChannelModule(map);
// }
//
// public int delAllDevChannelModule(Map<String,String> map){
// return devChannelModuleMapper.delAllDevChannelModule(map);
// }
//
// public int updateDevChannelModule(UpdateDevChannelModule updateDevChannelModule){
// return devChannelModuleMapper.updateDevChannelModule(updateDevChannelModule);
// }
//
// public DevChannelModuleVo getByAlias(String companyName,String name,String alias){
// return devChannelModuleMapper.getByAlias(companyName,name,alias);
// }
//
// public DevChannelModuleVo getByPort(String companyName,String moduleName,int port){
// return devChannelModuleMapper.getByPort(companyName,moduleName,port);
// }
/* public int updateMoreDevChannelModule(Map<String,Object> map){
return devChannelModuleMapper.updateMoreDevChannelModule(map);
}*/
}
package com.example.tdl.service;
import com.example.tdl.domain.vo.ResultProbesModelVo;
import com.example.tdl.domain.vo.UpdateProbesModelVo;
import com.example.tdl.mapper.ProbesModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class ProbesModelService {
@Autowired
private ProbesModelMapper probesModelMapper;
public List<ResultProbesModelVo> getAll(){
return probesModelMapper.getAll();
}
//新增通道
public int addProbesModel(Map<String,Object> map){
return probesModelMapper.addProbesModel(map);
}
//根据模板名查询模版信息
public ResultProbesModelVo getByProbesModelName(String probesModelName){
return probesModelMapper.getByProbesModelName(probesModelName);
}
//删除
public int delProbesModel(Map<String,Object> map){
return probesModelMapper.delProbesModel(map);
}
//修改
public int updateChannelModule(UpdateProbesModelVo updateProbesModelVo){
return probesModelMapper.updateProbesModel(updateProbesModelVo);
}
//获取该公司下所有模板个数
public int getProbesModelCount(){
return probesModelMapper.getProbesModelCount();
}
}
package com.example.tdl.service;
import com.example.tdl.domain.vo.AddTopicModelInfoVo;
import com.example.tdl.domain.vo.ResultTopicModelInfoVo;
import com.example.tdl.domain.vo.UpdateTopicModelInfoVo;
import com.example.tdl.mapper.TopicModelInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class TopicModelInfoService {
@Autowired
private TopicModelInfoMapper topicModelInfoMapper;
public List<ResultTopicModelInfoVo> getAll(String topicModelName){
return topicModelInfoMapper.getAll(topicModelName);
}
public int addTopicModelInfo(AddTopicModelInfoVo addTopicModelInfoVo){
return topicModelInfoMapper.addTopicModelInfo(addTopicModelInfoVo);
}
public int updateTopicModelInfo(UpdateTopicModelInfoVo updateTopicModelInfoVo){
return topicModelInfoMapper.updateTopicModelInfo(updateTopicModelInfoVo);
}
public int delTopicModelInfo(Map<String,Object> map){
return topicModelInfoMapper.delTopicModelInfo(map);
}
public ResultTopicModelInfoVo getByTopicModelNameAndTopicName(String topicModelName,String topicName){
return topicModelInfoMapper.getByTopicModelNameAndTopicName(topicModelName,topicName);
}
}
package com.example.tdl.service;
import com.example.tdl.domain.vo.ResultTopicModelVo;
import com.example.tdl.domain.vo.UpdateTopicModelVo;
import com.example.tdl.mapper.TopicModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class TopicModelService {
@Autowired
private TopicModelMapper topicModelMapper;
public List<ResultTopicModelVo> getAll(){
return topicModelMapper.getAll();
}
public int addTopicModel(Map<String,Object> map){
return topicModelMapper.addTopicModel(map);
}
public int updateTopicModel(UpdateTopicModelVo updateTopicModelVo){
return topicModelMapper.updateTopicModel(updateTopicModelVo);
}
public int delTopicModel(Map<String,Object> map){
return topicModelMapper.delTopicModel(map);
}
public ResultTopicModelVo getByTopicModelName(String topicModelName){
return topicModelMapper.getByTopicModelName(topicModelName);
}
public int getTopicModelCount(){
return topicModelMapper.getTopicModelCount();
}
}
package com.example.tdl.service; package com.example.tdl.service;
import com.example.tdl.domain.vo.DelAlarmVo;
import com.example.tdl.domain.vo.ResultWarehouseVo; import com.example.tdl.domain.vo.ResultWarehouseVo;
import com.example.tdl.domain.vo.UpdateWarehouseVo; import com.example.tdl.domain.vo.UpdateWarehouseVo;
import com.example.tdl.domain.vo.WarehouseTermVo; import com.example.tdl.domain.vo.WarehouseTermVo;
...@@ -40,4 +41,8 @@ public class WarehouseService { ...@@ -40,4 +41,8 @@ public class WarehouseService {
return warehouseMapper.getByWarehouseName(warehouseName); return warehouseMapper.getByWarehouseName(warehouseName);
} }
public List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo){
return warehouseMapper.getByAlarm(delAlarmVo);
}
} }
...@@ -9,6 +9,7 @@ import com.example.tdl.domain.vo.UpdateAlarmVo; ...@@ -9,6 +9,7 @@ import com.example.tdl.domain.vo.UpdateAlarmVo;
import com.example.tdl.domain.vo.UserVo; import com.example.tdl.domain.vo.UserVo;
import com.example.tdl.service.AlarmService; import com.example.tdl.service.AlarmService;
import com.example.tdl.service.TokenRedisService; import com.example.tdl.service.TokenRedisService;
import com.example.tdl.service.WarehouseService;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -35,6 +36,9 @@ public class AlarmController { ...@@ -35,6 +36,9 @@ public class AlarmController {
@Autowired @Autowired
private AlarmService alarmService=new AlarmService(); private AlarmService alarmService=new AlarmService();
@Autowired
private WarehouseService warehouseService;
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
...@@ -53,17 +57,9 @@ public class AlarmController { ...@@ -53,17 +57,9 @@ public class AlarmController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return alarmService.getAll(); return alarmService.getAll();
} }
}
//根据预警类型模糊查询 //根据预警类型模糊查询
@ApiOperation(value = "根据预警类型模糊查询",notes = "查询所有预警信息,返回值说明:" + @ApiOperation(value = "根据预警类型模糊查询",notes = "查询所有预警信息,返回值说明:" +
...@@ -80,19 +76,11 @@ public class AlarmController { ...@@ -80,19 +76,11 @@ public class AlarmController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAllByAlarmType",method = RequestMethod.POST) @RequestMapping(value="/getAllByAlarmType",method = RequestMethod.POST)
public Object getAllByAlarmType(@RequestBody String alarmType,HttpServletRequest request){ public Object getAllByAlarmType(@RequestBody String alarmType){
JSONObject jsonObject= JSON.parseObject(alarmType); JSONObject jsonObject= JSON.parseObject(alarmType);
alarmType=(String)jsonObject.get("alarmType"); alarmType=(String)jsonObject.get("alarmType");
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return alarmService.getAllByAlarmType(alarmType); return alarmService.getAllByAlarmType(alarmType);
} }
}
//添加预警信息 //添加预警信息
@ApiOperation(value = "添加预警信息",notes = "添加预警信息,传递参数:" + @ApiOperation(value = "添加预警信息",notes = "添加预警信息,传递参数:" +
...@@ -109,9 +97,7 @@ public class AlarmController { ...@@ -109,9 +97,7 @@ public class AlarmController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/addAlarm",method = RequestMethod.POST) @RequestMapping(value="/addAlarm",method = RequestMethod.POST)
public Object addAlarm(@RequestBody AddAlarmVo addAlarmVo,HttpServletRequest request){ public Object addAlarm(@RequestBody AddAlarmVo addAlarmVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if (StringUtils.isEmpty(addAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(addAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警类型不能为空"); fb.setMessage("预警类型不能为空");
...@@ -121,7 +107,8 @@ public class AlarmController { ...@@ -121,7 +107,8 @@ public class AlarmController {
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警场景不能为空"); fb.setMessage("预警场景不能为空");
return gson.toJson(fb); return gson.toJson(fb);
}else if (!addAlarmVo.getAlarmScene().equals("仓库")&&!addAlarmVo.getAlarmScene().equals("运输")){ }
if (!addAlarmVo.getAlarmScene().equals("仓库")&&!addAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请选择正确的预警场景"); fb.setMessage("请选择正确的预警场景");
return gson.toJson(fb); return gson.toJson(fb);
...@@ -213,7 +200,8 @@ public class AlarmController { ...@@ -213,7 +200,8 @@ public class AlarmController {
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警场景不能为空"); fb.setMessage("预警场景不能为空");
return gson.toJson(fb); return gson.toJson(fb);
}else if (!updateAlarmVo.getAlarmScene().equals("仓库")&&!updateAlarmVo.getAlarmScene().equals("运输")){ }
if (!updateAlarmVo.getAlarmScene().equals("仓库")&&!updateAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请选择正确的预警场景"); fb.setMessage("请选择正确的预警场景");
return gson.toJson(fb); return gson.toJson(fb);
...@@ -274,6 +262,21 @@ public class AlarmController { ...@@ -274,6 +262,21 @@ public class AlarmController {
}) })
@RequestMapping(value="/delAlarm",method = RequestMethod.POST) @RequestMapping(value="/delAlarm",method = RequestMethod.POST)
public Object delAlarm(@RequestBody DelAlarmVo delAlarmVo){ public Object delAlarm(@RequestBody DelAlarmVo delAlarmVo){
if (StringUtils.isEmpty(delAlarmVo.getAlarmScene())){
fb.setCode(0);
fb.setMessage("需要删除的预警场景不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(delAlarmVo.getAlarmType())){
fb.setCode(0);
fb.setMessage("需要删除的预警类型不能为空");
return gson.toJson(fb);
}
if (warehouseService.getByAlarm(delAlarmVo)!=null){
fb.setCode(0);
fb.setMessage("该预警正在被使用");
return gson.toJson(fb);
}
int a=alarmService.delAlarm(delAlarmVo); int a=alarmService.delAlarm(delAlarmVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
...@@ -291,16 +294,8 @@ public class AlarmController { ...@@ -291,16 +294,8 @@ public class AlarmController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getForWarehouse",method = RequestMethod.GET) @RequestMapping(value="/getForWarehouse",method = RequestMethod.GET)
public Object getForWarehouse(HttpServletRequest request){ public Object getForWarehouse(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return alarmService.getForWarehouse(); return alarmService.getForWarehouse();
} }
}
} }
package com.example.tdl.web;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.service.GatewayService;
import com.example.tdl.service.RoleService;
import com.example.tdl.service.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/gateway")
public class GatewayController {
private Logger logger = LoggerFactory.getLogger(GatewayController.class);
CommFeedback fb=new CommFeedback();
Gson gson=new Gson();
@Autowired
private GatewayService gatewayService=new GatewayService();
@Autowired
private TokenRedisService tokenRedisService;
//查询本公司的用户
@ApiOperation(value = "查询所有网关信息",notes = "查询所有网关信息:")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getAllRoleName",method = RequestMethod.GET)
public Object getAllRoleName(){
return null;
}
}
...@@ -86,10 +86,10 @@ public class LoginController { ...@@ -86,10 +86,10 @@ public class LoginController {
fb.setMessage("添加日志失败"); fb.setMessage("添加日志失败");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.info(e.toString()); // logger.info(e.toString());
fb.setCode(0); fb.setCode(0);
fb.setMessage("登录失败"); fb.setMessage("用户名或密码错误");
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
......
...@@ -48,17 +48,9 @@ public class LoginLogController { ...@@ -48,17 +48,9 @@ public class LoginLogController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return loginLogService.getAll(); return loginLogService.getAll();
} }
}
//根据时间查询登录日志 //根据时间查询登录日志
@ApiOperation(value = "根据时间查询登录日志",notes = "根据时间查询登录日志,传值说明:" + @ApiOperation(value = "根据时间查询登录日志",notes = "根据时间查询登录日志,传值说明:" +
...@@ -84,8 +76,5 @@ public class LoginLogController { ...@@ -84,8 +76,5 @@ public class LoginLogController {
return gson.toJson(fb); return gson.toJson(fb);
} }
return loginLogService.getByTime(loginLogTermVo); return loginLogService.getByTime(loginLogTermVo);
} }
} }
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddProbesModelVo;
import com.example.tdl.domain.vo.UpdateProbesModelVo;
import com.example.tdl.service.ProbesModelService;
import com.example.tdl.service.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(path="/probesModel")
public class ProbesModelController {
Gson gson = new Gson();
CommFeedback fb = new CommFeedback();
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ProbesModelService probesModelService;
@Autowired
private TokenRedisService tokenRedisService;
//获取所有的通道模板
@ApiOperation(value = "获取所有通道模板",notes = "返回参数:" +
" probesModelName: 模板名," +
" countNum: 模板下通道数量," +
" createTime: 创建时间," +
" updateTime: 修改时间")
@RequestMapping(value = "/getAll",method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAll(){
return probesModelService.getAll();
}
//新增模板
@ApiOperation(value = "新增通道模板" ,notes = "新增模板的同时,新增相应数量的模板通道,模板不能超过20个,每个模板的模板通道不能超过100个" +
" probesModelName:模板名," +
" countNum:通道数量,")
@RequestMapping(value = "/addProbesModel" ,method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String addProbesModel(@RequestBody AddProbesModelVo addProbesModelVo){
if(StringUtils.isEmpty(addProbesModelVo.getProbesModelName())){
fb.setCode(0);
fb.setMessage("模板名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addProbesModelVo.getCountNum()+"")){
fb.setCode(0);
fb.setMessage("新增的模板通道数量不能为空");
return gson.toJson(fb);
}
if(addProbesModelVo.getCountNum()>100){
fb.setCode(0);
fb.setMessage("新增的模板通道数量不能超过100");
return gson.toJson(fb);
}
int a=probesModelService.getProbesModelCount();
if (a>20){
fb.setCode(0);
fb.setMessage("对不起,只能添加20个模板");
return gson.toJson(fb);
}
Map<String, Object> map = new HashMap<>();
map.put("probesModelName", addProbesModelVo.getProbesModelName());
map.put("countNum", addProbesModelVo.getCountNum());
map.put("createTime",System.currentTimeMillis());
map.put("updateTime",System.currentTimeMillis());
map.put("alarmUp", 0);
map.put("alarmDown", 0);
try {
probesModelService.addProbesModel(map);
Map<String, Object> ms = new HashMap<>();
ms.put("msg", map.get("msg"));
if (ms.get("msg").equals("添加模板成功")) {
fb.setCode(1);
fb.setMessage(map.get("msg").toString());
} else {
fb.setCode(0);
fb.setMessage(map.get("msg").toString());
}
} catch (Exception e) {
e.printStackTrace();
logger.info(e.toString());
fb.setCode(0);
fb.setMessage("添加失败");
}
return gson.toJson(fb);
}
//修改模板
@ApiOperation(value = "修改通道模板",notes = "修改只能修改模板名,updateTime不用传,以下必传" +
" probesModelName: 模板名," +
" oldProbesModelName: 需要修改的模板名")
@RequestMapping(value = "/updateProbesModel",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String updateProbesModel(@RequestBody UpdateProbesModelVo updateProbesModelVo){
if (StringUtils.isEmpty(updateProbesModelVo.getOldProbesModelName())){
fb.setCode(0);
fb.setMessage("需要修改的模板名不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(updateProbesModelVo.getProbesModelName())){
fb.setCode(0);
fb.setMessage("模板名称不能为空");
return gson.toJson(fb);
}
if (probesModelService.getByProbesModelName(updateProbesModelVo.getProbesModelName())!=null&&
!updateProbesModelVo.getProbesModelName().equals(updateProbesModelVo.getOldProbesModelName())){
fb.setCode(0);
fb.setMessage("该模板已存在");
return gson.toJson(fb);
}
updateProbesModelVo.setUpdateTime(System.currentTimeMillis());
int a=probesModelService.updateChannelModule(updateProbesModelVo);
if (a>0){
fb.setCode(1);
fb.setMessage("修改成功");
}else{
fb.setCode(0);
fb.setMessage("修改模板失败");
}
return gson.toJson(fb);
}
//删除模板
@ApiOperation(value = "删除通道模板",notes = "删除模板的传参,以下必传" +
" name: 模板名")
@RequestMapping(value = "/delProbesModel",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String delProbesModel(@RequestBody String probesModelName){
JSONObject jsonObject= JSON.parseObject(probesModelName);
probesModelName=(String)jsonObject.get("probesModelName");
if(StringUtils.isEmpty(probesModelName)){
fb.setCode(0);
fb.setMessage("模板名不能为空");
return gson.toJson(fb);
}
Map<String,Object> params=new HashMap<String, Object>();
params.put("name",probesModelName);
try {
probesModelService.delProbesModel(params);
Map<String,Object> ms=new HashMap<>();
ms.put("msg",params.get("msg"));
if(ms.get("msg").equals("删除模板成功")){
fb.setCode(1);
fb.setMessage(ms.get("msg").toString());
}else{
fb.setCode(0);
fb.setMessage(ms.get("msg").toString());
}
}catch (Exception e){
e.printStackTrace();
logger.info(e.toString());
fb.setCode(0);
fb.setMessage("删除失败");
}
return gson.toJson(fb);
}
}
...@@ -46,17 +46,9 @@ public class RoleController { ...@@ -46,17 +46,9 @@ public class RoleController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAllRoleName",method = RequestMethod.GET) @RequestMapping(value="/getAllRoleName",method = RequestMethod.GET)
public Object getAllRoleName(HttpServletRequest request){ public Object getAllRoleName(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return roleService.getAllRoleName(); return roleService.getAllRoleName();
} }
}
......
...@@ -72,17 +72,9 @@ public class RouteController { ...@@ -72,17 +72,9 @@ public class RouteController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return routeService.getAll(); return routeService.getAll();
} }
}
//根据条件查询路由信息 //根据条件查询路由信息
@ApiOperation(value = "根据条件查询路由信息",notes = "根据条件查询路由信息,传值说明:" + @ApiOperation(value = "根据条件查询路由信息",notes = "根据条件查询路由信息,传值说明:" +
...@@ -115,17 +107,9 @@ public class RouteController { ...@@ -115,17 +107,9 @@ public class RouteController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getRouteByTerm",method = RequestMethod.POST) @RequestMapping(value="/getRouteByTerm",method = RequestMethod.POST)
public Object getRouteByTerm(@RequestBody RouteTermVo routeTermVo,HttpServletRequest request){ public Object getRouteByTerm(@RequestBody RouteTermVo routeTermVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return routeService.getRouteByTerm(routeTermVo); return routeService.getRouteByTerm(routeTermVo);
} }
}
@ApiOperation(value = "添加路由信息",notes = "添加路由信息,都要传,说明:" + @ApiOperation(value = "添加路由信息",notes = "添加路由信息,都要传,说明:" +
" startLongitude:启运经度," + " startLongitude:启运经度," +
...@@ -147,14 +131,7 @@ public class RouteController { ...@@ -147,14 +131,7 @@ public class RouteController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/addRoute",method = RequestMethod.POST) @RequestMapping(value="/addRoute",method = RequestMethod.POST)
public Object addRoute(@RequestBody AddRouteVo addRouteVo,HttpServletRequest request){ public Object addRoute(@RequestBody AddRouteVo addRouteVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addRouteVo.getStartLatitude())){ if (StringUtils.isEmpty(addRouteVo.getStartLatitude())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("启运纬度不能为空"); fb.setMessage("启运纬度不能为空");
...@@ -315,14 +292,7 @@ public class RouteController { ...@@ -315,14 +292,7 @@ public class RouteController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/updateRoute",method = RequestMethod.POST) @RequestMapping(value="/updateRoute",method = RequestMethod.POST)
public Object updateRoute(@RequestBody UpdateRouteVo updateRouteVo,HttpServletRequest request){ public Object updateRoute(@RequestBody UpdateRouteVo updateRouteVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
if (StringUtils.isEmpty(updateRouteVo.getStartLatitude())){ if (StringUtils.isEmpty(updateRouteVo.getStartLatitude())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("启运纬度不能为空"); fb.setMessage("启运纬度不能为空");
...@@ -407,7 +377,8 @@ public class RouteController { ...@@ -407,7 +377,8 @@ public class RouteController {
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输方式不能为空"); fb.setMessage("运输方式不能为空");
return gson.toJson(fb); return gson.toJson(fb);
}else if (!updateRouteVo.getTransport().equals("铁路")&&!updateRouteVo.getTransport().equals("汽运")&&!updateRouteVo.getTransport().equals("海运")&& }
if (!updateRouteVo.getTransport().equals("铁路")&&!updateRouteVo.getTransport().equals("汽运")&&!updateRouteVo.getTransport().equals("海运")&&
!updateRouteVo.getTransport().equals("空运")&&!updateRouteVo.getTransport().equals("快递")){ !updateRouteVo.getTransport().equals("空运")&&!updateRouteVo.getTransport().equals("快递")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请选择正确的运输方式"); fb.setMessage("请选择正确的运输方式");
...@@ -442,7 +413,7 @@ public class RouteController { ...@@ -442,7 +413,7 @@ public class RouteController {
fb.setMessage("修改路由失败"); fb.setMessage("修改路由失败");
} }
return gson.toJson(fb); return gson.toJson(fb);
}
} }
//删除路由信息 //删除路由信息
...@@ -451,16 +422,9 @@ public class RouteController { ...@@ -451,16 +422,9 @@ public class RouteController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
public Object delRoute(@RequestBody String routeNumber, HttpServletRequest request){ public Object delRoute(@RequestBody String routeNumber){
JSONObject jsonObject= JSON.parseObject(routeNumber); JSONObject jsonObject= JSON.parseObject(routeNumber);
routeNumber=(String)jsonObject.get("routeNumber"); routeNumber=(String)jsonObject.get("routeNumber");
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
if (StringUtils.isEmpty(routeNumber)){ if (StringUtils.isEmpty(routeNumber)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的路由编号不能为空"); fb.setMessage("需要删除的路由编号不能为空");
...@@ -474,7 +438,6 @@ public class RouteController { ...@@ -474,7 +438,6 @@ public class RouteController {
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除路由信息失败"); fb.setMessage("删除路由信息失败");
} }
}
return gson.toJson(fb); return gson.toJson(fb);
} }
......
...@@ -52,22 +52,16 @@ public class TDLDeviceController { ...@@ -52,22 +52,16 @@ public class TDLDeviceController {
" lastTime:最后使用时间," + " lastTime:最后使用时间," +
" useScene:使用场景(0为空闲,1为仓库,2为运输)," + " useScene:使用场景(0为空闲,1为仓库,2为运输)," +
" warehouseName:仓库名," + " warehouseName:仓库名," +
" transportationNo:运输编号。" ) " transportationNo:运输编号," +
" gatewaySN:网关序列号," +
" gatewayType:网关类型。" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return tdlDeviceService.getAll(); return tdlDeviceService.getAll();
} }
}
//根据条件查询TDL信息 //根据条件查询TDL信息
@ApiOperation(value = "根据条件查询TDL信息",notes = "根据条件查询TDL信息,传值说明:" + @ApiOperation(value = "根据条件查询TDL信息",notes = "根据条件查询TDL信息,传值说明:" +
...@@ -81,22 +75,16 @@ public class TDLDeviceController { ...@@ -81,22 +75,16 @@ public class TDLDeviceController {
" lastTime:最后使用时间," + " lastTime:最后使用时间," +
" useScene:使用场景(0为空闲,1为仓库,2为运输)," + " useScene:使用场景(0为空闲,1为仓库,2为运输)," +
" warehouseName:仓库名," + " warehouseName:仓库名," +
" transportationNo:运输编号。" ) " transportationNo:运输编号," +
" gatewaySN:网关序列号," +
" gatewayType:网关类型。" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/getByTerm",method = RequestMethod.POST) @RequestMapping(value="/getByTerm",method = RequestMethod.POST)
public Object getByTerm(@RequestBody TDLDeviceTermVo tdlDeviceTermVo,HttpServletRequest request){ public Object getByTerm(@RequestBody TDLDeviceTermVo tdlDeviceTermVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
return tdlDeviceService.getByTerm(tdlDeviceTermVo); return tdlDeviceService.getByTerm(tdlDeviceTermVo);
} }
}
//添加TDL信息 //添加TDL信息
@ApiOperation(value = "添加TDL信息",notes = "添加TDL信息,传值说明:" + @ApiOperation(value = "添加TDL信息",notes = "添加TDL信息,传值说明:" +
...@@ -106,14 +94,7 @@ public class TDLDeviceController { ...@@ -106,14 +94,7 @@ public class TDLDeviceController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/addTDLDevice",method = RequestMethod.POST) @RequestMapping(value="/addTDLDevice",method = RequestMethod.POST)
public Object addTDLDevice(@RequestBody AddTDLDeviceVo addTDLDeviceVo,HttpServletRequest request){ public Object addTDLDevice(@RequestBody AddTDLDeviceVo addTDLDeviceVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
if (StringUtils.isEmpty(addTDLDeviceVo.getTDLName())){ if (StringUtils.isEmpty(addTDLDeviceVo.getTDLName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("TDL名称不能为空"); fb.setMessage("TDL名称不能为空");
...@@ -139,7 +120,6 @@ public class TDLDeviceController { ...@@ -139,7 +120,6 @@ public class TDLDeviceController {
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
}
//修改TDL信息 //修改TDL信息
@ApiOperation(value = "修改TDL信息",notes = "修改TDL信息,TDLSN不能改,传值说明:" + @ApiOperation(value = "修改TDL信息",notes = "修改TDL信息,TDLSN不能改,传值说明:" +
...@@ -149,14 +129,8 @@ public class TDLDeviceController { ...@@ -149,14 +129,8 @@ public class TDLDeviceController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/updateTDLDevice",method = RequestMethod.POST) @RequestMapping(value="/updateTDLDevice",method = RequestMethod.POST)
public Object updateTDLDevice(@RequestBody UpdateTDLDeviceVo updateTDLDeviceVo,HttpServletRequest request){ public Object updateTDLDevice(@RequestBody UpdateTDLDeviceVo updateTDLDeviceVo){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
if (StringUtils.isEmpty(updateTDLDeviceVo.getTDLName())){ if (StringUtils.isEmpty(updateTDLDeviceVo.getTDLName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("TDL名称不能为空"); fb.setMessage("TDL名称不能为空");
...@@ -177,7 +151,6 @@ public class TDLDeviceController { ...@@ -177,7 +151,6 @@ public class TDLDeviceController {
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
}
//删除TDL信息 //删除TDL信息
@ApiOperation(value = "删除TDL信息",notes = "删除TDL信息,传值说明:" + @ApiOperation(value = "删除TDL信息",notes = "删除TDL信息,传值说明:" +
...@@ -186,16 +159,9 @@ public class TDLDeviceController { ...@@ -186,16 +159,9 @@ public class TDLDeviceController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/delTDLDevice",method = RequestMethod.POST) @RequestMapping(value="/delTDLDevice",method = RequestMethod.POST)
public Object delTDLDevice(@RequestBody String TDLSN, HttpServletRequest request){ public Object delTDLDevice(@RequestBody String TDLSN){
JSONObject jsonObject=JSON.parseObject(TDLSN); JSONObject jsonObject=JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN"); TDLSN=(String)jsonObject.get("TDLSN");
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
if(datum == null){
fb.setCode(0);
fb.setMessage("您没有登录,请先登录");
return gson.toJson(fb);
}else{
if (StringUtils.isEmpty(TDLSN)){ if (StringUtils.isEmpty(TDLSN)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的TDL序列号不能为空"); fb.setMessage("需要删除的TDL序列号不能为空");
...@@ -210,6 +176,6 @@ public class TDLDeviceController { ...@@ -210,6 +176,6 @@ public class TDLDeviceController {
fb.setMessage("删除TDL信息失败"); fb.setMessage("删除TDL信息失败");
} }
return gson.toJson(fb); return gson.toJson(fb);
}
} }
} }
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddTopicModelVo;
import com.example.tdl.domain.vo.UpdateTopicModelVo;
import com.example.tdl.service.TokenRedisService;
import com.example.tdl.service.TopicModelService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping(path = "/topicModel")
public class TopicModelController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private CommFeedback fb = new CommFeedback();
private Gson gson = new Gson();
@Autowired
private TopicModelService topicModelService;
@Autowired
private TokenRedisService tokenRedisService;
//获取设备的所有主题
@ApiOperation(value = "查询所有主题模板",notes = "查询所有主题模板的返回值对应的意义:" +
" topicModelName: 主题模板名," +
" prefixName:添加主题的前缀名," +
" createTime: 模板创建时间," +
" updateTime: 模板最新修改时间")
@RequestMapping(value = "/getAll",method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAll(){
return topicModelService.getAll();
}
@ApiOperation(value = "添加主题模板",notes = "添加主题模板的同时添加主题信息,传递的参数:" +
" topicModelName: 新增的主题模板名," +
" prefixName:新增的主题名前缀," +
" topicName: 主题名([\"主题1\",\"主题2\"])")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/addTopicModel",method = RequestMethod.POST)
public String addTopicModel(@RequestBody AddTopicModelVo addTopicModelVo){
if (StringUtils.isEmpty(addTopicModelVo.getTopicModelName())){
fb.setCode(0);
fb.setMessage("添加的主题模板不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addTopicModelVo.getPrefixName())){
fb.setCode(0);
fb.setMessage("添加的主题名前缀不能为空");
return gson.toJson(fb);
}
int s=topicModelService.getTopicModelCount();
if (s>=20){
fb.setCode(0);
fb.setMessage("添加的主题数量不能超过20个");
return gson.toJson(fb);
}
String topicNameVar="";
for (int a=0;a<addTopicModelVo.getTopicName().size();a++){
topicNameVar=topicNameVar+addTopicModelVo.getTopicName().get(a)+" ";
}
Map<String,Object> map=new HashMap<>();
map.put("topicModelName",addTopicModelVo.getTopicModelName());
map.put("prefixName",addTopicModelVo.getPrefixName());
map.put("createTime",System.currentTimeMillis());
map.put("updateTime",System.currentTimeMillis());
map.put("topicNameVar",topicNameVar);
map.put("num",addTopicModelVo.getTopicName().size());
topicModelService.addTopicModel(map);
Map<String,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("添加主题模板成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
@ApiOperation(value = "修改主题模板",notes = "修改主题模板只能修改主题模板名,updateTime不用传,传递的参数:" +
" topicModelName: 修改后的主题模板名," +
" prefixName:修改后的前缀名," +
" oldTopicModelName: 修改以前的主题模板名")
@RequestMapping(value = "/updateTopic",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String updateTopic(@RequestBody UpdateTopicModelVo updateTopicModelVo){
if (StringUtils.isEmpty(updateTopicModelVo.getTopicModelName())){
fb.setCode(0);
fb.setMessage("修改的主题模板名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelVo.getPrefixName())){
fb.setCode(0);
fb.setMessage("修改的主题名前缀不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelVo.getOldTopicModelName())){
fb.setCode(0);
fb.setMessage("需要修改的主题模板名不能为空");
return gson.toJson(fb);
}
if (topicModelService.getByTopicModelName(updateTopicModelVo.getTopicModelName())!=null&&!updateTopicModelVo.getTopicModelName().equals(updateTopicModelVo.getOldTopicModelName())){
fb.setCode(0);
fb.setMessage("修改的主题名不能相同");
return gson.toJson(fb);
}
updateTopicModelVo.setUpdateTime(System.currentTimeMillis());
int a=topicModelService.updateTopicModel(updateTopicModelVo);
if (a>0){
fb.setCode(1);
fb.setMessage("修改主题模板成功");
}else{
fb.setCode(0);
fb.setMessage("修改主题模板失败");
}
return gson.toJson(fb);
}
//删除
@ApiOperation(value = "删除主题模板",notes = "删除主题模板需要传的参数:" +
" topicModelName: 需要删除的主题模板名")
@RequestMapping(value = "/delTopicModel",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String delTopicModel(@RequestBody String topicModelName){
JSONObject jsonObject= JSON.parseObject(topicModelName);
topicModelName=(String)jsonObject.get("topicModelName");
if (StringUtils.isEmpty(topicModelName)){
fb.setCode(0);
fb.setMessage("删除的主题模板名不能为空");
return gson.toJson(fb);
}
Map<String,Object> map=new HashMap<>();
map.put("topicModelName",topicModelName);
topicModelService.delTopicModel(map);
Map<String,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("删除主题模板成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
}
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddTopicModelInfoVo;
import com.example.tdl.domain.vo.DelTopicModelInfoVo;
import com.example.tdl.domain.vo.UpdateTopicModelInfoVo;
import com.example.tdl.service.TokenRedisService;
import com.example.tdl.service.TopicModelInfoService;
import com.example.tdl.service.TopicModelService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping(path = "/topicModelInfo")
public class TopicModelInfoController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private CommFeedback fb = new CommFeedback();
private Gson gson = new Gson();
@Autowired
private TopicModelInfoService topicModelInfoService;
@Autowired
private TopicModelService topicModelService;
@Autowired
private TokenRedisService tokenRedisService;
//获取设备的所有主题
@ApiOperation(value = "查询某个主题模板下的主题配置信息",notes = "查询某个主题模板下的主题配置信息的返回值对应的意义:" +
" topicModelName: 主题模板名," +
" topicName: 主题名," +
" type: 主题类型," +
" intervalTime: 间隔时间," +
" frequency:发送次数")
@RequestMapping(value = "/getAll",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAll(@RequestBody String topicModelName){
JSONObject jsonObject= JSON.parseObject(topicModelName);
topicModelName=(String)jsonObject.get("topicModelName");
if (StringUtils.isEmpty(topicModelName)){
fb.setCode(0);
fb.setMessage("查询的主题模板名不能为空");
return gson.toJson(fb);
}
return topicModelInfoService.getAll(topicModelName);
}
@ApiOperation(value = "添加某个主题模板下的主题配置信息",notes = "添加某个主题模板下的主题配置信息,传递参数:" +
" topicModelName: 主题模板名," +
" topicName: 主题名," +
" type: 主题类型," +
" intervalTime: 间隔时间," +
" frequency:发送次数")
@RequestMapping(value="/addTopicModelInfo",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String addTopicModelInfo(@RequestBody AddTopicModelInfoVo topicModelInfoVo){
if (StringUtils.isEmpty(topicModelInfoVo.getTopicModelName())){
fb.setCode(0);
fb.setMessage("添加的主题模板名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(topicModelInfoVo.getTopicName())){
fb.setCode(0);
fb.setMessage("添加的主题名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(topicModelInfoVo.getType()+"")){
fb.setCode(0);
fb.setMessage("添加的主题类型不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(topicModelInfoVo.getIntervalTime()+"")){
fb.setCode(0);
fb.setMessage("添加的间隔时间不能为空");
return gson.toJson(fb);
}
if (topicModelInfoVo.getIntervalTime()<100){
fb.setCode(0);
fb.setMessage("添加的间隔时间不能小于100");
return gson.toJson(fb);
}
if (topicModelInfoService.getByTopicModelNameAndTopicName(topicModelInfoVo.getTopicModelName(),topicModelInfoVo.getTopicName())!=null){
fb.setCode(0);
fb.setMessage("添加模板的主题名不能相同");
return gson.toJson(fb);
}
int a=topicModelInfoService.addTopicModelInfo(topicModelInfoVo);
if (a>0){
fb.setCode(1);
fb.setMessage("添加模板主题成功");
}else{
fb.setCode(0);
fb.setMessage("添加模板主题失败");
}
return gson.toJson(fb);
}
@ApiOperation(value = "修改某个主题模板下的主题配置信息",notes = "修改某个主题模板下的主题配置信息,传递参数:" +
" topicModelName: 修改的主题模板名," +
" oldTopicName: 修改之前的主题名," +
" topicName: 修改以后的主题名," +
" type: 主题类型," +
" intervalTime: 间隔时间," +
" frequency:发送次数")
@RequestMapping(value = "/updateTopicModelInfo",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String updateTopicModelInfo(@RequestBody UpdateTopicModelInfoVo updateTopicModelInfoVo){
if (StringUtils.isEmpty(updateTopicModelInfoVo.getTopicModelName())){
fb.setCode(0);
fb.setMessage("需要修改的主题模板名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelInfoVo.getOldTopicName())){
fb.setCode(0);
fb.setMessage("需要修改的主题名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelInfoVo.getTopicName())){
fb.setCode(0);
fb.setMessage("修改的主题名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelInfoVo.getType()+"")){
fb.setCode(0);
fb.setMessage("修改的主题类型不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateTopicModelInfoVo.getIntervalTime()+"")){
fb.setCode(0);
fb.setMessage("修改的间隔时间不能为空");
return gson.toJson(fb);
}
if (updateTopicModelInfoVo.getIntervalTime()<100){
fb.setCode(0);
fb.setMessage("添加的间隔时间不能小于100");
return gson.toJson(fb);
}
if (topicModelInfoService.getByTopicModelNameAndTopicName(updateTopicModelInfoVo.getTopicModelName(),updateTopicModelInfoVo.getTopicName())!=null&&!updateTopicModelInfoVo.getOldTopicName().equals(updateTopicModelInfoVo.getTopicName())){
fb.setCode(0);
fb.setMessage("修改的主题名不能相同");
return gson.toJson(fb);
}
int a=topicModelInfoService.updateTopicModelInfo(updateTopicModelInfoVo);
if (a>0){
fb.setCode(1);
fb.setMessage("修改主题模板信息成功");
}else{
fb.setCode(0);
fb.setMessage("修改主题模板失败");
}
return gson.toJson(fb);
}
//删除
@ApiOperation(value = "删除某个主题模板下的主题配置信息",notes = "删除某个主题模板下的主题配置信息,传递参数:" +
" topicModelName: 需要删除的主题模板名," +
" topicName: 需要删除的主题名")
@RequestMapping(value = "/delTopicModel",method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String delTopicModel(@RequestBody DelTopicModelInfoVo delTopicModelInfoVo){
if (StringUtils.isEmpty(delTopicModelInfoVo.getTopicModelName())){
fb.setCode(0);
fb.setMessage("删除的主题模板名不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(delTopicModelInfoVo.getTopicName())){
fb.setCode(0);
fb.setMessage("删除的主题名不能为空");
return gson.toJson(fb);
}
try {
Map<String,Object> map=new HashMap<>();
map.put("topicModelName",delTopicModelInfoVo.getTopicModelName());
map.put("topicName",delTopicModelInfoVo.getTopicName());
topicModelInfoService.delTopicModelInfo(map);
Map<String,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if(msg.get("msg").equals("删除成功")){
fb.setCode(1);
fb.setMessage("删除成功");
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
}catch (Exception e){
logger.info(e.toString());
e.printStackTrace();
fb.setCode(0);
fb.setMessage("删除失败");
}
return gson.toJson(fb);
}
}
spring.datasource.url=jdbc:mysql://192.168.1.53:3306/cy?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://192.168.1.200:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8099 server.port=8092
management.security.enabled=false management.security.enabled=false
mybatis.type-aliases-package=com.example.demo.entity mybatis.type-aliases-package=com.example.demo.entity
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.CircuitMapper">
<!--根据报警信息查询线路-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.GatewayMapper">
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultGatewayVo">
SELECT SN,name,type,state,bConfig,(SELECT useScene from tdldevice where gateway_id=g.id limit 1) useScene
from gateway g
</select>
<!-- <insert id="addGateway" parameterType="">
INSERT into gateway VALUES (
NULL ,
#{SN,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
0,
0,
)
</insert>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.ProbesModelInfoMapper">
<!--<select id="getAll" parameterType="String" resultType="com.example.tdl.domain.vo.ResultProbesModelInfoVo">
select p.probesModelName, pi.port,pi.unit,pi.description,pi.alias,pi.type,pi.alarmUp,pi.alarmDown
from probes_model_info pi,probes_model p
where pi.probesModel_id=p.id
AND p.probesModelName = #{probesModelName,jdbcType=VARCHAR}
</select>
<select id="getCountByProbesModelName" parameterType="String" resultType="java.lang.Integer">
select count(*) from probes_model_info where channelmodule_id =#{channelModuleId,jdbcType =INTEGER}
</select>
&lt;!&ndash;添加单个模板通道&ndash;&gt;
<insert id="addProbesModelInfo" parameterType="com.example.tdl.domain.vo.AddProbesModelInfoVo">
INSERT INTO probes_model_info VALUES (
NULL ,
(SELECT id from probes_model WHERE probesModelName=#{probesModelName,jdbcType=VARCHAR}),
#{port,jdbcType=INTEGER},
#{unit,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{alias,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{alarmUp,jdbcType=INTEGER},
#{alarmDown,jdbcType=INTEGER}
)
</insert>
&lt;!&ndash;删除单个模板通道&ndash;&gt;
<delete id="delProbesModelInfo" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_delDevChannelModule(
#{name,mode=IN,jdbcType=VARCHAR},
#{port,mode=IN,jdbcType=INTEGER},
#{companyName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</delete>
&lt;!&ndash;删除所有模板通道&ndash;&gt;
<delete id="delAllDevChannelModule" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_delAllDevChannelModule(
#{name,mode=IN,jdbcType=VARCHAR},
#{companyName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</delete>
<select id="getByAlias" parameterType="String" resultType="com.example.demo.domain.vo.DevChannelModuleVo">
select c.name channelModuleName, d.port,d.unit,d.description,d.alias,d.type,d.alarmUp,d.alarmDown
from devchannelmodule d,channelmodule c
where d.channelmodule_id=c.id
and c.name = #{name,mode=IN,jdbcType=VARCHAR}
and c.company_id = (select id from company where companyName=#{companyName,mode=IN,jdbcType=VARCHAR})
AND d.alias=#{alias,jdbcType=VARCHAR}
</select>
<select id="getByPort" resultType="com.example.demo.domain.vo.DevChannelModuleVo">
select c.name channelModuleName, d.port,d.unit,d.description,d.alias,d.type,d.alarmUp,d.alarmDown
from devchannelmodule d,channelmodule c
where d.channelmodule_id=c.id
and c.name = #{name,mode=IN,jdbcType=VARCHAR}
and c.company_id = (select id from company where companyName=#{companyName,mode=IN,jdbcType=VARCHAR})
AND d.port=#{port,jdbcType=VARCHAR}
</select>
<update id="updateDevChannelModule" parameterType="com.example.demo.domain.vo.UpdateDevChannelModule">
UPDATE devchannelmodule SET
unit=#{unit,jdbcType=VARCHAR},
description=#{description,jdbcType=VARCHAR},
alias=#{alias,jdbcType=VARCHAR},
type=#{type,jdbcType=VARCHAR},
alarmUp=#{alarmUp,jdbcType=INTEGER},
alarmDown=#{alarmDown,jdbcType=INTEGER}
WHERE channelmodule_id=(SELECT id from channelmodule WHERE name=#{channelModuleName,jdbcType=VARCHAR} AND company_id=(SELECT id FROM company where companyName=#{companyName,jdbcType=VARCHAR}))
AND port=#{port,jdbcType=INTEGER}
</update>-->
<!--<![CDATA[
{
call pro_insertADevChannelModule(
#{channelModuleName,mode=IN,jdbcType=VARCHAR},
#{companyName,mode=IN,jdbcType=VARCHAR},
#{port,mode=IN,jdbcType=INTEGER},
#{unit,mode=IN,jdbcType=VARCHAR},
#{description,mode=IN,jdbcType=VARCHAR},
#{alias,mode=IN,jdbcType=VARCHAR},
#{type,mode=IN,jdbcType=VARCHAR},
#{alarmUp,mode=IN,jdbcType=INTEGER},
#{alarmDown,mode=IN,jdbcType=INTEGER},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>-->
<!-- <update id="updateMoreDevChannelModule" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{
call pro_updateDevChannelModule(
#{name,mode=IN,jdbcType=VARCHAR},
#{companyName,mode=IN,jdbcType=VARCHAR},
#{num,mode=IN,jdbcType=VARCHAR},
#{portVar,mode=IN,jdbcType=VARCHAR},
#{unitVar,mode=IN,jdbcType=VARCHAR},
#{descriptionVar,mode=IN,jdbcType=VARCHAR},
#{typeVar,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</update>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.ProbesModelMapper">
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultProbesModelVo">
select probesModelName,countNum,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
from probes_model order by updateTime
</select>
<insert id="addProbesModel" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_addProbesModel(
#{probesModelName,mode=IN,jdbcType=VARCHAR},
#{countNum,mode=IN,jdbcType=INTEGER},
#{createTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{alarmUp,mode=IN,jdbcType=INTEGER},
#{alarmDown,mode=IN,jdbcType=INTEGER},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</insert>
<select id="getByProbesModelName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultProbesModelVo">
select probesModelName,countNum,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
from probes_model
WHERE probesModelName = #{probesModelName,jdbcType=VARCHAR}
</select>
<delete id="delProbesModel" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_delProbesModel(
#{probesModelName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</delete>
<update id="updateProbesModel" parameterType="com.example.tdl.domain.vo.UpdateProbesModelVo">
UPDATE probes_model SET
probesModelName=#{probesModelName,jdbcType=VARCHAR},
updateTime=#{probesModelName,jdbcType=VARCHAR}
WHERE probesModelName = #{oldProbesModelName,jdbcType=VARCHAR}
</update>
<select id="getProbesModelCount" resultType="java.lang.Integer">
select COUNT(*) from probes_model
</select>
</mapper>
\ No newline at end of file
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
<!--查询所有TDL信息--> <!--查询所有TDL信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo"> <select id="getAll" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo">
SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName, SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo (SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,
(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t from tdldevice t
</select> </select>
<!--根据条件查询--> <!--根据条件查询-->
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo" parameterType="com.example.tdl.domain.vo.TDLDeviceTermVo"> <select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo" parameterType="com.example.tdl.domain.vo.TDLDeviceTermVo">
SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName, SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo (SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t WHERE 1=1 from tdldevice t where 1=1
<if test="TDLName!=null"> <if test="TDLName!=null">
AND TDLName like CONCAT(CONCAT('%',#{TDLName,jdbcType=VARCHAR}), '%') AND TDLName like CONCAT(CONCAT('%',#{TDLName,jdbcType=VARCHAR}), '%')
</if> </if>
...@@ -33,7 +34,8 @@ ...@@ -33,7 +34,8 @@
0, 0,
0, 0,
NULL , NULL ,
NULL NULL,
NULL ,
) )
</insert> </insert>
...@@ -49,7 +51,8 @@ ...@@ -49,7 +51,8 @@
<select id="getByTDLSN" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo"> <select id="getByTDLSN" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo">
SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName, SELECT TDLName,TDLSN,counts,FROM_UNIXTIME(lastTime) lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo (SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t WHERE TDLSN=#{TDLSN,jdbcType=VARCHAR} from tdldevice t
WHERE TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.TopicModelInfoMapper">
<select id="getAll" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTopicModelInfoVo">
SELECT topicModelName,topicName,type,intervalTime,frequency from topic_model_info t INNER JOIN topic_model m ON t.topicModel_id=m.id
WHERE topicModelName=#{topicModelName,jdbcType=VARCHAR}
</select>
<insert id="addTopicModelInfo" parameterType="com.example.tdl.domain.vo.AddTopicModelInfoVo">
INSERT INTO topic_model_info VALUES (
null,
(SELECT id from topic_model WHERE topicModelName=#{topicModelName,jdbcType=VARCHAR}),
#{topicName,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{intervalTime,jdbcType=INTEGER},
#{frequency,jdbcType=INTEGER}
)
</insert>
<update id="updateTopicModelInfo" parameterType="com.example.tdl.domain.vo.UpdateTopicModelInfoVo">
UPDATE topic_model_info SET
topicName=#{topicName,jdbcType=VARCHAR},
type=#{type,jdbcType=INTEGER},
intervalTime=#{intervalTime,jdbcType=INTEGER},
frequency=#{frequency,jdbcType=INTEGER}
WHERE topicModel_id=(SELECT id from topic_model WHERE topicModelName=#{topicModelName,jdbcType=VARCHAR})
AND topicName=#{oldTopicName,jdbcType=VARCHAR}
</update>
<delete id="delTopicModelInfo" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{
call pro_delTopicModelInfo(
#{topicModelName,mode=IN,jdbcType=VARCHAR},
#{topicName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</delete>
<select id="getByTopicModelNameAndTopicName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTopicModelInfoVo">
SELECT topicModelName,topicName,type,intervalTime,frequency from topic_model_info t INNER JOIN topic_model m ON t.topicModel_id=m.id
WHERE topicModelName=#{topicModelName,jdbcType=VARCHAR}
AND topicName=#{topicName,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.TopicModelMapper">
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultTopicModelVo">
SELECT topicModelName,prefixName,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
from topic_model
</select>
<insert id="addTopicModel" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_addTopicModel(
#{topicModelName,mode=IN,jdbcType=VARCHAR},
#{prefixName,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{topicNameVar,mode=IN,jdbcType=VARCHAR},
#{num,mode=IN,jdbcType=INTEGER},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</insert>
<update id="updateTopicModel" parameterType="com.example.tdl.domain.vo.UpdateTopicModelVo">
UPDATE topic_model SET
topicModelName=#{topicModelName,jdbcType=VARCHAR},
prefixName=#{prefixName,jdbcType=VARCHAR},
updateTime=#{updateTime,jdbcType=BIGINT}
WHERE topicModelName=#{oldTopicModelName,jdbcType=VARCHAR}
</update>
<delete id="delTopicModel" statementType="CALLABLE" parameterType="java.util.Map">
<![CDATA[
{
call pro_delTopicModel(
#{topicModelName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</delete>
<select id="getByTopicModelName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTopicModelVo">
SELECT topicModelName,prefixName,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
from topic_model WHERE topicModelName=#{topicModelName,jdbcType=VARCHAR}
</select>
<select id="getTopicModelCount" resultType="java.lang.Integer">
SELECT COUNT(*) from topic_model
</select>
</mapper>
\ No newline at end of file
...@@ -111,4 +111,13 @@ ...@@ -111,4 +111,13 @@
from warehouse w,alarm a WHERE w.alarm_id=a.id from warehouse w,alarm a WHERE w.alarm_id=a.id
AND warehouseName=#{warehouseName,jdbcType=VARCHAR} AND warehouseName=#{warehouseName,jdbcType=VARCHAR}
</select> </select>
<!--根据报警信息查询仓库信息-->
<select id="getByAlarm" parameterType="String" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
SELECT warehouseName,warehouseNo,country,province,city,district,address,regionCN,regionEN,longitude,latitude,property,type,
alarmType,alarmScene,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,weatherInfo,warehouseInfo,w.remark
from warehouse w,alarm a WHERE w.alarm_id=a.id
AND a.alarmType=#{alarmType,jdbcType=VARCHAR}
AND a.alarmScene=#{alarmScene,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -33,5 +33,11 @@ ...@@ -33,5 +33,11 @@
<mapper resource="mapper/WarehouseMapper.xml"/> <mapper resource="mapper/WarehouseMapper.xml"/>
<mapper resource="mapper/TDLDeviceMapper.xml"/> <mapper resource="mapper/TDLDeviceMapper.xml"/>
<mapper resource="mapper/LoginLogMapper.xml"/> <mapper resource="mapper/LoginLogMapper.xml"/>
<mapper resource="mapper/GatewayMapper.xml"/>
<mapper resource="mapper/CircuitMapper.xml"/>
<mapper resource="mapper/TopicModelMapper.xml"/>
<mapper resource="mapper/TopicModelInfoMapper.xml"/>
<mapper resource="mapper/ProbesModelMapper.xml"/>
<mapper resource="mapper/ProbesModelInfoMapper.xml"/>
</mappers> </mappers>
</configuration> </configuration>
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