package cn.cmts.member.system.controller;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.cmts.member.base.controller.BaseController;
import cn.cmts.member.entity.T0401_carinfo;
import cn.cmts.member.entity.T0402_carstation;
import cn.cmts.member.entity.T0403_station;
import cn.cmts.member.entity.T0404_userfee;
import cn.cmts.member.entity.T0405_koufeidetail;
import cn.cmts.member.system.service.IParkingService;
import cn.cmts.member.util.CPO;
/**
* @see
* @author admin
*/
@Controller
@RequestMapping(value = "/Parking")
public class ParkingController extends BaseController {
// 日志操作类
private static Logger logger = Logger.getLogger(ParkingController.class);
@Autowired
private IParkingService parkingService;
// 1列表-车位
/**
* @see 1列表-车位
*/
@RequestMapping(value = "/getStationList")
public String getStationList(Model model, T0403_station t0403) {
// 初始化分页-总数
Integer totalCount = parkingService.getStationCount(t0403);
// 初始化分页
this.initPage(t0403, totalCount);
// 初始化分页-列表查询
List<T0403_station> list = new ArrayList<T0403_station>();
if (totalCount != null && totalCount > 0) {
list = parkingService.getStationList(t0403);
}
// 返回数据
model.addAttribute("list", list);
model.addAttribute("m", t0403);
return "station/stationList";
}
/**
* @see 跳转到 -- 新增页
*/
@RequestMapping(value = "/addStation")
public String addStation(Model model) {
return "station/stationAdd";
}
/**
* @see 保存
*/
@RequestMapping(value = "/saveStation")
public String saveStation(Model model, HttpServletRequest request,
HttpServletResponse response, T0403_station t0403) {
try {
// 添加记录
parkingService.addStation(t0403);
t0403.setMsg("1"); // 成功
} catch (Exception e) {
e.printStackTrace();
t0403.setMsg("0"); // 失败
}
t0403.setSinfo("");
t0403.setState("");
return getStationList(model, t0403);
}
/**
* @see 跳转到 -- 编辑页
*/
@RequestMapping(value = "/editStation")
public String editStation(Model model, @RequestParam("sid") String sid) {
// 查询
T0403_station t0403 = new T0403_station();
t0403.setSid(Long.parseLong(sid));
t0403 = parkingService.selectStationById(t0403);
// 返回
model.addAttribute("m", t0403);
return "station/stationEdit";
}
/**
* @see 更新
*/
@RequestMapping(value = "/updateStation")
public String updateStation(Model model, HttpServletRequest request,
HttpServletResponse response, T0403_station t0403) {
try {
//更新记录
parkingService.updateStationById(t0403);
// 成功
t0403.setMsg("1");
} catch (Exception e) {
e.printStackTrace();
t0403.setMsg("0"); // 失败
}
t0403.setSinfo("");
t0403.setState("");
return getStationList(model, t0403);
}
/**
* @see 跳转到 -- 预定车位
*/
@RequestMapping(value = "/yudingStation")
public String yudingStation(Model model, @RequestParam("sid") String sid) {
// 查询
T0403_station t0403 = new T0403_station();
t0403.setSid(Long.parseLong(sid));
t0403 = parkingService.selectStationById(t0403);
// 返回
model.addAttribute("m", t0403);
return "station/stationYuding";
}
/**
* @see 修改车位状态
*/
@RequestMapping(value = "/changeStationState")
@ResponseBody
public String changeStationState(Model model, HttpServletRequest request,
HttpServletResponse response, T0403_station t0403) {
try {
//更新记录
parkingService.changeStationStateById(t0403);
// 成功
t0403.setMsg("1");
} catch (Exception e) {
e.printStackTrace();
t0403.setMsg("0"); // 失败
}
return t0403.getMsg();
}
/**
* @see 删除
*/
@RequestMapping(value = "/delStation")
public String delStation(Model model, @RequestParam("sid") String sid) {
T0403_station t0403 = new T0403_station();
t0403.setMsg("0");// 操作失败
try {
// 查询详细
t0403.setSid(Long.parseLong(sid));
// 删除
parkingService.delStation(t0403);
t0403.setMsg("1");// 操作成功
} catch (Exception e) {
e.printStackTrace();
}
t0403.setSinfo("");
t0403.setState("");
return getStationList(model, t0403);
}
// 2列表-车
/**
* @see 2列表-车
*/
@RequestMapping(value = "/getCarList")
public String getCarList(Model model, T0401_carinfo t0401) {
// 初始化分页-总数
Integer totalCount = parkingService.getCarCount(t0401);
// 初始化分页
this.initPage(t0401, totalCount);
// 初始化分页-列表查询
List<T0401_carinfo> list = new ArrayList<T0401_carinfo>();
if (totalCount != null && totalCount > 0) {
list = parkingService.getCarList(t0401);
}
// 返回数据
model.addAttribute("list", list);
model.addAttribute("m", t0401);
return "car/carList";
}
/**
* @see 跳转到 -- 新增页
*/
@RequestMapping(value = "/addCar")
public String addCar(Model model) {
return "car/carAdd";
}
/**
* @see 保存
*/
@RequestMapping(value = "/saveCar")
public String saveCar(Model model, HttpServletRequest request,
HttpServletResponse response, T0401_carinfo t0401) {
try {
// 添加记录
parkingService.addCar(t0401);
t0401.setMsg("1"); // 成功
} catch (Exception e) {
e.printStackTrace();
t0401.setMsg("0"); // 失败
}
t0401.setCno("");
return getCarList(model, t0401);
}
/**
* @see 跳转到 -- 编辑页
*/
@RequestMapping(value = "/editCar")
public String editCar(Model model, @RequestParam("cid") String cid) {
// 查询
T0401_carinfo t0401 = new T0401_carinfo();
t0401.setCid(Long.parseLong(cid));
t0401 = parkingService.selectCarById(t0401);
// 返回
model.addAttribute("m", t0401);
return "car/carEdit";
}
/**
* @see 更新
*/
@RequestMapping(value = "/updateCar")
public String updateCar(Model model, HttpServletRequest request,
HttpServletResponse response, T0401_carinfo t0401) {
try {
//更新记录
parkingService.updateCarById(t0401);
// 成功
t0401.setMsg("1");
} catch (Exception e) {
e.printStackTrace();
t0401.setMsg("0"); // 失败
}
t0401.setCno("");
return getCarList(model, t0401);
胥华引
- 粉丝: 97
- 资源: 439
最新资源
- 电动汽车蒙特卡洛分析matlab 通过matlab程序编写电动汽车蒙特卡洛模型,得到汽车行驶里程的概率分布曲线和充电功率曲线,程序运行可靠,有参考资料
- Prius2004永磁同步电机设计报告: (文档是我一个字一个字打出来的原创内容,模型也是自己搭建的) 磁路法、maxwell有限元法、MotorCAD温仿真、应力分析 (内容比较完善 ) 内容:
- JavaScriptkeyCodeJavaScript键盘键值大集合PDF
- 湘潭大学OJ系统质因数分解题目xtuojfactorization解析
- labview采集系统(数据保存到excel)可实现多个数据数据的采集
- 开源翻译模型 facebook/m2m100-418m
- websocket技术总结PDF
- Python 实现基于门控循环单元(GRU)的多输入单输出回归预测的方法的示例(含完整的程序,GUI设计和代码详解)
- Matlab基于TCN-LSTM-Attention单变量时间序列多步预测的详细项目实例(含完整的程序,GUI设计和代码详解)
- Matlab实现CNN-LSTM-SAM-Attention卷积长短期记忆神经网络融合空间注意力机制的数据分类预测的详细项目实例(含完整的程序,GUI设计和代码详解)
- roundtrip-governance.png
- Matlab实现BES-CNN-GRU-Mutilhead-Attention多变量时间序列预测的详细项目实例(含完整的程序,GUI设计和代码详解)
- Matlab实现WOA-LSSVM鲸鱼算法优化最小二乘支持向量机多输入多输出预测的详细项目实例(含完整的程序,GUI设计和代码详解)
- MATLAB 实现基于SCSO(沙猫群优化算法)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- MATLAB 实现基于IBL(改进二进制逻辑优化算法)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- linux常用命令大全.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