53b8ef911a6849b158a5827e1fff6c11e4a45b0f.svn-base 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package cn.com.goldenwater.dcproj.controller.wtprj;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttWtprjBase;
  5. import cn.com.goldenwater.dcproj.service.AttWtprjBaseService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.apache.commons.lang3.StringUtils;
  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.*;
  14. /**
  15. * @author lhc
  16. * @date 2021-4-14
  17. */
  18. @Api(value = "xxx管理", tags = "xxx管理")
  19. @RestController
  20. @RequestMapping("/att/wtprj/base")
  21. public class AttWtprjBaseController extends BaseController {
  22. private Logger logger = LoggerFactory.getLogger(getClass());
  23. @Autowired
  24. private AttWtprjBaseService attWtprjBaseService;
  25. @ApiOperation(value = "修改xxx")
  26. @RequestMapping(value = "", method = RequestMethod.POST)
  27. public BaseResponse<AttWtprjBase> insert(@ApiParam(name = "attWtprjBase", value = "AttWtprjBase", required = true)
  28. @RequestBody AttWtprjBase attWtprjBase) {
  29. int ret = 0;
  30. if (StringUtils.isBlank(attWtprjBase.getId())) {
  31. ret = attWtprjBaseService.insert(attWtprjBase);
  32. } else {
  33. ret = attWtprjBaseService.update(attWtprjBase);
  34. }
  35. return buildSuccessResponse(attWtprjBase);
  36. }
  37. @ApiOperation(value = "根据ID删除xxx")
  38. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  39. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  40. int ret = attWtprjBaseService.delete(id);
  41. return buildSuccessResponse();
  42. }
  43. @ApiOperation(value = "根据ID获取xxx(单表)")
  44. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  45. public BaseResponse<AttWtprjBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  46. AttWtprjBase attWtprjBase = attWtprjBaseService.get(id);
  47. return buildSuccessResponse(attWtprjBase);
  48. }
  49. @ApiOperation(value = "根据 objId 获取基本信息(单表)")
  50. @RequestMapping(value = "/getObjId/{objId}", method = {RequestMethod.GET, RequestMethod.POST})
  51. public BaseResponse<AttWtprjBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true)
  52. @PathVariable String objId) {
  53. return buildSuccessResponse(attWtprjBaseService.getObjId(objId));
  54. }
  55. }