parent
b714922b36
commit
48a4c772b4
@ -1,158 +1,155 @@
|
||||
package com.ruoyi.web.controller.test.gl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.test.domain.User;
|
||||
import com.ruoyi.test.domain.Vo.UserVo;
|
||||
import com.ruoyi.test.seriver.IUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "管理端用户管理")
|
||||
@RestController
|
||||
@RequestMapping("/gl/users")
|
||||
public class UserController {
|
||||
@Autowired
|
||||
private IUserService iUserService;
|
||||
|
||||
/*
|
||||
获取学生列表
|
||||
*/
|
||||
@ApiOperation("学生列表")
|
||||
@GetMapping("student")
|
||||
public R<IPage<User>> selectList(int pagenum){
|
||||
return R.ok(iUserService.selectStudentList(pagenum));
|
||||
}
|
||||
/*获取学生用户名查询查询记录
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("学生用户名查询")
|
||||
@GetMapping("/seleteStudentName")
|
||||
public R<IPage<User>> selectStudent(int pagenum,String name){
|
||||
return R.ok(iUserService.selectStudent(pagenum,name));
|
||||
}
|
||||
|
||||
/*增加学生用户信息
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("学生添加用户")
|
||||
@PostMapping("/insertStudent")
|
||||
public R<String> inserStudent(@RequestBody UserVo userVo){
|
||||
User user = new User();
|
||||
user.setAge(userVo.getAge());
|
||||
user.setBirthday(userVo.getBirthday());
|
||||
user.setGrade(userVo.getGrade());
|
||||
user.setSex(userVo.getSex());
|
||||
user.setName(userVo.getName());
|
||||
user.setTname(userVo.getTname());
|
||||
user.setTelephone(userVo.getTelephone());
|
||||
user.setRoleKey("2");
|
||||
user.setState(0L);
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
Long zhid = sysUser.getUserId();
|
||||
user.setZhId(zhid);
|
||||
List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
if(list.size()==0){
|
||||
if(iUserService.insertUser(user)!=0){
|
||||
return R.ok("添加成功!");
|
||||
}else{
|
||||
return R.fail("添加失败!");
|
||||
}
|
||||
}
|
||||
return R.fail("该账号已绑定用户了!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("教师列表")
|
||||
@GetMapping("/teacher")
|
||||
public R<IPage<User>> selectTeacher(int pagenum){
|
||||
return R.ok(iUserService.selectTeacherList(pagenum));
|
||||
}
|
||||
/*获取教师用户名查询查询记录
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("教师用户名查询")
|
||||
@GetMapping("/seleteTeacherName")
|
||||
public R<IPage<User>> selectTeacher(int pagenum,String name){
|
||||
return R.ok(iUserService.selectTeacher(pagenum,name));
|
||||
}
|
||||
/*增加教师用户信息
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("老师添加用户")
|
||||
@PostMapping("/insertTeacher")
|
||||
public R<String> insertTeacher(@RequestBody UserVo userVo){
|
||||
User user = new User();
|
||||
user.setAge(userVo.getAge());
|
||||
user.setBirthday(userVo.getBirthday());
|
||||
user.setGrade(userVo.getGrade());
|
||||
user.setSex(userVo.getSex());
|
||||
user.setName(userVo.getName());
|
||||
user.setTname(userVo.getTname());
|
||||
user.setTelephone(userVo.getTelephone());
|
||||
user.setRoleKey("3");
|
||||
user.setState(0L);
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
Long zhid = sysUser.getUserId();
|
||||
user.setZhId(zhid);
|
||||
List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
if(list.size()==0){
|
||||
if(iUserService.insertUser(user)!=0){
|
||||
return R.ok("添加成功!");
|
||||
}else{
|
||||
return R.fail("添加失败!");
|
||||
}
|
||||
}
|
||||
return R.fail("该账号已绑定用户了!");
|
||||
}
|
||||
|
||||
@ApiOperation("管理员列表")
|
||||
@GetMapping("/Gl")
|
||||
public R<IPage<User>> selectGl(int pagenum){
|
||||
return R.ok(iUserService.selectGlList(pagenum));
|
||||
}
|
||||
/*获取管理员用户名查询查询记录
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("管理员用户名查询")
|
||||
@GetMapping("/seleteGlName")
|
||||
public R<IPage<User>> selectGl(int pagenum,String name){
|
||||
return R.ok(iUserService.selectGl(pagenum,name));
|
||||
}
|
||||
/*增加管理员用户信息
|
||||
*@param name 用户名
|
||||
*/
|
||||
@ApiOperation("管理员添加用户")
|
||||
@PostMapping("/insertGl")
|
||||
public R<String> insertGl(@RequestBody UserVo userVo){
|
||||
User user = new User();
|
||||
user.setAge(userVo.getAge());
|
||||
user.setBirthday(userVo.getBirthday());
|
||||
user.setGrade(userVo.getGrade());
|
||||
user.setSex(userVo.getSex());
|
||||
user.setName(userVo.getName());
|
||||
user.setTname(userVo.getTname());
|
||||
user.setTelephone(userVo.getTelephone());
|
||||
user.setRoleKey("4");
|
||||
user.setState(0L);
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
Long zhid = sysUser.getUserId();
|
||||
user.setZhId(zhid);
|
||||
List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
if(list.size()==0){
|
||||
if(iUserService.insertUser(user)!=0){
|
||||
return R.ok("添加成功!");
|
||||
}else{
|
||||
return R.fail("添加失败!");
|
||||
}
|
||||
}
|
||||
return R.fail("该账号已绑定用户了!");
|
||||
}
|
||||
}
|
||||
//package com.ruoyi.web.controller.test.gl;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
//import com.ruoyi.common.core.domain.R;
|
||||
//import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
//import com.ruoyi.common.utils.SecurityUtils;
|
||||
//import io.swagger.annotations.Api;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Api(tags = "管理端用户管理")
|
||||
//@RestController
|
||||
//@RequestMapping("/gl/users")
|
||||
//public class UserController {
|
||||
// @Autowired
|
||||
// private IUserService iUserService;
|
||||
//
|
||||
// /*
|
||||
// 获取学生列表
|
||||
// */
|
||||
// @ApiOperation("学生列表")
|
||||
// @GetMapping("student")
|
||||
// public R<IPage<User>> selectList(int pagenum){
|
||||
// return R.ok(iUserService.selectStudentList(pagenum));
|
||||
// }
|
||||
// /*获取学生用户名查询查询记录
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("学生用户名查询")
|
||||
// @GetMapping("/seleteStudentName")
|
||||
// public R<IPage<User>> selectStudent(int pagenum,String name){
|
||||
// return R.ok(iUserService.selectStudent(pagenum,name));
|
||||
// }
|
||||
//
|
||||
// /*增加学生用户信息
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("学生添加用户")
|
||||
// @PostMapping("/insertStudent")
|
||||
// public R<String> inserStudent(@RequestBody UserVo userVo){
|
||||
// User user = new User();
|
||||
// user.setAge(userVo.getAge());
|
||||
// user.setBirthday(userVo.getBirthday());
|
||||
// user.setGrade(userVo.getGrade());
|
||||
// user.setSex(userVo.getSex());
|
||||
// user.setName(userVo.getName());
|
||||
// user.setTname(userVo.getTname());
|
||||
// user.setTelephone(userVo.getTelephone());
|
||||
// user.setRoleKey("2");
|
||||
// user.setState(0L);
|
||||
// SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
// Long zhid = sysUser.getUserId();
|
||||
// user.setZhId(zhid);
|
||||
// List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
// if(list.size()==0){
|
||||
// if(iUserService.insertUser(user)!=0){
|
||||
// return R.ok("添加成功!");
|
||||
// }else{
|
||||
// return R.fail("添加失败!");
|
||||
// }
|
||||
// }
|
||||
// return R.fail("该账号已绑定用户了!");
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @ApiOperation("教师列表")
|
||||
// @GetMapping("/teacher")
|
||||
// public R<IPage<User>> selectTeacher(int pagenum){
|
||||
// return R.ok(iUserService.selectTeacherList(pagenum));
|
||||
// }
|
||||
// /*获取教师用户名查询查询记录
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("教师用户名查询")
|
||||
// @GetMapping("/seleteTeacherName")
|
||||
// public R<IPage<User>> selectTeacher(int pagenum,String name){
|
||||
// return R.ok(iUserService.selectTeacher(pagenum,name));
|
||||
// }
|
||||
// /*增加教师用户信息
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("老师添加用户")
|
||||
// @PostMapping("/insertTeacher")
|
||||
// public R<String> insertTeacher(@RequestBody UserVo userVo){
|
||||
// User user = new User();
|
||||
// user.setAge(userVo.getAge());
|
||||
// user.setBirthday(userVo.getBirthday());
|
||||
// user.setGrade(userVo.getGrade());
|
||||
// user.setSex(userVo.getSex());
|
||||
// user.setName(userVo.getName());
|
||||
// user.setTname(userVo.getTname());
|
||||
// user.setTelephone(userVo.getTelephone());
|
||||
// user.setRoleKey("3");
|
||||
// user.setState(0L);
|
||||
// SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
// Long zhid = sysUser.getUserId();
|
||||
// user.setZhId(zhid);
|
||||
// List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
// if(list.size()==0){
|
||||
// if(iUserService.insertUser(user)!=0){
|
||||
// return R.ok("添加成功!");
|
||||
// }else{
|
||||
// return R.fail("添加失败!");
|
||||
// }
|
||||
// }
|
||||
// return R.fail("该账号已绑定用户了!");
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("管理员列表")
|
||||
// @GetMapping("/Gl")
|
||||
// public R<IPage<User>> selectGl(int pagenum){
|
||||
// return R.ok(iUserService.selectGlList(pagenum));
|
||||
// }
|
||||
// /*获取管理员用户名查询查询记录
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("管理员用户名查询")
|
||||
// @GetMapping("/seleteGlName")
|
||||
// public R<IPage<User>> selectGl(int pagenum,String name){
|
||||
// return R.ok(iUserService.selectGl(pagenum,name));
|
||||
// }
|
||||
// /*增加管理员用户信息
|
||||
// *@param name 用户名
|
||||
// */
|
||||
// @ApiOperation("管理员添加用户")
|
||||
// @PostMapping("/insertGl")
|
||||
// public R<String> insertGl(@RequestBody UserVo userVo){
|
||||
// User user = new User();
|
||||
// user.setAge(userVo.getAge());
|
||||
// user.setBirthday(userVo.getBirthday());
|
||||
// user.setGrade(userVo.getGrade());
|
||||
// user.setSex(userVo.getSex());
|
||||
// user.setName(userVo.getName());
|
||||
// user.setTname(userVo.getTname());
|
||||
// user.setTelephone(userVo.getTelephone());
|
||||
// user.setRoleKey("4");
|
||||
// user.setState(0L);
|
||||
// SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
// Long zhid = sysUser.getUserId();
|
||||
// user.setZhId(zhid);
|
||||
// List<User> list = iUserService.selectStudentByZhid(zhid);
|
||||
// if(list.size()==0){
|
||||
// if(iUserService.insertUser(user)!=0){
|
||||
// return R.ok("添加成功!");
|
||||
// }else{
|
||||
// return R.fail("添加失败!");
|
||||
// }
|
||||
// }
|
||||
// return R.fail("该账号已绑定用户了!");
|
||||
// }
|
||||
//}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.ruoyi.test.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("instructor_manage_class")
|
||||
public class InstructorManageClass {
|
||||
private Long id;
|
||||
private String grade;
|
||||
private String Class1;
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
package com.ruoyi.test.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("user")
|
||||
public class User {
|
||||
|
||||
private long userId;
|
||||
private String name;
|
||||
private String tname;
|
||||
private long age;
|
||||
private String sex;
|
||||
private String birthday;
|
||||
private String telephone;
|
||||
private String grade;
|
||||
private String createtime;
|
||||
private long state;
|
||||
private String roleKey;
|
||||
private long zhId;
|
||||
private String email;
|
||||
private String studentnumber;
|
||||
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getTname() {
|
||||
return tname;
|
||||
}
|
||||
|
||||
public void setTname(String tname) {
|
||||
this.tname = tname;
|
||||
}
|
||||
|
||||
|
||||
public long getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(long age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
|
||||
public String getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setGrade(String grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
|
||||
public String getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreatetime(String createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
|
||||
public long getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(long state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
||||
public String getRoleKey() {
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
public void setRoleKey(String roleKey) {
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
|
||||
|
||||
public long getZhId() {
|
||||
return zhId;
|
||||
}
|
||||
|
||||
public void setZhId(long zhId) {
|
||||
this.zhId = zhId;
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.ruoyi.test.domain.Vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserVo {
|
||||
|
||||
@TableId(value = "user_id")
|
||||
private Long userId;
|
||||
private String name;
|
||||
private String tname;
|
||||
private long age;
|
||||
private String sex;
|
||||
private String birthday;
|
||||
private String telephone;
|
||||
private String grade;
|
||||
private long state;
|
||||
private String email;
|
||||
private String studentnumber;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.ruoyi.test.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.test.domain.InstructorManageClass;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InstructorManageClassMapper extends BaseMapper<InstructorManageClass> {
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.ruoyi.test.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.test.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
// List<User> seleteUser(String name);
|
||||
|
||||
int insertUser(User user);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.ruoyi.test.seriver;
|
||||
|
||||
import com.ruoyi.test.domain.InstructorManageClass;
|
||||
|
||||
public interface IInstructorManageClassService {
|
||||
|
||||
InstructorManageClass selectByGradeAndClass1(String grade ,String Class1);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.test.seriver;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.test.domain.DO.UserDO;
|
||||
import com.ruoyi.test.domain.User;
|
||||
import com.ruoyi.test.domain.Vo.UserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IUserService {
|
||||
//获取学生列表
|
||||
IPage<User> selectStudentList(int pagenum);
|
||||
//根据用户名查询学生用户
|
||||
IPage<User> selectStudent(int pagenum,String name);
|
||||
|
||||
//绑定学生/老师/管理员用户信息
|
||||
int insertUser(User user);
|
||||
//
|
||||
List<User> selectStudentByZhid(Long zhid);
|
||||
|
||||
//获取教师列表
|
||||
IPage<User> selectTeacherList(int pagenum);
|
||||
//根据用户名查询教师用户
|
||||
IPage<User> selectTeacher(int pagenum,String name);
|
||||
|
||||
IPage<User> selectGlList(int pagenum);
|
||||
//根据用户名查询学生用户
|
||||
IPage<User> selectGl(int pagenum,String name);
|
||||
|
||||
//通过账号查询用户id
|
||||
Long selectByzhid(Long zhid);
|
||||
|
||||
User user(Long id);
|
||||
|
||||
UserDO getUserById(Long id);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.test.seriver.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.test.domain.InstructorManageClass;
|
||||
import com.ruoyi.test.mapper.InstructorManageClassMapper;
|
||||
import com.ruoyi.test.seriver.IInstructorManageClassService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class InstructorManageClassServiceImpl extends ServiceImpl<InstructorManageClassMapper, InstructorManageClass> implements IInstructorManageClassService {
|
||||
|
||||
@Autowired
|
||||
private InstructorManageClassMapper instructorManageClassMapper;
|
||||
|
||||
@Override
|
||||
public InstructorManageClass selectByGradeAndClass1(String grade, String Class1) {
|
||||
LambdaQueryWrapper<InstructorManageClass> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InstructorManageClass::getGrade,grade)
|
||||
.eq(InstructorManageClass::getClass1,Class1);
|
||||
return instructorManageClassMapper.selectOne(queryWrapper);
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
package com.ruoyi.test.seriver.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.test.domain.DO.UserDO;
|
||||
import com.ruoyi.test.domain.StudentClass;
|
||||
import com.ruoyi.test.domain.TeacherManageClass;
|
||||
import com.ruoyi.test.domain.User;
|
||||
import com.ruoyi.test.domain.Vo.UserVo;
|
||||
import com.ruoyi.test.mapper.StudentClassMapper;
|
||||
import com.ruoyi.test.mapper.TeacherManageClassMapper;
|
||||
import com.ruoyi.test.mapper.UserMapper;
|
||||
import com.ruoyi.test.seriver.IUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Resource
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements IUserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private StudentClassMapper studentClassMapper;
|
||||
|
||||
@Autowired
|
||||
private TeacherManageClassMapper teacherManageClassMapper;
|
||||
|
||||
@Override
|
||||
public IPage<User> selectStudentList(int pagenum) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getRoleKey,2L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> selectStudent(int pagenum,String name) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getName,name);
|
||||
queryWrapper.eq(User::getRoleKey,2L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertUser(User user) {
|
||||
return userMapper.insertUser(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> selectStudentByZhid(Long zhid) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getZhId,zhid);
|
||||
return userMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> selectTeacherList(int pagenum) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getRoleKey,3L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> selectTeacher(int pagenum,String name) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getName,name);
|
||||
queryWrapper.eq(User::getRoleKey,3L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> selectGlList(int pagenum) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getRoleKey,4L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> selectGl(int pagenum,String name) {
|
||||
Page<User> page = new Page<>(pagenum,10);
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(User::getUserId,User::getName,User::getTname,User::getAge,User::getSex,User::getBirthday
|
||||
,User::getTelephone,User::getGrade,User::getState);
|
||||
queryWrapper.eq(User::getName,name);
|
||||
queryWrapper.eq(User::getRoleKey,4L);
|
||||
IPage<User> iPage = userMapper.selectPage(page,queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long selectByzhid(Long zhid) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getZhId,zhid);
|
||||
return userMapper.selectOne(queryWrapper).getUserId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User user(Long id) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getUserId,id);
|
||||
return userMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDO getUserById(Long id) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.eq(User::getUserId,id);
|
||||
User user = userMapper.selectOne(queryWrapper);
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(user,userDO);
|
||||
StudentClass studentClass = studentClassMapper.selectOne(new LambdaQueryWrapper<StudentClass>().eq(StudentClass::getStudentid, id));
|
||||
userDO.setClass1(studentClass.getClass1());
|
||||
TeacherManageClass teacherManageClass = teacherManageClassMapper.selectOne(
|
||||
new LambdaQueryWrapper<TeacherManageClass>()
|
||||
.eq(TeacherManageClass::getClass1, studentClass.getClass1())
|
||||
.eq(TeacherManageClass::getGrade, studentClass.getGrade()));
|
||||
User user1 = userMapper.selectOne(
|
||||
new LambdaQueryWrapper<User>()
|
||||
.eq(User::getUserId, teacherManageClass.getTeacherid()));
|
||||
userDO.setTeacherName(user1.getTname());
|
||||
return userDO;
|
||||
}
|
||||
|
||||
public List<UserVo> up(List<User> list){
|
||||
List<UserVo> list1 = new ArrayList<>();
|
||||
for(User user:list){
|
||||
UserVo userVo = new UserVo();
|
||||
userVo.setUserId(user.getUserId());
|
||||
userVo.setName(user.getName());
|
||||
userVo.setTname(user.getTname());
|
||||
userVo.setAge(user.getAge());
|
||||
userVo.setGrade(user.getGrade());
|
||||
userVo.setSex(user.getSex());
|
||||
userVo.setBirthday(user.getBirthday());
|
||||
userVo.setTelephone(user.getTelephone());
|
||||
list1.add(userVo);
|
||||
}
|
||||
return list1;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div class="header-container">
|
||||
<div class="left-section">
|
||||
<span :class="collapseBtnClass" class="collapse-icon" @click="collapse"></span>
|
||||
</div>
|
||||
<div class="logout-container">
|
||||
<span class="logout-btn" @click="logout">退出</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Header",
|
||||
props: {
|
||||
collapseBtnClass: String,
|
||||
collapse: Boolean,
|
||||
},
|
||||
methods: {
|
||||
logout() {
|
||||
// 执行登出操作
|
||||
this.$store.dispatch("logout"); // 调用 Vuex 登出逻辑
|
||||
this.$router.push("/login"); // 跳转到登录页面
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
line-height: 50px;
|
||||
padding: 0 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.left-section {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.collapse-icon {
|
||||
cursor: pointer;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.logout-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
color: #409EFF;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background-color: #409EFF;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue