Commit 7acaa6ac by 涂亚平

测试版本

1 parent bcbbb8c4
......@@ -45,7 +45,7 @@ public class CourseDictController {
}
@PostMapping("queryCourses")
@ApiOperation("平台运营者--查询课程 pageSize pageNum companyId courseName categoryId courseType courseSource")
@ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
......
......@@ -19,7 +19,7 @@ public class QueryCoursesDTO {
private String courseSource;
//private Long administerId;
private Long administerId;
private Long companyId;
......
......@@ -164,6 +164,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
administerDO.setPassword("admin123");
administerDO.setStatus("1");
this.baseMapper.insert(administerDO);
RoleAdministerMappingDO roleAdministerMappingDO = new RoleAdministerMappingDO();
roleAdministerMappingDO.setAdministerId(administerDO.getId());
roleAdministerMappingDO.setRoleId(1L);
roleAdministerMappingMapper.insert(roleAdministerMappingDO);
return ConstantUtils.ADD_SUCCESS;
}
......
......@@ -80,6 +80,11 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
administerDO.setRole(1);
administerMapper.insert(administerDO);
RoleAdministerMappingDO roleAdministerMappingDO = new RoleAdministerMappingDO();
roleAdministerMappingDO.setAdministerId(administerDO.getId());
roleAdministerMappingDO.setRoleId(2L);
roleAdministerMappingMapper.insert(roleAdministerMappingDO);
return ConstantUtils.ADD_SUCCESS;
}
......
......@@ -75,6 +75,17 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
public IPage queryCourses(QueryCoursesDTO queryCoursesDTO) {
Page pager = new Page(queryCoursesDTO.getPageNum(), queryCoursesDTO.getPageSize());
//判断当前用户是运营者还是企业者
Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,queryCoursesDTO.getAdministerId())
.eq(RoleAdministerMappingDO::getRoleId,1));
if (count > 0){
queryCoursesDTO.setCompanyId(null);
}
return this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), queryCoursesDTO.getCategoryId(), queryCoursesDTO.getCourseType(), queryCoursesDTO.getCourseSource(), queryCoursesDTO.getCompanyId());
}
......
......@@ -24,12 +24,7 @@
left join category t2 on t.category_id = t2.id
WHERE
t.delete_date IS NULL
<if test="companyId ==null ">
and t.company_id is null
</if>
<if test="companyId !=null and companyId !='' ">
and t.company_id = #{companyId}
</if>
and t.company_id is null
<if test="categoryId != null">
AND t.category_id = #{categoryId}
</if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!