This commit is contained in:
wangjinlei
2024-05-22 14:33:07 +08:00
parent 689d241310
commit 01570f2985
8 changed files with 55 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
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;
@@ -24,4 +25,11 @@ public class CourseToMedicineMarketEntity {
@TableLogic
private Integer delFlag;
@TableField(exist = false)
private CourseMedicineMarketEntity courseMedicineMarketEntity;
@TableField(exist = false)
private CourseEntity courseEntity;
}

View File

@@ -1,5 +1,6 @@
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;
@@ -24,4 +25,11 @@ public class CourseToSociologyMarketEntity {
@TableLogic
private Integer delFlag;
@TableField(exist = false)
private CourseSociologyMarketEntity courseSociologyMarketEntity;
@TableField(exist = false)
private CourseEntity courseEntity;
}

View File

@@ -101,7 +101,7 @@ public class CourseMedicineMarketController {
@RequestMapping(path = "/getCourseByMarketId")
public R getCourseByMarketId(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
List<CourseEntity> courseByMarketId = toMarketService.getCourseByMarketId(marketId);
List<CourseToMedicineMarketEntity> courseByMarketId = toMarketService.getCourseByMarketId(marketId);
return R.ok().put("list",courseByMarketId);
}

View File

@@ -109,8 +109,8 @@ public class CourseSociologyMarketController {
@RequestMapping("/getCourseListByMarketId")
public R getCourseListByMarketId(@RequestBody Map<String,Integer> map){
List<CourseEntity> marketId = toMarketService.getCourseListByMarketId(map.get("marketId"));
return R.ok().put("courseList",marketId);
List<CourseToSociologyMarketEntity> marketId = toMarketService.getCourseListByMarketId(map.get("marketId"));
return R.ok().put("list",marketId);
}
/**

View File

@@ -8,5 +8,5 @@ import java.util.List;
public interface CourseToMedicineMarketService extends IService<CourseToMedicineMarketEntity> {
List<CourseEntity> getCourseByMarketId(int marketId);
List<CourseToMedicineMarketEntity> getCourseByMarketId(int marketId);
}

View File

@@ -9,5 +9,5 @@ import java.util.List;
public interface CourseToSociologyMarketService extends IService<CourseToSociologyMarketEntity> {
List<CourseEntity> getCourseListByMarketId(int marketId);
List<CourseToSociologyMarketEntity> getCourseListByMarketId(int marketId);
}

View File

@@ -1,12 +1,16 @@
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;
@@ -14,16 +18,20 @@ 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<CourseEntity> getCourseByMarketId(int marketId) {
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToMedicineMarketEntity::getCourseId);
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId);
wrapper.orderByAsc(CourseToMedicineMarketEntity::getSort);
List<CourseEntity> courseEntities = this.getBaseMapper().selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
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,7 +1,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.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;
@@ -10,6 +13,7 @@ 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;
@@ -17,15 +21,20 @@ 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<CourseEntity> getCourseListByMarketId(int marketId) {
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyMarketEntity::getCourseId);
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
wrapper.orderByAsc(CourseToSociologyMarketEntity::getSort);
List<CourseEntity> courseEntities = this.getBaseMapper().selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
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;
}
}