命名错误,课程营销标签分开的bug

This commit is contained in:
wangjinlei
2024-05-20 16:02:52 +08:00
parent 2547a918f8
commit 4be1541818
44 changed files with 498 additions and 300 deletions

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseCategoryDao extends MPJBaseMapper<CourseCategoryEntity> {
}

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseMarketDao extends MPJBaseMapper<CourseMarketEntity> {
}

View File

@@ -1,9 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseMedicine;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseMedicalDao extends MPJBaseMapper<CourseMedical> {
public interface CourseMedicineDao extends MPJBaseMapper<CourseMedicine> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseMedicineMarketDao extends MPJBaseMapper<CourseMedicineMarketEntity> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseSociologyMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseSociologyMarketDao extends MPJBaseMapper<CourseSociologyMarketEntity> {
}

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseToCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseToCategoryDao extends MPJBaseMapper<CourseToCategoryEntity> {
}

View File

@@ -1,9 +0,0 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseToMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseToMarketDao extends MPJBaseMapper<CourseToMarketEntity> {
}

View File

@@ -1,9 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.entity.CourseToMedicine;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseToMedicalDao extends MPJBaseMapper<CourseToMedical> {
public interface CourseToMedicineDao extends MPJBaseMapper<CourseToMedicine> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseToMedicineMarketDao extends MPJBaseMapper<CourseToMedicineMarketEntity> {
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CourseToSociologyMarketDao extends MPJBaseMapper<CourseToSociologyMarketEntity> {
}

View File

@@ -9,8 +9,8 @@ import java.util.Date;
import java.util.List;
@Data
@TableName("course_medical")
public class CourseMedical {
@TableName("course_medicine")
public class CourseMedicine {
@TableId
private Integer id;
@@ -29,5 +29,5 @@ public class CourseMedical {
private Integer delFlag;
@TableField(exist = false)
private List<CourseMedical> children;
private List<CourseMedicine> children;
}

View File

@@ -10,8 +10,8 @@ import java.util.Date;
import java.util.List;
@Data
@TableName("course_market")
public class CourseMarketEntity {
@TableName("course_medicine_market")
public class CourseMedicineMarketEntity {
@TableId
private Integer id;
@@ -29,5 +29,5 @@ public class CourseMarketEntity {
private Integer delFlag;
@TableField(exist = false)
private List<CourseMarketEntity> children;
private List<CourseMedicineMarketEntity> children;
}

View File

@@ -1,31 +1,33 @@
package com.peanut.modules.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@TableName("course_category")
public class CourseCategoryEntity {
@TableName("course_sociology_market")
public class CourseSociologyMarketEntity {
@TableId
private Integer id;
private Integer pid;
private String uid;
private Integer isLast;
private String title;
private Integer isLast;
private Integer sort;
private Date createTime;
@TableLogic
private Integer delFlag;
@TableField(exist = false)
private List<CourseSociologyMarketEntity> children;
}

View File

@@ -8,8 +8,8 @@ import lombok.Data;
import java.util.Date;
@Data
@TableName("course_to_medical")
public class CourseToMedical {
@TableName("course_to_medicine")
public class CourseToMedicine {
@TableId
private Integer id;

View File

@@ -8,15 +8,15 @@ import lombok.Data;
import java.util.Date;
@Data
@TableName("course_to_market")
public class CourseToMarketEntity {
@TableName("course_to_medicine_market")
public class CourseToMedicineMarketEntity {
@TableId
private Integer id;
private Integer courseId;
private Integer marketId;
private Integer medicineMarketId;
private Date createTime;

View File

@@ -8,14 +8,15 @@ import lombok.Data;
import java.util.Date;
@Data
@TableName("course_to_category")
public class CourseToCategoryEntity {
@TableName("course_to_sociology_market")
public class CourseToSociologyMarketEntity {
@TableId
private Integer id;
private Integer courseId;
private Integer categoryId;
private Integer sociologyMarketId;
private Date createTime;

View File

@@ -3,8 +3,8 @@ package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.entity.CourseMedicine;
import com.peanut.modules.common.entity.CourseToMedicine;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.CourseMedicalService;
import com.peanut.modules.master.service.CourseService;
@@ -20,7 +20,7 @@ import java.util.List;
@Slf4j
@RestController("masterCourseMedical")
@RequestMapping("master/courseMedical")
public class CourseMedicalController {
public class CourseMedicineController {
@Autowired
private CourseMedicalService medicalService;
@Autowired
@@ -30,14 +30,14 @@ public class CourseMedicalController {
@RequestMapping("/getCourseMedicalList")
public R getCourseMedicalList(){
List<CourseMedical> courseMedicalList = medicalService.getCourseMedicalList();
return R.ok().put("Medicals",courseMedicalList);
List<CourseMedicine> courseMedicineList = medicalService.getCourseMedicalList();
return R.ok().put("Medicals", courseMedicineList);
}
@RequestMapping("/addCourseMedical")
public R addCourseMedical(@RequestBody CourseMedical courseMedical){
medicalService.save(courseMedical);
return R.ok().put("Medical",courseMedical);
public R addCourseMedical(@RequestBody CourseMedicine courseMedicine){
medicalService.save(courseMedicine);
return R.ok().put("Medical", courseMedicine);
}
@RequestMapping("/delCourseMedical")
@@ -46,8 +46,8 @@ public class CourseMedicalController {
}
@RequestMapping("/editCourseMedical")
public R editCourseMedical(@RequestBody CourseMedical courseMedical){
return medicalService.editCourseMedical(courseMedical);
public R editCourseMedical(@RequestBody CourseMedicine courseMedicine){
return medicalService.editCourseMedical(courseMedicine);
}
@RequestMapping("/getCourseListForMedical")
@@ -63,12 +63,12 @@ public class CourseMedicalController {
}
@RequestMapping("/bindCourseAndMedical")
public R bindCourseAndMedical(@RequestBody CourseToMedical toMedical){
public R bindCourseAndMedical(@RequestBody CourseToMedicine toMedical){
return toMedicalService.bindCourseAndMedical(toMedical);
}
@RequestMapping("/unbindCourseAndMedical")
public R unbindCourseAndMedical(@RequestBody CourseToMedical toMedical){
public R unbindCourseAndMedical(@RequestBody CourseToMedicine toMedical){
boolean b = toMedicalService.removeById(toMedical.getId());
if(b){
return R.ok();
@@ -78,7 +78,7 @@ public class CourseMedicalController {
}
@RequestMapping("/updateCourseToMedicalSort")
public R updateCourseToMedicalSort(@RequestBody CourseToMedical toMedical){
public R updateCourseToMedicalSort(@RequestBody CourseToMedicine toMedical){
toMedicalService.updateById(toMedical);
return R.ok();
}

View File

@@ -0,0 +1,179 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.master.service.CourseMedicineMarketService;
import com.peanut.modules.master.service.CourseService;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController("masterCourseMedicineMarket")
@RequestMapping("master/courseMedicineMarket")
public class CourseMedicineMarketController {
@Autowired
private CourseMedicineMarketService marketService;
@Autowired
private CourseToMedicineMarketService toMarketService;
@Autowired
private CourseService courseService;
/**
* 营销标签树
*/
@RequestMapping(path = "/marketTree")
public R marketTree() {
List<CourseMedicineMarketEntity> marketsTree = marketService.marketTree();
return R.ok().put("result", marketsTree);
}
/**
* 获取营销标签列表
*/
@RequestMapping(path = "/getMakertListByPid")
public R getMakertListByPid(String pid) {
LambdaQueryWrapper<CourseMedicineMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseMedicineMarketEntity::getPid,pid);
wrapper.orderByAsc(CourseMedicineMarketEntity::getSort);
wrapper.orderByAsc(CourseMedicineMarketEntity::getCreateTime);
List<CourseMedicineMarketEntity> marketTopList = marketService.list(wrapper);
return R.ok().put("result", marketTopList);
}
@RequestMapping(path = "/getMarketById")
public R getMarketById(String id) {
return R.ok().put("result",marketService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateMarket")
public R saveOrUpdateMarket(@RequestBody CourseMedicineMarketEntity market) {
if (market.getId()==null){
if(market.getPid()==0){
marketService.save(market);
return R.ok().put("result",market);
}else {
CourseMedicineMarketEntity m = marketService.getById(market.getPid());
if (m.getIsLast()==1){
return R.error("请将父标签设置为非最后一集");
}else {
marketService.save(market);
return R.ok().put("result",market);
}
}
}else {
if (market.getIsLast() == 1){
List mList = marketService.list(new LambdaQueryWrapper<CourseMedicineMarketEntity>()
.eq(CourseMedicineMarketEntity::getPid,market.getId()));
if (mList.size()>0){
return R.error("请先删除子集,再设置为最后一集");
}else {
marketService.saveOrUpdate(market);
return R.ok().put("result",market);
}
}else {
marketService.saveOrUpdate(market);
return R.ok().put("result",market);
}
}
}
@RequestMapping(path = "/delMarket")
public R delMarket(String id) {
CourseMedicineMarketEntity market = marketService.getById(id);
if (market.getIsLast()==1){
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,id);
List<CourseToMedicineMarketEntity> tomarkets = toMarketService.list(wrapper);
if (tomarkets.size()>0){
return R.error("请先移除课程");
}else {
marketService.removeById(id);
return R.ok();
}
}else {
List<CourseMedicineMarketEntity> marketList = marketService.list(new LambdaQueryWrapper<CourseMedicineMarketEntity>().eq(CourseMedicineMarketEntity::getPid,id));
if (marketList.size() > 0) {
return R.error("请先删除子集");
}else {
marketService.removeById(id);
return R.ok();
}
}
}
/**
* 获取营销标签下课程
*/
@RequestMapping(path = "/getCourseByMarketId")
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToMedicineMarketEntity::getCourseId);
wrapper.selectAll(CourseEntity.class);
wrapper.like(CourseEntity::getTitle,params.get("title"));
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,params.get("marketId"));
Page res = toMarketService.pageMaps(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
return R.ok().put("result", res);
}
/**
* 获取未关联课程列表
*/
@RequestMapping("/getNotToMarketList")
public R getNotToMarketList(@RequestBody Map params){
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper();
wrapper.like(CourseEntity::getTitle,params.get("title"));
if (params.containsKey("marketId")&&!"".equals(params.get("marketId").toString())){
String sql = "select course_id from course_to_market where del_flag = 0 and market_id = "+params.get("marketId");
wrapper.notInSql(CourseEntity::getId,sql);
}
Page<CourseEntity> page = courseService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
@RequestMapping(path = "/saveToMarket")
public R saveToMarket(@RequestBody Map params) {
if (!StringUtils.isEmpty(params.get("courseId").toString())){
String[] ids = params.get("courseId").toString().split(",");
if (ids.length > 0) {
for (String id : ids) {
CourseToMedicineMarketEntity toMarket = new CourseToMedicineMarketEntity();
toMarket.setMedicineMarketId(Integer.parseInt(params.get("marketId").toString()));
toMarket.setCourseId(Integer.parseInt(id));
toMarketService.save(toMarket);
}
}
}
return R.ok();
}
@RequestMapping(path = "/delToMarket")
public R delToMarket(String marketId,String courseId) {
if(StringUtils.isNotEmpty(courseId)){
String[] productIds = courseId.split(",");
for(String id : productIds){
LambdaQueryWrapper<CourseToMedicineMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId);
wrapper.eq(CourseToMedicineMarketEntity::getCourseId,id);
toMarketService.remove(wrapper);
}
return R.ok();
}
return R.error("参数为空");
}
}

View File

@@ -4,30 +4,27 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseMarketEntity;
import com.peanut.modules.common.entity.CourseToMarketEntity;
import com.peanut.modules.master.service.CourseMarketService;
import com.peanut.modules.master.service.CourseService;
import com.peanut.modules.master.service.CourseToMarketService;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.master.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController("masterCourseMarket")
@RequestMapping("master/courseMarket")
public class CourseMarketController {
@RestController("masterCourseSociologyMarket")
@RequestMapping("master/courseSociologyMarket")
public class CourseSociologyMarketController {
@Autowired
private CourseMarketService marketService;
private CourseSociologyMarketService marketService;
@Autowired
private CourseToMarketService toMarketService;
private CourseToSociologyMarketService toMarketService;
@Autowired
private CourseService courseService;
@@ -36,8 +33,8 @@ public class CourseMarketController {
*/
@RequestMapping(path = "/marketTree")
public R marketTree() {
List<CourseMarketEntity> marketsTree = marketService.marketTree();
return R.ok().put("result", marketsTree);
List<CourseSociologyMarketEntity> courseSociologyMarketEntities = marketService.marketTree();
return R.ok().put("result", courseSociologyMarketEntities);
}
/**
@@ -45,11 +42,11 @@ public class CourseMarketController {
*/
@RequestMapping(path = "/getMakertListByPid")
public R getMakertListByPid(String pid) {
LambdaQueryWrapper<CourseMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseMarketEntity::getPid,pid);
wrapper.orderByAsc(CourseMarketEntity::getSort);
wrapper.orderByAsc(CourseMarketEntity::getCreateTime);
List<CourseMarketEntity> marketTopList = marketService.list(wrapper);
LambdaQueryWrapper<CourseSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseSociologyMarketEntity::getPid,pid);
wrapper.orderByAsc(CourseSociologyMarketEntity::getSort);
wrapper.orderByAsc(CourseSociologyMarketEntity::getCreateTime);
List<CourseSociologyMarketEntity> marketTopList = marketService.list(wrapper);
return R.ok().put("result", marketTopList);
}
@@ -59,13 +56,13 @@ public class CourseMarketController {
}
@RequestMapping(path = "/saveOrUpdateMarket")
public R saveOrUpdateMarket(@RequestBody CourseMarketEntity market) {
public R saveOrUpdateMarket(@RequestBody CourseSociologyMarketEntity market) {
if (market.getId()==null){
if(market.getPid()==0){
marketService.save(market);
return R.ok().put("result",market);
}else {
CourseMarketEntity m = marketService.getById(market.getPid());
CourseSociologyMarketEntity m = marketService.getById(market.getPid());
if (m.getIsLast()==1){
return R.error("请将父标签设置为非最后一集");
}else {
@@ -75,8 +72,8 @@ public class CourseMarketController {
}
}else {
if (market.getIsLast() == 1){
List mList = marketService.list(new LambdaQueryWrapper<CourseMarketEntity>()
.eq(CourseMarketEntity::getPid,market.getId()));
List mList = marketService.list(new LambdaQueryWrapper<CourseSociologyMarketEntity>()
.eq(CourseSociologyMarketEntity::getPid,market.getId()));
if (mList.size()>0){
return R.error("请先删除子集,再设置为最后一集");
}else {
@@ -92,11 +89,11 @@ public class CourseMarketController {
@RequestMapping(path = "/delMarket")
public R delMarket(String id) {
CourseMarketEntity market = marketService.getById(id);
CourseSociologyMarketEntity market = marketService.getById(id);
if (market.getIsLast()==1){
MPJLambdaWrapper<CourseToMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.eq(CourseToMarketEntity::getMarketId,id);
List<CourseToMarketEntity> tomarkets = toMarketService.list(wrapper);
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,id);
List<CourseToSociologyMarketEntity> tomarkets = toMarketService.list(wrapper);
if (tomarkets.size()>0){
return R.error("请先移除课程");
}else {
@@ -104,7 +101,7 @@ public class CourseMarketController {
return R.ok();
}
}else {
List<CourseMarketEntity> marketList = marketService.list(new LambdaQueryWrapper<CourseMarketEntity>().eq(CourseMarketEntity::getPid,id));
List<CourseSociologyMarketEntity> marketList = marketService.list(new LambdaQueryWrapper<CourseSociologyMarketEntity>().eq(CourseSociologyMarketEntity::getPid,id));
if (marketList.size() > 0) {
return R.error("请先删除子集");
}else {
@@ -119,11 +116,11 @@ public class CourseMarketController {
*/
@RequestMapping(path = "/getCourseByMarketId")
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<CourseToMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToMarketEntity::getCourseId);
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToSociologyMarketEntity::getCourseId);
wrapper.selectAll(CourseEntity.class);
wrapper.like(CourseEntity::getTitle,params.get("title"));
wrapper.eq(CourseToMarketEntity::getMarketId,params.get("marketId"));
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,params.get("marketId"));
Page res = toMarketService.pageMaps(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
return R.ok().put("result", res);
@@ -151,8 +148,8 @@ public class CourseMarketController {
String[] ids = params.get("courseId").toString().split(",");
if (ids.length > 0) {
for (String id : ids) {
CourseToMarketEntity toMarket = new CourseToMarketEntity();
toMarket.setMarketId(Integer.parseInt(params.get("marketId").toString()));
CourseToSociologyMarketEntity toMarket = new CourseToSociologyMarketEntity();
toMarket.setSociologyMarketId(Integer.parseInt(params.get("marketId").toString()));
toMarket.setCourseId(Integer.parseInt(id));
toMarketService.save(toMarket);
}
@@ -166,9 +163,9 @@ public class CourseMarketController {
if(StringUtils.isNotEmpty(courseId)){
String[] productIds = courseId.split(",");
for(String id : productIds){
LambdaQueryWrapper<CourseToMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseToMarketEntity::getMarketId,marketId);
wrapper.eq(CourseToMarketEntity::getCourseId,id);
LambdaQueryWrapper<CourseToSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
wrapper.eq(CourseToSociologyMarketEntity::getCourseId,id);
toMarketService.remove(wrapper);
}
return R.ok();

View File

@@ -1,12 +0,0 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMarketEntity;
import java.util.List;
public interface CourseMarketService extends IService<CourseMarketEntity> {
List<CourseMarketEntity> marketTree();
}

View File

@@ -2,13 +2,13 @@ package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseMedicine;
import java.util.List;
public interface CourseMedicalService extends IService<CourseMedical> {
List<CourseMedical> getCourseMedicalList();
public interface CourseMedicalService extends IService<CourseMedicine> {
List<CourseMedicine> getCourseMedicalList();
R delCourseMedical(int id);
R editCourseMedical(CourseMedical courseMedical);
R editCourseMedical(CourseMedicine courseMedicine);
}

View File

@@ -0,0 +1,12 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import java.util.List;
public interface CourseMedicineMarketService extends IService<CourseMedicineMarketEntity> {
List<CourseMedicineMarketEntity> marketTree();
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseSociologyMarketEntity;
import java.util.List;
public interface CourseSociologyMarketService extends IService<CourseSociologyMarketEntity> {
List<CourseSociologyMarketEntity> marketTree();
}

View File

@@ -1,7 +0,0 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseToMarketEntity;
public interface CourseToMarketService extends IService<CourseToMarketEntity> {
}

View File

@@ -2,9 +2,9 @@ package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.entity.CourseToMedicine;
public interface CourseToMedicalService extends IService<CourseToMedical> {
public interface CourseToMedicalService extends IService<CourseToMedicine> {
R bindCourseAndMedical(CourseToMedical toMedical);
R bindCourseAndMedical(CourseToMedicine toMedical);
}

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
public interface CourseToMedicineMarketService extends IService<CourseToMedicineMarketEntity> {
}

View File

@@ -0,0 +1,8 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
public interface CourseToSociologyMarketService extends IService<CourseToSociologyMarketEntity> {
}

View File

@@ -2,9 +2,9 @@ package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseMarketDao;
import com.peanut.modules.common.entity.CourseMarketEntity;
import com.peanut.modules.master.service.CourseMarketService;
import com.peanut.modules.common.dao.CourseMedicineMarketDao;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.master.service.CourseMedicineMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,16 +13,16 @@ import java.util.stream.Collectors;
@Slf4j
@Service("masterCourseMarketService")
public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketDao, CourseMarketEntity> implements CourseMarketService {
public class CourseMedicineMarketServiceImpl extends ServiceImpl<CourseMedicineMarketDao, CourseMedicineMarketEntity> implements CourseMedicineMarketService {
@Autowired
private CourseMarketDao marketDao;
private CourseMedicineMarketDao marketDao;
@Override
public List<CourseMarketEntity> marketTree() {
List<CourseMarketEntity> markets = marketDao.selectList(new QueryWrapper<>());
List<CourseMarketEntity> marketsTree = markets.stream().filter((courseMarketEntity) ->
public List<CourseMedicineMarketEntity> marketTree() {
List<CourseMedicineMarketEntity> markets = marketDao.selectList(new QueryWrapper<>());
List<CourseMedicineMarketEntity> marketsTree = markets.stream().filter((courseMarketEntity) ->
courseMarketEntity.getPid() == 0
).map((market)->{
market.setChildren(getMarketChildrens(market,markets));
@@ -33,8 +33,8 @@ public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketDao, Course
return marketsTree;
}
private List<CourseMarketEntity> getMarketChildrens(CourseMarketEntity root,List<CourseMarketEntity> all){
List<CourseMarketEntity> children = all.stream().filter(courseMarketEntity -> {
private List<CourseMedicineMarketEntity> getMarketChildrens(CourseMedicineMarketEntity root, List<CourseMedicineMarketEntity> all){
List<CourseMedicineMarketEntity> children = all.stream().filter(courseMarketEntity -> {
return root.getId().equals(courseMarketEntity.getPid());
}).map(courseMarketEntity -> {
courseMarketEntity.setChildren(getMarketChildrens(courseMarketEntity, all));

View File

@@ -3,10 +3,10 @@ package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.utils.R;
import com.peanut.modules.common.dao.CourseMedicalDao;
import com.peanut.modules.common.dao.CourseToMedicalDao;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.dao.CourseMedicineDao;
import com.peanut.modules.common.dao.CourseToMedicineDao;
import com.peanut.modules.common.entity.CourseMedicine;
import com.peanut.modules.common.entity.CourseToMedicine;
import com.peanut.modules.master.service.CourseMedicalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,25 +16,25 @@ import java.util.List;
@Slf4j
@Service("masterCourseMedicalService")
public class CourseMedicalServiceImpl extends ServiceImpl<CourseMedicalDao, CourseMedical> implements CourseMedicalService {
public class CourseMedicineServiceImpl extends ServiceImpl<CourseMedicineDao, CourseMedicine> implements CourseMedicalService {
@Autowired
private CourseToMedicalDao toMedicalDao;
private CourseToMedicineDao toMedicalDao;
@Override
public List<CourseMedical> getCourseMedicalList() {
public List<CourseMedicine> getCourseMedicalList() {
return this.medicals(0);
}
@Override
public R delCourseMedical(int id) {
//查看下一级是否存在
int count = this.count(new LambdaQueryWrapper<CourseMedical>().eq(CourseMedical::getPid, id));
int count = this.count(new LambdaQueryWrapper<CourseMedicine>().eq(CourseMedicine::getPid, id));
if(count>0){
return R.error(501,"删除失败,请先删除子项目后再尝试");
}
//查看绑定关系是否存在
Integer integer = toMedicalDao.selectCount(new LambdaQueryWrapper<CourseToMedical>().eq(CourseToMedical::getMedicalId, id));
Integer integer = toMedicalDao.selectCount(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, id));
if(integer>0){
return R.error(502,"删除失败,请先解绑课程与国学标签的绑定关系");
}
@@ -43,29 +43,29 @@ public class CourseMedicalServiceImpl extends ServiceImpl<CourseMedicalDao, Cour
}
@Override
public R editCourseMedical(CourseMedical courseMedical) {
CourseMedical old = this.getById(courseMedical.getId());
if(old.getIsLast()==0&&courseMedical.getIsLast()==1){
CourseMedical one = this.getOne(new LambdaQueryWrapper<CourseMedical>().eq(CourseMedical::getPid, courseMedical.getId()));
public R editCourseMedical(CourseMedicine courseMedicine) {
CourseMedicine old = this.getById(courseMedicine.getId());
if(old.getIsLast()==0&& courseMedicine.getIsLast()==1){
CourseMedicine one = this.getOne(new LambdaQueryWrapper<CourseMedicine>().eq(CourseMedicine::getPid, courseMedicine.getId()));
if(one!=null){
return R.error(501,"更新失败,请先清空此项的下级标签,才能将此标签变成终极标签");
}
}
if(old.getIsLast()==1&&courseMedical.getIsLast()==0){
CourseToMedical courseToSociologyEntity = toMedicalDao.selectOne(new LambdaQueryWrapper<CourseToMedical>().eq(CourseToMedical::getMedicalId, courseMedical.getId()));
if(old.getIsLast()==1&& courseMedicine.getIsLast()==0){
CourseToMedicine courseToSociologyEntity = toMedicalDao.selectOne(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, courseMedicine.getId()));
if(courseToSociologyEntity!=null){
return R.error(502,"更新失败,请先把此项与课程的关联关系清空后才可把此标签变成普通标签");
}
}
this.updateById(courseMedical);
return R.ok().put("sociology",courseMedical);
this.updateById(courseMedicine);
return R.ok().put("sociology", courseMedicine);
}
private List<CourseMedical> medicals(int id){
List<CourseMedical> list = this.list(new LambdaQueryWrapper<CourseMedical>().eq(CourseMedical::getPid, id));
for (CourseMedical c : list){
private List<CourseMedicine> medicals(int id){
List<CourseMedicine> list = this.list(new LambdaQueryWrapper<CourseMedicine>().eq(CourseMedicine::getPid, id));
for (CourseMedicine c : list){
if(c.getIsLast()!=1){
List<CourseMedical> so = this.medicals(c.getId());
List<CourseMedicine> so = this.medicals(c.getId());
c.setChildren(so);
}
}

View File

@@ -23,18 +23,14 @@ import java.util.stream.Collectors;
@Slf4j
@Service("masterCourseService")
public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> implements CourseService {
@Autowired
private CourseCategoryDao courseCategoryDao;
@Autowired
private CourseToCategoryDao courseToCategoryDao;
@Autowired
private CourseSociologyDao courseSociologyDao;
@Autowired
private CourseToSociologyDao courseToSociologyDao;
@Autowired
private CourseMedicalDao medicalDao;
private CourseMedicineDao medicalDao;
@Autowired
private CourseToMedicalDao toMedicalDao;
private CourseToMedicineDao toMedicalDao;
@Autowired
private CourseCatalogueDao courseCatalogueDao;
@Autowired
@@ -47,37 +43,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
Integer limit = Integer.valueOf(map.get("limit").toString());
Integer page = Integer.valueOf(map.get("page").toString());
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
if(map.get("type").toString().equals("1")){
Integer categoryId = Integer.valueOf(map.get("categoryId").toString());
List<Integer> collect;
if(categoryId==0){
LambdaQueryWrapper<CourseCategoryEntity> courseCategoryEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
courseCategoryEntityLambdaQueryWrapper.eq(CourseCategoryEntity::getIsLast,1);
collect = courseCategoryDao.selectList(courseCategoryEntityLambdaQueryWrapper).stream().map(CourseCategoryEntity::getId).collect(Collectors.toList());
}else{
collect = this.categoryIds(categoryId);
}
if(collect.size()>0){
List<Integer> collect1 = courseToCategoryDao.selectList(new LambdaQueryWrapper<CourseToCategoryEntity>().in(CourseToCategoryEntity::getCategoryId, collect)).stream().map(CourseToCategoryEntity::getCourseId).collect(Collectors.toList());
wrapper.in(collect1.size()>0,CourseEntity::getId,collect1);
}else{
return new Page();
}
} else if (map.get("type").toString().equals("2")) {
Integer sociologyId = Integer.valueOf(map.get("sociologyId").toString());
List<Integer> c;
if(sociologyId==0){
c = courseSociologyDao.selectList(new LambdaQueryWrapper<CourseSociologyEntity>().eq(CourseSociologyEntity::getIsLast,1)).stream().map(CourseSociologyEntity::getId).collect(Collectors.toList());
}else{
c = this.sociologyIds(sociologyId);
}
if(c.size()>0){
List<Integer> collect = courseToSociologyDao.selectList(new LambdaQueryWrapper<CourseToSociologyEntity>().in(CourseToSociologyEntity::getSociologyId, c)).stream().map(CourseToSociologyEntity::getCourseId).collect(Collectors.toList());
wrapper.in(collect.size()>0,CourseEntity::getId,collect);
}else{
return new Page();
}
}
if(ObjectUtils.isNotBlank(map,"keywords")){
wrapper.like(CourseEntity::getTitle,map.get("keywords").toString());
@@ -129,20 +94,20 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
@Override
public List<CourseEntity> getCourseListForMedical(int medicalId) {
MPJLambdaWrapper<CourseToMedical> wrapper = new MPJLambdaWrapper<>();
MPJLambdaWrapper<CourseToMedicine> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.selectAs(CourseToMedical::getId,"bindId");
wrapper.selectAs(CourseToMedical::getSort,"toSociologySort");
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToMedical::getCourseId);
wrapper.eq(CourseToMedical::getMedicalId,medicalId);
wrapper.orderByAsc(CourseToMedical::getSort);
wrapper.selectAs(CourseToMedicine::getId,"bindId");
wrapper.selectAs(CourseToMedicine::getSort,"toSociologySort");
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToMedicine::getCourseId);
wrapper.eq(CourseToMedicine::getMedicalId,medicalId);
wrapper.orderByAsc(CourseToMedicine::getSort);
List<CourseEntity> courseEntities = toMedicalDao.selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
}
@Override
public Page getCourseListCanMedical(ParamTo param) {
List<Integer> collect = toMedicalDao.selectList(new LambdaQueryWrapper<CourseToMedical>().eq(CourseToMedical::getMedicalId, param.getId())).stream().map(CourseToMedical::getCourseId).collect(Collectors.toList());
List<Integer> collect = toMedicalDao.selectList(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, param.getId())).stream().map(CourseToMedicine::getCourseId).collect(Collectors.toList());
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
if (collect.size() != 0){
wrapper.notIn(CourseEntity::getId,collect);
@@ -192,20 +157,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
}
}
private List<Integer> categoryIds(Integer id){
ArrayList<Integer> integers = new ArrayList<>();
CourseCategoryEntity courseCategoryEntity = courseCategoryDao.selectById(id);
if(courseCategoryEntity.getIsLast()==1){
integers.add(id);
}else{
List<CourseCategoryEntity> courseCategoryEntities = courseCategoryDao.selectList(new LambdaQueryWrapper<CourseCategoryEntity>().eq(CourseCategoryEntity::getPid, id));
for (CourseCategoryEntity c : courseCategoryEntities ){
List<Integer> integers1 = this.categoryIds(c.getId());
integers.addAll(integers1);
}
}
return integers;
}
private List<Integer> sociologyIds(Integer id){
ArrayList<Integer> integers = new ArrayList<>();

View File

@@ -0,0 +1,52 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseMedicineMarketDao;
import com.peanut.modules.common.dao.CourseSociologyMarketDao;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseSociologyMarketEntity;
import com.peanut.modules.master.service.CourseMedicineMarketService;
import com.peanut.modules.master.service.CourseSociologyMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service("masterCourseSociologyMarketService")
public class CourseSociologyMarketServiceImpl extends ServiceImpl<CourseSociologyMarketDao, CourseSociologyMarketEntity> implements CourseSociologyMarketService {
@Autowired
private CourseSociologyMarketDao marketDao;
@Override
public List<CourseSociologyMarketEntity> marketTree() {
List<CourseSociologyMarketEntity> markets = marketDao.selectList(new QueryWrapper<>());
List<CourseSociologyMarketEntity> marketsTree = markets.stream().filter((courseSociologyMarketEntity) ->
courseSociologyMarketEntity.getPid() == 0
).map((market)->{
market.setChildren(getMarketChildrens(market,markets));
return market;
}).sorted((sort1,sort2)->{
return (sort1.getSort() == null? 0 : sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
}).collect(Collectors.toList());
return marketsTree;
}
private List<CourseSociologyMarketEntity> getMarketChildrens(CourseSociologyMarketEntity root, List<CourseSociologyMarketEntity> all){
List<CourseSociologyMarketEntity> children = all.stream().filter(CourseSociologyMarketEntity -> {
return root.getId().equals(CourseSociologyMarketEntity.getPid());
}).map(courseMarketEntity -> {
courseMarketEntity.setChildren(getMarketChildrens(courseMarketEntity, all));
return courseMarketEntity;
}).sorted((sort1,sort2)->{
return (sort1.getSort()==null?0:sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
}).collect(Collectors.toList());
return children;
}
}

View File

@@ -1,13 +0,0 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseToMarketDao;
import com.peanut.modules.common.entity.CourseToMarketEntity;
import com.peanut.modules.master.service.CourseToMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterCourseToMarketService")
public class CourseToMarketServiceImpl extends ServiceImpl<CourseToMarketDao, CourseToMarketEntity> implements CourseToMarketService {
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterCourseToMarketService")
public class CourseToMedicineMarketServiceImpl extends ServiceImpl<CourseToMedicineMarketDao, CourseToMedicineMarketEntity> implements CourseToMedicineMarketService {
}

View File

@@ -3,19 +3,19 @@ package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.utils.R;
import com.peanut.modules.common.dao.CourseToMedicalDao;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.dao.CourseToMedicineDao;
import com.peanut.modules.common.entity.CourseToMedicine;
import com.peanut.modules.master.service.CourseToMedicalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterCourseToMedicalService")
public class CourseToMedicalServiceImpl extends ServiceImpl<CourseToMedicalDao, CourseToMedical> implements CourseToMedicalService {
public class CourseToMedicineServiceImpl extends ServiceImpl<CourseToMedicineDao, CourseToMedicine> implements CourseToMedicalService {
@Override
public R bindCourseAndMedical(CourseToMedical toMedical) {
public R bindCourseAndMedical(CourseToMedicine toMedical) {
//去重
CourseToMedical one = this.getOne(new LambdaQueryWrapper<CourseToMedical>().eq(CourseToMedical::getCourseId, toMedical.getCourseId()).eq(CourseToMedical::getMedicalId, toMedical.getMedicalId()));
CourseToMedicine one = this.getOne(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId, toMedical.getCourseId()).eq(CourseToMedicine::getMedicalId, toMedical.getMedicalId()));
if(one != null){
return R.error(501,"绑定失败,绑定关系已将存在");
}

View File

@@ -0,0 +1,16 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
import com.peanut.modules.common.dao.CourseToSociologyMarketDao;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
import com.peanut.modules.master.service.CourseToSociologyMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterCourseToSociologyMarketService")
public class CourseToSociologyMarketServiceImpl extends ServiceImpl<CourseToSociologyMarketDao, CourseToSociologyMarketEntity> implements CourseToSociologyMarketService {
}

View File

@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseMarketEntity;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseMedicine;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.medical.service.CourseMarketService;
import com.peanut.modules.medical.service.CourseMedicalService;
@@ -32,7 +32,7 @@ public class HomeController {
//获取医学标签列表
@RequestMapping("/getMedicalLabels")
public R getMedicalLabels(@RequestBody ParamTo param){
List<CourseMedical> sociologyLabels = medicalService.getMedicalLabels(param.getId());
List<CourseMedicine> sociologyLabels = medicalService.getMedicalLabels(param.getId());
return R.ok().put("labels",sociologyLabels);
}
@@ -48,7 +48,7 @@ public class HomeController {
*/
@RequestMapping(path = "/courseMarketTree")
public R courseMarketTree() {
List<CourseMarketEntity> labelsTree = courseMarketService.courseMarketTree();
List<CourseMedicineMarketEntity> labelsTree = courseMarketService.courseMarketTree();
return R.ok().put("result", labelsTree);
}

View File

@@ -1,11 +1,11 @@
package com.peanut.modules.medical.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMarketEntity;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import java.util.List;
public interface CourseMarketService extends IService<CourseMarketEntity> {
public interface CourseMarketService extends IService<CourseMedicineMarketEntity> {
List<CourseMarketEntity> courseMarketTree();
List<CourseMedicineMarketEntity> courseMarketTree();
}

View File

@@ -1,11 +1,11 @@
package com.peanut.modules.medical.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.entity.CourseMedicine;
import java.util.List;
public interface CourseMedicalService extends IService<CourseMedical> {
public interface CourseMedicalService extends IService<CourseMedicine> {
List<CourseMedical> getMedicalLabels(Integer id);
List<CourseMedicine> getMedicalLabels(Integer id);
}

View File

@@ -2,8 +2,8 @@ package com.peanut.modules.medical.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseMarketDao;
import com.peanut.modules.common.entity.CourseMarketEntity;
import com.peanut.modules.common.dao.CourseMedicineMarketDao;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.medical.service.CourseMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,15 +14,15 @@ import java.util.stream.Collectors;
@Slf4j
@Service("medicalCourseMarketService")
public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketDao, CourseMarketEntity> implements CourseMarketService {
public class CourseMarketServiceImpl extends ServiceImpl<CourseMedicineMarketDao, CourseMedicineMarketEntity> implements CourseMarketService {
@Autowired
private CourseMarketDao courseMarketDao;
private CourseMedicineMarketDao courseMedicineMarketDao;
@Override
public List<CourseMarketEntity> courseMarketTree() {
List<CourseMarketEntity> markets = courseMarketDao.selectList(new QueryWrapper<>());
List<CourseMarketEntity> marketsTree = markets.stream().filter((courseMarketEntity) ->
public List<CourseMedicineMarketEntity> courseMarketTree() {
List<CourseMedicineMarketEntity> markets = courseMedicineMarketDao.selectList(new QueryWrapper<>());
List<CourseMedicineMarketEntity> marketsTree = markets.stream().filter((courseMarketEntity) ->
courseMarketEntity.getPid() == 0
).map((market)->{
market.setChildren(getMarketChildrens(market,markets));
@@ -33,8 +33,8 @@ public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketDao, Course
return marketsTree;
}
private List<CourseMarketEntity> getMarketChildrens(CourseMarketEntity root,List<CourseMarketEntity> all){
List<CourseMarketEntity> children = all.stream().filter(courseMarketEntity -> {
private List<CourseMedicineMarketEntity> getMarketChildrens(CourseMedicineMarketEntity root, List<CourseMedicineMarketEntity> all){
List<CourseMedicineMarketEntity> children = all.stream().filter(courseMarketEntity -> {
return root.getId().equals(courseMarketEntity.getPid());
}).map(courseMarketEntity -> {
courseMarketEntity.setChildren(getMarketChildrens(courseMarketEntity, all));

View File

@@ -2,8 +2,8 @@ package com.peanut.modules.medical.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseMedicalDao;
import com.peanut.modules.common.entity.CourseMedical;
import com.peanut.modules.common.dao.CourseMedicineDao;
import com.peanut.modules.common.entity.CourseMedicine;
import com.peanut.modules.medical.service.CourseMedicalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -11,14 +11,14 @@ import java.util.List;
@Slf4j
@Service("medicineCourseMedicalService")
public class CourseMedicalServiceImpl extends ServiceImpl<CourseMedicalDao, CourseMedical> implements CourseMedicalService {
public class CourseMedicalServiceImpl extends ServiceImpl<CourseMedicineDao, CourseMedicine> implements CourseMedicalService {
@Override
public List<CourseMedical> getMedicalLabels(Integer id) {
LambdaQueryWrapper<CourseMedical> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CourseMedical::getPid,id);
wrapper.orderByAsc(CourseMedical::getSort);
List<CourseMedical> list = this.list(wrapper);
public List<CourseMedicine> getMedicalLabels(Integer id) {
LambdaQueryWrapper<CourseMedicine> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CourseMedicine::getPid,id);
wrapper.orderByAsc(CourseMedicine::getSort);
List<CourseMedicine> list = this.list(wrapper);
return list;
}
}

View File

@@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.CourseDao;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMarketEntity;
import com.peanut.modules.common.entity.CourseToMedical;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToMedicine;
import com.peanut.modules.common.entity.UserToCourseEntity;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.medical.service.CourseService;
@@ -23,8 +23,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
public Page<CourseEntity> getMedicalCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToMedical.class,CourseToMedical::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMedical::getMedicalId,param.getId());
wrapper.leftJoin(CourseToMedicine.class, CourseToMedicine::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMedicine::getMedicalId,param.getId());
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()),CourseEntity.class, wrapper);
return courseEntityPage;
}
@@ -33,8 +33,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
public Page<CourseEntity> getMarketCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToMarketEntity.class,CourseToMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMarketEntity::getMarketId,param.getId());
wrapper.leftJoin(CourseToMedicineMarketEntity.class, CourseToMedicineMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,param.getId());
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;
}
@@ -43,7 +43,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
public List<CourseEntity> getUserLateCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.rightJoin(CourseToMedical.class,CourseToMedical::getCourseId,CourseEntity::getId);
wrapper.rightJoin(CourseToMedicine.class, CourseToMedicine::getCourseId,CourseEntity::getId);
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
wrapper.eq(UserToCourseEntity::getUserId,param.getId());
wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);

View File

@@ -77,8 +77,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
public Page<CourseEntity> getMarketCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToMarketEntity.class,CourseToMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMarketEntity::getMarketId,param.getId());
wrapper.leftJoin(CourseToMedicineMarketEntity.class, CourseToMedicineMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,param.getId());
wrapper.orderByAsc(CourseToSociologyEntity::getSort);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;

View File

@@ -25,7 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
@Slf4j
@Service
@Service("sysShiroService")
public class ShiroServiceImpl implements ShiroService {
@Autowired
private SysMenuDao sysMenuDao;

View File

@@ -1,22 +0,0 @@
<?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.peanut.modules.common.dao.BookListeningDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.peanut.modules.common.entity.BookListeningEntity" id="bookListeningMap">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="bookId" column="book_id" />
<result property="chapterId" column="chapter_id" />
<result property="chapterName" column="chapter_name" />
<result property="contentId" column="content_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="sort" column="sort" />
<result property="delFlag" column="del_flag" />
</resultMap>
</mapper>