he2802 3 years ago
parent
commit
fc71c6d7de

+ 9 - 18
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseBusinessController.java

@@ -1,32 +1,23 @@
 package com.zhongzheng.controller.course;
 
-import java.util.List;
-import java.util.Arrays;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
-import com.zhongzheng.modules.course.vo.CourseBusinessVo;
-import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.bo.CourseBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseBusinessEditBo;
+import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.service.ICourseBusinessService;
-import com.zhongzheng.common.utils.poi.ExcelUtil;
-import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 业务层次Controller

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/bo/ActivityRecommendAddBo.java

@@ -33,6 +33,12 @@ public class ActivityRecommendAddBo {
     /** 项目ID */
     @ApiModelProperty("项目ID")
     private Long projectId;
+    /** 项目ID */
+    @ApiModelProperty("专业ID")
+    private Long majorId;
+    /** 项目ID */
+    @ApiModelProperty("科目ID")
+    private List<Long> subjectIds;
     /** 1有效 0无效 */
     @ApiModelProperty("1有效 0无效")
     private Integer status;

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/bo/ActivityRecommendEditBo.java

@@ -38,6 +38,14 @@ public class ActivityRecommendEditBo {
     @ApiModelProperty("业务层次id")
     private Long businessId;
 
+    /** 项目ID */
+    @ApiModelProperty("专业ID")
+    private Long majorId;
+
+    /** 项目ID */
+    @ApiModelProperty("科目ID")
+    private List<Long> subjectIds;
+
     /** 项目ID */
     @ApiModelProperty("项目ID")
     private Long projectId;

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/domain/ActivityRecommend.java

@@ -36,6 +36,10 @@ private static final long serialVersionUID=1L;
     private Long businessId;
     /** 项目ID */
     private Long projectId;
+    /** 专业ID */
+    private Long majorId;
+    /** 科目ID */
+    private String subjectIds;
     /** 1有效 0无效 */
     private Integer status;
     /** 创建时间 */

+ 21 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityRecommendServiceImpl.java

@@ -2,6 +2,11 @@ package com.zhongzheng.modules.activity.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.Page;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.activity.bo.ActivityRecommendAddBo;
 import com.zhongzheng.modules.activity.bo.ActivityRecommendEditBo;
@@ -13,21 +18,13 @@ import com.zhongzheng.modules.activity.mapper.ActivityRecommendMapper;
 import com.zhongzheng.modules.activity.service.IActivityRecommendGoodsService;
 import com.zhongzheng.modules.activity.service.IActivityRecommendService;
 import com.zhongzheng.modules.activity.vo.ActivityRecommendVo;
-import com.zhongzheng.modules.goods.bo.GoodsCourseAddBo;
-import com.zhongzheng.modules.goods.domain.GoodsAttached;
-import com.zhongzheng.modules.goods.domain.GoodsCourse;
-import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.github.pagehelper.Page;
 import org.springframework.transaction.annotation.Transactional;
 
-
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -44,6 +41,7 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
     @Autowired
     private IActivityRecommendGoodsService iActivityRecommendGoodsService;
 
+
     @Override
     public ActivityRecommendVo queryById(Long recommendId){
         ActivityRecommend db = this.baseMapper.selectById(recommendId);
@@ -90,6 +88,9 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
+        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())){
+            add.setSubjectIds(StringUtils.join(bo.getSubjectIds(),","));
+        }
         Boolean rs =  this.save(add);
         if(bo.getGoodsList()!=null){
             Collection<ActivityRecommendGoods> coll = new HashSet<>();
@@ -111,7 +112,13 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
 
     @Override
     public ActivityRecommendVo getDetail(ActivityRecommendQueryBo bo) {
-        return baseMapper.getDetail(bo);
+        ActivityRecommendVo detail = baseMapper.getDetail(bo);
+        //获取科目名称
+        if (StringUtils.isNotBlank(detail.getSubjectIdList())){
+            List<Long> collect = Arrays.stream(detail.getSubjectIdList().split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList());
+            detail.setSubjectIds(collect);
+        }
+        return detail;
     }
 
     @Override
@@ -119,6 +126,9 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
         ActivityRecommend update = BeanUtil.toBean(bo, ActivityRecommend.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
+        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())){
+            update.setSubjectIds(StringUtils.join(bo.getSubjectIds(),","));
+        }
         if(bo.getGoodsList()!=null){
             iActivityRecommendGoodsService.remove(new LambdaQueryWrapper<ActivityRecommendGoods>().eq(ActivityRecommendGoods::getRecommendId, bo.getRecommendId()));
             Collection<ActivityRecommendGoods> coll = new HashSet<>();

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/vo/ActivityRecommendVo.java

@@ -41,6 +41,12 @@ public class ActivityRecommendVo {
 	@Excel(name = "业务层次id")
 	@ApiModelProperty("业务层次id")
 	private Long businessId;
+	@ApiModelProperty("专业ID")
+	private Long majorId;
+	@ApiModelProperty("科目IDs")
+	private String subjectIdList;
+	@ApiModelProperty("科目IDs")
+	private List<Long> subjectIds;
 	/** 项目ID */
 	@Excel(name = "项目ID")
 	@ApiModelProperty("项目ID")

+ 1 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseBusinessMapper.java

@@ -1,13 +1,11 @@
 package com.zhongzheng.modules.course.mapper;
 
-import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 
 import java.util.Collection;
-import java.util.List;
 
 /**
  * 业务层次Mapper接口
@@ -18,6 +16,4 @@ import java.util.List;
 public interface CourseBusinessMapper extends BaseMapper<CourseBusiness> {
 
     Collection<CourseBusinessVo> queryList(CourseBusinessQueryBo bo);
-
-
 }

+ 4 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseBusinessService.java

@@ -1,11 +1,11 @@
 package com.zhongzheng.modules.course.service;
 
-import com.zhongzheng.modules.course.domain.CourseBusiness;
-import com.zhongzheng.modules.course.vo.CourseBusinessVo;
-import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.course.bo.CourseBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseBusinessEditBo;
-import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
+import com.zhongzheng.modules.course.domain.CourseBusiness;
+import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 
 import java.util.Collection;
 import java.util.List;

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java

@@ -11,7 +11,7 @@ import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
 import com.zhongzheng.modules.course.domain.CourseProjectType;
 import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
 import com.zhongzheng.modules.course.service.ICourseProjectTypeService;
-import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
+import com.zhongzheng.modules.course.vo.*;
 import org.apache.el.util.Validation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,7 +24,6 @@ import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.bo.CourseBusinessEditBo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.course.mapper.CourseBusinessMapper;
-import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 import com.zhongzheng.modules.course.service.ICourseBusinessService;
 import org.springframework.util.CollectionUtils;
 

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsQueryBo.java

@@ -178,6 +178,9 @@ GoodsQueryBo extends BaseEntity {
 	/** 科目ID,拼接 */
 	@ApiModelProperty("科目ID,拼接")
 	private String subjectIds;
+	/** 科目ID,拼接 */
+	@ApiModelProperty("科目ID集合")
+	private List<Long> subjectIdList;
 	/** 证书类型ID */
 	@ApiModelProperty("证书类型ID")
 	private Long certificateTypeId;

+ 4 - 1
zhongzheng-system/src/main/resources/mapper/modules/activity/ActivityRecommendMapper.xml

@@ -31,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="educationName" column="education_name"/>
         <result property="projectName" column="project_name"/>
         <result property="businessName" column="business_name"/>
+        <result property="majorId" column="major_id"/>
+        <result property="subjectIdList" column="subject_ids"/>
         <collection property="goodsList" column="recommend_id" select="findGoodsList"/>
     </resultMap>
 
@@ -84,7 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getDetail" parameterType="com.zhongzheng.modules.activity.bo.ActivityRecommendQueryBo" resultMap="ActivityRecommendVoResult">
         SELECT ar.*, cet.education_name,
                cpt.project_name,
-               cb.business_name from activity_recommend ar
+               cb.business_name
+               from activity_recommend ar
                                          LEFT JOIN course_education_type cet ON ar.education_type_id = cet.id
                                          LEFT JOIN course_project_type cpt ON ar.project_id = cpt.id
                                          LEFT JOIN course_business cb ON ar.business_id = cb.id

+ 0 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CourseBusinessMapper.xml

@@ -88,5 +88,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by b.sort
     </select>
 
-
 </mapper>

+ 12 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -270,6 +270,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="subjectId != null and subjectId >0">
             AND FIND_IN_SET(#{subjectId},g.subject_ids)
         </if>
+        <if test="subjectIdList != null and subjectIdList.size > 0 ">
+            AND (
+            <foreach collection="subjectIdList" item="item" index="index">
+                <if test=" index == 0 ">
+                    FIND_IN_SET(#{item},g.subject_ids)
+                </if>
+                <if test=" index != 0 ">
+                    OR FIND_IN_SET(#{item},g.subject_ids)
+                </if>
+            </foreach>
+            )
+        </if>
         <if test="goodsType ==1 and haveCourse != null and haveCourse == 1">
             AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id = g.goods_id and c.`status` = 1
             ) >0