前台学科专业筛选完善

master
rong.liu 5 months ago
parent 52af918cda
commit 8efcdef1c9
  1. 18
      src/main/java/com/huoran/iasf/controller/DisciplineController.java
  2. 4
      src/main/java/com/huoran/iasf/entity/Discipline.java
  3. 5
      src/main/java/com/huoran/iasf/entity/ProfessionalClass.java
  4. 14
      src/main/java/com/huoran/iasf/mapper/xml/SysProductDetailsMapper.xml
  5. 3
      src/main/java/com/huoran/iasf/service/DisciplineService.java
  6. 39
      src/main/java/com/huoran/iasf/service/impl/DisciplineServiceImpl.java
  7. 10
      src/main/java/com/huoran/iasf/vo/req/PageCourseProductReq.java

@ -37,6 +37,8 @@ public class DisciplineController {
@Autowired @Autowired
public ProfessionalClassService classService; public ProfessionalClassService classService;
@GetMapping("/courseDiscipline") @GetMapping("/courseDiscipline")
@ApiOperation(value = "课程学科类别", response = Discipline.class) @ApiOperation(value = "课程学科类别", response = Discipline.class)
public R courseDiscipline() { public R courseDiscipline() {
@ -46,19 +48,31 @@ public class DisciplineController {
@GetMapping("/courseProfessionalClass") @GetMapping("/courseProfessionalClass")
@ApiOperation(value = "课程专业类", response = ProfessionalClass.class) @ApiOperation(value = "课程专业类", response = ProfessionalClass.class)
public R disciplineList(@ApiParam(value = "disciplineId", required = true) @RequestParam("disciplineId") Integer disciplineId) { public R disciplineList(@ApiParam(value = "disciplineId") @RequestParam("disciplineId") Integer disciplineId) {
QueryWrapper<ProfessionalClass> queryWrapper = new QueryWrapper<>(); QueryWrapper<ProfessionalClass> queryWrapper = new QueryWrapper<>();
if (disciplineId != null){
queryWrapper.eq("discipline_id", disciplineId); queryWrapper.eq("discipline_id", disciplineId);
}
List<ProfessionalClass> list = classService.list(queryWrapper); List<ProfessionalClass> list = classService.list(queryWrapper);
return R.success(list); return R.success(list);
} }
@GetMapping("/threeLevelJointInvestigation")
@ApiOperation(value = "三级联查", response = ProfessionalClass.class)
public R threeLevelJointInvestigation(@ApiParam(value = "disciplineId") @RequestParam("disciplineId") Integer disciplineId) {
return R.success(disciplineService.getCourseDisciplineWithDetails(disciplineId));
}
@GetMapping("/courseProfessional") @GetMapping("/courseProfessional")
@ApiOperation(value = "课程专业", response = Professional.class) @ApiOperation(value = "课程专业", response = Professional.class)
public R courseProfessional(@ApiParam(value = "professionalClassId", required = true) @RequestParam("professionalClassId") Integer professionalClassId) { public R courseProfessional(@ApiParam(value = "professionalClassId") @RequestParam("professionalClassId") Integer professionalClassId) {
QueryWrapper<Professional> queryWrapper = new QueryWrapper<>(); QueryWrapper<Professional> queryWrapper = new QueryWrapper<>();
if (professionalClassId != null){
queryWrapper.eq("professional_class_id", professionalClassId); queryWrapper.eq("professional_class_id", professionalClassId);
}
List<Professional> list = professionalService.list(queryWrapper); List<Professional> list = professionalService.list(queryWrapper);
return R.success(list); return R.success(list);
} }

@ -1,6 +1,7 @@
package com.huoran.iasf.entity; package com.huoran.iasf.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -9,6 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* <p> * <p>
@ -34,4 +36,6 @@ public class Discipline implements Serializable {
private String disciplineName; private String disciplineName;
@TableField(exist = false)
List<ProfessionalClass> professionalClasses;
} }

@ -1,6 +1,7 @@
package com.huoran.iasf.entity; package com.huoran.iasf.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -9,6 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* <p> * <p>
@ -36,5 +38,6 @@ public class ProfessionalClass implements Serializable {
@ApiModelProperty(value = "学科层次id") @ApiModelProperty(value = "学科层次id")
private Integer disciplineId; private Integer disciplineId;
@TableField(exist = false)
List<Professional> professionals;
} }

@ -188,6 +188,20 @@
AND is_top = 1 AND is_top = 1
</if> </if>
<if test="req.subjectCategoryId != null">
AND FIND_IN_SET(#{req.subjectCategoryId},( SELECT GROUP_CONCAT( subject_category_id ) FROM sys_subject_specialty WHERE template_details_id = d.id ) )
</if>
<if test="req.professionalCategoryId != null">
AND FIND_IN_SET(#{req.professionalCategoryId},( SELECT GROUP_CONCAT( professional_category_id ) FROM sys_subject_specialty WHERE template_details_id = d.id ) )
</if>
<if test="req.majorId != null">
AND FIND_IN_SET(#{req.majorId},( SELECT GROUP_CONCAT( major_id ) FROM sys_subject_specialty WHERE template_details_id = d.id ) )
</if>
<if test="req.keyWord!=null and req.keyWord!=''"> <if test="req.keyWord!=null and req.keyWord!=''">
and d.NAME LIKE CONCAT('%',#{req.keyWord},'%') and d.NAME LIKE CONCAT('%',#{req.keyWord},'%')
</if> </if>

@ -1,5 +1,6 @@
package com.huoran.iasf.service; package com.huoran.iasf.service;
import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.Discipline; import com.huoran.iasf.entity.Discipline;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -16,4 +17,6 @@ import java.util.List;
public interface DisciplineService extends IService<Discipline> { public interface DisciplineService extends IService<Discipline> {
List<Discipline> subjectCategory(); List<Discipline> subjectCategory();
R getCourseDisciplineWithDetails(Integer disciplineId);
} }

@ -1,9 +1,16 @@
package com.huoran.iasf.service.impl; package com.huoran.iasf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.Discipline; import com.huoran.iasf.entity.Discipline;
import com.huoran.iasf.entity.Professional;
import com.huoran.iasf.entity.ProfessionalClass;
import com.huoran.iasf.mapper.DisciplineMapper; import com.huoran.iasf.mapper.DisciplineMapper;
import com.huoran.iasf.mapper.ProfessionalClassMapper;
import com.huoran.iasf.mapper.ProfessionalMapper;
import com.huoran.iasf.service.DisciplineService; import com.huoran.iasf.service.DisciplineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -18,9 +25,41 @@ import java.util.List;
*/ */
@Service @Service
public class DisciplineServiceImpl extends ServiceImpl<DisciplineMapper, Discipline> implements DisciplineService { public class DisciplineServiceImpl extends ServiceImpl<DisciplineMapper, Discipline> implements DisciplineService {
@Autowired
private DisciplineMapper disciplineMapper;
@Autowired
private ProfessionalClassMapper professionalClassMapper;
@Autowired
private ProfessionalMapper professionalMapper;
@Override @Override
public List<Discipline> subjectCategory() { public List<Discipline> subjectCategory() {
return baseMapper.selectList(null); return baseMapper.selectList(null);
} }
@Override
public R getCourseDisciplineWithDetails(Integer disciplineId) {
if (disciplineId == null) {
// 如果没有disciplineId,只查询第一级(学科类别)
List<Discipline> disciplines = disciplineMapper.selectList(new LambdaQueryWrapper<>());
return R.success(disciplines);
} else {
// 进行完整的三级联查
List<Discipline> disciplines = disciplineMapper.selectList(new LambdaQueryWrapper<Discipline>().eq(Discipline::getDisciplineId, disciplineId));
disciplines.forEach(discipline -> {
// 获取该学科类别下的所有专业类别
List<ProfessionalClass> professionalClasses = professionalClassMapper.selectList(new LambdaQueryWrapper<ProfessionalClass>().eq(ProfessionalClass::getDisciplineId, discipline.getDisciplineId()));
discipline.setProfessionalClasses(professionalClasses);
// 为每个专业类别填充其下的专业
professionalClasses.forEach(professionalClass -> {
List<Professional> professionals = professionalMapper.selectList(new LambdaQueryWrapper<Professional>().eq(Professional::getProfessionalClassId, professionalClass.getProfessionalClassId()));
professionalClass.setProfessionals(professionals);
});
});
return R.success(disciplines);
}
}
} }

@ -35,4 +35,14 @@ public class PageCourseProductReq extends PageReqVO {
private Integer selection; private Integer selection;
@ApiModelProperty(value = "学科类别id,仅产品使用,可为空")
private Integer subjectCategoryId;
@ApiModelProperty(value = "专业类别id,仅产品使用,可为空")
private Integer professionalCategoryId;
@ApiModelProperty(value = "专业id,仅产品使用,可为空")
private Integer majorId;
} }
Loading…
Cancel
Save