This commit is contained in:
wuchunlei
2024-05-24 09:33:34 +08:00
23 changed files with 496 additions and 202 deletions

View File

@@ -1,17 +1,13 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
import com.peanut.modules.common.entity.CourseCatalogueEntity;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.to.EditCourseRecordDto;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.CourseCatalogueChapterService;
import com.peanut.modules.master.service.CourseCatalogueChapterVideoService;
import com.peanut.modules.master.service.CourseCatalogueService;
import com.peanut.modules.master.service.CourseService;
import com.peanut.modules.master.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@@ -34,6 +30,8 @@ public class CourseController {
private CourseCatalogueChapterService courseCatalogueChapterService;
@Autowired
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
@Autowired
private SysCourseDirectService sysCourseDirectService;
@RequestMapping("/getCourseList")
@@ -129,6 +127,26 @@ public class CourseController {
return R.ok();
}
/**
* 获取课程说明
* @param map
* @return
*/
@RequestMapping("/getCourseRecord")
public R getCourseRecord(@RequestBody Map<String,Integer> map){
SysCourseDirectEntity info = sysCourseDirectService.getOne(new LambdaQueryWrapper<SysCourseDirectEntity>().eq(SysCourseDirectEntity::getType, map.get("type")));
return R.ok().put("result",info);
}
@RequestMapping("/editCourseRecord")
public R editCourseRecord(@RequestBody EditCourseRecordDto editCourseRecordDto){
SysCourseDirectEntity sysCourseDirectEntity = sysCourseDirectService.editCourseRecord(editCourseRecordDto);
return R.ok().put("result",sysCourseDirectEntity);
}
@RequestMapping("/editCourseCatalogueChapterVideo")
public R editCourseCatalogueChapterVideo(@RequestBody CourseCatalogueChapterVideoEntity courseCatalogueChapterVideoEntity){
courseCatalogueChapterVideoService.updateById(courseCatalogueChapterVideoEntity);

View File

@@ -3,10 +3,10 @@ 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.ObjectUtils;
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.common.entity.*;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.CourseMedicineMarketService;
import com.peanut.modules.master.service.CourseService;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController("masterCourseMedicineMarket")
@@ -40,58 +41,41 @@ public class CourseMedicineMarketController {
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) {
public R getMarketById(@RequestBody Map<String,Integer> map) {
int id = map.get("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("/addSociologyMarket")
public R addSociologyMarket(@RequestBody CourseMedicineMarketEntity courseMedicineMarketEntity){
marketService.save(courseMedicineMarketEntity);
return R.ok().put("result",courseMedicineMarketEntity);
}
@RequestMapping("/editSociologyMarket")
public R editSociologyMarket(@RequestBody CourseMedicineMarketEntity courseMedicineMarketEntity){
CourseMedicineMarketEntity old = marketService.getById(courseMedicineMarketEntity.getId());
if(courseMedicineMarketEntity.getIsLast()==1&&old.getIsLast()==0){//非终节点到终结点,要排除是否存在子集
Integer integer = marketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseMedicineMarketEntity>().eq(CourseMedicineMarketEntity::getPid, courseMedicineMarketEntity.getId()));
if(integer>0){
return R.error("请先清空子集再操作!");
}
}
if(courseMedicineMarketEntity.getIsLast()==0&&old.getIsLast()==1){
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, courseMedicineMarketEntity.getId()));
if(integer>0){
return R.error("请先清空绑定的课程后,再操作");
}
}
marketService.updateById(courseMedicineMarketEntity);
return R.ok().put("result",courseMedicineMarketEntity);
}
@RequestMapping(path = "/delMarket")
public R delMarket(String id) {
public R delMarket(@RequestBody Map<String ,Integer> map) {
int id = map.get("id");
CourseMedicineMarketEntity market = marketService.getById(id);
if (market.getIsLast()==1){
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
@@ -114,66 +98,55 @@ public class CourseMedicineMarketController {
}
}
/**
* 获取营销标签下课程
*/
@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);
public R getCourseByMarketId(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
List<CourseToMedicineMarketEntity> courseByMarketId = toMarketService.getCourseByMarketId(marketId);
return R.ok().put("list",courseByMarketId);
}
@RequestMapping("/editMarketSort")
public R editMarketSort(@RequestBody Map<String,Integer> map){
CourseToMedicineMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getCourseId, map.get("courseId")).eq(CourseToMedicineMarketEntity::getMedicineMarketId, map.get("marketId")),false);
info.setSort(map.get("sort"));
toMarketService.updateById(info);
return R.ok().put("result",info);
}
/**
* 获取未关联课程列表
*/
@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);
public R getNotToMarketList(@RequestBody ParamTo param){
List<Integer> collect1 = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, param.getId())).stream().map(CourseToMedicineMarketEntity::getCourseId).collect(Collectors.toList());
LambdaQueryWrapper<CourseEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.notIn(collect1.size()>0,CourseEntity::getId,collect1);
wrapper1.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
Page<CourseEntity> page1 = courseService.page(new Page<>(param.getPage(), param.getLimit()), wrapper1);
return R.ok().put("page",page1);
}
@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);
}
}
@RequestMapping("/bindCourseAndMedicineMarket")
public R bindCourseAndMedicineMarket(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
int courseId = map.get("courseId");
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, marketId).eq(CourseToMedicineMarketEntity::getCourseId, courseId));
if(integer>0){
return R.error("不可重复绑定");
}
CourseToMedicineMarketEntity courseToMedicineMarketEntity = new CourseToMedicineMarketEntity();
courseToMedicineMarketEntity.setMedicineMarketId(marketId);
courseToMedicineMarketEntity.setCourseId(courseId);
toMarketService.save(courseToMedicineMarketEntity);
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("参数为空");
@RequestMapping("/unbindCourseAndMedicineMarket")
public R unbindCourseAndMedicineMarket(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
int courseId = map.get("courseId");
toMarketService.getBaseMapper().delete(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId).eq(CourseToMedicineMarketEntity::getCourseId,courseId));
return R.ok();
}
}

