parent
32502a5b32
commit
9b29319c5d
39 changed files with 1217 additions and 174 deletions
@ -0,0 +1,67 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.Discipline; |
||||
import com.huoran.iasf.entity.Professional; |
||||
import com.huoran.iasf.entity.ProfessionalClass; |
||||
import com.huoran.iasf.service.DisciplineService; |
||||
import com.huoran.iasf.service.ProfessionalClassService; |
||||
import com.huoran.iasf.service.ProfessionalService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:学科控制类 |
||||
* @作者: Rong |
||||
* @日期: 2024-06-17 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/subject") |
||||
@Api(value = "学科类相关", tags = "学科类相关") |
||||
public class DisciplineController { |
||||
|
||||
@Autowired |
||||
public DisciplineService disciplineService; |
||||
@Autowired |
||||
public ProfessionalService professionalService; |
||||
|
||||
@Autowired |
||||
public ProfessionalClassService classService; |
||||
|
||||
@GetMapping("/courseDiscipline") |
||||
@ApiOperation(value = "课程学科类别", response = Discipline.class) |
||||
public R courseDiscipline() { |
||||
List<Discipline> list = disciplineService.subjectCategory(); |
||||
return R.success(list); |
||||
} |
||||
|
||||
@GetMapping("/courseProfessionalClass") |
||||
@ApiOperation(value = "课程专业类", response = ProfessionalClass.class) |
||||
public R disciplineList(@ApiParam(value = "disciplineId", required = true) @RequestParam("disciplineId") Integer disciplineId) { |
||||
QueryWrapper<ProfessionalClass> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("discipline_id", disciplineId); |
||||
List<ProfessionalClass> list = classService.list(queryWrapper); |
||||
return R.success(list); |
||||
} |
||||
|
||||
|
||||
@GetMapping("/courseProfessional") |
||||
@ApiOperation(value = "课程专业", response = Professional.class) |
||||
public R courseProfessional(@ApiParam(value = "professionalClassId", required = true) @RequestParam("professionalClassId") Integer professionalClassId) { |
||||
QueryWrapper<Professional> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("professional_class_id", professionalClassId); |
||||
List<Professional> list = professionalService.list(queryWrapper); |
||||
return R.success(list); |
||||
} |
||||
|
||||
} |
||||
|
@ -1,110 +0,0 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.huoran.iasf.common.exception.BusinessException; |
||||
import com.huoran.iasf.common.exception.code.BaseResponseCode; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import com.huoran.iasf.service.SysProductDetailsService; |
||||
import com.huoran.iasf.service.SysSubjectSpecialtyService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 综合产品与课程详情信息表控制类 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/productDetails") |
||||
@Api(value = "A-综合产品与课程详情", tags = "A-综合产品与课程详情") |
||||
@Slf4j |
||||
public class ProductDetailsController { |
||||
|
||||
@Autowired |
||||
private SysProductDetailsService service; |
||||
|
||||
@Autowired |
||||
private SysSubjectSpecialtyService subjectSpecialtyService; |
||||
|
||||
|
||||
/** |
||||
* 保存或更新综合产品与课程详情信息 |
||||
* 根据实体中的ID判断是保存还是更新 |
||||
* |
||||
* @param productDetails 要保存或更新的实体 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperation("保存或更新综合产品与课程详情信息") |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R saveOrUpdate(@RequestBody @Validated ProductDetails productDetails) { |
||||
try { |
||||
// 增加重复检查逻辑
|
||||
boolean isDuplicate = false; |
||||
if (productDetails.getId() != null) { |
||||
// 更新逻辑,排除当前记录自身
|
||||
isDuplicate = service.existsOtherByProductName(productDetails.getName(), productDetails.getId()); |
||||
} else { |
||||
// 新增逻辑,直接检查名称是否存在
|
||||
isDuplicate = service.existsByProductName(productDetails.getName()); |
||||
} |
||||
|
||||
if (isDuplicate) { |
||||
return R.fail("名称已存在,请检查后重新提交"); |
||||
} |
||||
|
||||
boolean addState = service.saveOrUpdate(productDetails); |
||||
|
||||
if (addState && productDetails.getSubjectSpecialtyList() != null && !productDetails.getSubjectSpecialtyList().isEmpty()) { |
||||
// 确保每个subjectSpecialty都关联到正确的templateDetailsId
|
||||
productDetails.getSubjectSpecialtyList().forEach(subjectSpecialty -> subjectSpecialty.setTemplateDetailsId(productDetails.getId())); |
||||
subjectSpecialtyService.removeByTemplateDetailsId(productDetails.getId()); |
||||
subjectSpecialtyService.saveBatch(productDetails.getSubjectSpecialtyList()); |
||||
} |
||||
|
||||
return R.result(addState, addState ? "操作成功" : "操作失败"); |
||||
} catch (Exception e) { |
||||
log.error("保存或更新产品详情时发生错误", e); |
||||
throw new BusinessException(BaseResponseCode.SYSTEM_BUSY); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 根据ID查询详情 |
||||
* |
||||
* @param id 主键ID |
||||
* @return 查询结果 |
||||
*/ |
||||
@PostMapping("/findById") |
||||
@ApiOperation("根据ID查询详情") |
||||
public R findById(@RequestParam("id") Integer id) { |
||||
ProductDetails productDetails = service.getById(id); |
||||
return R.success(productDetails); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 批量删除记录 |
||||
* |
||||
* @param ids 主键ID列表 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/batchDelete") |
||||
@ApiOperation("批量删除记录") |
||||
public R batchDelete(@RequestBody List<Integer> ids) { |
||||
if (ids == null || ids.isEmpty()) { |
||||
return R.fail("请选择要删除的记录"); |
||||
} |
||||
boolean delState = service.removeByIds(ids); |
||||
return R.result(delState, delState ? "批量删除成功" : "批量删除失败"); |
||||
} |
||||
} |
@ -0,0 +1,214 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
import com.huoran.iasf.common.exception.BusinessException; |
||||
import com.huoran.iasf.common.exception.code.BaseResponseCode; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.service.SysColumnService; |
||||
import com.huoran.iasf.service.SysProductDetailsService; |
||||
import com.huoran.iasf.service.SysSubjectSpecialtyService; |
||||
import com.huoran.iasf.vo.req.PageCourseProductReq; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.text.SimpleDateFormat; |
||||
import java.time.LocalDate; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 综合产品与课程详情信息表控制类 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/productDetails") |
||||
@Api(value = "A-综合产品与课程详情", tags = "A-综合产品与课程详情") |
||||
@Slf4j |
||||
public class SysProductDetailsController { |
||||
|
||||
@Autowired |
||||
private SysProductDetailsService service; |
||||
|
||||
@Autowired |
||||
private SysSubjectSpecialtyService subjectSpecialtyService; |
||||
|
||||
@Autowired |
||||
private SysColumnService columnService; |
||||
|
||||
@PostMapping("/checkIfTheTitleIsRepeat") |
||||
@ApiOperation(value = "标题判重——适用于新增、编辑及发布前的校验", response = Boolean.class) |
||||
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ProductDetails content) { |
||||
boolean isDuplicate = false; |
||||
|
||||
// 如果ID不为空,说明是编辑操作,需要排除当前记录自身
|
||||
if (content.getId() != null) { |
||||
isDuplicate = service.existsOtherByProductName(content.getName(), content.getId(), content.getSiteId()); |
||||
} else { |
||||
// ID为空,说明是新增操作
|
||||
isDuplicate = service.existsByProductName(content.getName(), content.getSiteId()); |
||||
} |
||||
|
||||
return R.result(!isDuplicate, !isDuplicate ? "标题可用" : "该标题已重复!"); |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
// 获取当前日期时间
|
||||
LocalDate currentDate = LocalDate.now(); |
||||
|
||||
// 输出当前日期,此时已经去除了时分秒信息
|
||||
System.out.println("当前日期(去除时分秒): " + currentDate); |
||||
} |
||||
|
||||
/** |
||||
* 保存或更新综合产品与课程详情信息 |
||||
* 根据实体中的ID判断是保存还是更新 |
||||
* |
||||
* @param productDetails 要保存或更新的实体 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperation("保存或更新综合产品与课程详情信息") |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R saveOrUpdate(@RequestBody @Validated ProductDetails productDetails) { |
||||
try { |
||||
|
||||
SysColumn column = columnService.getById(productDetails.getColumnId()); |
||||
if (column == null) { |
||||
throw new BusinessException(BaseResponseCode.DATA_DOES_NOT_EXIST); |
||||
} |
||||
|
||||
|
||||
if (productDetails.getPublishStatus()) { |
||||
// 获取当前日期时间
|
||||
Date currentDate = new Date(); |
||||
// 创建SimpleDateFormat对象,指定日期时间格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
// 格式化当前日期时间
|
||||
String formattedDateTime = formatter.format(currentDate); |
||||
// 输出格式化后的日期时间
|
||||
productDetails.setReleaseTime(formattedDateTime); |
||||
} else { |
||||
productDetails.setReleaseTime("—"); |
||||
} |
||||
boolean addState = service.saveOrUpdate(productDetails); |
||||
|
||||
|
||||
if (addState && productDetails.getSubjectSpecialtyList() != null && !productDetails.getSubjectSpecialtyList().isEmpty()) { |
||||
// 确保每个subjectSpecialty都关联到正确的templateDetailsId
|
||||
productDetails.getSubjectSpecialtyList().forEach(subjectSpecialty -> subjectSpecialty.setTemplateDetailsId(productDetails.getId())); |
||||
subjectSpecialtyService.removeByTemplateDetailsId(productDetails.getId()); |
||||
subjectSpecialtyService.saveBatch(productDetails.getSubjectSpecialtyList()); |
||||
} |
||||
|
||||
//新增成功后返回id
|
||||
return R.result(addState, addState ? String.valueOf(productDetails.getId()) : "操作失败"); |
||||
} catch (Exception e) { |
||||
log.error("保存或更新产品详情时发生错误", e); |
||||
throw new BusinessException(BaseResponseCode.SYSTEM_BUSY); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据ID查询详情 |
||||
* |
||||
* @param id 主键ID |
||||
* @return 查询结果 |
||||
*/ |
||||
@PostMapping("/findById") |
||||
@ApiOperation("根据ID查询详情") |
||||
public R findById(@RequestParam("id") Integer id) { |
||||
ProductDetails productDetails = service.getById(id); |
||||
|
||||
//查询详情的时候也要查询学科专业
|
||||
productDetails.setSubjectSpecialtyList(subjectSpecialtyService.getByTemplateDetailsId(id)); |
||||
|
||||
return R.success(productDetails); |
||||
} |
||||
|
||||
|
||||
//前台预览
|
||||
@PostMapping("/foregroundPreview") |
||||
@ApiOperation("前台预览") |
||||
public R foregroundPreview(@RequestParam("id") Integer id) { |
||||
ProductDetails productDetails = service.foregroundPreview(id); |
||||
return R.success(productDetails); |
||||
} |
||||
|
||||
@PostMapping("/articlePreview") |
||||
@ApiOperation(value = "增加文章浏览量(点击一次算一次)", response = ProductDetails.class) |
||||
public R articlePreview(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId) { |
||||
return R.success(service.statisticsOfPageViews(contentId)); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/articleEnableOrDisable") |
||||
@ApiOperation(value = "文章启用禁用", response = ProductDetails.class) |
||||
public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { |
||||
UpdateWrapper<ProductDetails> updateWrapper = new UpdateWrapper<>(); |
||||
updateWrapper.set("is_disable", isDisable); |
||||
updateWrapper.eq("id", id); |
||||
boolean ret = service.update(updateWrapper); |
||||
return ret ? R.success() : R.fail("禁用/启用失败"); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 批量删除记录 |
||||
* |
||||
* @param ids 主键ID列表 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/batchDelete") |
||||
@ApiOperation("批量删除记录") |
||||
public R batchDelete(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) { |
||||
if (ids == null || ids.isEmpty()) { |
||||
return R.fail("请选择要删除的记录"); |
||||
} |
||||
boolean delState = service.removeByIds(ids); |
||||
return R.result(delState, delState ? "批量删除成功" : "批量删除失败"); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/courseProductTopOperation") |
||||
@ApiOperation(value = "课程产品置顶/取消置顶", response = ProductDetails.class) |
||||
public R courseProductTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "课程产品id", required = true) @RequestParam Integer articleId) { |
||||
//是否置顶(默认为0 不置顶 1为置顶)
|
||||
UpdateWrapper<ProductDetails> updateWrap = new UpdateWrapper<>(); |
||||
|
||||
if (isTop == 1) { |
||||
//置顶时间(置顶一次更新一次)
|
||||
updateWrap.set("top_time", new Date()); |
||||
} else { |
||||
updateWrap.set("top_time", null); |
||||
} |
||||
updateWrap.set("is_top", isTop); |
||||
updateWrap.eq("id", articleId); |
||||
updateWrap.eq("deleted", 1); |
||||
boolean ret = service.update(updateWrap); |
||||
return R.result(ret, ret ? "操作除成功" : "操作失败"); |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据前端传的栏目id,只查询栏目下启用且未删除的数据 |
||||
* |
||||
* @param sysContent |
||||
* @return |
||||
*/ |
||||
@PostMapping("/courseProduct") |
||||
@ApiOperation(value = "前台课程产品", response = PageContentRespVO.class) |
||||
public R courseProduct(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) PageCourseProductReq sysContent) { |
||||
return service.courseProduct(sysContent); |
||||
} |
||||
} |
@ -1,21 +0,0 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("//sys-subject-specialty") |
||||
public class SysSubjectSpecialtyController { |
||||
|
||||
} |
||||
|
@ -0,0 +1,37 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 学科 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@TableName("s_discipline") |
||||
@ApiModel(value = "Discipline对象", description = "学科") |
||||
public class Discipline implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "主键id") |
||||
@TableId(value = "discipline_id", type = IdType.AUTO) |
||||
private Integer disciplineId; |
||||
|
||||
@ApiModelProperty(value = "学科名称") |
||||
private String disciplineName; |
||||
|
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@TableName("s_professional") |
||||
@ApiModel(value = "Professional对象", description = "专业") |
||||
public class Professional implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "专业主键id") |
||||
@TableId(value = "professional_id", type = IdType.AUTO) |
||||
private Integer professionalId; |
||||
|
||||
@ApiModelProperty(value = "专业名称") |
||||
private String professionalName; |
||||
|
||||
@ApiModelProperty(value = "专业类id") |
||||
private Integer professionalClassId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@TableName("s_professional_class") |
||||
@ApiModel(value = "ProfessionalClass对象", description = "专业类") |
||||
public class ProfessionalClass implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "专业类主键id") |
||||
@TableId(value = "professional_class_id", type = IdType.AUTO) |
||||
private Integer professionalClassId; |
||||
|
||||
@ApiModelProperty(value = "专业类名称") |
||||
private String professionalClassName; |
||||
|
||||
@ApiModelProperty(value = "学科层次id") |
||||
private Integer disciplineId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.Discipline; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 学科 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface DisciplineMapper extends BaseMapper<Discipline> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.ProfessionalClass; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业类 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface ProfessionalClassMapper extends BaseMapper<ProfessionalClass> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.Professional; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface ProfessionalMapper extends BaseMapper<Professional> { |
||||
|
||||
} |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.DisciplineMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.ProfessionalClassMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.ProfessionalMapper"> |
||||
|
||||
</mapper> |
@ -1,5 +1,255 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.SysProductDetailsMapper"> |
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.huoran.iasf.entity.ProductDetails"> |
||||
<id column="id" property="id"/> |
||||
<result column="column_id" property="columnId"/> |
||||
<result column="name" property="name"/> |
||||
<result column="category_id" property="categoryId"/> |
||||
<result column="classification_tag_id" property="classificationTagId"/> |
||||
<result column="cover_image_url" property="coverImageUrl"/> |
||||
<result column="source" property="source"/> |
||||
<result column="jump_button_name" property="jumpButtonName"/> |
||||
<result column="jump_link_url" property="jumpLinkUrl"/> |
||||
<result column="introduction" property="introduction"/> |
||||
<result column="detailed_description" property="detailedDescription"/> |
||||
<result column="publish_status" property="publishStatus"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="deleted" property="deleted"/> |
||||
<result column="course_type" property="courseType"/> |
||||
<result column="matched_courses" property="matchedCourses"/> |
||||
<result column="estimated_hours" property="estimatedHours"/> |
||||
<result column="applicable_scenarios" property="applicableScenarios"/> |
||||
<result column="founder_id" property="founderId"/> |
||||
<result column="editor_id" property="editorId"/> |
||||
<result column="total_browsing" property="totalBrowsing"/> |
||||
<result column="site_id" property="siteId"/> |
||||
<result column="article_template" property="articleTemplate"/> |
||||
<result column="template_status" property="templateStatus"/> |
||||
<result column="is_top" property="isTop"/> |
||||
<result column="is_disable" property="isDisable"/> |
||||
<result column="top_time" property="topTime"/> |
||||
</resultMap> |
||||
<select id="productCourseList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> |
||||
SELECT |
||||
d.id, |
||||
d.NAME AS title, |
||||
d.column_id, |
||||
d.cover_image_url AS titleImg, |
||||
d.source AS source, |
||||
d.publish_status AS isRelease, |
||||
d.total_browsing AS totalBrowsing, |
||||
d.is_disable AS isDisable, |
||||
sc.column_name AS columnName, |
||||
fu.real_name AS founderName, |
||||
eu.real_name AS editorName, |
||||
sc.type_id AS typeId, |
||||
d.release_time AS releaseTime, |
||||
COALESCE ( ( SELECT cc.classification_name FROM sys_content_classification cc WHERE cc.id = d.category_id ), |
||||
'暂无' ) AS classificationName, |
||||
'1' as isCourseProduct, |
||||
d.is_top AS isTop, |
||||
d.update_time as updateTime |
||||
FROM |
||||
sys_product_details d |
||||
LEFT JOIN sys_column sc ON sc.id = d.column_id |
||||
LEFT JOIN sys_user fu ON fu.id = d.founder_id |
||||
LEFT JOIN sys_user eu ON eu.id = d.editor_id |
||||
WHERE |
||||
d.deleted = 1 |
||||
|
||||
|
||||
<if test="req.columnIds.size() > 0"> |
||||
AND d.column_id IN |
||||
<foreach item="item" index="index" collection="req.columnIds" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
|
||||
|
||||
AND d.site_id = #{req.siteId} |
||||
<if test="req.title != null and req.title != ''"> |
||||
AND d.name LIKE CONCAT('%',#{req.title},'%') |
||||
</if> |
||||
<if test="req.founder != null and req.founder != ''"> |
||||
AND fu.real_name LIKE CONCAT('%',#{req.founder},'%') |
||||
</if> |
||||
<if test="req.editor != null and req.editor !=''"> |
||||
AND eu.real_name LIKE CONCAT('%',#{req.editor},'%') |
||||
</if> |
||||
<if test="req.column != null and req.column !=''"> |
||||
AND sc.column_name LIKE CONCAT('%',#{req.column},'%') |
||||
</if> |
||||
<if test="req.isDisable != null"> |
||||
AND d.is_disable = #{req.isDisable} |
||||
</if> |
||||
|
||||
|
||||
<choose> |
||||
<when test="req.modifiedTimeSort ==0"> |
||||
ORDER BY d.update_time desc |
||||
</when> |
||||
|
||||
<when test="req.modifiedTimeSort ==1"> |
||||
ORDER BY d.update_time asc |
||||
</when> |
||||
|
||||
<when test="req.publicationTimeSort ==0"> |
||||
ORDER BY d.release_time desc |
||||
</when> |
||||
|
||||
<when test="req.publicationTimeSort ==1"> |
||||
ORDER BY d.release_time asc |
||||
</when> |
||||
|
||||
<when test="req.topSort ==0"> |
||||
ORDER BY is_top asc, |
||||
top_time asc |
||||
</when> |
||||
|
||||
<when test="req.topSort ==1"> |
||||
ORDER BY is_top desc, |
||||
top_time DESC |
||||
</when> |
||||
|
||||
<otherwise> |
||||
ORDER BY |
||||
CASE |
||||
WHEN d.release_time = '—' THEN |
||||
1 ELSE 0 |
||||
END, |
||||
d.release_time desc,d.create_time desc |
||||
</otherwise> |
||||
</choose> |
||||
|
||||
</select> |
||||
|
||||
|
||||
|
||||
<!--<select id="courseProduct" resultType="com.huoran.iasf.vo.resp.PageCourseProductRespVO"> |
||||
SELECT |
||||
id, |
||||
d.NAME, |
||||
d.cover_image_url, |
||||
d.source, |
||||
d.total_browsing, |
||||
d.column_id, |
||||
d.category_id, |
||||
d.classification_tag_id, |
||||
c.NAME AS category |
||||
FROM |
||||
sys_product_details d |
||||
left JOIN sys_category c ON c.category_id = d.classification_tag_id |
||||
WHERE |
||||
d.deleted = 1 |
||||
AND d.site_id = #{req.siteId} |
||||
and d.column_id = #{req.columnId} |
||||
<if test="req.categoryId!=null and req.categoryId !=''"> |
||||
and find_in_set(#{req.categoryId},d.category_id) |
||||
</if> |
||||
|
||||
<if test="req.classificationTagId!=null and req.classificationTagId!=''"> |
||||
and d.classification_tag_id = #{req.classificationTagId} |
||||
</if> |
||||
and d.publish_status = 1 |
||||
</select>--> |
||||
|
||||
<select id="courseProduct" resultType="com.huoran.iasf.vo.resp.PageCourseProductRespVO"> |
||||
SELECT |
||||
id, |
||||
d.NAME, |
||||
d.cover_image_url, |
||||
d.source, |
||||
d.total_browsing, |
||||
d.column_id, |
||||
d.category_id, |
||||
d.classification_tag_id, |
||||
d.is_top, |
||||
d.introduction, |
||||
d.detailed_description, |
||||
c.NAME AS category |
||||
FROM |
||||
sys_product_details d |
||||
LEFT JOIN sys_category c ON c.category_id = d.classification_tag_id |
||||
WHERE |
||||
d.deleted = 1 |
||||
AND d.site_id = #{req.siteId} |
||||
AND d.column_id = #{req.columnId} |
||||
<if test="req.selection == 1"> |
||||
AND is_top = 1 |
||||
</if> |
||||
|
||||
<if test="req.keyWord!=null and req.keyWord!=''"> |
||||
and d.NAME LIKE CONCAT('%',#{req.keyWord},'%') |
||||
</if> |
||||
|
||||
<if test="req.categoryId != null and req.categoryId != ''"> |
||||
AND FIND_IN_SET(#{req.categoryId}, d.category_id) |
||||
</if> |
||||
<if test="req.classificationTagId != null and req.classificationTagId != ''"> |
||||
AND d.classification_tag_id = #{req.classificationTagId} |
||||
</if> |
||||
AND d.publish_status = 1 |
||||
ORDER BY |
||||
<choose> |
||||
<when test="req.sortFiltering == 1"> |
||||
ISNULL(d.is_top) DESC, d.release_time DESC |
||||
</when> |
||||
<when test="req.sortFiltering == 2"> |
||||
d.total_browsing DESC |
||||
</when> |
||||
<when test="req.sortFiltering == 3"> |
||||
<choose> |
||||
<when test="req.timeOrdering == 'asc'"> |
||||
d.release_time ASC |
||||
</when> |
||||
<otherwise> |
||||
d.release_time DESC |
||||
</otherwise> |
||||
</choose> |
||||
</when> |
||||
<otherwise> |
||||
d.release_time DESC |
||||
</otherwise> |
||||
</choose> |
||||
</select> |
||||
|
||||
|
||||
<select id="foregroundPreview" resultType="com.huoran.iasf.entity.ProductDetails"> |
||||
|
||||
SELECT |
||||
d.* |
||||
FROM |
||||
sys_product_details d |
||||
WHERE |
||||
d.deleted = 1 |
||||
and d.id = #{id} |
||||
|
||||
|
||||
</select> |
||||
<select id="queryDisciplineAndSpecialty" resultType="com.huoran.iasf.vo.DisciplineAndSpecialtyVO"> |
||||
SELECT |
||||
GROUP_CONCAT(DISTINCT d.discipline_name) as disciplineName, |
||||
GROUP_CONCAT(DISTINCT c.professional_class_name) as professionalClassName, |
||||
GROUP_CONCAT(DISTINCT p.professional_name ) as professionalName |
||||
FROM |
||||
sys_subject_specialty s |
||||
INNER JOIN s_discipline d ON s.subject_category_id = d.discipline_id |
||||
INNER JOIN s_professional_class c ON c.professional_class_id = s.professional_category_id |
||||
INNER JOIN s_professional p ON p.professional_id = s.major_id |
||||
WHERE |
||||
s.template_details_id = #{id}; |
||||
|
||||
</select> |
||||
<select id="queryTypeByCategoryId" resultType="java.lang.String"> |
||||
SELECT |
||||
GROUP_CONCAT( DISTINCT NAME ) |
||||
FROM |
||||
sys_category s |
||||
WHERE |
||||
FIND_IN_SET( s.category_id, #{classificationTagId} ) |
||||
</select> |
||||
|
||||
</mapper> |
||||
|
@ -0,0 +1,19 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.Discipline; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 学科 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface DisciplineService extends IService<Discipline> { |
||||
|
||||
List<Discipline> subjectCategory(); |
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.ProfessionalClass; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业类 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface ProfessionalClassService extends IService<ProfessionalClass> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.Professional; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
public interface ProfessionalService extends IService<Professional> { |
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.iasf.entity.Discipline; |
||||
import com.huoran.iasf.mapper.DisciplineMapper; |
||||
import com.huoran.iasf.service.DisciplineService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 学科 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Service |
||||
public class DisciplineServiceImpl extends ServiceImpl<DisciplineMapper, Discipline> implements DisciplineService { |
||||
|
||||
@Override |
||||
public List<Discipline> subjectCategory() { |
||||
return baseMapper.selectList(null); |
||||
} |
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.huoran.iasf.entity.ProfessionalClass; |
||||
import com.huoran.iasf.mapper.ProfessionalClassMapper; |
||||
import com.huoran.iasf.service.ProfessionalClassService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业类 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Service |
||||
public class ProfessionalClassServiceImpl extends ServiceImpl<ProfessionalClassMapper, ProfessionalClass> implements ProfessionalClassService { |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.huoran.iasf.entity.Professional; |
||||
import com.huoran.iasf.mapper.ProfessionalMapper; |
||||
import com.huoran.iasf.service.ProfessionalService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 专业 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Service |
||||
public class ProfessionalServiceImpl extends ServiceImpl<ProfessionalMapper, Professional> implements ProfessionalService { |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.huoran.iasf.vo; |
||||
|
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 学科 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-17 |
||||
*/ |
||||
@Data |
||||
public class DisciplineAndSpecialtyVO { |
||||
|
||||
@ApiModelProperty(value = "综合产品与课程详情") |
||||
private ProductDetails productDetails; |
||||
|
||||
@ApiModelProperty(value = "学科名称") |
||||
private String disciplineName; |
||||
|
||||
@ApiModelProperty(value = "专业类名称") |
||||
private String professionalClassName; |
||||
|
||||
@ApiModelProperty(value = "专业名称") |
||||
private String professionalName; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class PageCourseProductReq extends PageReqVO { |
||||
|
||||
//栏目id
|
||||
@ApiModelProperty(value = "栏目id", name = "columnId", example = "1", required = true) |
||||
private Integer columnId; |
||||
|
||||
//站点id
|
||||
@ApiModelProperty(value = "站点id", name = "siteId", example = "1", required = true) |
||||
private Integer siteId; |
||||
|
||||
@ApiModelProperty(value = "类型") |
||||
private Integer categoryId; |
||||
|
||||
@ApiModelProperty(value = "分类(多选)") |
||||
private Integer classificationTagId; |
||||
|
||||
@ApiModelProperty("排序筛选参数(1.综合排序2.热销排序3.发布时间)") |
||||
private Integer sortFiltering; |
||||
|
||||
@ApiModelProperty("时间排序(asc,desc)") |
||||
private String timeOrdering; |
||||
|
||||
//搜索条件
|
||||
@ApiModelProperty(value = "搜索条件") |
||||
private String keyWord; |
||||
|
||||
//筛选条件:官方精选
|
||||
@ApiModelProperty(value = "筛选条件:官方精选") |
||||
private Integer selection; |
||||
|
||||
|
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.huoran.iasf.vo.resp; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.huoran.iasf.entity.Category; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
public class PageCourseProductRespVO { |
||||
|
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "名称,课程或产品的名称,根据类型区分") |
||||
private String name; |
||||
|
||||
|
||||
@ApiModelProperty(value = "封面图片URL,课程封面或产品封面") |
||||
private String coverImageUrl; |
||||
|
||||
@ApiModelProperty(value = "来源信息,仅课程详情使用,可为空") |
||||
private String source; |
||||
|
||||
|
||||
@ApiModelProperty(value = "简介") |
||||
private String introduction; |
||||
|
||||
@ApiModelProperty(value = "详细描述") |
||||
private String detailedDescription; |
||||
|
||||
@ApiModelProperty(value = "文章总浏览量") |
||||
private Integer totalBrowsing; |
||||
|
||||
@ApiModelProperty(value = "课程分类id或产品分类id") |
||||
private String categoryId; |
||||
|
||||
@ApiModelProperty(value = "类型(多选)") |
||||
private String classificationTagId; |
||||
|
||||
|
||||
@ApiModelProperty(value = "分类(单选)") |
||||
private String category; |
||||
|
||||
@ApiModelProperty(value = "标签") |
||||
private String tag; |
||||
|
||||
@ApiModelProperty(value = "是否置顶(0否,1是)") |
||||
private Integer isTop; |
||||
} |
Loading…
Reference in new issue