瀏覽代碼

(*)新增和修改导向目标;

linxiaobin 5 月之前
父節點
當前提交
6e915587b4

+ 15 - 7
education-api/src/main/java/com/education/api/controller/admin/education/GoalInfoController.java

@@ -4,14 +4,14 @@ import com.education.business.service.education.GoalInfoService;
 import com.education.common.base.BaseController;
 import com.education.common.utils.Result;
 import com.education.common.utils.ResultCode;
-import com.education.model.dto.GoalInfoDto;
 import com.education.model.dto.GoalInfoReqDto;
-import com.education.model.entity.ExtKnowledgePoint;
+import com.education.model.dto.GoalInfoSaveDto;
 import com.education.model.entity.GoalInfo;
 import com.education.model.request.PageParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.beans.BeanUtils;
 
 /**
  * 导向目标管理
@@ -23,26 +23,34 @@ public class GoalInfoController extends BaseController {
     @Autowired
     private GoalInfoService goalInfoService;
 
+    private GoalInfo TransformGoalInfoSaveDto(GoalInfoSaveDto goalInfoSaveDto) {
+        GoalInfo goalInfo = new GoalInfo();
+        BeanUtils.copyProperties(goalInfoSaveDto, goalInfo);
+        return goalInfo;
+    }
+
     /**
      * 添加导向目标
-     * @param goalInfo
+     * @param goalInfoSaveDto
      * @return
      */
     @PostMapping
     //@RequiresPermissions("system:goalInfo:save")
-    public Result add(@RequestBody GoalInfoDto goalInfo) {
+    public Result add(@RequestBody @Validated(GoalInfoSaveDto.Add.class) GoalInfoSaveDto goalInfoSaveDto) {
+        GoalInfo goalInfo = TransformGoalInfoSaveDto(goalInfoSaveDto);
         Integer id = goalInfoService.add(goalInfo);
         return Result.success(id);
     }
 
     /**
      * 更新导向目标
-     * @param goalInfo
+     * @param goalInfoSaveDto
      * @return
      */
     @PutMapping
     //@RequiresPermissions("system:goalInfo:update")
-    public Result update(@RequestBody @Validated(GoalInfo.Update.class) GoalInfo goalInfo) {
+    public Result update(@RequestBody @Validated(GoalInfoSaveDto.Update.class) GoalInfoSaveDto goalInfoSaveDto) {
+        GoalInfo goalInfo = TransformGoalInfoSaveDto(goalInfoSaveDto);
         goalInfoService.saveOrUpdate(goalInfo);
         return Result.success();
     }
@@ -73,7 +81,7 @@ public class GoalInfoController extends BaseController {
         goalInfo.setSchoolType(goalInfoReqDto.getSchoolType());
         goalInfo.setGradeId(goalInfoReqDto.getGradeId());
         goalInfo.setCourseId(goalInfoReqDto.getCourseId());
-        goalInfo.setgOriented(goalInfoReqDto.getGOriented());
+        goalInfo.setgOriented(goalInfoReqDto.getgOriented());
         return Result.success(goalInfoService.selectPageList(pageParam, goalInfo));
     }
 }

+ 30 - 1
education-model/src/main/java/com/education/model/dto/GoalInfoReqDto.java

@@ -2,7 +2,6 @@ package com.education.model.dto;
 
 import lombok.Data;
 
-@Data
 public class GoalInfoReqDto {
     /**
      * 阶段id
@@ -24,5 +23,35 @@ public class GoalInfoReqDto {
      */
     private String gOriented;
 
+    public Integer getSchoolType() {
+        return schoolType;
+    }
 
+    public void setSchoolType(Integer schoolType) {
+        this.schoolType = schoolType;
+    }
+
+    public Integer getGradeId() {
+        return gradeId;
+    }
+
+    public void setGradeId(Integer gradeId) {
+        this.gradeId = gradeId;
+    }
+
+    public Integer getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Integer courseId) {
+        this.courseId = courseId;
+    }
+
+    public String getgOriented() {
+        return gOriented;
+    }
+
+    public void setgOriented(String gOriented) {
+        this.gOriented = gOriented;
+    }
 }

+ 204 - 0
education-model/src/main/java/com/education/model/dto/GoalInfoSaveDto.java