View File

@@ -3,8 +3,10 @@ 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.ObjectUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController("masterCourseSociologyMarket")
@@ -37,58 +40,41 @@ public class CourseSociologyMarketController {
return R.ok().put("result", courseSociologyMarketEntities);
}
/**
* 获取营销标签列表
*/
@RequestMapping(path = "/getMakertListByPid")
public R getMakertListByPid(String pid) {
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);
}
@RequestMapping(path = "/getMarketById")
public R getMarketById(String id) {
public R getMarketById(@RequestBody Map<String,Integer> map) {
int id = map.get("id");
return R.ok().put("result",marketService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateMarket")
public R saveOrUpdateMarket(@RequestBody CourseSociologyMarketEntity market) {
if (market.getId()==null){
if(market.getPid()==0){
marketService.save(market);
return R.ok().put("result",market);
}else {
CourseSociologyMarketEntity 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<CourseSociologyMarketEntity>()
.eq(CourseSociologyMarketEntity::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("/addSociologyMarket")
public R addSociologyMarket(@RequestBody CourseSociologyMarketEntity courseSociologyMarketEntity){
marketService.save(courseSociologyMarketEntity);
return R.ok().put("market",courseSociologyMarketEntity);
}
@RequestMapping("/editSociologyMarket")
public R editSociologyMarket(@RequestBody CourseSociologyMarketEntity courseSociologyMarketEntity){
CourseSociologyMarketEntity old = marketService.getById(courseSociologyMarketEntity.getId());
if(courseSociologyMarketEntity.getIsLast()==1&&old.getIsLast()==0){//非终节点到终结点,要排除是否存在子集
Integer integer = marketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseSociologyMarketEntity>().eq(CourseSociologyMarketEntity::getPid, courseSociologyMarketEntity.getId()));
if(integer>0){
return R.error("请先清空子集再操作!");
}
}
if(courseSociologyMarketEntity.getIsLast()==0&&old.getIsLast()==1){
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, courseSociologyMarketEntity.getId()));
if(integer>0){
return R.error("请先清空绑定的课程后,再操作");
}
}
marketService.updateById(courseSociologyMarketEntity);
return R.ok().put("market",courseSociologyMarketEntity);
}
@RequestMapping(path = "/delMarket")
public R delMarket(String id) {
public R delMarket(@RequestBody Map<String ,Integer> map) {
int id = map.get("id");
CourseSociologyMarketEntity market = marketService.getById(id);
if (market.getIsLast()==1){
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
@@ -111,66 +97,115 @@ public class CourseSociologyMarketController {
}
}
@RequestMapping("/editMarketSort")
public R editMarketSort(@RequestBody Map<String,Integer> map){
CourseToSociologyMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper<CourseToSociologyMarketEntity>()
.eq(CourseToSociologyMarketEntity::getSociologyMarketId, map.get("marketId"))
.eq(CourseToSociologyMarketEntity::getCourseId, map.get("courseId")), false);
info.setSort(map.get("sort"));
toMarketService.updateById(info);
return R.ok().put("result",info);
}
@RequestMapping("/getCourseListByMarketId")
public R getCourseListByMarketId(@RequestBody Map<String,Integer> map){
List<CourseToSociologyMarketEntity> marketId = toMarketService.getCourseListByMarketId(map.get("marketId"));
return R.ok().put("list",marketId);
}
/**
* 获取营销标签下课程
*/
@RequestMapping(path = "/getCourseByMarketId")
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
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(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);
// @RequestMapping(path = "/getCourseByMarketId")
// public R getCourseByMarket(@RequestBody Map<String, Object> params) {
// 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(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);
// }
@RequestMapping("/getNotToMarketList")
public R getNotToMarketList(@RequestBody ParamTo param){
List<Integer> collect = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, param.getId())).stream().map(CourseToSociologyMarketEntity::getCourseId).collect(Collectors.toList());
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.notIn(collect.size()>0,CourseEntity::getId,collect);
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
Page<CourseEntity> page = courseService.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
return R.ok().put("page",page);
}
/**
* 获取未关联课程列表
*/
@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("/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) {
CourseToSociologyMarketEntity toMarket = new CourseToSociologyMarketEntity();
toMarket.setSociologyMarketId(Integer.parseInt(params.get("marketId").toString()));
toMarket.setCourseId(Integer.parseInt(id));
toMarketService.save(toMarket);
}
}
@RequestMapping("/bindCourseAndSociologyMarket")
public R bindCourseAndSociologyMarket(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
int courseId = map.get("courseId");
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, marketId).eq(CourseToSociologyMarketEntity::getCourseId, courseId));
if(integer>0){
return R.error("不可重复绑定");
}
CourseToSociologyMarketEntity courseToSociologyMarketEntity = new CourseToSociologyMarketEntity();
courseToSociologyMarketEntity.setSociologyMarketId(marketId);
courseToSociologyMarketEntity.setCourseId(courseId);
toMarketService.save(courseToSociologyMarketEntity);
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<CourseToSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
wrapper.eq(CourseToSociologyMarketEntity::getCourseId,id);
toMarketService.remove(wrapper);
}
return R.ok();
}
return R.error("参数为空");
@RequestMapping("/unbindCourseAndSociologyMarket")
public R unbindCourseAndSociologyMarket(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
int courseId = map.get("courseId");
toMarketService.getBaseMapper().delete(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId).eq(CourseToSociologyMarketEntity::getCourseId,courseId));
return R.ok();
}
// @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) {
// CourseToSociologyMarketEntity toMarket = new CourseToSociologyMarketEntity();
// toMarket.setSociologyMarketId(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<CourseToSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
// wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
// wrapper.eq(CourseToSociologyMarketEntity::getCourseId,id);
// toMarketService.remove(wrapper);
// }
// return R.ok();
// }
// return R.error("参数为空");
// }
}

