瀏覽代碼

学习计划

change 3 年之前
父節點
當前提交
f97fdb2455

+ 19 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/plan/UserPlanController.java

@@ -3,6 +3,11 @@ package com.zhongzheng.controller.plan;
 import java.util.List;
 import java.util.Arrays;
 
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.*;
+import com.zhongzheng.modules.course.domain.Course;
+import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +47,7 @@ public class UserPlanController extends BaseController {
 
     private final IUserPlanService iUserPlanService;
 
+    private final WxTokenService WxTokenService;
     /**
      * 查询学习计划列表
      */
@@ -98,4 +104,17 @@ public class UserPlanController extends BaseController {
         UserPlanVo list = iUserPlanService.listPlan(bo);
         return AjaxResult.success(list);
     }
+
+    /**
+     * 查询学习计划列表
+     */
+    @ApiOperation("查询学员能生成学习计划的课程")
+    @PreAuthorize("@ss.hasPermi('system:plan:list')")
+    @GetMapping("/listCourse")
+    public TableDataInfo<CourseVo> listCourse(UserPlanQueryBo bo) {
+        ClientLoginUser loginUser = WxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        List<CourseVo> list = iUserPlanService.listCourse(bo);
+        return getDataTable(list);
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -5,6 +5,7 @@ import com.zhongzheng.modules.exam.domain.ExamApply;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.exam.vo.ExamApplySiteTimeVo;
 import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
+import com.zhongzheng.modules.exam.vo.ExamApplyVo;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -27,4 +28,6 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
     List<ExamApplySiteVo> addressExam(@Param("applyId") Long applyId,@Param("status") Long i);
 
     List<ExamApplySiteTimeVo> addressTimeExam(Long id);
+
+    ExamApplyVo selectByApply(Long applyId);
 }

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -39,8 +39,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
 
     @Override
     public ExamApplyVo queryById(Long applyId){
-        ExamApply db = this.baseMapper.selectById(applyId);
-        ExamApplyVo examApplyVo = BeanUtil.toBean(db, ExamApplyVo.class);
+        ExamApplyVo examApplyVo = baseMapper.selectByApply(applyId);
         List<ExamNumberGoodsVo> examNumberGoodsVos = baseMapper.examNumberGoodsVos(applyId);
         List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(applyId,1L);
         for (ExamApplySiteVo examApplySiteVo : examApplySite) {

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyVo.java

@@ -68,6 +68,13 @@ public class ExamApplyVo {
 	/** 项目ID */
 	@ApiModelProperty("项目ID")
 	private Long projectId;
+	@ApiModelProperty("教育名称")
+	private String educationName;
+	@ApiModelProperty("项目名称")
+	private String projectName;
+	@ApiModelProperty("业务名称")
+	private String businessName;
+
 
 	/** 考试编码 */
 	@ApiModelProperty("考试编码")

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamBeforeVo.java

@@ -78,6 +78,13 @@ public class ExamBeforeVo {
 	@ApiModelProperty("项目ID")
 	private Long projectId;
 
+	@ApiModelProperty("教育名称")
+	private String educationName;
+	@ApiModelProperty("项目名称")
+	private String projectName;
+	@ApiModelProperty("业务名称")
+	private String businessName;
+
 	@ApiModelProperty("商品")
 	private List<ExamNumberGoodsVo> examNumberGoods;
 

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserPlanMapper.java

@@ -1,9 +1,13 @@
 package com.zhongzheng.modules.user.mapper;
 
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.user.bo.UserPlanEditBo;
+import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import com.zhongzheng.modules.user.domain.UserPlan;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 学习计划Mapper接口
  *
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface UserPlanMapper extends BaseMapper<UserPlan> {
 
     Integer selectCountCourse(UserPlanEditBo bo);
+
+    List<CourseVo> listCourse(UserPlanQueryBo bo);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserPlanService.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.user.service;
 
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.user.domain.UserPlan;
 import com.zhongzheng.modules.user.vo.UserPlanVo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
@@ -51,4 +52,6 @@ public interface IUserPlanService extends IService<UserPlan> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     UserPlanVo listPlan(UserPlanEditBo bo);
+
+	List<CourseVo> listCourse(UserPlanQueryBo bo);
 }

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.course.vo.CourseVo;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -112,10 +113,15 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
 
     @Override
     public UserPlanVo listPlan(UserPlanEditBo bo) {
-
+        validEntityPlanBeforeSave(bo);
         return null;
     }
 
+    @Override
+    public List<CourseVo> listCourse(UserPlanQueryBo bo) {
+        return baseMapper.listCourse(bo);
+    }
+
     /**
      * 保存前的数据校验
      *

+ 26 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -17,6 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplyVo" id="ExamApplyVo">
+        <result property="applyId" column="exam_apply_id"/>
+        <result property="applyUrl" column="apply_url"/>
+        <result property="applyName" column="apply_name"/>
+        <result property="applyIntroduce" column="apply_introduce"/>
+        <result property="applyStatus" column="apply_status"/>
+        <result property="applyStartTime" column="apply_start_time"/>
+        <result property="applyEndTime" column="apply_end_time"/>
+        <result property="status" column="status"/>
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+    </resultMap>
+
     <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
         <result property="id" column="id"/>
         <result property="examNumberId" column="exam_number_id"/>
@@ -117,4 +131,16 @@ and (SELECT COUNT(eay.apply_id) FROM exam_apply eay LEFT JOIN exam_apply_goods e
         where 1=1
           and east.apply_site_id =#{id}
     </select>
+
+    <select id="selectByApply" parameterType="long" resultMap="ExamApplyVo">
+        SELECT
+            * ,
+            (select cet.education_name FROM course_education_type cet where ea.education_type_id= cet.id) as education_name,
+            (select cpt.project_name FROM course_project_type cpt where ea.project_id= cpt.id) as project_name,
+            (select cb.business_name FROM course_business cb where ea.business_id= cb.id) as business_name
+        FROM
+            exam_apply ea
+        where 1=1
+          and ea.apply_id = #{applyId}
+    </select>
 </mapper>

+ 7 - 1
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamBeforeMapper.xml

@@ -28,6 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
         <result property="urlName" column="url_name"/>
         <result property="url" column="url"/>
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
     </resultMap>
 
 
@@ -86,7 +89,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectByBefore" parameterType="long" resultMap="ExamBeforeVo">
         SELECT
-            *
+            *,
+            (select cet.education_name FROM course_education_type cet where eb.education_type_id= cet.id) as education_name,
+            (select cpt.project_name FROM course_project_type cpt where eb.project_id= cpt.id) as project_name,
+            (select cb.business_name FROM course_business cb where eb.business_id= cb.id) as business_name
         FROM
             exam_before eb
                 LEFT JOIN exam_before_url ebu on eb.before_url=ebu.before_url_id