@@ -0,0 +1,204 @@
+package com.education.model.dto;
+
+import com.education.model.entity.GoalInfo;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.groups.Default;
+import lombok.Data;
+
+public class GoalInfoSaveDto {
+
+    @NotNull(groups = Update.class)
+    private Integer id;
+
+    /**
+     * 学科名称
+     */
+    @NotNull
+    private Integer subjectId;
+
+    /**
+     * 阶段id
+     */
+    private Integer schoolType;
+
+    /**
+     * 试题类型
+     */
+    private Integer courseSectionId;
+
+    /**
+     * 课程id
+     */
+    @NotNull
+    private Integer courseId;
+
+    //年级,可为空
+    private Integer gradeId;
+
+    /**
+     * 试题内容
+     */
+    private String content;
+
+    /**
+     * 导向目标G
+     */
+    @NotEmpty
+    private String gOriented;
+
+    /**
+     * P评分标准
+     */
+    private String pScoreStd;
+
+    /**
+     * S评分标准
+     */
+    private String sScoreStd;
+
+    /**
+     * R评分标准
+     */
+    private String rScoreStd;
+
+    /**
+     * E评分标准
+     */
+    private String eScoreStd;
+
+    /**
+     * N评分标准
+     */
+    private String nScoreStd;
+
+    //知识点
+    private String knowPoints;
+
+    //发布标识,0-未发布,1-已发布
+    private Integer publishFlag;
+
+    public @NotNull(groups = Update.class) Integer getId() {
+        return id;
+    }
+
+    public void setId(@NotNull(groups = Update.class) Integer id) {
+        this.id = id;
+    }
+
+    public @NotNull(groups = Update.class) Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(@NotNull(groups = Update.class) Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getSchoolType() {
+        return schoolType;
+    }
+
+    public void setSchoolType(Integer schoolType) {
+        this.schoolType = schoolType;
+    }
+
+    public Integer getCourseSectionId() {
+        return courseSectionId;
+    }
+
+    public void setCourseSectionId(Integer courseSectionId) {
+        this.courseSectionId = courseSectionId;
+    }
+
+    public Integer getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Integer courseId) {
+        this.courseId = courseId;
+    }
+
+    public Integer getGradeId() {
+        return gradeId;
+    }
+
+    public void setGradeId(Integer gradeId) {
+        this.gradeId = gradeId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public @NotEmpty String getgOriented() {
+        return gOriented;
+    }
+
+    public void setgOriented(@NotEmpty String gOriented) {
+        this.gOriented = gOriented;
+    }
+
+    public String getpScoreStd() {
+        return pScoreStd;
+    }
+
+    public void setpScoreStd(String pScoreStd) {
+        this.pScoreStd = pScoreStd;
+    }
+
+    public String getsScoreStd() {
+        return sScoreStd;
+    }
+
+    public void setsScoreStd(String sScoreStd) {
+        this.sScoreStd = sScoreStd;
+    }
+
+    public String getrScoreStd() {
+        return rScoreStd;
+    }
+
+    public void setrScoreStd(String rScoreStd) {
+        this.rScoreStd = rScoreStd;
+    }
+
+    public String geteScoreStd() {
+        return eScoreStd;
+    }
+
+    public void seteScoreStd(String eScoreStd) {
+        this.eScoreStd = eScoreStd;
+    }
+
+    public String getnScoreStd() {
+        return nScoreStd;
+    }
+
+    public void setnScoreStd(String nScoreStd) {
+        this.nScoreStd = nScoreStd;
+    }
+
+    public String getKnowPoints() {
+        return knowPoints;
+    }
+
+    public void setKnowPoints(String knowPoints) {
+        this.knowPoints = knowPoints;
+    }
+
+    public Integer getPublishFlag() {
+        return publishFlag;
+    }
+
+    public void setPublishFlag(Integer publishFlag) {
+        this.publishFlag = publishFlag;
+    }
+
+    public interface Add extends Default {}
+    public interface Update extends Default{}
+
+}

+ 1 - 1
education-model/src/main/java/com/education/model/entity/GoalInfo.java

@@ -171,7 +171,7 @@ public class GoalInfo extends BaseEntity<GoalInfo>{
     private Integer courseSectionId;
 
     /**
-     * 课程id
+     * 
      */
     private Integer courseId;