package com.hz.employmentsite.controller.jobUserManager; import com.github.pagehelper.PageInfo; import com.hz.employmentsite.filter.exception.BaseErrorEnum; import com.hz.employmentsite.filter.exception.BaseException; import com.hz.employmentsite.filter.exception.BaseResponse; import com.hz.employmentsite.filter.exception.RespGenerstor; import com.hz.employmentsite.services.service.AccountService; import com.hz.employmentsite.services.service.jobUserManager.JobFairsService; import com.hz.employmentsite.vo.jobUserManager.JobFairsVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; import java.util.UUID; @RestController @RequestMapping(value = "/api/jobFairs") public class JobFairsController { @Autowired private JobFairsService jobFairsService; @Autowired private AccountService accountService; @ResponseBody @GetMapping("/getList") public BaseResponse getList(@RequestParam Integer pageIndex, @RequestParam Integer pageSize, @RequestParam(required = false) String jobFairsName, @RequestParam(required = false) String regionCode, @RequestParam(required = false) Date startDate, @RequestParam(required = false) Date endDate, @RequestParam(required = false) Date nowDate, @RequestParam(required = false) String loginUserID) { PageInfo list = jobFairsService.getList(pageIndex, pageSize, jobFairsName, regionCode, startDate, endDate, nowDate, loginUserID); return RespGenerstor.success(list); } @GetMapping("getById") public BaseResponse get(@RequestParam(required = false) String jobFairID) { JobFairsVo data = jobFairsService.getJobFairById(jobFairID); if (data == null) { data = new JobFairsVo(); data.setJobfairsID(UUID.randomUUID().toString()); } return RespGenerstor.success(data); } @PostMapping("save") public BaseResponse save(@RequestBody JobFairsVo data) { return RespGenerstor.success(jobFairsService.save(data, accountService.getLoginUserID())); } @ResponseBody @PostMapping("/delete") public BaseResponse delete(@RequestBody List idList) { var result = jobFairsService.deleteByIds(idList); if (result <= 0) { throw new BaseException(BaseErrorEnum.DELETE_NOT_DATA_ERROR); } return RespGenerstor.success(result); } }