Commit 87c970f5 authored by chenying's avatar chenying

5.30修改TDL网关使用记录,删除预警场景字段

parent a0e46451
...@@ -4,8 +4,6 @@ public class AddAlarmVo { ...@@ -4,8 +4,6 @@ public class AddAlarmVo {
private String alarmType; private String alarmType;
private String alarmScene;
private Float temMax;//温度上限 private Float temMax;//温度上限
private Float temMin;//温度下限 private Float temMin;//温度下限
...@@ -30,14 +28,6 @@ public class AddAlarmVo { ...@@ -30,14 +28,6 @@ public class AddAlarmVo {
this.alarmType = alarmType; this.alarmType = alarmType;
} }
public String getAlarmScene() {
return alarmScene;
}
public void setAlarmScene(String alarmScene) {
this.alarmScene = alarmScene;
}
public Float getTemMax() { public Float getTemMax() {
return temMax; return temMax;
} }
......
...@@ -3,8 +3,6 @@ package com.example.tdl.domain.vo; ...@@ -3,8 +3,6 @@ package com.example.tdl.domain.vo;
public class DelAlarmVo { public class DelAlarmVo {
private String alarmType; private String alarmType;
private String alarmScene;
private String companyName; private String companyName;
public String getCompanyName() { public String getCompanyName() {
...@@ -23,11 +21,4 @@ public class DelAlarmVo { ...@@ -23,11 +21,4 @@ public class DelAlarmVo {
this.alarmType = alarmType; this.alarmType = alarmType;
} }
public String getAlarmScene() {
return alarmScene;
}
public void setAlarmScene(String alarmScene) {
this.alarmScene = alarmScene;
}
} }
...@@ -4,8 +4,6 @@ public class ResultAlarmVo{ ...@@ -4,8 +4,6 @@ public class ResultAlarmVo{
private String alarmType; private String alarmType;
private String alarmScene;
private Float temMax;//温度上限 private Float temMax;//温度上限
private Float temMin;//温度下限 private Float temMin;//温度下限
...@@ -28,14 +26,6 @@ public class ResultAlarmVo{ ...@@ -28,14 +26,6 @@ public class ResultAlarmVo{
this.alarmType = alarmType; this.alarmType = alarmType;
} }
public String getAlarmScene() {
return alarmScene;
}
public void setAlarmScene(String alarmScene) {
this.alarmScene = alarmScene;
}
public Float getTemMax() { public Float getTemMax() {
return temMax; return temMax;
} }
......
...@@ -4,8 +4,6 @@ public class UpdateAlarmVo { ...@@ -4,8 +4,6 @@ public class UpdateAlarmVo {
private String alarmType; private String alarmType;
private String alarmScene;
private Float temMax;//温度上限 private Float temMax;//温度上限
private Float temMin;//温度下限 private Float temMin;//温度下限
...@@ -22,8 +20,6 @@ public class UpdateAlarmVo { ...@@ -22,8 +20,6 @@ public class UpdateAlarmVo {
private String oldAlarmType; private String oldAlarmType;
private String oldAlarmScene;
private String companyName; private String companyName;
public String getCompanyName() { public String getCompanyName() {
...@@ -42,14 +38,6 @@ public class UpdateAlarmVo { ...@@ -42,14 +38,6 @@ public class UpdateAlarmVo {
this.alarmType = alarmType; this.alarmType = alarmType;
} }
public String getAlarmScene() {
return alarmScene;
}
public void setAlarmScene(String alarmScene) {
this.alarmScene = alarmScene;
}
public Float getTemMax() { public Float getTemMax() {
return temMax; return temMax;
} }
...@@ -114,11 +102,4 @@ public class UpdateAlarmVo { ...@@ -114,11 +102,4 @@ public class UpdateAlarmVo {
this.oldAlarmType = oldAlarmType; this.oldAlarmType = oldAlarmType;
} }
public String getOldAlarmScene() {
return oldAlarmScene;
}
public void setOldAlarmScene(String oldAlarmScene) {
this.oldAlarmScene = oldAlarmScene;
}
} }
...@@ -19,11 +19,7 @@ public interface AlarmMapper { ...@@ -19,11 +19,7 @@ public interface AlarmMapper {
int delAlarm(DelAlarmVo delAlarmVo); int delAlarm(DelAlarmVo delAlarmVo);
ResultAlarmVo getByTypeAndScene(@Param("alarmType") String alarmType,@Param("alarmScene") String alarmScene,@Param("companyName") String companyName); ResultAlarmVo getByType(@Param("alarmType") String alarmType,@Param("companyName") String companyName);
List<AlarmTypeVo> getForWarehouse(String companyName);
List<AlarmTypeVo> getForTransportation(String companyName);
ResultAlarmVo getAlarmByWarehouseNo(@Param("warehouseNo") String warehouseNo ,@Param("gatewaySN")String gatewaySN,@Param("TDLSN")String TDLSN); ResultAlarmVo getAlarmByWarehouseNo(@Param("warehouseNo") String warehouseNo ,@Param("gatewaySN")String gatewaySN,@Param("TDLSN")String TDLSN);
} }
...@@ -41,7 +41,7 @@ public interface WarehouseMapper { ...@@ -41,7 +41,7 @@ public interface WarehouseMapper {
ResultWarehouseVo getByWarehouseName(@Param("warehouseName") String warehouseName, @Param("companyName") String companyName); ResultWarehouseVo getByWarehouseName(@Param("warehouseName") String warehouseName, @Param("companyName") String companyName);
List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo); // List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo);
List<GatewaySNVo> getGateway(String warehouseNo); List<GatewaySNVo> getGateway(String warehouseNo);
......
...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; ...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
public class MqttListener implements MqttCallback { public class MqttListener implements MqttCallback {
private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms
private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms
private static final String CHECKIN_TOPIC = "TDL/+/+/CheckIn"; private static final String CHECKIN_TOPIC = "CY/+/+/CheckIn";
private MqttTemlateAsync mqttAsyncClient; private MqttTemlateAsync mqttAsyncClient;
......
...@@ -35,16 +35,8 @@ public class AlarmService { ...@@ -35,16 +35,8 @@ public class AlarmService {
return alarmMapper.delAlarm(delAlarmVo); return alarmMapper.delAlarm(delAlarmVo);
} }
public ResultAlarmVo getByTypeAndScene(String alarmType,String alarmScene,String companyName){ public ResultAlarmVo getByType(String alarmType,String companyName){
return alarmMapper.getByTypeAndScene(alarmType,alarmScene,companyName); return alarmMapper.getByType(alarmType,companyName);
}
public List<AlarmTypeVo> getForWarehouse(String companyName){
return alarmMapper.getForWarehouse(companyName);
}
public List<AlarmTypeVo> getForTransportation(String companyName){
return alarmMapper.getForTransportation(companyName);
} }
public ResultAlarmVo getAlarmByWarehouseNo(String warehouseNo,String SN, String TDLSN){ public ResultAlarmVo getAlarmByWarehouseNo(String warehouseNo,String SN, String TDLSN){
......
...@@ -72,9 +72,9 @@ public class WarehouseService { ...@@ -72,9 +72,9 @@ public class WarehouseService {
return warehouseMapper.getByWarehouseName(warehouseName,companyName); return warehouseMapper.getByWarehouseName(warehouseName,companyName);
} }
public List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo){ // public List<ResultWarehouseVo> getByAlarm(DelAlarmVo delAlarmVo){
return warehouseMapper.getByAlarm(delAlarmVo); // return warehouseMapper.getByAlarm(delAlarmVo);
} // }
public List<GatewaySNVo> getGateway(String warehouseNo){ public List<GatewaySNVo> getGateway(String warehouseNo){
return warehouseMapper.getGateway(warehouseNo); return warehouseMapper.getGateway(warehouseNo);
......
...@@ -52,7 +52,6 @@ public class AlarmController { ...@@ -52,7 +52,6 @@ public class AlarmController {
//查询所有预警信息 //查询所有预警信息
@ApiOperation(value = "查询所有预警信息",notes = "查询所有预警信息,返回值说明:" + @ApiOperation(value = "查询所有预警信息",notes = "查询所有预警信息,返回值说明:" +
" alarmType:预警类型," + " alarmType:预警类型," +
" alarmScene:预警场景," +
" temMax:温度上限," + " temMax:温度上限," +
" temMin:温度下限," + " temMin:温度下限," +
" humidityMax:湿度上限," + " humidityMax:湿度上限," +
...@@ -75,7 +74,6 @@ public class AlarmController { ...@@ -75,7 +74,6 @@ public class AlarmController {
//根据预警类型模糊查询 //根据预警类型模糊查询
@ApiOperation(value = "根据预警类型模糊查询",notes = "查询所有预警信息,返回值说明:" + @ApiOperation(value = "根据预警类型模糊查询",notes = "查询所有预警信息,返回值说明:" +
" alarmType:预警类型," + " alarmType:预警类型," +
" alarmScene:预警场景," +
" temMax:温度上限," + " temMax:温度上限," +
" temMin:温度下限," + " temMin:温度下限," +
" humidityMax:湿度上限," + " humidityMax:湿度上限," +
...@@ -100,7 +98,6 @@ public class AlarmController { ...@@ -100,7 +98,6 @@ public class AlarmController {
//添加预警信息 //添加预警信息
@ApiOperation(value = "添加预警信息",notes = "添加预警信息,companyName不用传,需要传递参数:" + @ApiOperation(value = "添加预警信息",notes = "添加预警信息,companyName不用传,需要传递参数:" +
" alarmType:预警类型," + " alarmType:预警类型," +
" alarmScene:预警场景," +
" temMax:温度上限," + " temMax:温度上限," +
" temMin:温度下限," + " temMin:温度下限," +
" humidityMax:湿度上限," + " humidityMax:湿度上限," +
...@@ -123,16 +120,6 @@ public class AlarmController { ...@@ -123,16 +120,6 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"alarmType")); fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addAlarmVo.getAlarmScene())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmScene"));
return gson.toJson(fb);
}
if (!addAlarmVo.getAlarmScene().equals("仓库")&&!addAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongAlarmScene"));
return gson.toJson(fb);
}
if (addAlarmVo.getTemMax()== null){ if (addAlarmVo.getTemMax()== null){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMax")); fb.setMessage(i18n.getMessage(request,"temMax"));
...@@ -173,7 +160,7 @@ public class AlarmController { ...@@ -173,7 +160,7 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"shock")); fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (alarmService.getByTypeAndScene(addAlarmVo.getAlarmType(),addAlarmVo.getAlarmScene(),user.getCompanyName())!=null){ if (alarmService.getByType(addAlarmVo.getAlarmType(),user.getCompanyName())!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmExist")); fb.setMessage(i18n.getMessage(request,"alarmExist"));
return gson.toJson(fb); return gson.toJson(fb);
...@@ -193,9 +180,7 @@ public class AlarmController { ...@@ -193,9 +180,7 @@ public class AlarmController {
//修改预警信息 //修改预警信息
@ApiOperation(value = "修改预警信息",notes = "修改预警信息,companyName不用传,需要传递参数:" + @ApiOperation(value = "修改预警信息",notes = "修改预警信息,companyName不用传,需要传递参数:" +
" oldAlarmType:需要修改的预警类型," + " oldAlarmType:需要修改的预警类型," +
" oldAlarmScene:需要修改的预警场景," +
" alarmType:预警类型," + " alarmType:预警类型," +
" alarmScene:预警场景," +
" temMax:温度上限," + " temMax:温度上限," +
" temMin:温度下限," + " temMin:温度下限," +
" humidityMax:湿度上限," + " humidityMax:湿度上限," +
...@@ -218,31 +203,11 @@ public class AlarmController { ...@@ -218,31 +203,11 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"modifiedAlarmType")); fb.setMessage(i18n.getMessage(request,"modifiedAlarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateAlarmVo.getOldAlarmScene())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"modifiedAlarmScene"));
return gson.toJson(fb);
}
if (!updateAlarmVo.getOldAlarmScene().equals("仓库")&&!updateAlarmVo.getOldAlarmScene().equals("运输")){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"modifiedWrongAlarmScene"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(updateAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmType")); fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateAlarmVo.getAlarmScene())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmScene"));
return gson.toJson(fb);
}
if (!updateAlarmVo.getAlarmScene().equals("仓库")&&!updateAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongAlarmScene"));
return gson.toJson(fb);
}
if (updateAlarmVo.getTemMax()==null){ if (updateAlarmVo.getTemMax()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMax")); fb.setMessage(i18n.getMessage(request,"temMax"));
...@@ -283,7 +248,7 @@ public class AlarmController { ...@@ -283,7 +248,7 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"shock")); fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (alarmService.getByTypeAndScene(updateAlarmVo.getAlarmType(),updateAlarmVo.getAlarmType(),user.getCompanyName())!=null&&!updateAlarmVo.getAlarmType().equals(updateAlarmVo.getAlarmType())&&!updateAlarmVo.getAlarmScene().equals(updateAlarmVo.getAlarmScene())){ if (alarmService.getByType(updateAlarmVo.getAlarmType(),user.getCompanyName())!=null&&!updateAlarmVo.getAlarmType().equals(updateAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"modifiedAlarmExist")); fb.setMessage(i18n.getMessage(request,"modifiedAlarmExist"));
return gson.toJson(fb); return gson.toJson(fb);
...@@ -315,30 +280,22 @@ public class AlarmController { ...@@ -315,30 +280,22 @@ public class AlarmController {
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage"); String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(delAlarmVo.getAlarmScene())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"deletedAlarmScene"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(delAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(delAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"deletedAlarmType")); fb.setMessage(i18n.getMessage(request,"deletedAlarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
delAlarmVo.setCompanyName(user.getCompanyName()); delAlarmVo.setCompanyName(user.getCompanyName());
if("运输".equals(delAlarmVo.getAlarmScene())){ if(tdlLogService.getByAlarm(delAlarmVo).size()>0){
if(tdlLogService.getByAlarm(delAlarmVo).size()>0){ fb.setCode(0);
fb.setCode(0); fb.setMessage(i18n.getMessage(request,"dusedAlarm"));
fb.setMessage(i18n.getMessage(request,"dusedAlarm")); return gson.toJson(fb);
return gson.toJson(fb);
}
}else{
if (warehouseService.getByAlarm(delAlarmVo).size()>0){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"dusedAlarm"));
return gson.toJson(fb);
}
} }
// if (warehouseService.getByAlarm(delAlarmVo).size()>0){
// fb.setCode(0);
// fb.setMessage(i18n.getMessage(request,"dusedAlarm"));
// 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);
...@@ -350,34 +307,4 @@ public class AlarmController { ...@@ -350,34 +307,4 @@ public class AlarmController {
return gson.toJson(fb); return gson.toJson(fb);
} }
//查询仓库场景下的预警类型
@ApiOperation(value = "查询仓库场景下的预警类型",notes = "查询仓库场景下的预警类型")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@RequestMapping(value="/getForWarehouse",method = RequestMethod.GET)
public Object getForWarehouse(HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
return alarmService.getForWarehouse(user.getCompanyName());
}
@ApiOperation(value = "查询运输场景下的预警类型",notes = "查询运输场景下的预警类型")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@RequestMapping(value="/getForTransportation",method = RequestMethod.GET)
public Object getForTransportation(HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
return alarmService.getForTransportation(user.getCompanyName());
}
} }
...@@ -1559,7 +1559,7 @@ public class CircuitController { ...@@ -1559,7 +1559,7 @@ public class CircuitController {
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
ResultAlarmVo alarmVo = alarmService.getByTypeAndScene(alarmType,"运输",user.getCompanyName()); ResultAlarmVo alarmVo = alarmService.getByType(alarmType,user.getCompanyName());
for(String alias :list){ for(String alias :list){
List<AlarmRuleVo> alarmRuleVos = new ArrayList<>(); List<AlarmRuleVo> alarmRuleVos = new ArrayList<>();
AlarmRuleVo alarmRuleVo = new AlarmRuleVo(); AlarmRuleVo alarmRuleVo = new AlarmRuleVo();
......
...@@ -137,15 +137,13 @@ public class EquipmentBindingController { ...@@ -137,15 +137,13 @@ public class EquipmentBindingController {
//获取gateway下的所有tdl的编号 //获取gateway下的所有tdl的编号
List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType()); List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType());
devList.add("TDL-"+bindingVo.getTDLSN()); devList.add("TDL-"+bindingVo.getTDLSN());
String alarmScene = "";
Integer gpsPeriod = null; Integer gpsPeriod = null;
Integer gprsPeriod = null; Integer gprsPeriod = null;
if(bindingVo.getMode() == 2){ if(bindingVo.getMode() == 2){
alarmScene="仓库";
gpsPeriod = 43200; gpsPeriod = 43200;
gprsPeriod= 60; gprsPeriod= 60;
}else{ }else{
alarmScene="运输";
gpsPeriod=5; gpsPeriod=5;
gprsPeriod=15; gprsPeriod=15;
} }
...@@ -170,8 +168,7 @@ public class EquipmentBindingController { ...@@ -170,8 +168,7 @@ public class EquipmentBindingController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("配置网关成功")){ if (msg.get("msg").equals("配置网关成功")){
//根据报警类型货报警信息 //根据报警类型货报警信息
ResultAlarmVo alarmVo = alarmService.getByType(bindingVo.getAlarmType(),user.getCompanyName());
ResultAlarmVo alarmVo = alarmService.getByTypeAndScene(bindingVo.getAlarmType(),alarmScene,user.getCompanyName());
for(String alias :list){ for(String alias :list){
List<AlarmRuleVo> alarmRuleVos = new ArrayList<>(); List<AlarmRuleVo> alarmRuleVos = new ArrayList<>();
AlarmRuleVo alarmRuleVo = new AlarmRuleVo(); AlarmRuleVo alarmRuleVo = new AlarmRuleVo();
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<mapper namespace="com.example.tdl.mapper.AlarmMapper"> <mapper namespace="com.example.tdl.mapper.AlarmMapper">
<!--查询所有预警信息--> <!--查询所有预警信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultAlarmVo" parameterType="String"> <select id="getAll" resultType="com.example.tdl.domain.vo.ResultAlarmVo" parameterType="String">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark SELECT alarmType,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR} WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
</select> </select>
<!--根据预警类型模糊查询--> <!--根据预警类型模糊查询-->
<select id="getAllByAlarmType" resultType="com.example.tdl.domain.vo.ResultAlarmVo" parameterType="String"> <select id="getAllByAlarmType" resultType="com.example.tdl.domain.vo.ResultAlarmVo" parameterType="String">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark SELECT alarmType,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR} WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
AND alarmType LIKE CONCAT(CONCAT('%',#{alarmType,jdbcType=VARCHAR}), '%') AND alarmType LIKE CONCAT(CONCAT('%',#{alarmType,jdbcType=VARCHAR}), '%')
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
INSERT INTO alarm VALUES ( INSERT INTO alarm VALUES (
NULL , NULL ,
#{alarmType,jdbcType=VARCHAR}, #{alarmType,jdbcType=VARCHAR},
#{alarmScene,jdbcType=VARCHAR},
#{temMax,jdbcType=FLOAT}, #{temMax,jdbcType=FLOAT},
#{temMin,jdbcType=FLOAT}, #{temMin,jdbcType=FLOAT},
#{humidityMax,jdbcType=FLOAT}, #{humidityMax,jdbcType=FLOAT},
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
<update id="updateAlarm" parameterType="com.example.tdl.domain.vo.UpdateAlarmVo"> <update id="updateAlarm" parameterType="com.example.tdl.domain.vo.UpdateAlarmVo">
UPDATE alarm SET UPDATE alarm SET
alarmType=#{alarmType,jdbcType=VARCHAR}, alarmType=#{alarmType,jdbcType=VARCHAR},
alarmScene=#{alarmScene,jdbcType=VARCHAR},
temMax=#{temMax,jdbcType=FLOAT}, temMax=#{temMax,jdbcType=FLOAT},
temMin=#{temMin,jdbcType=FLOAT}, temMin=#{temMin,jdbcType=FLOAT},
humidityMax=#{humidityMax,jdbcType=FLOAT}, humidityMax=#{humidityMax,jdbcType=FLOAT},
...@@ -46,40 +44,25 @@ ...@@ -46,40 +44,25 @@
shock=#{shock,jdbcType=VARCHAR}, shock=#{shock,jdbcType=VARCHAR},
remark=#{remark,jdbcType=VARCHAR} remark=#{remark,jdbcType=VARCHAR}
WHERE alarmType=#{oldAlarmType,jdbcType=VARCHAR} WHERE alarmType=#{oldAlarmType,jdbcType=VARCHAR}
AND alarmScene=#{oldAlarmScene,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</update> </update>
<!--删除预警信息--> <!--删除预警信息-->
<delete id="delAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo"> <delete id="delAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo">
DELETE from alarm WHERE alarmType=#{alarmType,jdbcType=VARCHAR} DELETE from alarm WHERE alarmType=#{alarmType,jdbcType=VARCHAR}
AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</delete> </delete>
<!--根据预警类型和预警场景查询--> <!--根据预警类型和预警场景查询-->
<select id="getByTypeAndScene" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo"> <select id="getByType" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark SELECT alarmType,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR} WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
AND alarmType=#{alarmType,jdbcType=VARCHAR} AND alarmType=#{alarmType,jdbcType=VARCHAR}
AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
</select>
<!--查询仓库的预警类型-->
<select id="getForWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo">
SELECT alarmType from alarm WHERE alarmScene="仓库"
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select>
<!--查询仓库的预警类型-->
<select id="getForTransportation" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo">
SELECT alarmType from alarm WHERE alarmScene="运输"
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
<select id="getAlarmByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo"> <select id="getAlarmByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,a.remark SELECT alarmType,temMax,temMin,humidityMax,humidityMin,tilt,shock,a.remark
FROM tdl_gateway_log tgl INNER JOIN alarm a ON tgl.alarm_id=a.id FROM tdl_gateway_log tgl INNER JOIN alarm a ON tgl.alarm_id=a.id
where warehouseNo=#{warehouseNo,jdbcType=VARCHAR} where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
AND gatewaySN=#{gatewaySN,jdbcType=VARCHAR} AND gatewaySN=#{gatewaySN,jdbcType=VARCHAR}
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.TDLLogMapper"> <mapper namespace="com.example.tdl.mapper.TDLLogMapper">
<select id="getByNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultGatewayVo"> <select id="getByNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultGatewayVo">
select gatewaySN SN,gatewayType type from tdl_gateway_log select gatewaySN SN,gatewayType type from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR} where transportationNo = #{transportationNo,jdbcType=VARCHAR}
GROUP BY gatewaySN GROUP BY gatewaySN
</select> </select>
<select id="getByTransportationNo" parameterType="String" resultType="com.example.tdl.domain.vo.TDLLogVo"> <select id="getByTransportationNo" parameterType="String" resultType="com.example.tdl.domain.vo.TDLLogVo">
select gatewaySN gSN,gatewayType gType, GROUP_CONCAT(TDLSN) TDLSN select gatewaySN gSN,gatewayType gType,GROUP_CONCAT(TDLSN) TDLSN
from tdl_gateway_log from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR} where transportationNo = #{transportationNo,jdbcType=VARCHAR}
</select> </select>
<select id="getTdlSN" parameterType="String" resultType="String"> <select id="getTdlSN" parameterType="String" resultType="String">
select CONCAT("TDL-",TDLSN) TDLSN select CONCAT("TDL-",TDLSN) TDLSN
from tdl_gateway_log from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR} where transportationNo = #{transportationNo,jdbcType=VARCHAR}
</select> </select>
...@@ -26,16 +26,14 @@ ...@@ -26,16 +26,14 @@
</select> </select>
<select id="getByAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo" resultType="String"> <select id="getByAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo" resultType="String">
select DISTINCT transportationNo select DISTINCT transportationNo
from tdl_gateway_log tgl ,alarm a ,company c from tdl_gateway_log tgl ,alarm a ,company c
where a.id=tgl.alarm_id where a.id=tgl.alarm_id
and a.company_id =c.id and a.company_id =c.id
AND a.alarmType=#{alarmType,jdbcType=VARCHAR} AND a.alarmType=#{alarmType,jdbcType=VARCHAR}
AND a.alarmScene=#{alarmScene,jdbcType=VARCHAR}
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
</select> </select>
<select id="getByTdl" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo"> <select id="getByTdl" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
select alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark select alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a,tdl_gateway_log t from alarm a,tdl_gateway_log t
......
...@@ -3,25 +3,25 @@ ...@@ -3,25 +3,25 @@
<mapper namespace="com.example.tdl.mapper.WarehouseMapper"> <mapper namespace="com.example.tdl.mapper.WarehouseMapper">
<!--查询所有仓库信息--> <!--查询所有仓库信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultWarehouseVo"> <select id="getAll" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
select w.warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property, select w.warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and r.id = w.region_id and r.id = w.region_id
and ct.id = w.city_id and ct.id = w.city_id
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
order by createTime desc order by createTime desc
</select> </select>
<!-- 根据条件查询仓库信息--> <!-- 根据条件查询仓库信息-->
<select id="getAllByTerm" resultType="com.example.tdl.domain.vo.ResultWarehouseVo" parameterType="com.example.tdl.domain.vo.WarehouseTermVo"> <select id="getAllByTerm" resultType="com.example.tdl.domain.vo.ResultWarehouseVo" parameterType="com.example.tdl.domain.vo.WarehouseTermVo">
select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property, select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and r.id = w.region_id and r.id = w.region_id
and ct.id = w.city_id and ct.id = w.city_id
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
<if test="warehouseName!=null"> <if test="warehouseName!=null">
AND warehouseName like CONCAT(CONCAT('%',#{warehouseName,jdbcType=VARCHAR}), '%') AND warehouseName like CONCAT(CONCAT('%',#{warehouseName,jdbcType=VARCHAR}), '%')
</if> </if>
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
</select> </select>
<select id="getWarehouseNo" resultType="java.lang.Integer" parameterType="String"> <select id="getWarehouseNo" resultType="java.lang.Integer" parameterType="String">
select count(warehouseNo) from warehouse where warehouseNo=#{warehouseNo,jdbcType=VARCHAR} select count(warehouseNo) from warehouse where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
</select> </select>
<select id="getByWarehouseName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultWarehouseVo"> <select id="getByWarehouseName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property, select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and r.id = w.region_id and r.id = w.region_id
...@@ -149,7 +149,6 @@ ...@@ -149,7 +149,6 @@
]]> ]]>
</insert> </insert>
<update id="untieGateway" parameterType="java.util.Map" statementType="CALLABLE"> <update id="untieGateway" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[ <![CDATA[
{ {
...@@ -190,9 +189,9 @@ ...@@ -190,9 +189,9 @@
</select> </select>
<!--根据报警信息查询仓库信息--> <!--根据报警信息查询仓库信息-->
<select id="getByAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo" resultType="com.example.tdl.domain.vo.ResultWarehouseVo"> <!--<select id="getByAlarm" parameterType="com.example.tdl.domain.vo.DelAlarmVo" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
SELECT warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,a.alarmType,property, SELECT warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,a.alarmType,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,w.remark
from warehouse w,alarm a ,region r,company c,city ct from warehouse w,alarm a ,region r,company c,city ct
WHERE w.alarm_id=a.id WHERE w.alarm_id=a.id
and w.city_id =ct.id and w.city_id =ct.id
...@@ -200,9 +199,8 @@ ...@@ -200,9 +199,8 @@
and w.company_id= c.id and w.company_id= c.id
and a.company_id =c.id and a.company_id =c.id
AND a.alarmType=#{alarmType,jdbcType=VARCHAR} AND a.alarmType=#{alarmType,jdbcType=VARCHAR}
AND a.alarmScene=#{alarmScene,jdbcType=VARCHAR}
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
</select> </select>-->
<select id="getByWarehouse" parameterType="com.example.tdl.domain.vo.WareHouseByTermVo" resultType="com.example.tdl.domain.vo.SimpleWarehouseVo"> <select id="getByWarehouse" parameterType="com.example.tdl.domain.vo.WareHouseByTermVo" resultType="com.example.tdl.domain.vo.SimpleWarehouseVo">
select warehouseNo, warehouseName,CONCAT_WS("-",ct.country,ct.city) regions,ct.country,ct.city, (select count(id) from tdldevice t where t.warehouse_id = w.id ) count,property,type,hardwareLevel,areaPlanIndoor select warehouseNo, warehouseName,CONCAT_WS("-",ct.country,ct.city) regions,ct.country,ct.city, (select count(id) from tdldevice t where t.warehouse_id = w.id ) count,property,type,hardwareLevel,areaPlanIndoor
...@@ -219,7 +217,6 @@ ...@@ -219,7 +217,6 @@
<if test="city!=null"> <if test="city!=null">
AND ct.city like CONCAT(CONCAT('%',#{city,jdbcType=VARCHAR}), '%') AND ct.city like CONCAT(CONCAT('%',#{city,jdbcType=VARCHAR}), '%')
</if> </if>
</select> </select>
<select id="getDevice" parameterType="String" resultType="com.example.tdl.domain.vo.DeviceVo"> <select id="getDevice" parameterType="String" resultType="com.example.tdl.domain.vo.DeviceVo">
...@@ -251,15 +248,15 @@ ...@@ -251,15 +248,15 @@
<select id="getDeviceMessage" parameterType="com.example.tdl.domain.vo.SearchTdlVo" resultType="com.example.tdl.domain.vo.DeviceMessageVo"> <select id="getDeviceMessage" parameterType="com.example.tdl.domain.vo.SearchTdlVo" resultType="com.example.tdl.domain.vo.DeviceMessageVo">
SELECT t.TDLName,g.SN,g.type,w.warehouseName,w.addressDetail,(SELECT regionName from region where w.region_id=id) regionName, SELECT t.TDLName,g.SN,g.type,w.warehouseName,w.addressDetail,(SELECT regionName from region where w.region_id=id) regionName,
a.alarmType,a.temMax,a.temMin,a.humidityMax,a.humidityMin a.alarmType,a.temMax,a.temMin,a.humidityMax,a.humidityMin
from tdl_gateway_log tgl INNER JOIN warehouse w ON tgl.warehouseNo=w.warehouseNo,gateway g,tdldevice t,alarm a from tdl_gateway_log tgl INNER JOIN warehouse w ON tgl.warehouseNo=w.warehouseNo,gateway g,tdldevice t,alarm a
where tgl.alarm_id=a.id where tgl.alarm_id=a.id
and tgl.gatewaySN=g.SN and tgl.gatewaySN=g.SN
AND tgl.TDLSN=t.TDLSN AND tgl.TDLSN=t.TDLSN
AND w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR} AND w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
AND g.SN=#{SN,jdbcType=VARCHAR} AND g.SN=#{SN,jdbcType=VARCHAR}
AND t.TDLSN=#{TDLSN,jdbcType=VARCHAR} AND t.TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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