作者 mxy

后端成长树/班级/年级

正在显示 41 个修改的文件 包含 911 行增加19 行删除
... ... @@ -3,8 +3,11 @@ package cn.bronet.admin.demo.controller;
import java.util.List;
import java.util.Arrays;
import io.swagger.annotations.ApiImplicitParam;
import lombok.RequiredArgsConstructor;
import javax.validation.constraints.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
... ... @@ -30,6 +33,7 @@ import io.swagger.annotations.ApiOperation;
* @author ruoyi
* @date 2021-09-09
*/
@Slf4j
@Validated
@Api(value = "学校年级控制器", tags = {"学校年级管理"})
@RequiredArgsConstructor()
... ... @@ -46,6 +50,8 @@ public class CGradeController extends BaseController {
@PreAuthorize("@ss.hasPermi('demo:grade:list')")
@GetMapping("/list")
public TableDataInfo<CGradeVo> list(@Validated CGradeBo bo) {
log.info("<<<接收的参数<<<::"+bo);
return iCGradeService.queryPageList(bo);
}
... ... @@ -108,4 +114,71 @@ public class CGradeController extends BaseController {
@PathVariable Long[] ids) {
return toAjax(iCGradeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
/**
* 查询此学校下所有的年级
*/
@ApiOperation("查询此年级下的所有年级")
@GetMapping("/getAllGrades")
public AjaxResult myAllGrades(@RequestBody CGradeBo bo){
return iCGradeService.getAllGrades(bo);
}
/**
* 添加年级
*/
@ApiOperation("添加年级")
@PostMapping("/saveGrade")
public AjaxResult mySaveGrade(@RequestBody CGradeBo bo){
log.info("<<<接收的参数<<<::"+bo);
return iCGradeService.saveGrade(bo);
}
/**
* 查询此学校下正常状态的年级
*/
@ApiOperation("查询此学校下正常状态的年级")
@GetMapping("/getGrades")
public AjaxResult myGrades(){
return iCGradeService.getGrades();
}
/**
* 添加班级
*/
@ApiOperation("添加班级")
@PostMapping("/saveClasses")
public AjaxResult myClasses(@RequestBody CGradeBo bo){
log.info("<<<接收的参数<<<::"+bo);
return iCGradeService.saveClasses(bo);
}
/**
* 查询此学校下所有班级
*/
@ApiOperation("查询此学校下所有班级")
@PostMapping("/getAllClasses")
public AjaxResult myAllClasses(@RequestBody CGradeBo bo){
log.info("<<<接收的参数<<<::"+bo);
return iCGradeService.getAllClasses(bo);
}
/**
* 查询此学校下正常状态的班级
*/
@ApiImplicitParam(name = "gradeParentId",value = "年级ID",dataType = "Long",required = true,paramType = "query")
@ApiOperation("查询此学校下正常状态的班级")
@GetMapping("/getClasses")
public AjaxResult myClasses( Long gradeParentId){
return iCGradeService.getClasses(gradeParentId);
}
}
... ...
... ... @@ -108,4 +108,15 @@ public class CGrowthReportLevelController extends BaseController {
@PathVariable Long[] ids) {
return toAjax(iCGrowthReportLevelService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
/**
* 查询所有的评分
*/
@ApiOperation("查询所有的评分")
@GetMapping("/getAllLevel")
public AjaxResult myAllLevel(){
return iCGrowthReportLevelService.getAllLevel();
}
}
... ...
... ... @@ -3,8 +3,12 @@ package cn.bronet.admin.demo.controller;
import java.util.List;
import java.util.Arrays;
import cn.bronet.admin.demo.domain.bo.CGrowthsBo;
import cn.bronet.admin.demo.domain.bo.GrowthTableBo;
import lombok.RequiredArgsConstructor;
import javax.validation.constraints.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
... ... @@ -30,6 +34,7 @@ import io.swagger.annotations.ApiOperation;
* @author ruoyi
* @date 2021-09-09
*/
@Slf4j
@Validated
@Api(value = "成长树控制器", tags = {"成长树管理"})
@RequiredArgsConstructor()
... ... @@ -49,7 +54,7 @@ public class CGrowthReportStudentController extends BaseController {
return iCGrowthReportStudentService.queryPageList(bo);
}
/**
/**
* 导出成长树列表
*/
@ApiOperation("导出成长树列表")
... ... @@ -108,4 +113,28 @@ public class CGrowthReportStudentController extends BaseController {
@PathVariable Long[] ids) {
return toAjax(iCGrowthReportStudentService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
/**
* 班主任条件查询成长树
*/
@ApiOperation("班主任条件查询成长树")
@PostMapping("/growthList")
public AjaxResult myGrowthList(@RequestBody GrowthTableBo bo){
log.info("<<<接收的参数<<<::"+bo);
return iCGrowthReportStudentService.getGrowthList(bo);
}
/**
* 发布
*/
@ApiOperation("发布")
@PostMapping("/send")
public AjaxResult mySend(@RequestBody CGrowthsBo bo){
log.info("<<<接收的参数<<<::"+bo);
return iCGrowthReportStudentService.mySend(bo);
}
}
... ...
... ... @@ -5,6 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.math.BigDecimal;
... ... @@ -49,4 +50,14 @@ public class CGrade implements Serializable {
*/
private Long parentId;
/**
* 状态
*/
private Integer state;
/**
* 创建时间
*/
private LocalDateTime createTime;
}
... ...
... ... @@ -71,4 +71,9 @@ public class CGrowthReportStudent implements Serializable {
*/
private Long type;
/**
* growths的Id
*/
private Long growthsId;
}
... ...
package cn.bronet.admin.demo.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("c_growths")
public class CGrowths implements Serializable {
private static final long serialVersionUID=1L;
/**
* 编号
*/
@TableId(value = "id")
private Long id;
/**
* 报告标题
*/
private String title;
/**
* 副标题
*/
private String otherTitle;
/**
* 老师的userId
*/
private Long userId;
/**
* 年级Id
*/
private Long gradeParentId;
/**
* 年级Id
*/
private Long gradeId;
/**
* 状态
*/
private Integer type;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
}
... ...
... ... @@ -59,4 +59,9 @@ public class CRelationshipStudentSgc implements Serializable {
*/
private Integer gardeType;
/**
* 学校ID
*/
private Long schoolId;
}
... ...
... ... @@ -91,4 +91,14 @@ public class CUser implements Serializable {
*/
private String wxName;
/**
* 学校id
*/
private Long schoolCurrent;
/**
* 学号
*/
private Long student;
}
... ...
... ... @@ -75,4 +75,10 @@ public class CGradeBo extends BaseEntity {
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
private String isAsc;
/**
* 状态
*/
@ApiModelProperty("状态 0-正常 1-隐藏")
private Integer state;
}
... ...
... ... @@ -57,4 +57,10 @@ public class CGrowthReportLevelBo extends BaseEntity {
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
private String isAsc;
/**
* 学校Id
*/
@ApiModelProperty("学校Id")
private Long schoolId;
}
... ...
package cn.bronet.admin.demo.domain.bo;
import cn.bronet.admin.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("成长树对象")
public class CGrowthsBo extends BaseEntity{
/**
* id
*/
@ApiModelProperty("编号")
private Long id;
/**
* 文件标题
*/
@ApiModelProperty("文件标题")
private String title;
/**
* 副标题
*/
@ApiModelProperty("副标题")
private String otherTitle;
/**
* 年级Id
*/
@ApiModelProperty("年级ID")
private Long gradeParentId;
/**
* 班级Id
*/
@ApiModelProperty("班级ID")
private Long[] gradesId;
}
... ...
package cn.bronet.admin.demo.domain.bo;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class GrowthTableBo {
/**
* 报告名称
*/
private String reportName;
/**
* 状态
*/
private Integer type;
/**
* 年级
*/
private Long gradeParentId;
/**
* 班级
*/
private Long gradeId;
/**
* 发布日期
*/
private LocalDateTime createTime;
/**
* 截止日期
*/
private LocalDateTime endTime;
}
... ...
... ... @@ -52,5 +52,7 @@ public class CGradeVo {
@ApiModelProperty("父类id")
private Long parentId;
private Integer state;
}
... ...
package cn.bronet.admin.demo.domain.vo;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class GrowthVo {
/**
* 序号
*/
private Long id;
/**
* 报告标题
*/
private String title;
/**
* 年级
*/
private String gradeName;
/**
* 状态
*/
private Integer type;
/**
* 发布时间
*/
private LocalDateTime createTime;
}
... ...
... ... @@ -2,6 +2,14 @@ package cn.bronet.admin.demo.mapper;
import cn.bronet.admin.demo.domain.CGrade;
import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
import cn.bronet.admin.demo.domain.TestDemo;
import cn.bronet.admin.demo.domain.vo.CGradeVo;
import cn.bronet.admin.demo.domain.vo.TestDemoVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 学校年级Mapper接口
... ... @@ -11,4 +19,8 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CGradeMapper extends BaseMapperPlus<CGrade> {
List<CGrade> selectBySchoolId(@Param("sid") Long sid, @Param("gtid") Integer gtid);
Page<CGradeVo> customPageList(@Param("page") Page<CGrade> page, @Param("ew") Wrapper<CGrade> wrapper);
}
... ...
... ... @@ -3,6 +3,8 @@ package cn.bronet.admin.demo.mapper;
import cn.bronet.admin.demo.domain.CGrowthReportLevel;
import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
import java.util.List;
/**
* 成长树评分Mapper接口
*
... ... @@ -11,4 +13,5 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CGrowthReportLevelMapper extends BaseMapperPlus<CGrowthReportLevel> {
List<CGrowthReportLevel> selectBySchoolId(Long sid);
}
... ...
... ... @@ -11,4 +11,5 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CGrowthReportStudentMapper extends BaseMapperPlus<CGrowthReportStudent> {
CGrowthReportStudent selectByUserId(Long uid);
}
... ...
package cn.bronet.admin.demo.mapper;
import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
import cn.bronet.admin.demo.domain.CGrowths;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 成长树Mapper接口
*
* @author mdx
* @date 2021-09-022
*/
public interface CGrowthsMapper extends BaseMapperPlus<CGrowths> {
List<Long> studentList(@Param("gid") Long gid, @Param("sid") Long sid);
CGrowths growth(@Param("uid") Long uid, @Param("gpid") Long gpid);
}
... ...
... ... @@ -12,4 +12,6 @@ Mapper接口
*/
public interface CPersonalInformationMapper extends BaseMapperPlus<CPersonalInformation> {
CPersonalInformation studentInfo(Long uid);
}
... ...
... ... @@ -11,4 +11,6 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CRegisterSchoolMapper extends BaseMapperPlus<CRegisterSchool> {
Long selectByUserId(Long uid);
}
... ...
... ... @@ -11,4 +11,6 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CRelationshipStudentSgcMapper extends BaseMapperPlus<CRelationshipStudentSgc> {
}
... ...
... ... @@ -3,6 +3,8 @@ package cn.bronet.admin.demo.mapper;
import cn.bronet.admin.demo.domain.CTeacher;
import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
import java.util.List;
/**
* 老师Mapper接口
*
... ... @@ -11,4 +13,5 @@ import cn.bronet.admin.common.core.mybatisplus.core.BaseMapperPlus;
*/
public interface CTeacherMapper extends BaseMapperPlus<CTeacher> {
List<Long> getTeachers(Long gid);
}
... ...
package cn.bronet.admin.demo.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.demo.domain.CGrade;
import cn.bronet.admin.demo.domain.vo.CGradeVo;
import cn.bronet.admin.demo.domain.bo.CGradeBo;
... ... @@ -16,6 +17,7 @@ import java.util.List;
* @date 2021-09-09
*/
public interface ICGradeService extends IServicePlus<CGrade, CGradeVo> {
/**
* 查询单个
* @return
... ... @@ -53,4 +55,46 @@ public interface ICGradeService extends IServicePlus<CGrade, CGradeVo> {
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 查询此学校下所有年级
* @return
* @author mdx
*/
AjaxResult getAllGrades(CGradeBo bo);
/**
* 添加年级
*
* @param bo
* @return
*/
AjaxResult saveGrade(CGradeBo bo);
/**
* 查询此学校下正常状态的年级
* @return
*/
AjaxResult getGrades();
/**
* 添加班级
* @param bo
* @return
*/
AjaxResult saveClasses(CGradeBo bo);
/**
* 查询此学校下所有班级
* @param bo
* @return
*/
AjaxResult getAllClasses(CGradeBo bo);
/**
* 查询此学校下正常状态的班级
* @return
*/
AjaxResult getClasses(Long gradeParentId);
}
... ...
package cn.bronet.admin.demo.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.demo.domain.CGrowthReportLevel;
import cn.bronet.admin.demo.domain.vo.CGrowthReportLevelVo;
import cn.bronet.admin.demo.domain.bo.CGrowthReportLevelBo;
... ... @@ -53,4 +54,11 @@ public interface ICGrowthReportLevelService extends IServicePlus<CGrowthReportLe
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 查询所有的评分
* @return
*/
AjaxResult getAllLevel();
}
... ...
package cn.bronet.admin.demo.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.demo.domain.CGrowthReportStudent;
import cn.bronet.admin.demo.domain.bo.CGrowthsBo;
import cn.bronet.admin.demo.domain.bo.GrowthTableBo;
import cn.bronet.admin.demo.domain.vo.CGrowthReportStudentVo;
import cn.bronet.admin.demo.domain.bo.CGrowthReportStudentBo;
import cn.bronet.admin.common.core.mybatisplus.core.IServicePlus;
... ... @@ -53,4 +56,19 @@ public interface ICGrowthReportStudentService extends IServicePlus<CGrowthReport
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 班主任条件查询成长树列表
* @param bo 查询条件
* @return
* @author mdx
*/
AjaxResult getGrowthList(GrowthTableBo bo);
/**
* 发布年级下的成长树
* @param bo
* @return
*/
AjaxResult mySend(CGrowthsBo bo);
}
... ...
package cn.bronet.admin.demo.service.impl;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.common.utils.ServletUtils;
import cn.bronet.admin.demo.domain.CUser;
import cn.bronet.admin.demo.domain.vo.TestDemoVo;
import cn.bronet.admin.demo.mapper.CRegisterSchoolMapper;
import cn.bronet.admin.demo.mapper.CUserMapper;
import cn.hutool.core.bean.BeanUtil;
import cn.bronet.admin.common.utils.PageUtils;
import cn.bronet.admin.common.core.page.PagePlus;
import cn.bronet.admin.common.core.page.TableDataInfo;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javassist.runtime.Desc;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.bronet.admin.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
... ... @@ -15,6 +26,8 @@ import cn.bronet.admin.demo.domain.CGrade;
import cn.bronet.admin.demo.mapper.CGradeMapper;
import cn.bronet.admin.demo.service.ICGradeService;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
... ... @@ -25,9 +38,20 @@ import java.util.Collection;
* @author ruoyi
* @date 2021-09-09
*/
@Slf4j
@Service
public class CGradeServiceImpl extends ServicePlusImpl<CGradeMapper, CGrade, CGradeVo> implements ICGradeService {
@Autowired
private CUserMapper cUserMapper;
@Autowired
private CGradeMapper cGradeMapper;
@Autowired
private CRegisterSchoolMapper cRegisterSchoolMapper;
@Override
public CGradeVo queryById(Long id){
return getVoById(id);
... ... @@ -35,6 +59,9 @@ public class CGradeServiceImpl extends ServicePlusImpl<CGradeMapper, CGrade, CGr
@Override
public TableDataInfo<CGradeVo> queryPageList(CGradeBo bo) {
PagePlus<CGrade, CGradeVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
return PageUtils.buildDataInfo(result);
}
... ... @@ -51,6 +78,7 @@ public class CGradeServiceImpl extends ServicePlusImpl<CGradeMapper, CGrade, CGr
lqw.eq(bo.getSchoolId() != null, CGrade::getSchoolId, bo.getSchoolId());
lqw.eq(bo.getGradeType() != null, CGrade::getGradeType, bo.getGradeType());
lqw.eq(bo.getParentId() != null, CGrade::getParentId, bo.getParentId());
lqw.eq(bo.getState() !=null,CGrade::getState,bo.getState());
return lqw;
}
... ... @@ -84,4 +112,167 @@ public class CGradeServiceImpl extends ServicePlusImpl<CGradeMapper, CGrade, CGr
}
return removeByIds(ids);
}
/**
* 查询此学校下所有年级
* @return
* @author mdx
*/
@Override
public AjaxResult getAllGrades(CGradeBo bo) {
// TODO: 2021/9/23 获取登录人的ID
Long uId=119911L;
CUser cUser = cUserMapper.selectById(uId);
Long school = cRegisterSchoolMapper.selectByUserId(uId);
// TODO: 2021/9/23 分页查询
bo.setSchoolId(school);
Page<CGradeVo> pageList = baseMapper.customPageList(PageUtils.buildPage(), buildQueryWrapper(bo));
return AjaxResult.success(pageList);
}
/**
* 添加年级
* @param bo
* @return
*/
@Override
public AjaxResult saveGrade(CGradeBo bo) {
//获取登录用户的Id
Long uId=111111L;
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
//创建需要添加到数据库的参数
CGrade grade = new CGrade();
grade.setGradeName(bo.getGradeName())
.setGradeType(bo.getGradeType())
.setCreateTime(LocalDateTime.now())
.setState(bo.getState())
.setSchoolId(schoolId);
cGradeMapper.insert(grade);
return AjaxResult.success();
}
/**
* 查询此学校下正常状态的年级
* @return
*/
@Override
public AjaxResult getGrades() {
//获取登录人的Id
Long uId =119911L;
CUser cUser = cUserMapper.selectById(uId);
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
//创建数据库查询条件
LambdaQueryWrapper<CGrade> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CGrade::getState,0)
.eq(CGrade::getSchoolId,schoolId)
.eq(CGrade::getGradeType,1);
List<CGrade> cGrades = cGradeMapper.selectList(wrapper);
//创建返回值
List<CGradeVo> vos = new ArrayList<>();
//循环遍历获得的数据
for (CGrade cGrade : cGrades) {
//数据添加到返回值中
CGradeVo vo = new CGradeVo();
BeanUtils.copyProperties(cGrade,vo);
vos.add(vo);
}
log.info("<<<返回的参数<<<::"+vos);
return AjaxResult.success(vos);
}
/**
* 添加班级
* @param bo
* @return
*/
@Override
public AjaxResult saveClasses(CGradeBo bo) {
//获取登录人ID
Long uId=119911L;
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
//创建存储信息
CGrade grade = new CGrade();
BeanUtils.copyProperties(bo,grade);
grade.setSchoolId(schoolId);
cGradeMapper.insert(grade);
return AjaxResult.success();
}
/**
* 查询此学校下所有班级
* @param bo
* @return
*/
@Override
public AjaxResult getAllClasses(CGradeBo bo) {
Long uId=119911L;
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
bo.setSchoolId(schoolId);
bo.setGradeType(2);
Page<CGradeVo> pageList = baseMapper.customPageList(PageUtils.buildPage(), buildQueryWrapper(bo));
log.info("<<<返回的参数<<<::"+pageList);
return AjaxResult.success(pageList);
}
/**
* 查询此学校下正常状态的班级
* @return
*/
@Override
public AjaxResult getClasses(Long gradeParentId) {
//获取登录人用户
Long uId=119911L;
CUser cUser = cUserMapper.selectById(uId);
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
LambdaQueryWrapper<CGrade> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CGrade::getParentId,gradeParentId)
.eq(CGrade::getSchoolId,schoolId)
.eq(CGrade::getGradeType,2)
.eq(CGrade::getState,0);
List<CGrade> cGrades = cGradeMapper.selectList(wrapper);
List<CGradeVo> vos = new ArrayList<>();
for (CGrade cGrade : cGrades) {
CGradeVo vo = new CGradeVo();
BeanUtils.copyProperties(cGrade,vo);
vos.add(vo);
}
log.info("<<<返回的参数<<<::"+vos);
return AjaxResult.success(vos);
}
}
... ...
package cn.bronet.admin.demo.service.impl;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.demo.mapper.CRegisterSchoolMapper;
import cn.hutool.core.bean.BeanUtil;
import cn.bronet.admin.common.utils.PageUtils;
import cn.bronet.admin.common.core.page.PagePlus;
import cn.bronet.admin.common.core.page.TableDataInfo;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.ser.BeanSerializer;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import cn.bronet.admin.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
... ... @@ -15,6 +22,7 @@ import cn.bronet.admin.demo.domain.CGrowthReportLevel;
import cn.bronet.admin.demo.mapper.CGrowthReportLevelMapper;
import cn.bronet.admin.demo.service.ICGrowthReportLevelService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
... ... @@ -28,6 +36,13 @@ import java.util.Collection;
@Service
public class CGrowthReportLevelServiceImpl extends ServicePlusImpl<CGrowthReportLevelMapper, CGrowthReportLevel, CGrowthReportLevelVo> implements ICGrowthReportLevelService {
@Autowired
private CRegisterSchoolMapper cRegisterSchoolMapper;
@Autowired
private CGrowthReportLevelMapper cGrowthReportLevelMapper;
@Override
public CGrowthReportLevelVo queryById(Long id){
return getVoById(id);
... ... @@ -81,4 +96,29 @@ public class CGrowthReportLevelServiceImpl extends ServicePlusImpl<CGrowthReport
}
return removeByIds(ids);
}
/**
* 查询所有的成长树评价
* @return
*/
@Override
public AjaxResult getAllLevel() {
// TODO: 2021/9/22 获取用户ID
Long uId = 11111L;
Long schoolId = cRegisterSchoolMapper.selectByUserId(uId);
List<CGrowthReportLevel> levels = cGrowthReportLevelMapper.selectBySchoolId(schoolId);
List<CGrowthReportLevelVo> vos = new ArrayList<>();
for (CGrowthReportLevel level : levels) {
CGrowthReportLevelVo vo = new CGrowthReportLevelVo();
BeanUtils.copyProperties(level,vo);
vos.add(vo);
}
return AjaxResult.success(vos);
}
}
... ...
package cn.bronet.admin.demo.service.impl;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.common.utils.ServletUtils;
import cn.bronet.admin.demo.domain.*;
import cn.bronet.admin.demo.domain.bo.CGrowthsBo;
import cn.bronet.admin.demo.domain.bo.GrowthTableBo;
import cn.bronet.admin.demo.domain.vo.TestDemoVo;
import cn.bronet.admin.demo.mapper.*;
import cn.hutool.core.bean.BeanUtil;
import cn.bronet.admin.common.utils.PageUtils;
import cn.bronet.admin.common.utils.PageUtils;
import cn.bronet.admin.common.core.page.PagePlus;
import cn.bronet.admin.common.core.page.TableDataInfo;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Service;
import cn.bronet.admin.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.bronet.admin.demo.domain.bo.CGrowthReportStudentBo;
import cn.bronet.admin.demo.domain.vo.CGrowthReportStudentVo;
import cn.bronet.admin.demo.domain.CGrowthReportStudent;
import cn.bronet.admin.demo.mapper.CGrowthReportStudentMapper;
import cn.bronet.admin.demo.service.ICGrowthReportStudentService;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Collection;
... ... @@ -28,6 +38,31 @@ import java.util.Collection;
@Service
public class CGrowthReportStudentServiceImpl extends ServicePlusImpl<CGrowthReportStudentMapper, CGrowthReportStudent, CGrowthReportStudentVo> implements ICGrowthReportStudentService {
@Autowired
private CGrowthsMapper cGrowthsMapper;
@Autowired
private CUserMapper cUserMapper;
@Autowired
private CGradeMapper cGradeMapper;
@Autowired
private CTeacherMapper cTeacherMapper;
@Autowired
private CRelationshipStudentSgcMapper cRelationshipStudentSgcMapper;
@Autowired
private CPersonalInformationMapper cPersonalInformationMapper;
@Autowired
private CGrowthReportStudentMapper cGrowthReportStudentMapper;
@Autowired
private CGrowthSubjectMapper cGrowthSubjectMapper;
@Override
public CGrowthReportStudentVo queryById(Long id){
return getVoById(id);
... ... @@ -86,4 +121,111 @@ public class CGrowthReportStudentServiceImpl extends ServicePlusImpl<CGrowthRepo
}
return removeByIds(ids);
}
/**
* 班主任条件查询成长树
* @param bo 查询条件
* @return
*/
@Override
public AjaxResult getGrowthList(GrowthTableBo bo) {
LambdaQueryWrapper<CGrowthReportStudent> wrapper = new LambdaQueryWrapper<>();
if (!bo.getReportName().isEmpty()){
wrapper.eq(CGrowthReportStudent::getTitle,bo.getReportName());
}
if (bo.getType() != null){
wrapper.eq(CGrowthReportStudent::getType,bo.getType());
}
if (bo.getCreateTime() != null && bo.getEndTime() != null ){
wrapper.between(CGrowthReportStudent::getCreateTime,bo.getCreateTime(),bo.getEndTime());
}
// TODO: 2021/9/22 分页查询
List<CGrowthReportStudent> reportStudentList = cGrowthReportStudentMapper.selectList(wrapper);
return null;
}
/**
* 创建年级下的所有成长树
* @param bo
* @return
*/
@Transactional
@Override
public AjaxResult mySend(CGrowthsBo bo) {
// TODO: 2021/9/22 登录人Id
long uId = 1437688801904930818L;
CUser cUser = cUserMapper.selectById(uId);
Long[] gradesId = bo.getGradesId();
//一次发布多个班级
if (gradesId.length>1){
//循环遍历班级Id
for (Long gradeId : gradesId) {
//存储growths表信息
CGrowths cGrowths = new CGrowths();
cGrowths.setTitle(bo.getTitle())
.setOtherTitle(bo.getOtherTitle())
// TODO: 2021/9/22 用户Id
.setUserId(uId)
.setGradeParentId(bo.getGradeParentId())
.setGradeId(gradeId)
.setUpdateTime(LocalDateTime.now())
.setCreateTime(LocalDateTime.now());
cGrowthsMapper.insert(cGrowths);
//获取c_growths表信息
CGrowths growth = cGrowthsMapper.growth(uId, bo.getGradeParentId());
//获取此学校此班级的所有学生
List<Long> longs = cGrowthsMapper.studentList(gradeId, cUser.getSchoolCurrent());
//循环遍历学生
for (Long aLong : longs) {
CPersonalInformation studentInfo = cPersonalInformationMapper.studentInfo(aLong);
//创建所有学的的成长报告
CGrowthReportStudent cGrowthReportStudent = new CGrowthReportStudent();
cGrowthReportStudent.setTitle(studentInfo.getName()+"同学月度学习成长报告")
.setUserId(aLong)
.setGrowthsId(growth.getId());
cGrowthReportStudentMapper.insert(cGrowthReportStudent);
CGrowthReportStudent reportStudent = cGrowthReportStudentMapper.selectByUserId(aLong);
//查询学生的所有老师
List<Long> teachers = cTeacherMapper.getTeachers(gradeId);
//循环遍历所有老师
for (Long teacher : teachers) {
CGrowthSubject subject = new CGrowthSubject();
subject.setGrowthReportId(reportStudent.getId())
.setTeacherId(teacher);
cGrowthSubjectMapper.insert(subject);
}
}
}
}
return AjaxResult.success();
}
}
... ...
... ... @@ -10,7 +10,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="schoolId" column="school_id"/>
<result property="gradeType" column="grade_type"/>
<result property="parentId" column="parent_id"/>
<result property="state" column="state"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="selectBySchoolId" resultMap="CGradeResult">
SELECT * FROM c_grade WHERE school_id=#{sid} AND grade_type=#{gtid}
</select>
</mapper>
\ No newline at end of file
<select id="customPageList" resultType="cn.bronet.admin.demo.domain.vo.CGradeVo">
SELECT * FROM test_demo ${ew.customSqlSegment}
</select>
</mapper>
... ...
... ... @@ -10,6 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectBySchoolId" resultMap="CGrowthReportLevelResult">
SELECT * FROM c_growth_report_level WHERE school_id=#{sid}
</select>
</mapper>
\ No newline at end of file
</mapper>
... ...
... ... @@ -16,5 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type"/>
</resultMap>
<select id="selectByUserId" resultType="cn.bronet.admin.demo.domain.CGrowthReportStudent">
SELECT * FROM c_growth_report_student WHERE user_id =#{uid};
</select>
</mapper>
\ No newline at end of file
</mapper>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.bronet.admin.demo.mapper.CGrowthsMapper">
<resultMap type="cn.bronet.admin.demo.domain.CGrowths" id="CGrowthsResult">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="otherTitle" column="other_title"/>
<result property="userId" column="user_id"/>
<result property="gradeParentId" column="grade_parent_id"/>
<result property="gradeId" column="grade_id"/>
<result property="type" column="type"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="studentList" resultType="long" >
SELECT user_id FROM c_relationship_student_sgc WHERE gerde_id =#{gid} AND school_id=#{sid}
</select>
<select id="growth" resultMap="CGrowthsResult">
SELECT * From c_growths WHERE user_id =#{uid} And grade_parent_id= #{gpid}
</select>
</mapper>
... ...
... ... @@ -22,6 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="attentionNumber" column="attention_number"/>
<result property="beanVermicelli" column="bean_vermicelli"/>
</resultMap>
<select id="studentInfo" resultMap="CPersonalInformationResult">
SELECT * FROM c_personal_information WHERE user_id = #{uid}
</select>
</mapper>
... ...
... ... @@ -17,5 +17,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="schoolType" column="school_type"/>
</resultMap>
<select id="selectByUserId" resultType="java.lang.Long">
SELECT school_id FROM c_register_school WHERE user_id=#{uid}
</select>
</mapper>
... ...
... ... @@ -11,6 +11,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="tecaherType" column="tecaher_type"/>
<result property="subject" column="subject"/>
</resultMap>
<select id="getTeachers" resultType="java.lang.Long">
SELECT user_id FROM c_teacher WHERE grade_id =#{gid}
</select>
</mapper>
\ No newline at end of file
</mapper>
... ...
... ... @@ -10,10 +10,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* Created with IDEA
... ... @@ -60,7 +57,7 @@ public class FamilyController {
@ApiImplicitParam(name = "familyId",value = "家庭关系表Id",dataType = "Long",required = true,paramType = "query")
@ApiOperation("删除家庭关系信息")
@PostMapping("/deleteFamily")
@GetMapping("/deleteFamily")
public AjaxResult deleteFamily(Long familyId){
log.info("<<<接收到的参数<<<::"+familyId);
... ...
... ... @@ -43,7 +43,7 @@ public class CFamilyRelationStudent implements Serializable {
/**
* 关系
*/
private Integer relationship;
private String relationship;
/**
* 子类id(孩子id)
... ...
... ... @@ -52,7 +52,6 @@ public class CGrowthReportLevel implements Serializable {
/**
* 学校Id
*/
@TableId(value = "school_id")
private Long schoolId;
}
... ...
... ... @@ -46,7 +46,7 @@ public class CFamilyRelationStudentBo extends BaseEntity {
*/
@ApiModelProperty("关系")
@NotNull(message = "关系不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer relationship;
private String relationship;
/**
* 子类id(孩子id)
... ...
package com.example.client.domain.vo;
import cn.bronet.admin.common.annotation.Excel;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
... ... @@ -21,6 +23,7 @@ public class CFamilyRelationStudentVo {
/**
* 编号
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("编号")
private Long id;
... ... @@ -29,6 +32,7 @@ public class CFamilyRelationStudentVo {
*/
@Excel(name = "用户id")
@ApiModelProperty("用户id")
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
/**
... ... @@ -43,13 +47,14 @@ public class CFamilyRelationStudentVo {
*/
@Excel(name = "关系")
@ApiModelProperty("关系")
private Integer relationship;
private String relationship;
/**
* 子类id(孩子id)
*/
@Excel(name = "子类id" , readConverterExp = "孩=子id")
@Excel(name = "子类id" , readConverterExp = "孩子id")
@ApiModelProperty("子类id(孩子id)")
@JsonSerialize(using = ToStringSerializer.class)
private Long subclassId;
/**
... ...
... ... @@ -2,6 +2,7 @@ package com.example.client.service.impl;
import cn.bronet.admin.common.core.domain.AjaxResult;
import cn.bronet.admin.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.client.domain.CFamilyRelationStudent;
... ... @@ -99,7 +100,10 @@ public class FamilyServiceImpl extends ServicePlusImpl<CFamilyRelationStudentMap
if (cUser.getIdentityType().equals(Identity.TEACHWE)){
//根据用户Id查询家庭关系表
List<CFamilyRelationStudent> families= cFamilyRelationStudentMapper.getAllFamilies(uId);
LambdaQueryWrapper<CFamilyRelationStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CFamilyRelationStudent::getUserId,uId);
List<CFamilyRelationStudent> families = cFamilyRelationStudentMapper.selectList(wrapper);
//List<CFamilyRelationStudent> families= cFamilyRelationStudentMapper.getAllFamilies(uId);
//判断 等于 null
if (families.isEmpty()){
... ... @@ -302,6 +306,7 @@ public class FamilyServiceImpl extends ServicePlusImpl<CFamilyRelationStudentMap
//添加信息到数据库
CFamilyRelationStudent family = new CFamilyRelationStudent();
BeanUtils.copyProperties(bo,family);
family.setUserId(uId);
family.setCreatorTime(LocalDateTime.now());
cFamilyRelationStudentMapper.insert(family);
... ...