package com.ims.eval.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ims.eval.config.CustomException; import com.ims.eval.entity.dto.result.R; import com.ims.eval.entity.PersonnelEvaluationRule; import com.ims.eval.service.IPersonnelEvaluationRuleService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** *

* 考评人员配置 前端控制器 *

* * @author wang * @since 2023-03-01 */ @RestController @RequestMapping("//personnel-evaluation-rule") public class PersonnelEvaluationRuleController { @Autowired private IPersonnelEvaluationRuleService personnelEvaluationRuleService; /** * 分页查询 * * @param pageNum 当前页数 * @param pageSize 当前页大小 * @param id 主键ID * @param personnelId 人员编码 * @param personnelName 人员名称 * @param companyId 所属共公司ID * @param companyName 所属公司名称 * @param deptId 所属部门 * @param position 所属部门名称 * @param evaluationCycle 人员岗位 * @param year 年 * @param month 月 * @return */ //@ImsPreAuth("eval:personnelEvaluationRule:view") @GetMapping(value = "list") public R list(@RequestParam(value = "pageNum") Integer pageNum, @RequestParam(value = "pageSize") Integer pageSize, @RequestParam(value = "id", required = false) String id, @RequestParam(value = "personnelId", required = false) String personnelId, @RequestParam(value = "personnelName", required = false) String personnelName, @RequestParam(value = "companyId", required = false) String companyId, @RequestParam(value = "companyName", required = false) String companyName, @RequestParam(value = "deptId", required = false) String deptId, @RequestParam(value = "position", required = false) String position, @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle, @RequestParam(value = "year", required = false) String year, @RequestParam(value = "month", required = false) String month) { IPage list = personnelEvaluationRuleService.list(pageNum, pageSize, id, personnelId, personnelName, companyId, companyName, deptId, position, evaluationCycle, year, month); return R.ok().data(list); } /** * 查询所有数据 * * @param id 主键ID * @param personnelId 人员编码 * @param personnelName 人员名称 * @param companyId 所属共公司ID * @param companyName 所属公司名称 * @param deptId 所属部门 * @param position 所属部门名称 * @param evaluationCycle 人员岗位 * @param year 年 * @param month 月 * @return */ //@ImsPreAuth("eval:personnelEvaluationRule:view") @GetMapping(value = "listAll") public R listAll( @RequestParam(value = "id", required = false) String id, @RequestParam(value = "personnelId", required = false) String personnelId, @RequestParam(value = "personnelName", required = false) String personnelName, @RequestParam(value = "companyId", required = false) String companyId, @RequestParam(value = "companyName", required = false) String companyName, @RequestParam(value = "deptId", required = false) String deptId, @RequestParam(value = "position", required = false) String position, @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle, @RequestParam(value = "year", required = false) String year, @RequestParam(value = "month", required = false) String month) { List list = personnelEvaluationRuleService.listAll(id, personnelId, personnelName, companyId, companyName, deptId, position, evaluationCycle, year, month); return R.ok().data(list); } /** * 添加 * * @param evaluationRule * @return */ //@ImsPreAuth("eval:personnelEvaluationRule:edit") @PostMapping(value = "/save") @ApiOperation(value = "新增(修改)", notes = "新增(修改)") public R addAll(@RequestBody PersonnelEvaluationRule evaluationRule) { try { boolean b = personnelEvaluationRuleService.saveOrUpdate(evaluationRule); if (b) { return R.ok().data(b); } else { return R.error().data("保存失败!"); } } catch (CustomException e) { return R.customError(e.getMessage()).data("失败!"); } } /** * 批量删除 * * @param ids * @return */ //@ImsPreAuth("eval:personnelEvaluationRule:remove") @PostMapping(value = "/remove/{ids}") @ApiOperation(value = "删除", notes = "删除") public R deleteAll(@PathVariable("ids") String ids) { String[] strings = ids.split(","); boolean b = personnelEvaluationRuleService.removeByIds(Arrays.asList(strings)); if (b) { return R.ok().data(b); } else { return R.error().data("删除失败!"); } } }