You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.8 KiB
Java
125 lines
3.8 KiB
Java
package com.nmgs.controller;
|
|
import com.nmgs.entity.Operators;
|
|
import com.nmgs.entity.StationInfo;
|
|
import com.nmgs.mapper.StationInfoMapper;
|
|
import com.nmgs.service.IStationInfoService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
@RequestMapping("/StationInfo")
|
|
@CrossOrigin(origins = "*")
|
|
public class StationInfoController {
|
|
|
|
public static Logger logger = LoggerFactory.getLogger(StationInfoController.class);
|
|
|
|
@Autowired
|
|
private IStationInfoService stationInfoService;
|
|
|
|
@Autowired
|
|
private StationInfoMapper stationInfoMapper;
|
|
|
|
|
|
|
|
@PostMapping("/getStationInfoList")
|
|
@ResponseBody
|
|
public Object getStationInfoList(@RequestBody Map<String, Object> params){
|
|
|
|
return stationInfoService.getStationInfoList(params);
|
|
}
|
|
|
|
@PostMapping("/getOverMsg")
|
|
@ResponseBody
|
|
public Object getOverMsg(){
|
|
|
|
return stationInfoService.getOverMsg();
|
|
}
|
|
|
|
|
|
@PostMapping("/getFiterData")
|
|
@ResponseBody
|
|
public Object getFiterData(@RequestBody Map<String, Object> params) {
|
|
System.out.println(params);
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
if("N".equals(params.get("isChange"))){
|
|
resultMap.put("subComList", stationInfoMapper.selectSubComList());
|
|
|
|
resultMap.put("roadList", stationInfoMapper.selectRoadList());
|
|
|
|
resultMap.put("staList", stationInfoMapper.selectStaList(params));
|
|
}else{
|
|
resultMap.put("staList", stationInfoMapper.selectStaList(params));
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
|
|
@PostMapping("/addStation")
|
|
@ResponseBody
|
|
public Object addStation(@RequestBody StationInfo stationInfo) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
try {
|
|
int res = stationInfoService.addStation(stationInfo);
|
|
if(res >= 0){
|
|
resultMap.put("msg","保存成功");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",1);
|
|
}else if(res == -2){
|
|
resultMap.put("msg","该收费站已经添加,不能重复添加");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",-2);
|
|
}else{
|
|
resultMap.put("msg","保存失败");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",-1);
|
|
}
|
|
return resultMap;
|
|
} catch (Exception e) {
|
|
logger.error("com.nmgs.controller.StationInfoController.addStation: 保存数据失败 "+e);
|
|
resultMap.put("msg","保存失败");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",-1);
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/deleteStation")
|
|
@ResponseBody
|
|
public Object deleteStation(@RequestBody List<StationInfo> stationInfos) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
try {
|
|
int res = stationInfoService.deleteStation(stationInfos);
|
|
if(res >= 0){
|
|
resultMap.put("msg","删除成功");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",1);
|
|
}else{
|
|
resultMap.put("msg","删除失败");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",-1);
|
|
}
|
|
return resultMap;
|
|
} catch (Exception e) {
|
|
logger.error("com.nmgs.controller.StationInfoController.deleteStation: 删除失败 "+e);
|
|
resultMap.put("msg","删除失败");
|
|
resultMap.put("data","");
|
|
resultMap.put("result",-1);
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
} |