123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package com.hz.employmentsite.controller.baseSettings;
- import com.github.pagehelper.PageInfo;
- import com.hz.employmentsite.filter.exception.BaseResponse;
- import com.hz.employmentsite.filter.exception.RespGenerstor;
- import com.hz.employmentsite.model.PcLabel;
- import com.hz.employmentsite.services.service.AccountService;
- import com.hz.employmentsite.services.service.baseSettings.LabelService;
- import com.hz.employmentsite.vo.baseSettings.LabelVo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.UUID;
- @RestController
- @RequestMapping("/api/label/")
- public class LabelController {
- @Autowired
- private LabelService labelService;
- @Autowired
- private AccountService accountService;
- @ResponseBody
- @GetMapping("/getList")
- public BaseResponse<PageInfo<LabelVo>> getList(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
- @RequestParam(required = false) String labelID, @RequestParam(required = false) String labelName,
- @RequestParam(required = false) String labelType, @RequestParam(required = false) String bigType) {
- PageInfo<LabelVo> result = labelService.getLabelList(pageIndex,pageSize,labelID, labelName,labelType,bigType);
- return RespGenerstor.success(result);
- }
- @GetMapping("get")
- public BaseResponse<PcLabel> get(@RequestParam(required = false) String id) {
- var data = labelService.getDataById(id);
- if (data == null) {
- data = new PcLabel();
- data.setLabelID(UUID.randomUUID().toString());
- }
- return RespGenerstor.success(data);
- }
- @PostMapping("/save")
- public BaseResponse<Integer> save(@RequestBody PcLabel data) {
- return RespGenerstor.success(labelService.save(data,accountService.getLoginUserID()));
- }
- @ResponseBody
- @PostMapping("/delete")
- public BaseResponse<Integer> delete(@RequestBody List<String> idList){
- return RespGenerstor.success(labelService.delete(idList));
- }
- }
|