| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.group.Update; |
| | | import com.ycl.jxkg.group.Add; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import javax.validation.constraints.NotEmpty; |
| | |
| | | import com.ycl.jxkg.domain.query.ExamTemplateQuery; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.ycl.jxkg.enums.DeductTypeEnum.EachCorrect; |
| | | import static com.ycl.jxkg.enums.DeductTypeEnum.PartCorrect; |
| | | |
| | | /** |
| | | * 随机试卷模板 前端控制器 |
| | |
| | | public class ExamTemplateController { |
| | | |
| | | private final ExamTemplateService examTemplateService; |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加", notes = "添加") |
| | | public Result add(@RequestBody @Validated(Add.class) ExamTemplateForm form) { |
| | | //参数校验 |
| | | if(form.getDeductType()!=null && (form.getDeductType() ==PartCorrect.getCode() || form.getDeductType() == EachCorrect.getCode()) && (form.getDeductTypeScore() ==null || form.getDeductTypeScore().compareTo(BigDecimal.ZERO) <= 0)){ |
| | | return Result.fail(SystemCode.ParameterValidError.getCode(),"多选评分不能为0或空"); |
| | | } |
| | | return examTemplateService.add(form); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public Result update(@RequestBody @Validated(Update.class) ExamTemplateForm form) { |
| | | //参数校验 |
| | | if(form.getDeductType()!=null && (form.getDeductType() ==PartCorrect.getCode() || form.getDeductType() == EachCorrect.getCode()) && (form.getDeductTypeScore() ==null || form.getDeductTypeScore().compareTo(BigDecimal.ZERO) <= 0)){ |
| | | return Result.fail(SystemCode.ParameterValidError.getCode(),"多选评分不能为0或空"); |
| | | } |
| | | return examTemplateService.update(form); |
| | | } |
| | | |