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.model.PcExperience; import com.hz.employmentsite.services.service.AccountService; import com.hz.employmentsite.services.service.jobUserManager.ExperienceService; 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/jobUserService/experience") public class ExperienceController { @Autowired private ExperienceService experienceService; @Autowired private AccountService accountService; @ResponseBody @GetMapping("/getListByJobUserID") public BaseResponse getListByJobUserID(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize, @RequestParam(required = false) String jobUserID) { PageInfo result = experienceService.getListByJobUserID(pageIndex, pageSize,jobUserID); return RespGenerstor.success(result); } @ResponseBody @GetMapping("/getById") public BaseResponse getById(@RequestParam(required = false) String experienceID) { PcExperience dataModel = new PcExperience(); if (experienceID == null || experienceID == ""){ dataModel.setExperienceID(UUID.randomUUID().toString()); dataModel.setStartTime(new Date()); dataModel.setEndTime(new Date()); }else{ dataModel = experienceService.getById(experienceID); } return RespGenerstor.success(dataModel); } @PostMapping("save") public BaseResponse save(@RequestBody PcExperience data) { String loginUserID = "";//data.loginUserID; try { loginUserID = accountService.getLoginUserID(); } catch (Exception e){ } return RespGenerstor.success(experienceService.save(data,loginUserID)); } @ResponseBody @PostMapping("/deleteExperience") public BaseResponse deleteExperience(@RequestBody List ids) { var result = experienceService.deleteExperienceByIDs(ids); if (result <= 0) { throw new BaseException(BaseErrorEnum.DELETE_NOT_DATA_ERROR); } return RespGenerstor.success(1); } }