LabelController.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.hz.employmentsite.controller.baseSettings;
  2. import com.github.pagehelper.PageInfo;
  3. import com.hz.employmentsite.filter.exception.BaseResponse;
  4. import com.hz.employmentsite.filter.exception.RespGenerstor;
  5. import com.hz.employmentsite.model.PcLabel;
  6. import com.hz.employmentsite.services.service.AccountService;
  7. import com.hz.employmentsite.services.service.baseSettings.LabelService;
  8. import com.hz.employmentsite.vo.baseSettings.LabelVo;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.List;
  12. import java.util.UUID;
  13. @RestController
  14. @RequestMapping("/api/label/")
  15. public class LabelController {
  16. @Autowired
  17. private LabelService labelService;
  18. @Autowired
  19. private AccountService accountService;
  20. @ResponseBody
  21. @GetMapping("/getList")
  22. public BaseResponse<PageInfo<LabelVo>> getList(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
  23. @RequestParam(required = false) String labelID, @RequestParam(required = false) String labelName,
  24. @RequestParam(required = false) String labelType, @RequestParam(required = false) String bigType) {
  25. PageInfo<LabelVo> result = labelService.getLabelList(pageIndex,pageSize,labelID, labelName,labelType,bigType);
  26. return RespGenerstor.success(result);
  27. }
  28. @GetMapping("get")
  29. public BaseResponse<PcLabel> get(@RequestParam(required = false) String id) {
  30. var data = labelService.getDataById(id);
  31. if (data == null) {
  32. data = new PcLabel();
  33. data.setLabelID(UUID.randomUUID().toString());
  34. }
  35. return RespGenerstor.success(data);
  36. }
  37. @PostMapping("/save")
  38. public BaseResponse<Integer> save(@RequestBody PcLabel data) {
  39. return RespGenerstor.success(labelService.save(data,accountService.getLoginUserID()));
  40. }
  41. @ResponseBody
  42. @PostMapping("/delete")
  43. public BaseResponse<Integer> delete(@RequestBody List<String> idList){
  44. return RespGenerstor.success(labelService.delete(idList));
  45. }
  46. }