作者 mxy

圈子下拉选项

动态种类
... ... @@ -89,4 +89,18 @@ public class ActivityController {
return activityService.selectActivity(activityId);
}
@ApiOperation("查询学校")
@PostMapping("/getSchools")
public AjaxResult getSchools(){
return activityService.getSchool();
}
@ApiOperation("动态的种类")
@PostMapping("/getActivityType")
public AjaxResult getActivityType(){
return activityService.getActivityType();
}
}
... ...
package com.example.client.domain.vo;
import cn.bronet.admin.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ActivitySchoolVo {
/**
* 学校id
*/
@ApiModelProperty("学校id")
private Long schoolId;
/**
* 学校名称
*/
@Excel(name = "学校名称")
@ApiModelProperty("学校名称")
private String schoolName;
}
... ...
... ... @@ -58,4 +58,16 @@ public interface ActivityService {
*/
AjaxResult selectActivity(Long activityId);
/**
* 获取所有学校
* @return
*/
AjaxResult getSchool();
/**
* 动态的所有种类
* @return
*/
AjaxResult getActivityType();
}
... ...
... ... @@ -83,6 +83,12 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi
@Autowired
private CMycollectMapper cMycollectMapper;
@Autowired
private CRelationshipStudentSgcMapper cRelationshipStudentSgcMapper;
@Autowired
private CActivityTypesMapper cActivityTypesMapper;
@ApiOperation("发布动态的初始化界面")
... ... @@ -552,6 +558,99 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi
}
/**
* 获取所有学校
* @return
*/
@Override
public AjaxResult getSchool() {
Long uId = UserContext.currentUserId();
CUser cUser = cUserMapper.selectById(uId);
//老师
if (cUser.getIdentityType().equals(Identity.TEACHWE)){
//根据登录人ID查询老师的信息
LambdaQueryWrapper<CTeacher> teacherWrapper = new LambdaQueryWrapper<>();
teacherWrapper.eq(CTeacher::getUserId,uId);
CTeacher cTeacher = cTeacherMapper.selectOne(teacherWrapper);
log.info("<<<<<<cTeacher::"+cTeacher);
//根据老师信息的GradeID查询年级表
LambdaQueryWrapper<CGrade> cGradeWrapper = new LambdaQueryWrapper<>();
cGradeWrapper.eq(CGrade::getId,cTeacher.getGradeId());
CGrade cGrade = cGradeMapper.selectOne(cGradeWrapper);
LambdaQueryWrapper<CRegisterSchool> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CRegisterSchool::getSchoolId,cGrade.getSchoolId());
List<CRegisterSchool> schools = cSchoolMapper.selectList(wrapper);
List<MySchoolVo> schoolVos = new ArrayList<>();
for (CRegisterSchool school : schools) {
MySchoolVo mySchoolVo = new MySchoolVo();
mySchoolVo.setSchoolName(school.getSchoolName());
mySchoolVo.setId(school.getSchoolId());
schoolVos.add(mySchoolVo);
}
return AjaxResult.success(schoolVos);
}else if(cUser.getIdentityType().equals(Identity.STUDENT)){
List<MySchoolVo> schoolVos = cRelationshipStudentSgcMapper.getSchool(uId, 1);
return AjaxResult.success(schoolVos);
}else if (cUser.getIdentityType().equals(Identity.PATRIARCH)){
List<MySchoolVo> schoolVos = cRelationshipStudentSgcMapper.getSchool(cUser.getAtPresent(), 1);
return AjaxResult.success(schoolVos);
}else if (cUser.getIdentityType().equals(Identity.SCHOOL)){
CRegisterSchool cRegisterSchool = cSchoolMapper.selectById(cUser.getSchoolCurrent());
List<MySchoolVo> schoolVos = new ArrayList<>();
MySchoolVo mySchoolVo = new MySchoolVo();
mySchoolVo.setId(cRegisterSchool.getSchoolId());
mySchoolVo.setSchoolName(cRegisterSchool.getSchoolName());
schoolVos.add(mySchoolVo);
return AjaxResult.success(schoolVos);
}else {
return AjaxResult.error();
}
}
/**
* 动态的所以种类
* @return
*/
@Override
public AjaxResult getActivityType() {
LambdaQueryWrapper<CActivityTypes> wrapper = new LambdaQueryWrapper<>();
List<CActivityTypes> types = cActivityTypesMapper.selectList(wrapper);
List<CActivityTypesVo> vos = new ArrayList<CActivityTypesVo>();
for (CActivityTypes type : types) {
CActivityTypesVo vo = new CActivityTypesVo();
BeanUtils.copyProperties(type,vo);
vos.add(vo);
}
return AjaxResult.success(vos);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "cActivity",value = "动态信息",dataType = "CActivity",required = true,paramType = "query"),
@ApiImplicitParam(name = "uId",value = "查看人Id",dataType = "Long",required = true,paramType = "query")
... ...