4e55f93dcd2cfcd945f4d72b1948b7b3b7df8c23.svn-base 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package cn.com.goldenwater.dcproj.controller.vill;
  2. import cn.com.goldenwater.dcproj.model.AttEngHyst;
  3. import cn.com.goldenwater.dcproj.service.AttEngHystService;
  4. import cn.com.goldenwater.core.web.BaseController;
  5. import cn.com.goldenwater.core.web.BaseResponse;
  6. import cn.com.goldenwater.id.util.UuidUtil;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import io.swagger.annotations.ApiParam;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestMethod;
  17. import org.springframework.web.bind.annotation.RestController;
  18. /**
  19. * @author lune
  20. * @date 2019-2-18
  21. */
  22. @Api(value = "xxx管理", tags = "xxx管理")
  23. @RestController
  24. @RequestMapping("/dc/eng/hyst")
  25. public class AttEngHystController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private AttEngHystService attEngHystService;
  29. @ApiOperation(value = "添加xxx")
  30. @RequestMapping(value = "", method = RequestMethod.POST)
  31. public BaseResponse<String> insert(@ApiParam(name = "attEngHyst", value = "AttEngHyst", required = true) @RequestBody AttEngHyst attEngHyst) {
  32. String uuid = UuidUtil.uuid(); // 生成uuid
  33. attEngHystService.insert(attEngHyst);
  34. return buildSuccessResponse(uuid);
  35. }
  36. @ApiOperation(value = "根据ID删除xxx")
  37. @RequestMapping(value = "/{id}", method = RequestMethod.POST)
  38. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  39. attEngHystService.delete(id);
  40. return buildSuccessResponse();
  41. }
  42. @ApiOperation(value = "更新xxx信息")
  43. @RequestMapping(value = "/update", method = RequestMethod.POST)
  44. public BaseResponse update(@ApiParam(name = "attEngHyst", value = "AttEngHyst", required = true) @RequestBody AttEngHyst attEngHyst) {
  45. attEngHystService.update(attEngHyst);
  46. return buildSuccessResponse();
  47. }
  48. @ApiOperation(value = "根据ID获取xxx(单表)")
  49. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  50. public BaseResponse<AttEngHyst> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. AttEngHyst attEngHyst = attEngHystService.get(id);
  52. return buildSuccessResponse(attEngHyst);
  53. }
  54. }