View File

@@ -116,6 +116,18 @@ public class MedicineLabelAndMarketController {
}
}
/**
* 修改商品和营销标签下的排序权重
* @return
*/
@RequestMapping("/editMarketSort")
public R editMarketSort(@RequestBody Map<String,Integer> map){
ShopProductToMedicineMarket toMarket = toMarketService.getById(map.get("id"));
toMarket.setSort(map.get("sort"));
toMarketService.updateById(toMarket);
return R.ok().put("result",toMarket);
}
@RequestMapping(path = "/delLabel")
public R delLabel(String id) {
ShopProductMedicineLabel label = labelService.getById(id);
@@ -279,6 +291,7 @@ public class MedicineLabelAndMarketController {
if (params.containsKey("medicineMarketId")&&!"".equals(params.get("medicineMarketId").toString())){
wrapper.eq(ShopProductToMedicineMarket::getMedicineMarketId,params.get("medicineMarketId").toString());
}
wrapper.orderByAsc(ShopProductToMedicineMarket::getSort);
Page<ShopProductToMedicineMarket> page = toMarketService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
List<ShopProductToMedicineMarket> res = page.getRecords();

View File

@@ -226,6 +226,14 @@ public class SociologyLabelAndMarketController {
return R.ok().put("result", page);
}
@RequestMapping("/editMarketSort")
public R editMarketSort(@RequestBody Map<String,Integer> map){
ShopProductToSociologyMarket toMarket = toMarketService.getById(map.get("id"));
toMarket.setSort(map.get("sort"));
toMarketService.updateById(toMarket);
return R.ok().put("market",toMarket);
}
/**
* 获取书标签列表
*/

View File

@@ -1,7 +1,12 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import java.util.List;
public interface CourseToMedicineMarketService extends IService<CourseToMedicineMarketEntity> {
List<CourseToMedicineMarketEntity> getCourseByMarketId(int marketId);
}

View File

@@ -1,8 +1,13 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
import java.util.List;
public interface CourseToSociologyMarketService extends IService<CourseToSociologyMarketEntity> {
List<CourseToSociologyMarketEntity> getCourseListByMarketId(int marketId);
}

View File

@@ -0,0 +1,10 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.SysCourseDirectEntity;
import com.peanut.modules.common.to.EditCourseRecordDto;
public interface SysCourseDirectService extends IService<SysCourseDirectEntity> {
SysCourseDirectEntity editCourseRecord(EditCourseRecordDto editCourseRecordDto);
}

View File

@@ -52,8 +52,8 @@ public class CourseMedicineServiceImpl extends ServiceImpl<CourseMedicineDao, Co
}
}
if(old.getIsLast()==1&& courseMedicine.getIsLast()==0){
CourseToMedicine courseToSociologyEntity = toMedicalDao.selectOne(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, courseMedicine.getId()));
if(courseToSociologyEntity!=null){
Integer integer = toMedicalDao.selectCount(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, courseMedicine.getId()));
if(integer>0){
return R.error(502,"更新失败,请先把此项与课程的关联关系清空后才可把此标签变成普通标签");
}
}

