| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.moral.api.entity.SpecialDevice; |
| | | import com.moral.api.service.SpecialDeviceService; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "insert", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage insert(@RequestBody SpecialDevice specialDevice){ |
| | | System.out.println(specialDevice); |
| | | Map<String,Object> resultMap = specialDeviceService.insert(specialDevice); |
| | | String msg = resultMap.get("msg").toString(); |
| | | int code = Integer.parseInt(resultMap.get("code").toString()); |
| | | if (code == 0){ |
| | | return ResultMessage.ok(msg); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | } |