作者 mxy

圈子下拉选项

动态种类
@@ -89,4 +89,18 @@ public class ActivityController { @@ -89,4 +89,18 @@ public class ActivityController {
89 89
90 return activityService.selectActivity(activityId); 90 return activityService.selectActivity(activityId);
91 } 91 }
  92 +
  93 + @ApiOperation("查询学校")
  94 + @PostMapping("/getSchools")
  95 + public AjaxResult getSchools(){
  96 +
  97 + return activityService.getSchool();
  98 + }
  99 +
  100 + @ApiOperation("动态的种类")
  101 + @PostMapping("/getActivityType")
  102 + public AjaxResult getActivityType(){
  103 +
  104 + return activityService.getActivityType();
  105 + }
92 } 106 }
  1 +package com.example.client.domain.vo;
  2 +
  3 +import cn.bronet.admin.common.annotation.Excel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +@Data
  8 +public class ActivitySchoolVo {
  9 +
  10 + /**
  11 + * 学校id
  12 + */
  13 + @ApiModelProperty("学校id")
  14 + private Long schoolId;
  15 +
  16 +
  17 + /**
  18 + * 学校名称
  19 + */
  20 + @Excel(name = "学校名称")
  21 + @ApiModelProperty("学校名称")
  22 + private String schoolName;
  23 +}
@@ -58,4 +58,16 @@ public interface ActivityService { @@ -58,4 +58,16 @@ public interface ActivityService {
58 */ 58 */
59 AjaxResult selectActivity(Long activityId); 59 AjaxResult selectActivity(Long activityId);
60 60
  61 + /**
  62 + * 获取所有学校
  63 + * @return
  64 + */
  65 + AjaxResult getSchool();
  66 +
  67 + /**
  68 + * 动态的所有种类
  69 + * @return
  70 + */
  71 + AjaxResult getActivityType();
  72 +
61 } 73 }
@@ -83,6 +83,12 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi @@ -83,6 +83,12 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi
83 @Autowired 83 @Autowired
84 private CMycollectMapper cMycollectMapper; 84 private CMycollectMapper cMycollectMapper;
85 85
  86 + @Autowired
  87 + private CRelationshipStudentSgcMapper cRelationshipStudentSgcMapper;
  88 +
  89 + @Autowired
  90 + private CActivityTypesMapper cActivityTypesMapper;
  91 +
86 92
87 93
88 @ApiOperation("发布动态的初始化界面") 94 @ApiOperation("发布动态的初始化界面")
@@ -552,6 +558,99 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi @@ -552,6 +558,99 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi
552 558
553 } 559 }
554 560
  561 + /**
  562 + * 获取所有学校
  563 + * @return
  564 + */
  565 + @Override
  566 + public AjaxResult getSchool() {
  567 +
  568 + Long uId = UserContext.currentUserId();
  569 + CUser cUser = cUserMapper.selectById(uId);
  570 +
  571 + //老师
  572 + if (cUser.getIdentityType().equals(Identity.TEACHWE)){
  573 +
  574 + //根据登录人ID查询老师的信息
  575 + LambdaQueryWrapper<CTeacher> teacherWrapper = new LambdaQueryWrapper<>();
  576 + teacherWrapper.eq(CTeacher::getUserId,uId);
  577 + CTeacher cTeacher = cTeacherMapper.selectOne(teacherWrapper);
  578 + log.info("<<<<<<cTeacher::"+cTeacher);
  579 +
  580 + //根据老师信息的GradeID查询年级表
  581 + LambdaQueryWrapper<CGrade> cGradeWrapper = new LambdaQueryWrapper<>();
  582 + cGradeWrapper.eq(CGrade::getId,cTeacher.getGradeId());
  583 + CGrade cGrade = cGradeMapper.selectOne(cGradeWrapper);
  584 +
  585 + LambdaQueryWrapper<CRegisterSchool> wrapper = new LambdaQueryWrapper<>();
  586 + wrapper.eq(CRegisterSchool::getSchoolId,cGrade.getSchoolId());
  587 + List<CRegisterSchool> schools = cSchoolMapper.selectList(wrapper);
  588 +
  589 + List<MySchoolVo> schoolVos = new ArrayList<>();
  590 +
  591 + for (CRegisterSchool school : schools) {
  592 +
  593 + MySchoolVo mySchoolVo = new MySchoolVo();
  594 + mySchoolVo.setSchoolName(school.getSchoolName());
  595 + mySchoolVo.setId(school.getSchoolId());
  596 +
  597 + schoolVos.add(mySchoolVo);
  598 +
  599 + }
  600 +
  601 + return AjaxResult.success(schoolVos);
  602 +
  603 + }else if(cUser.getIdentityType().equals(Identity.STUDENT)){
  604 +
  605 + List<MySchoolVo> schoolVos = cRelationshipStudentSgcMapper.getSchool(uId, 1);
  606 +
  607 + return AjaxResult.success(schoolVos);
  608 +
  609 + }else if (cUser.getIdentityType().equals(Identity.PATRIARCH)){
  610 +
  611 + List<MySchoolVo> schoolVos = cRelationshipStudentSgcMapper.getSchool(cUser.getAtPresent(), 1);
  612 +
  613 + return AjaxResult.success(schoolVos);
  614 +
  615 + }else if (cUser.getIdentityType().equals(Identity.SCHOOL)){
  616 +
  617 + CRegisterSchool cRegisterSchool = cSchoolMapper.selectById(cUser.getSchoolCurrent());
  618 +
  619 + List<MySchoolVo> schoolVos = new ArrayList<>();
  620 + MySchoolVo mySchoolVo = new MySchoolVo();
  621 + mySchoolVo.setId(cRegisterSchool.getSchoolId());
  622 + mySchoolVo.setSchoolName(cRegisterSchool.getSchoolName());
  623 + schoolVos.add(mySchoolVo);
  624 + return AjaxResult.success(schoolVos);
  625 + }else {
  626 +
  627 + return AjaxResult.error();
  628 + }
  629 + }
  630 +
  631 + /**
  632 + * 动态的所以种类
  633 + * @return
  634 + */
  635 + @Override
  636 + public AjaxResult getActivityType() {
  637 +
  638 + LambdaQueryWrapper<CActivityTypes> wrapper = new LambdaQueryWrapper<>();
  639 + List<CActivityTypes> types = cActivityTypesMapper.selectList(wrapper);
  640 +
  641 + List<CActivityTypesVo> vos = new ArrayList<CActivityTypesVo>();
  642 +
  643 + for (CActivityTypes type : types) {
  644 +
  645 + CActivityTypesVo vo = new CActivityTypesVo();
  646 + BeanUtils.copyProperties(type,vo);
  647 +
  648 + vos.add(vo);
  649 + }
  650 +
  651 + return AjaxResult.success(vos);
  652 + }
  653 +
555 @ApiImplicitParams({ 654 @ApiImplicitParams({
556 @ApiImplicitParam(name = "cActivity",value = "动态信息",dataType = "CActivity",required = true,paramType = "query"), 655 @ApiImplicitParam(name = "cActivity",value = "动态信息",dataType = "CActivity",required = true,paramType = "query"),
557 @ApiImplicitParam(name = "uId",value = "查看人Id",dataType = "Long",required = true,paramType = "query") 656 @ApiImplicitParam(name = "uId",value = "查看人Id",dataType = "Long",required = true,paramType = "query")