View File

@@ -1,13 +1,37 @@
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.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.CourseDao;
import com.peanut.modules.common.dao.CourseMedicineMarketDao;
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service("masterCourseToMarketService")
public class CourseToMedicineMarketServiceImpl extends ServiceImpl<CourseToMedicineMarketDao, CourseToMedicineMarketEntity> implements CourseToMedicineMarketService {
@Autowired
private CourseMedicineMarketDao courseMedicineMarketDao;
@Autowired
private CourseDao courseDao;
@Override
public List<CourseToMedicineMarketEntity> getCourseByMarketId(int marketId) {
List<CourseToMedicineMarketEntity> courseToMedicineMarketEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToMedicineMarketEntity>()
.eq(CourseToMedicineMarketEntity::getMedicineMarketId, marketId)
.orderByAsc(CourseToMedicineMarketEntity::getSort));
for (CourseToMedicineMarketEntity c :courseToMedicineMarketEntities){
c.setCourseMedicineMarketEntity(courseMedicineMarketDao.selectById(c.getMedicineMarketId()));
c.setCourseEntity(courseDao.selectById(c.getCourseId()));
}
return courseToMedicineMarketEntities;
}
}

View File

@@ -1,16 +1,40 @@
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.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.CourseDao;
import com.peanut.modules.common.dao.CourseSociologyMarketDao;
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
import com.peanut.modules.common.dao.CourseToSociologyMarketDao;
import com.peanut.modules.common.entity.CourseEntity;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service("masterCourseToSociologyMarketService")
public class CourseToSociologyMarketServiceImpl extends ServiceImpl<CourseToSociologyMarketDao, CourseToSociologyMarketEntity> implements CourseToSociologyMarketService {
@Autowired
private CourseSociologyMarketDao courseSociologyMarketDao;
@Autowired
private CourseDao courseDao;
@Override
public List<CourseToSociologyMarketEntity> getCourseListByMarketId(int marketId) {
List<CourseToSociologyMarketEntity> courseToSociologyMarketEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToSociologyMarketEntity>()
.eq(CourseToSociologyMarketEntity::getSociologyMarketId, marketId)
.orderByAsc(CourseToSociologyMarketEntity::getSort));
for (CourseToSociologyMarketEntity c : courseToSociologyMarketEntities){
c.setCourseSociologyMarketEntity(courseSociologyMarketDao.selectById(c.getSociologyMarketId()));
c.setCourseEntity(courseDao.selectById(c.getCourseId()));
}
return courseToSociologyMarketEntities;
}
}

View File

@@ -0,0 +1,36 @@
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.modules.common.dao.SysCourseDirectDao;
import com.peanut.modules.common.entity.SysCourseDirectEntity;
import com.peanut.modules.common.to.EditCourseRecordDto;
import com.peanut.modules.master.service.SysCourseDirectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterSysCourseDirect")
public class SysCourseDirectServiceImpl extends ServiceImpl<SysCourseDirectDao, SysCourseDirectEntity> implements SysCourseDirectService {
@Override
public SysCourseDirectEntity editCourseRecord(EditCourseRecordDto editCourseRecordDto) {
SysCourseDirectEntity one = this.getOne(new LambdaQueryWrapper<SysCourseDirectEntity>().eq(SysCourseDirectEntity::getType, editCourseRecordDto.getType()));
switch (editCourseRecordDto.getRecordType()){
case 0:
one.setBuyRecord(editCourseRecordDto.getContent());
break;
case 1:
one.setUseRecord(editCourseRecordDto.getContent());
break;
case 2:
one.setStudyRecord(editCourseRecordDto.getContent());
break;
case 3:
one.setVipRecord(editCourseRecordDto.getContent());
break;
}
this.updateById(one);
return one;
}
}