| package com.moral.api.controller; | 
|   | 
| import com.moral.api.service.SpecialDeviceHistoryService; | 
| import com.moral.constant.ResponseCodeEnum; | 
| import com.moral.constant.ResultMessage; | 
| import com.moral.util.WebUtils; | 
| import io.swagger.annotations.Api; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import javax.annotation.Resource; | 
| import javax.servlet.http.HttpServletRequest; | 
| import java.util.Map; | 
|   | 
| @Slf4j | 
| @Api(tags = {"特殊设备历史"}) | 
| @RestController | 
| @RequestMapping("/specialDeviceHistory") | 
| public class SpecialDeviceHistoryController { | 
|   | 
|     @Resource | 
|     private SpecialDeviceHistoryService specialDeviceHistoryService; | 
|   | 
|     @RequestMapping(value = "getSpecialDeviceHistoryByCondition",method = RequestMethod.GET) | 
|     @ResponseBody | 
|     public ResultMessage getSpecialDeviceHistoryByCondition(HttpServletRequest request){ | 
|         Map<String,Object> parameters = WebUtils.getParametersStartingWith(request,null); | 
|         Map resultMap = specialDeviceHistoryService.getDataByCondition(parameters); | 
|         if (!resultMap.containsKey("code")){ | 
|             return ResultMessage.ok(resultMap); | 
|         } | 
|         return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); | 
|     } | 
|   | 
|     @RequestMapping(value = "delete", method = RequestMethod.POST) | 
|     @ResponseBody | 
|     public ResultMessage delete(@RequestBody Map map){ | 
|         if (map.get("id") == null){ | 
|             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), | 
|                     ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|         } | 
|         specialDeviceHistoryService.delete(Integer.parseInt(map.get("id").toString())); | 
|         return ResultMessage.ok(); | 
|     } | 
| } |