/** * 版权所有 @鸿名物联 * 未经授权,禁止侵权和商业,违法必究 * 联系QQ:2224313811 * */ package com.lp.controller.iot; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.lp.bo.AlarmTriggerStatisticBO; import com.lp.common.Constants; import com.lp.common.Code; import com.lp.common.RequestURLIOT; import com.lp.controller.BaseController; import com.lp.util.ObjectUtil; import com.lp.util.ResultMapUtils; @Controller public class AlarmTriggerStatisticController extends BaseController { /** * 检索 */ @RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC_PAGE) public ModelAndView selectPage(HttpServletResponse response, @RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey, @RequestBody AlarmTriggerStatisticBO obj, @RequestParam(required = false) Integer pageSize, @RequestParam Integer paged) { Map resultMap = getResultMap(); try { resultMap = service.selectPageList("AlarmTriggerStatistic.selectPage", getPageBean(paged, pageSize), obj); } catch (Exception e) { exception(e, resultMap, obj); } return getModelAndView(response, resultMap); } /** * 插入 */ @RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC) public ModelAndView save(HttpServletResponse response, @RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey, @RequestBody AlarmTriggerStatisticBO obj) { Map resultMap = getResultMap(); try { resultMap = service.insert("AlarmTriggerStatistic.insert", obj); } catch (Exception e) { exception(e, resultMap, obj); } return getModelAndView(response, resultMap); } /** * 查询单个 */ @RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC) public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) { Map resultMap = getResultMap(); try { resultMap = service.selectOne("AlarmTriggerStatistic.selectOne", new AlarmTriggerStatisticBO(id)); } catch (Exception e) { exception(e, resultMap, id); } return getModelAndView(response, resultMap); } /** * 更新 */ @RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC) public ModelAndView update(HttpServletResponse response, @RequestBody AlarmTriggerStatisticBO obj) { Map resultMap = getResultMap(); try { resultMap = service.update("AlarmTriggerStatistic.update", obj); } catch (Exception e) { exception(e, resultMap, obj); } return getModelAndView(response, resultMap); } /** * 删除 */ @RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC) public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) { Map resultMap = getResultMap(); try { AlarmTriggerStatisticBO obj = new AlarmTriggerStatisticBO(); if (ObjectUtil.isEmpty(id)) { putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR); } else { obj.setId(id); obj.setDelete_flag(Constants.DELETE.YES); resultMap = service.update("AlarmTriggerStatistic.update", obj); } } catch (Exception e) { exception(e, resultMap, id); } return getModelAndView(response, resultMap); } }