package com.ims.eval.controller; import com.ims.eval.config.CustomException; import com.ims.eval.entity.dto.result.R; import com.ims.eval.entity.EvaluateRuleInfo; import com.ims.eval.service.IEvaluateRuleInfoService; 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-02-28 */ @RestController @RequestMapping("//evaluate-rule-info") public class EvaluateRuleInfoController { @Autowired private IEvaluateRuleInfoService evaluateRuleInfoService; /** * 查询 list * * @param id 主键 * @param des 描述 * @param indicatorId 指标ID * @return */ //@ImsPreAuth("eval:dataDictionary:view") @GetMapping(value = "list") public R list(@RequestParam(value = "id", required = false) String id, @RequestParam(value = "des", required = false) String des, @RequestParam(value = "indicatorId", required = false) String indicatorId, @RequestParam(value = "evaluateRuleId", required = false) String evaluateRuleId, @RequestParam(value = "indicatorName", required = false) String indicatorName) { List list = evaluateRuleInfoService.list(id, des, indicatorId, evaluateRuleId,indicatorName); return R.ok().data(list); } /** * 添加 * * @param evaluateRuleInfo * @return */ //@ImsPreAuth("eval:dataDictionary:edit") @PostMapping(value = "/save") @ApiOperation(value = "新增(修改)", notes = "新增(修改)") public R addAll(@RequestBody EvaluateRuleInfo evaluateRuleInfo) { try { boolean b = evaluateRuleInfoService.saveOrUpdate(evaluateRuleInfo); 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:dataDictionary:remove") @PostMapping(value = "/remove/{ids}") @ApiOperation(value = "删除", notes = "删除") public R deleteAll(@PathVariable("ids") String ids) { String[] strings = ids.split(","); // boolean b = evaluateRuleInfoService.removeByIds(Arrays.asList(strings)); boolean b = evaluateRuleInfoService.updateDeleteTime(Arrays.asList(strings)); if (b) { return R.ok().data(b); } else { return R.error().data("删除失败!"); } } }