Merge branch 'master' of 39.106.16.162:/home/git/teaching-backend/teaching-backend

master
yh 4 months ago
commit 2a42c9de00
  1. 2
      pom.xml
  2. 5
      src/main/java/com/teaching/backend/controller/courses/CoursesController.java
  3. 15
      src/main/java/com/teaching/backend/controller/records/CourseLearningRecordController.java
  4. 72
      src/main/java/com/teaching/backend/controller/umsAdmin/UmsStudentManageController.java
  5. 13
      src/main/java/com/teaching/backend/controller/umsStudent/UmsStudentController.java
  6. 22
      src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentManageMapper.java
  7. 1
      src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java
  8. 25
      src/main/java/com/teaching/backend/model/dto/umsAdmin/UmsStudentPageQueryDTO.java
  9. 84
      src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentManage.java
  10. 21
      src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentPageQuery.java
  11. 3
      src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsUser.java
  12. 5
      src/main/java/com/teaching/backend/service/courses/ICoursesService.java
  13. 34
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  14. 17
      src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java
  15. 2
      src/main/java/com/teaching/backend/service/impl/report/ReportServiceImpl.java
  16. 94
      src/main/java/com/teaching/backend/service/impl/umsAdmin/UmsStudentManageServiceImpl.java
  17. 4
      src/main/java/com/teaching/backend/service/impl/umsAdmin/UmsUserServiceImpl.java
  18. 2
      src/main/java/com/teaching/backend/service/records/ICourseLearningRecordService.java
  19. 21
      src/main/java/com/teaching/backend/service/umsAdmin/UmsStudentManageService.java
  20. 5
      src/main/resources/mapper/UmsPermissionMapper.xml
  21. 46
      src/main/resources/mapper/UmsStudentManageService.xml
  22. 20
      src/main/resources/mapper/UmsStudentMapper.xml
  23. 14
      src/main/resources/mapper/UmsUserMapper.xml

@ -227,8 +227,6 @@
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
<version>2.6</version> <version>2.6</version>
</dependency> </dependency>
<!-- 文件下载--> <!-- 文件下载-->
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>

@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -132,8 +133,8 @@ public class CoursesController {
@ApiOperation("查询学生列表") @ApiOperation("查询学生列表")
@PostMapping("/studentList") @PostMapping("/studentList")
public CommonResult<LinkedHashSet<PersonalCenterStudentListVO>> getStudentList(@RequestParam String userId){ public CommonResult<List<PersonalCenterStudentListVO>> getStudentList(@RequestParam String userId){
LinkedHashSet<PersonalCenterStudentListVO> umsStudentList = coursesService.queryStudentList(userId); List<PersonalCenterStudentListVO> umsStudentList = coursesService.queryStudentList(userId);
return CommonResult.success(umsStudentList); return CommonResult.success(umsStudentList);
} }

@ -70,4 +70,19 @@ public class CourseLearningRecordController {
} }
return CommonResult.success(coursesVOList); return CommonResult.success(coursesVOList);
} }
/**
* 推荐课程
* @return
*/
@ApiOperation("推荐课程")
@PostMapping("/recommendCourses")
public CommonResult<List<CoursesVO>> recommendCourses(@RequestParam String userId) {
List<CoursesVO> coursesVOList = courseLearningRecordService.queryrecommendCourses(userId);
if (coursesVOList == null){
CommonResult.failed("用户或角色错误");
}
return CommonResult.success(coursesVOList);
}
} }

@ -0,0 +1,72 @@
package com.teaching.backend.controller.umsAdmin;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
import com.teaching.backend.service.umsAdmin.UmsStudentManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@Api(tags = "学生管理")
@RequestMapping("/api/studentManage")
@Slf4j
public class UmsStudentManageController {
@Autowired
private UmsStudentManageService umsStudentManageService;
/**
* 学生管理分页查询
* @param umsStudentPageQueryDTO
* @return
*/
@GetMapping("/page")
@ApiOperation("学生管理分页查询")
public CommonResult<Map<String, Object>> page(UmsStudentPageQueryDTO umsStudentPageQueryDTO){
Map<String, Object> pageResult = umsStudentManageService.pageQuery(umsStudentPageQueryDTO);
return CommonResult.success(pageResult);
}
/**
* 启用禁用学生账号
* @param status
* @param id
* @return
*/
@PostMapping("/status/{status}")
@ApiOperation("启用禁用员工账号")
public CommonResult startOrStop(@PathVariable String status, Long id){
umsStudentManageService.startOrStop(status,id);
return CommonResult.success("修改成功");
}
/**
* 根据id查询学生信息
* @param id
* @return
*/
@GetMapping("/{id}")
@ApiOperation("根据id查询学生信息")
public CommonResult<UmsStudentManage> getById(@PathVariable Long id){
UmsStudentManage umsStudentManage = umsStudentManageService.getByIdStudentAndUser(id);
return CommonResult.success(umsStudentManage);
}
/**
* 编辑学生信息
* @param umsStudentManage
* @return
*/
@PutMapping
@ApiOperation("编辑学生信息")
public CommonResult update(@RequestBody UmsStudentManage umsStudentManage){
log.info("编辑学生信息: {}",umsStudentManage);
umsStudentManageService.updateStudentAndUser(umsStudentManage);
return CommonResult.success("修改成功");
}
}

@ -1,13 +0,0 @@
package com.teaching.backend.controller.umsStudent;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "UmsStudentController")
@RequestMapping("/api/student")
@Slf4j
public class UmsStudentController {
}

@ -0,0 +1,22 @@
package com.teaching.backend.mapper.umsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
import com.teaching.backend.model.entity.umsAdmin.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UmsStudentManageMapper extends BaseMapper<UmsStudentManage> {
UmsStudentManage queryStudent(String userId);
List<UmsStudentManage> pageQueryStudent(UmsStudentPageQuery umsStudentPageQuery);
int pageQueryStudentCount(UmsStudentPageQueryDTO umsStudentPageQueryDTO);
UmsStudentManage getByIdStudentAndUser(Long id);
}

@ -15,4 +15,5 @@ public interface UmsStudentMapper extends BaseMapper<UmsStudent> {
boolean updateStudentInfo(UmsStudent umsStudent); boolean updateStudentInfo(UmsStudent umsStudent);
UmsStudent selectByUserId(Integer userId); UmsStudent selectByUserId(Integer userId);
} }

@ -0,0 +1,25 @@
package com.teaching.backend.model.dto.umsAdmin;
import lombok.Data;
import java.io.Serializable;
@Data
public class UmsStudentPageQueryDTO implements Serializable {
//学生姓名
private String name;
//学号
private String number;
//页码
private int page;
//每页显示记录数
private int pageSize;
//学号
private String userId;
}

@ -0,0 +1,84 @@
package com.teaching.backend.model.entity.umsAdmin;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zjh
* @since 2024-06-12
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UmsStudentManage implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
//用户名
private String username;
//密码
private String password;
//昵称
private String nickName;
//头像
private String icon;
//注册时间
private LocalDateTime createTime;
//账号状态
private Integer status;
//姓名
private String name;
//性别
private String sex;
//民族
private String nationality;
//学号
private String number;
//生日
private LocalDateTime birthday;
//手机号
private String phone;
//院系
private String faculty;
//专业
private String major;
//入学年份
private LocalDate yearAge;
//班级
private String className;
//user_id
private Integer userId;
}

@ -0,0 +1,21 @@
package com.teaching.backend.model.entity.umsAdmin;
import lombok.Data;
import java.io.Serializable;
@Data
public class UmsStudentPageQuery implements Serializable {
//学生姓名
private String name;
//学号
private String number;
//每页显示记录数
private int pageSize;
//偏移量
private int offset;
}

@ -3,6 +3,7 @@ package com.teaching.backend.model.entity.umsAdmin;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -35,7 +36,7 @@ public class UmsUser implements Serializable {
private LocalDateTime createTime; private LocalDateTime createTime;
//账号状态 //账号状态
private Integer status; private String status;
//角色id //角色id
private String roleId; private String roleId;

@ -6,6 +6,8 @@ import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO; import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.courses.Courses; import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.umsAdmin.UmsStudent; import com.teaching.backend.model.entity.umsAdmin.UmsStudent;
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
import com.teaching.backend.model.entity.umsAdmin.UmsUser;
import com.teaching.backend.model.query.CourseQuery; import com.teaching.backend.model.query.CourseQuery;
import com.teaching.backend.model.vo.courses.CoursesVO; import com.teaching.backend.model.vo.courses.CoursesVO;
import com.teaching.backend.model.vo.courses.PersonalCenterStudentListVO; import com.teaching.backend.model.vo.courses.PersonalCenterStudentListVO;
@ -47,5 +49,6 @@ public interface ICoursesService extends IService<Courses> {
Map<String, Object> getPagePageSize2(int page, int pageSize); Map<String, Object> getPagePageSize2(int page, int pageSize);
LinkedHashSet<PersonalCenterStudentListVO> queryStudentList(String userId); List<PersonalCenterStudentListVO> queryStudentList(String userId);
LinkedHashSet<UmsStudentManage> queryTeacherByStudentList(String userId);
} }

@ -14,6 +14,7 @@ import com.teaching.backend.mapper.chapter.ChapterMapper;
import com.teaching.backend.mapper.courses.*; import com.teaching.backend.mapper.courses.*;
import com.teaching.backend.mapper.records.CourseLearningRecordMapper; import com.teaching.backend.mapper.records.CourseLearningRecordMapper;
import com.teaching.backend.mapper.records.LearningRecordsMapper; import com.teaching.backend.mapper.records.LearningRecordsMapper;
import com.teaching.backend.mapper.umsAdmin.UmsStudentManageMapper;
import com.teaching.backend.mapper.umsAdmin.UmsStudentMapper; import com.teaching.backend.mapper.umsAdmin.UmsStudentMapper;
import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper; import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper;
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; import com.teaching.backend.mapper.umsAdmin.UmsUserMapper;
@ -24,6 +25,7 @@ import com.teaching.backend.model.entity.courses.*;
import com.teaching.backend.model.entity.records.CourseLearningRecord; import com.teaching.backend.model.entity.records.CourseLearningRecord;
import com.teaching.backend.model.entity.records.LearningRecords; import com.teaching.backend.model.entity.records.LearningRecords;
import com.teaching.backend.model.entity.umsAdmin.UmsStudent; import com.teaching.backend.model.entity.umsAdmin.UmsStudent;
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; import com.teaching.backend.model.entity.umsAdmin.UmsTeacher;
import com.teaching.backend.model.entity.umsAdmin.UmsUser; import com.teaching.backend.model.entity.umsAdmin.UmsUser;
import com.teaching.backend.model.query.CourseQuery; import com.teaching.backend.model.query.CourseQuery;
@ -93,6 +95,8 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
private LearningRecordsMapper learningRecordsMapper; private LearningRecordsMapper learningRecordsMapper;
@Autowired @Autowired
CourseLearningRecordMapper courseLearningRecordMapper; CourseLearningRecordMapper courseLearningRecordMapper;
@Autowired
private UmsStudentManageMapper umsStudentManageMapper;
@Override @Override
@ -350,15 +354,30 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
} }
@Override @Override
public LinkedHashSet<PersonalCenterStudentListVO> queryStudentList(String userId) { public List<PersonalCenterStudentListVO> queryStudentList(String userId) {
LinkedHashSet<UmsStudentManage> umsStudentManageList = queryTeacherByStudentList(userId);
List<PersonalCenterStudentListVO> personalCenterStudentListVOList = new ArrayList<>();
PersonalCenterStudentListVO personalCenterStudentListVO = null;
for (UmsStudentManage umsStudentManage : umsStudentManageList) {
personalCenterStudentListVO = new PersonalCenterStudentListVO();
personalCenterStudentListVO.setIcon(umsStudentManage.getIcon());
personalCenterStudentListVO.setName(umsStudentManage.getName());
personalCenterStudentListVO.setNumber(umsStudentManage.getNumber());
personalCenterStudentListVOList.add(personalCenterStudentListVO);
}
return personalCenterStudentListVOList;
}
@Override
public LinkedHashSet<UmsStudentManage> queryTeacherByStudentList(String userId) {
String roleId = umsUserMapper.getbyIdRoleId(userId); String roleId = umsUserMapper.getbyIdRoleId(userId);
CourseQuery courseQuery = new CourseQuery(); CourseQuery courseQuery = new CourseQuery();
courseQuery.setUserId(userId); courseQuery.setUserId(userId);
LinkedHashSet<UmsStudentManage> umsStudentManageList = new LinkedHashSet<>();
if (roleId.equals("1")){ if (roleId.equals("1")){
PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery); PageDTO<CoursesVO> queryCourses = queryCourses(courseQuery);
List<CoursesVO> coursesList = queryCourses.getList(); List<CoursesVO> coursesList = queryCourses.getList();
List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList()); List<String> courseIds = coursesList.stream().map(CoursesVO::getId).collect(Collectors.toList());
LinkedHashSet<PersonalCenterStudentListVO> studentNameList = new LinkedHashSet<>();
for (String courseId : courseIds) { for (String courseId : courseIds) {
List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId); List<StudentCourses> studentUsernames = studentCoursesMapper.selectBatchSomeStudent(courseId);
List<CourseLearningRecord> courseLearningRecordList = new ArrayList<>(); List<CourseLearningRecord> courseLearningRecordList = new ArrayList<>();
@ -368,16 +387,11 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
} }
courseLearningRecordList = courseLearningRecordList.stream().sorted(Comparator.comparing(CourseLearningRecord::getTimes).reversed()).collect(Collectors.toList()); courseLearningRecordList = courseLearningRecordList.stream().sorted(Comparator.comparing(CourseLearningRecord::getTimes).reversed()).collect(Collectors.toList());
for (CourseLearningRecord courseLearningRecord : courseLearningRecordList) { for (CourseLearningRecord courseLearningRecord : courseLearningRecordList) {
UmsStudent umsStudent = umsStudentMapper.selectByUserId(Integer.valueOf(courseLearningRecord.getUserId())); UmsStudentManage umsStudentManage = umsStudentManageMapper.queryStudent(courseLearningRecord.getUserId());
UmsUser user = umsUserMapper.selectById(courseLearningRecord.getUserId()); umsStudentManageList.add(umsStudentManage);
PersonalCenterStudentListVO pcsl = new PersonalCenterStudentListVO();
pcsl.setName(umsStudent.getName());
pcsl.setNumber(umsStudent.getNumber());
pcsl.setIcon(user.getIcon());
studentNameList.add(pcsl);
} }
} }
return studentNameList; return umsStudentManageList;
} }
throw new BusinessException(400,"只有老师才有此功能"); throw new BusinessException(400,"只有老师才有此功能");
} }

@ -145,4 +145,21 @@ public class CourseLearningRecordServiceImpl extends ServiceImpl<CourseLearningR
return null; return null;
} }
} }
@Override
public List<CoursesVO> queryrecommendCourses(String userId) {
String roleId = umsUserMapper.getbyIdRoleId(userId);
if (roleId.equals("1")) {
return null;
} else if (roleId.equals("2")) {
return null;
}else {
return null;
}
}
} }

@ -30,7 +30,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
List<String> ThisMonthBrowseList = new ArrayList<>(); List<String> ThisMonthBrowseList = new ArrayList<>();
//存放上个月访问的前一天至前七天的每天对应的浏览量 //存放上个月访问的前一天至前七天的每天对应的浏览量
List<String> LastMonthBrowseList = new ArrayList<>(); List<String> LastMonthBrowseList = new ArrayList<>();
//获取今天的日期 //获取今天的日期
LocalDate end = LocalDate.now(); LocalDate end = LocalDate.now();
@ -51,7 +50,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
//查询上个月的今天对应的浏览量 //查询上个月的今天对应的浏览量
String lastMonthBrowse = reportMapper.getBrowseByTime(lastMonth); String lastMonthBrowse = reportMapper.getBrowseByTime(lastMonth);
LastMonthBrowseList.add(lastMonthBrowse); LastMonthBrowseList.add(lastMonthBrowse);
} }

@ -0,0 +1,94 @@
package com.teaching.backend.service.impl.umsAdmin;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.umsAdmin.*;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
import com.teaching.backend.model.entity.umsAdmin.*;
import com.teaching.backend.service.impl.courses.CoursesServiceImpl;
import com.teaching.backend.service.umsAdmin.UmsStudentManageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@Slf4j
public class UmsStudentManageServiceImpl extends ServiceImpl<UmsStudentManageMapper, UmsStudentManage> implements UmsStudentManageService {
@Autowired
private UmsStudentManageMapper umsStudentManageMapper;
@Autowired
private UmsStudentMapper umsStudentMapper;
@Autowired
private UmsUserMapper umsUserMapper;
@Autowired
private CoursesServiceImpl coursesService;
@Override
public Map<String, Object> pageQuery(UmsStudentPageQueryDTO umsStudentPageQueryDTO) {
LinkedHashSet<UmsStudentManage> umsStudentManages = coursesService.queryTeacherByStudentList(umsStudentPageQueryDTO.getUserId());
//总记录数
int totalCount = umsStudentManages.size();
//总页数
int totalPages = (int) Math.ceil((double) totalCount / umsStudentPageQueryDTO.getPageSize());
List<UmsStudentManage> umsStudentManageList = umsStudentManages.stream()
.skip((umsStudentPageQueryDTO.getPage() - 1) * umsStudentPageQueryDTO.getPageSize())
.limit(umsStudentPageQueryDTO.getPageSize())
.collect(Collectors.toList());
Map<String, Object> result = new HashMap<>();
result.put("Records", umsStudentManageList);
result.put("totalCount", totalCount);
result.put("totalPages", totalPages);
result.put("currentPage", umsStudentPageQueryDTO.getPage());
return result;
}
@Override
public UmsStudentManage getByIdStudentAndUser(Long id) {
UmsStudentManage studentAndUser = umsStudentManageMapper.getByIdStudentAndUser(id);
return studentAndUser;
}
@Override
public void updateStudentAndUser(UmsStudentManage umsStudentManage) {
UmsStudent umsStudent = new UmsStudent();
BeanUtils.copyProperties(umsStudentManage,umsStudent);
boolean studentInfo = umsStudentMapper.updateStudentInfo(umsStudent);
if (studentInfo == false){
throw new BusinessException(400,"修改失败");
}
UmsUser umsUser = new UmsUser();
BeanUtils.copyProperties(umsStudentManage, umsUser);
umsUser.setId(Long.valueOf(umsStudentManage.getUserId()));
boolean userInformation = umsUserMapper.updateUserInformation(umsUser);
if (userInformation == false){
throw new BusinessException(400,"修改失败");
}
}
@Override
public void startOrStop(String status, Long id) {
UmsUser umsUser = new UmsUser();
umsUser.setStatus(status);
umsUser.setId(id);
boolean updateUserInformation = umsUserMapper.updateUserInformation(umsUser);
if (updateUserInformation == false){
throw new BusinessException(400,"账号状态修改失败");
}
}
}

@ -70,7 +70,7 @@ public class UmsUserServiceImpl extends ServiceImpl<UmsUserMapper, UmsUser> impl
UmsUser umsUser = new UmsUser(); UmsUser umsUser = new UmsUser();
BeanUtils.copyProperties(umsAdminParam, umsUser); BeanUtils.copyProperties(umsAdminParam, umsUser);
umsUser.setCreateTime(LocalDateTime.now()); umsUser.setCreateTime(LocalDateTime.now());
umsUser.setStatus(1); umsUser.setStatus("1");
//查询是否有相同用户名的用户 //查询是否有相同用户名的用户
List<UmsUser> umsAdminList = lambdaQuery() List<UmsUser> umsAdminList = lambdaQuery()
.eq(UmsUser::getUsername, umsUser.getUsername()) .eq(UmsUser::getUsername, umsUser.getUsername())
@ -291,7 +291,7 @@ public class UmsUserServiceImpl extends ServiceImpl<UmsUserMapper, UmsUser> impl
UmsUser umsUser = new UmsUser(); UmsUser umsUser = new UmsUser();
BeanUtils.copyProperties(umsUserParam, umsUser); BeanUtils.copyProperties(umsUserParam, umsUser);
umsUser.setCreateTime(LocalDateTime.now()); umsUser.setCreateTime(LocalDateTime.now());
umsUser.setStatus(1); umsUser.setStatus("1");
//查询是否有相同手机号的用户 //查询是否有相同手机号的用户
List<UmsUser> umsUserList = lambdaQuery() List<UmsUser> umsUserList = lambdaQuery()
.eq(UmsUser::getPhone,umsUserParam.getPhone()) .eq(UmsUser::getPhone,umsUserParam.getPhone())

@ -28,4 +28,6 @@ public interface ICourseLearningRecordService extends IService<CourseLearningRec
BaseResponse<String> removeCoursesRecords(List<Long> ids); BaseResponse<String> removeCoursesRecords(List<Long> ids);
List<CoursesVO> queryCourseList(String userId); List<CoursesVO> queryCourseList(String userId);
List<CoursesVO> queryrecommendCourses(String userId);
} }

@ -0,0 +1,21 @@
package com.teaching.backend.service.umsAdmin;
import cn.hutool.db.PageResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
import java.util.Map;
public interface UmsStudentManageService extends IService<UmsStudentManage> {
Map<String, Object> pageQuery(UmsStudentPageQueryDTO umsStudentPageQueryDTO);
UmsStudentManage getByIdStudentAndUser(Long id);
void updateStudentAndUser(UmsStudentManage umsStudentManage);
void startOrStop(String status, Long id);
}

@ -1,5 +0,0 @@
<?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="com.teaching.backend.mapper.umsAdmin.UmsPermissionMapper">
</mapper>

@ -0,0 +1,46 @@
<?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="com.teaching.backend.mapper.umsAdmin.UmsStudentManageMapper">
<select id="queryStudent" resultType="com.teaching.backend.model.entity.umsAdmin.UmsStudentManage">
select *
from ums_student us
INNER JOIN ums_user uu ON us.user_id = uu.id
WHERE us.user_id = #{userId}
</select>
<select id="pageQueryStudent" resultType="com.teaching.backend.model.entity.umsAdmin.UmsStudentManage">
select *
from ums_student us
INNER JOIN ums_user uu ON us.user_id = uu.id
<where>
<if test="name != null and name != ''">
and name like concat('%',#{name},'%')
</if>
<if test="number != null and number != ''">
and number like concat('%',#{number},'%')
</if>
</where>
LIMIT #{pageSize} OFFSET #{offset};
</select>
<select id="pageQueryStudentCount" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ums_student us
INNER JOIN ums_user uu ON us.user_id = uu.id
<where>
<if test="name != null and name != ''">
AND us.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="number != null and number != ''">
AND us.number LIKE CONCAT('%', #{number}, '%')
</if>
</where>
</select>
<select id="getByIdStudentAndUser" resultType="com.teaching.backend.model.entity.umsAdmin.UmsStudentManage"
parameterType="java.lang.Long">
select *
from ums_student us
INNER JOIN ums_user uu ON us.user_id = uu.id
WHERE us.id = #{id}
</select>
</mapper>

@ -5,34 +5,34 @@
<update id="updateStudentInfo" parameterType="com.teaching.backend.model.entity.umsAdmin.UmsStudent"> <update id="updateStudentInfo" parameterType="com.teaching.backend.model.entity.umsAdmin.UmsStudent">
update ums_student update ums_student
<set> <set>
<if test="name != null"> <if test="name != null and name != ''">
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="sex != null"> <if test="sex != null and sex != ''">
sex = #{sex}, sex = #{sex},
</if> </if>
<if test="nationality != null"> <if test="nationality != null and nationality != ''">
nationality = #{nationality,jdbcType=VARCHAR}, nationality = #{nationality,jdbcType=VARCHAR},
</if> </if>
<if test="number != null"> <if test="number != null and number != ''">
number = #{number,jdbcType=VARCHAR}, number = #{number,jdbcType=VARCHAR},
</if> </if>
<if test="birthday != null"> <if test="birthday != null and birthday != ''">
birthday = #{birthday,jdbcType=VARCHAR}, birthday = #{birthday,jdbcType=VARCHAR},
</if> </if>
<if test="phone != null"> <if test="phone != null and phone != ''">
phone = #{phone,jdbcType=TIMESTAMP}, phone = #{phone,jdbcType=TIMESTAMP},
</if> </if>
<if test="faculty != null"> <if test="faculty != null and faculty != ''">
faculty = #{faculty,jdbcType=INTEGER}, faculty = #{faculty,jdbcType=INTEGER},
</if> </if>
<if test="major != null"> <if test="major != null and major != ''">
major = #{major,jdbcType=INTEGER}, major = #{major,jdbcType=INTEGER},
</if> </if>
<if test="yearAge != null"> <if test="yearAge != null and yearAge != ''">
year_age = #{yearAge,jdbcType=INTEGER}, year_age = #{yearAge,jdbcType=INTEGER},
</if> </if>
<if test="className != null"> <if test="className != null and className != ''">
class_name = #{className,jdbcType=INTEGER}, class_name = #{className,jdbcType=INTEGER},
</if> </if>
</set> </set>

@ -5,25 +5,25 @@
<update id="updateUserInformation"> <update id="updateUserInformation">
update ums_user update ums_user
<set> <set>
<if test="username != null"> <if test="username != null and username != ''">
username = #{username,jdbcType=VARCHAR}, username = #{username,jdbcType=VARCHAR},
</if> </if>
<if test="password != null"> <if test="password != null and password != ''">
password = #{password}, password = #{password},
</if> </if>
<if test="phone != null"> <if test="phone != null and phone != ''">
phone = #{phone,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR},
</if> </if>
<if test="nickName != null"> <if test="nickName != null and nickName != ''">
nick_name = #{nickName,jdbcType=VARCHAR}, nick_name = #{nickName,jdbcType=VARCHAR},
</if> </if>
<if test="icon != null"> <if test="icon != null and icon != ''">
icon = #{icon,jdbcType=VARCHAR}, icon = #{icon,jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null and createTime != ''">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="status != null"> <if test="status != null and status != ''">
status = #{status,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER},
</if> </if>
</set> </set>

Loading…
Cancel
Save