From 93af1c6ffb9ae0e894689ad3a37b548e57d54cff Mon Sep 17 00:00:00 2001 From: linzhijie <19970921lzj> Date: 星期四, 11 三月 2021 19:10:07 +0800 Subject: [PATCH] 有注释的测评系统业务代码 --- src/main/java/com/ots/project/exam/controller/EntDemographyParamController.java | 63 +++++++++++++++++++++++++------ 1 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ots/project/exam/controller/EntDemographyParamController.java b/src/main/java/com/ots/project/exam/controller/EntDemographyParamController.java index cd4ad4d..be327ff 100644 --- a/src/main/java/com/ots/project/exam/controller/EntDemographyParamController.java +++ b/src/main/java/com/ots/project/exam/controller/EntDemographyParamController.java @@ -1,4 +1,5 @@ package com.ots.project.exam.controller; + import com.ots.common.enums.UserTypeEnum; import com.ots.common.utils.poi.ExcelUtil; import com.ots.common.utils.security.ShiroUtils; @@ -17,22 +18,34 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; + import java.util.ArrayList; import java.util.List; import java.util.Objects; +/** + * 浜哄彛瀛﹀彉閲忓畾涔塁ontroller + * + * @author ots + * @date 2019-12-11 + */ @Controller @RequestMapping("/exam/demographyParam") public class EntDemographyParamController extends BaseController { private String prefix = "exam/demographyParam"; + @Autowired private IEntDemographyParamService entDemographyParamService; + @RequiresPermissions("exam:demographyParam:view") @GetMapping() public String demographyParam() { return prefix + "/demographyParam"; } - + + /** + * 鏌ヨ浜哄彛瀛﹀彉閲忓畾涔夊垪琛� + */ @RequiresPermissions("exam:demographyParam:list") @PostMapping("/list") @ResponseBody @@ -42,14 +55,17 @@ if (Objects.isNull(entDemographyParam.getUserId()) && !Objects.equals(UserTypeEnum.SYS_USER.getUserType(), sysUser.getUserType())) { entDemographyParam.setUserId(sysUser.getUserId()); } - - - + //浜哄彛瀛︿笉鍖哄垎鐢ㄦ埛 + //宸茬粡淇敼涓轰紒涓氱敤鎴风殑浜哄彛瀛︿笉鑳借缃紝鍙湁涓�浠戒汉鍙e銆傜鐞嗗憳鍜屼唬鐞嗗晢鍙互淇敼銆傦紙褰撳墠闇�姹傦級锛岃�屼唬鐞嗗晢涓�у寲浜哄彛瀛︼紝涓嶆敮鎸併�� + //涓�浠界鐞嗗憳锛屾敼鎴愪竴浠介�氱敤 entDemographyParam.setUserId(null); List<EntDemographyParam> list = entDemographyParamService.selectEntDemographyParamList(entDemographyParam); return getDataTable(list); } - + + /** + * 鏌ヨ浜哄彛瀛﹀璇█鍒楄〃 + */ @RequiresPermissions("exam:demographyParam:list") @PostMapping("/listCodes") @ResponseBody @@ -64,14 +80,20 @@ List<DemographyDto> list = JsonUtil.toJsonListObject(langCodes, DemographyDto.class); return getDataTable(list); } - + + /** + * 鏌ヨ浜哄彛瀛﹀璇█鍒楄〃 + */ @RequiresPermissions("exam:demographyParam:list") @PostMapping("/addListCodes") @ResponseBody public TableDataInfo addListCodes(EntDemographyParam entDemographyParam) { return getDataTable(new ArrayList<EntDemographyParam>()); } - + + /** + * 瀵煎嚭浜哄彛瀛﹀彉閲忓畾涔夊垪琛� + */ @RequiresPermissions("exam:demographyParam:export") @PostMapping("/export") @ResponseBody @@ -80,23 +102,31 @@ ExcelUtil<EntDemographyParam> util = new ExcelUtil<EntDemographyParam>(EntDemographyParam.class); return util.exportExcel(list, "demographyParam"); } - + + /** + * 鏂板浜哄彛瀛﹀彉閲忓畾涔� + */ @GetMapping("/add") public String add(ModelMap mmap) { User sysUser = ShiroUtils.getSysUser(); mmap.put("sysUser", sysUser); return prefix + "/add"; } - + + /** + * 鏂板淇濆瓨浜哄彛瀛﹀彉閲忓畾涔� + */ @RequiresPermissions("exam:demographyParam:add") @Log(title = "浜哄彛瀛﹀彉閲忓畾涔�", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(EntDemographyParam entDemographyParam) { + User sysUser = ShiroUtils.getSysUser(); if (!Objects.equals(UserTypeEnum.SYS_USER.getUserType(), sysUser.getUserType())) { return error("鍙湁绯荤粺鐢ㄦ埛鎵嶅厑璁告坊鍔犱汉鍙e鍙橀噺锛�"); } + EntDemographyParam param = new EntDemographyParam(); param.setParamCode(entDemographyParam.getParamCode()); List<EntDemographyParam> entDemographyParams = entDemographyParamService.selectEntDemographyParamList(param); @@ -105,14 +135,20 @@ } return toAjax(entDemographyParamService.insertEntDemographyParam(entDemographyParam)); } - + + /** + * 淇敼浜哄彛瀛﹀彉閲忓畾涔� + */ @GetMapping("/edit/{paramId}") public String edit(@PathVariable("paramId") Long paramId, ModelMap mmap) { EntDemographyParam entDemographyParam = entDemographyParamService.selectEntDemographyParamById(paramId); mmap.put("entDemographyParam", entDemographyParam); return prefix + "/edit"; } - + + /** + * 淇敼淇濆瓨浜哄彛瀛﹀彉閲忓畾涔� + */ @RequiresPermissions("exam:demographyParam:edit") @Log(title = "浜哄彛瀛﹀彉閲忓畾涔�", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -120,7 +156,10 @@ public AjaxResult editSave(EntDemographyParam entDemographyParam) { return toAjax(entDemographyParamService.updateEntDemographyParam(entDemographyParam)); } - + + /** + * 鍒犻櫎浜哄彛瀛﹀彉閲忓畾涔� + */ @RequiresPermissions("exam:demographyParam:remove") @Log(title = "浜哄彛瀛﹀彉閲忓畾涔�", businessType = BusinessType.DELETE) @PostMapping("/remove") -- Gitblit v1.9.1