Commit 38c814f4 authored by liuyang's avatar liuyang

讲师列表添加拥有课程数量

parent 010d4080
......@@ -677,4 +677,8 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
}
return PageResult.<SearchCourseResultModel>builder().code(CodeEnum.SUCCESS.getCode()).count(page.getTotal()).data(list).build();
}
public int countByTeacher(Long teacherId) {
return count(Wrappers.<CoursePO>lambdaQuery().eq(CoursePO::getTeacherId,teacherId));
}
}
\ No newline at end of file
......@@ -39,6 +39,8 @@ public class TeacherService extends ServiceImpl<TeacherMapper, TeacherPO> {
@Autowired
private SysUserService sysUserService;
@Autowired
private CourseService courseService;
@Transactional
public void saveModel(TeacherModel model) {
......@@ -110,6 +112,10 @@ public class TeacherService extends ServiceImpl<TeacherMapper, TeacherPO> {
Page page = new Page(param.getPageIndex(),param.getPageSize());
List<TeacherModel> list = baseMapper.queryPage(page,param);
//TODO add courseCount
for (TeacherModel model : list){
int count = courseService.countByTeacher(model.getId());
model.setCourseCount(count);
}
return PageResult.<TeacherModel>builder().code(CodeEnum.SUCCESS.getCode()).count(page.getTotal()).data(list).build();
}
......
......@@ -11,7 +11,7 @@
select u.*
from sys_user u
inner join sys_user_role r on u.id = r.user_id
where u.is_del=0 and r.role_id in (1,2)
where u.is_del=0 and r.role_id in (1,2,6)
<if test="p.username != null and p.username != ''">
and u.username like concat('%',#{p.username},'%')
</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment