├── README.md ├── pom.xml └── src └── main ├── java └── com │ └── qxf │ ├── BootShiroVueStu.java │ ├── aspect │ └── HttpAspect.java │ ├── config │ ├── CorsConfig.java │ ├── FileConfig.java │ ├── MybatisConfig.java │ └── ShiroConfig.java │ ├── controller │ ├── BaseController.java │ ├── ClazzController.java │ ├── CourseController.java │ ├── DictController.java │ ├── FileController.java │ ├── GradeController.java │ ├── InstituteController.java │ ├── LoginController.java │ ├── MajorController.java │ ├── PermsController.java │ ├── QuestionChoicController.java │ ├── QuestionExamController.java │ ├── QuestionExamRecordController.java │ ├── QuestionFillJudgeController.java │ ├── QuestionPaperController.java │ ├── RoleController.java │ ├── StudentController.java │ ├── SysController.java │ ├── TeacherController.java │ └── UserController.java │ ├── exception │ ├── ExceptionHandle.java │ └── MyException.java │ ├── ftp │ ├── FTPFileTransmit.java │ └── UploadUtil.java │ ├── mapper │ ├── ClazzMapper.java │ ├── CourseMapper.java │ ├── CourseTeacherMapper.java │ ├── DictMapper.java │ ├── GradeMapper.java │ ├── InstituteMapper.java │ ├── LoginLogMapper.java │ ├── MajorMapper.java │ ├── OperateRecordMapper.java │ ├── PermsMapper.java │ ├── QuestionChoicDao.java │ ├── QuestionExamDao.java │ ├── QuestionExamRecordDao.java │ ├── QuestionFillJudgeDao.java │ ├── QuestionPaperDao.java │ ├── RoleMapper.java │ ├── RolePermsMapper.java │ ├── StudentMapper.java │ ├── TeacherMapper.java │ ├── UserMapper.java │ ├── UserRoleMapper.java │ └── xml │ │ ├── ClazzMapper.xml │ │ ├── CourseMapper.xml │ │ ├── DictMapper.xml │ │ ├── GradeMapper.xml │ │ ├── InstituteMapper.xml │ │ ├── LoginLogMapper.xml │ │ ├── MajorMapper.xml │ │ ├── OperateRecordMapper.xml │ │ ├── PermsMapper.xml │ │ ├── QuestionChoicDao.xml │ │ ├── QuestionExamDao.xml │ │ ├── QuestionExamRecordDao.xml │ │ ├── QuestionFillJudgeDao.xml │ │ ├── QuestionPaperDao.xml │ │ ├── RoleMapper.xml │ │ ├── RolePermsMapper.xml │ │ ├── StudentMapper.xml │ │ ├── TeacherMapper.xml │ │ ├── UserMapper.xml │ │ └── UserRoleMapper.xml │ ├── pojo │ ├── Clazz.java │ ├── Course.java │ ├── CourseTeacher.java │ ├── ExamVo.java │ ├── Grade.java │ ├── Institute.java │ ├── LoginLog.java │ ├── Major.java │ ├── OperateRecord.java │ ├── Perms.java │ ├── QuestionChoic.java │ ├── QuestionExam.java │ ├── QuestionExamRecord.java │ ├── QuestionFillJudge.java │ ├── QuestionPaper.java │ ├── Role.java │ ├── RolePerms.java │ ├── Student.java │ ├── StudentCourse.java │ ├── SysDict.java │ ├── Teacher.java │ ├── User.java │ └── UserRole.java │ ├── service │ ├── ClazzService.java │ ├── CourseService.java │ ├── CourseTeacherService.java │ ├── DictService.java │ ├── GradeService.java │ ├── InstituteService.java │ ├── LoginLogService.java │ ├── MajorService.java │ ├── OperateRecordService.java │ ├── PermsService.java │ ├── QuestionChoicService.java │ ├── QuestionExamRecordService.java │ ├── QuestionExamService.java │ ├── QuestionFillJudgeService.java │ ├── QuestionPaperService.java │ ├── RolePermsService.java │ ├── RoleService.java │ ├── StudentService.java │ ├── TeacherService.java │ ├── UserRoleService.java │ ├── UserService.java │ └── impl │ │ ├── ClazzServiceImpl.java │ │ ├── CourseServiceImpl.java │ │ ├── CourseTeacherServiceImpl.java │ │ ├── DictServiceImpl.java │ │ ├── GradeServiceImpl.java │ │ ├── InstituteServiceImpl.java │ │ ├── LoginLogServiceImpl.java │ │ ├── MajorServiceImpl.java │ │ ├── OperateRecordServiceImpl.java │ │ ├── PermsServiceImpl.java │ │ ├── QuestionChoicServiceImpl.java │ │ ├── QuestionExamRecordServiceImpl.java │ │ ├── QuestionExamServiceImpl.java │ │ ├── QuestionFillJudgeServiceImpl.java │ │ ├── QuestionPaperServiceImpl.java │ │ ├── RolePermsServiceImpl.java │ │ ├── RoleServiceImpl.java │ │ ├── StudentServiceImpl.java │ │ ├── TeacherServiceImpl.java │ │ ├── UserRoleServiceImpl.java │ │ └── UserServiceImpl.java │ ├── shiro │ ├── AuthRealm.java │ └── CredentialsMatcher.java │ └── utils │ ├── EnumCode.java │ ├── ExcelUtil.java │ └── ResultUtil.java └── resources ├── application.yml ├── boot_shiro_vue_stu.sql └── logback-spring.xml /README.md: -------------------------------------------------------------------------------- 1 | # 精力有限,此项目已停止维护 2 | # springboot-shiro-vue-stu 3 | 基于springBoot,shiro,vue的前后端分离的学生信息管理系统 4 | 客户端地址:https://github.com/qiuxinfa/boot-shiro-vue-stu-client 5 | 6 | 目前,包括3种类型的角色:管理员,老师,学生 7 | 各角色功能如下: 8 | 一、管理员: 9 | 1.系统管理:查看登录日志和操作日志 10 | 2.字典管理:维护系统中使用到的字典项 11 | 3.用户管理:添加、删除、查询用户 12 | 4.权限管理:给用户分配角色和权限 13 | 5.课程管理:发布和查询课程,指定任课老师等 14 | 6.老师管理:查看、新增老师 15 | 7.学生管理:查看、新增学生 16 | 8.学院、专业、班级管理 17 | 9.个人中心:修改头像,邮箱等信息 18 | 二、老师: 19 | 1.课程中心:查看所教课程及选课学生,并可以为学生录入成绩 20 | 2.成绩统计:开发中 21 | 3.个人中心:修改头像,邮箱等信息 22 | 三、学生: 23 | 1.我的课程:查看我选择的课程的详细信息,并可以选择新的课程,查看成绩等 24 | 2.个人中心:修改头像,邮箱等信息 25 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/BootShiroVueStu.java: -------------------------------------------------------------------------------- 1 | package com.qxf; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.transaction.annotation.EnableTransactionManagement; 7 | 8 | /** 9 | * @Auther: qiuxinfa 10 | * @Date: 2019/11/17 11 | * @Description: com.qxf 12 | */ 13 | @SpringBootApplication 14 | @MapperScan("com.qxf.mapper") 15 | public class BootShiroVueStu { 16 | public static void main(String[] args) { 17 | SpringApplication.run(BootShiroVueStu.class,args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/aspect/HttpAspect.java: -------------------------------------------------------------------------------- 1 | package com.qxf.aspect; 2 | 3 | import com.qxf.controller.BaseController; 4 | import com.qxf.exception.MyException; 5 | import com.qxf.pojo.OperateRecord; 6 | import com.qxf.service.OperateRecordService; 7 | import com.qxf.service.PermsService; 8 | import com.qxf.service.RolePermsService; 9 | import com.qxf.utils.EnumCode; 10 | import com.qxf.utils.ResultUtil; 11 | import org.aspectj.lang.JoinPoint; 12 | import org.aspectj.lang.ProceedingJoinPoint; 13 | import org.aspectj.lang.annotation.*; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.stereotype.Component; 18 | import org.springframework.util.StringUtils; 19 | import org.springframework.validation.BindingResult; 20 | import org.springframework.web.context.request.RequestContextHolder; 21 | import org.springframework.web.context.request.ServletRequestAttributes; 22 | 23 | import javax.servlet.http.HttpServletRequest; 24 | import java.util.Arrays; 25 | import java.util.Date; 26 | 27 | @Aspect 28 | @Component 29 | public class HttpAspect extends BaseController { 30 | 31 | @Autowired 32 | private RolePermsService rolePermissionService; 33 | 34 | @Autowired 35 | private PermsService permissionService; 36 | 37 | @Autowired 38 | private OperateRecordService operatingRecordService; 39 | 40 | private final static Logger log = LoggerFactory.getLogger(HttpAspect.class); 41 | 42 | @Pointcut("execution(public * com.qxf.controller..*(..))") 43 | public void log() { 44 | 45 | } 46 | /** 47 | * @desc: 记录请求 48 | */ 49 | @Before("log()") 50 | public void doBefore(JoinPoint joinPoint) { 51 | shiroFilter(joinPoint); 52 | } 53 | 54 | /** 55 | * @desc: 响应请求 56 | */ 57 | @After("log()") 58 | public void doAfter() { 59 | log.info("========================== ↓响应请求↓ =========================="); 60 | } 61 | 62 | /** 63 | * @desc: 打印返回值 64 | */ 65 | @AfterReturning(returning = "obj",pointcut = "log()") 66 | public void doAfterReturnning(Object obj) { 67 | log.info("请求返回值:{}",obj); 68 | } 69 | 70 | 71 | /** 72 | * @desc: 统一参数验证处理 73 | */ 74 | @Around("execution(* com.qxf.controller..*(..)) && args(..,bindingResult)") 75 | public Object doAround(ProceedingJoinPoint pjp, BindingResult bindingResult) throws Throwable { 76 | 77 | shiroFilter(pjp); 78 | 79 | Object retVal; 80 | if (bindingResult.hasErrors()) { 81 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),bindingResult.getFieldError().getDefaultMessage(),null); 82 | } else { 83 | retVal = pjp.proceed(); 84 | } 85 | return retVal; 86 | } 87 | 88 | /** 89 | * @desc: 请求拦截器 90 | */ 91 | public void shiroFilter(JoinPoint joinPoint){ 92 | 93 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); 94 | HttpServletRequest request = attributes.getRequest(); 95 | 96 | String requestUrl = request.getRequestURI().replaceAll(request.getContextPath(), ""); 97 | String remoteAddr = request.getRemoteAddr(); 98 | String method = request.getMethod(); 99 | String args = Arrays.toString(joinPoint.getArgs()); 100 | 101 | log.info("========================== ↓收到请求↓ =========================="); 102 | log.info("请求url:{}",requestUrl); 103 | log.info("请求源ip:{}",remoteAddr); 104 | log.info("请求方式:{}",method); 105 | log.info("请求方法:{}",joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()+ "()"); 106 | log.info("请求参数:{}", args); 107 | log.info("getContextPath:{}",request.getContextPath()); 108 | log.info("========================== ↑收到请求↑ =========================="); 109 | 110 | OperateRecord or = new OperateRecord(); 111 | or.setRequestUrl(requestUrl); 112 | or.setRemoteAddr(remoteAddr); 113 | or.setMethod(method); 114 | // or.setParams(args); //参数太长会报错 115 | or.setCreateTime(new Date()); 116 | or.setUserId(super.getUserId()); 117 | 118 | //下面根据请求的url,进行权限验证 119 | Integer count = permissionService.findCountByUrl(requestUrl); 120 | //如果请求的url存在数据库中,说明是有权限的,否则不需要权限 121 | if (count != 0){ 122 | String roleId = super.getRoleId(); 123 | if (StringUtils.isEmpty(roleId)) { 124 | or.setIsSuccess(0); 125 | operatingRecordService.insert(or); 126 | throw new MyException(ResultUtil.result(EnumCode.FORBIDDEN.getValue(), EnumCode.FORBIDDEN.getText())); 127 | } 128 | 129 | Integer row = rolePermissionService.findCountByRole(roleId, request.getRequestURI().replaceAll(request.getContextPath(),"")); 130 | //如果当前角色没有权限,并且不是管理员,角色"1"为管理员,这里可以根据情况调整,因为管理员也不是拥有所有权限 131 | if (row == 0 && ! "1".equals(super.getRoleId())) { 132 | or.setIsSuccess(0); 133 | operatingRecordService.insert(or); 134 | throw new MyException(ResultUtil.result(EnumCode.FORBIDDEN.getValue(), EnumCode.FORBIDDEN.getText())); 135 | } 136 | } 137 | or.setIsSuccess(1); 138 | operatingRecordService.insert(or); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.qxf.config; 2 | import org.springframework.context.annotation.Bean; 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.cors.CorsConfiguration; 5 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 6 | import org.springframework.web.filter.CorsFilter; 7 | 8 | @Configuration 9 | public class CorsConfig { 10 | private CorsConfiguration buildConfig() { 11 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 12 | corsConfiguration.addAllowedOrigin("*"); // 1 设置访问源地址 13 | corsConfiguration.addAllowedHeader("*"); // 2 设置访问源请求头 14 | corsConfiguration.addAllowedMethod("*"); // 3 设置访问源请求方法 15 | corsConfiguration.setAllowCredentials(true);// 4 允许跨域携带cookie 16 | corsConfiguration.setMaxAge((long) 1209600); 17 | return corsConfiguration; 18 | } 19 | 20 | @Bean 21 | public CorsFilter corsFilter() { 22 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 23 | source.registerCorsConfiguration("/**", buildConfig()); // 5 对接口配置跨域设置 24 | return new CorsFilter(source); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/config/FileConfig.java: -------------------------------------------------------------------------------- 1 | package com.qxf.config; 2 | 3 | import org.springframework.boot.web.servlet.MultipartConfigFactory; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import javax.servlet.MultipartConfigElement; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2020/4/26 12 | * @Description: 配置文件上传的大小 13 | */ 14 | @Configuration 15 | public class FileConfig { 16 | 17 | /** 18 | * 配置文件上传大小 19 | */ 20 | @Bean 21 | public MultipartConfigElement multipartConfigElement(){ 22 | MultipartConfigFactory factory = new MultipartConfigFactory(); 23 | // 单个数据大小 100M 24 | factory.setMaxFileSize("102400KB"); 25 | /// 总上传数据大小 100M 26 | factory.setMaxRequestSize("102400KB"); 27 | return factory.createMultipartConfig(); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/config/MybatisConfig.java: -------------------------------------------------------------------------------- 1 | package com.qxf.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import com.baomidou.mybatisplus.MybatisConfiguration; 5 | import com.baomidou.mybatisplus.MybatisXMLLanguageDriver; 6 | import com.baomidou.mybatisplus.entity.GlobalConfiguration; 7 | import com.baomidou.mybatisplus.enums.DBType; 8 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 9 | import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; 10 | import com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean; 11 | import org.apache.ibatis.mapping.DatabaseIdProvider; 12 | import org.apache.ibatis.plugin.Interceptor; 13 | import org.mybatis.spring.boot.autoconfigure.MybatisProperties; 14 | import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.boot.bind.RelaxedPropertyResolver; 19 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | import org.springframework.core.env.Environment; 23 | import org.springframework.core.io.DefaultResourceLoader; 24 | import org.springframework.core.io.ResourceLoader; 25 | import org.springframework.util.ObjectUtils; 26 | import org.springframework.util.StringUtils; 27 | import org.springframework.validation.beanvalidation.MethodValidationPostProcessor; 28 | 29 | import javax.sql.DataSource; 30 | import java.sql.SQLException; 31 | 32 | @Configuration 33 | @EnableConfigurationProperties(MybatisProperties.class) 34 | public class MybatisConfig { 35 | 36 | @Autowired 37 | private Environment environment; 38 | private RelaxedPropertyResolver propertyResolver; 39 | 40 | @Autowired 41 | private DataSource dataSource; 42 | 43 | @Autowired 44 | private MybatisProperties properties; 45 | 46 | @Autowired 47 | private ResourceLoader resourceLoader = new DefaultResourceLoader(); 48 | 49 | @Autowired(required = false) 50 | private Interceptor[] interceptors; 51 | 52 | @Autowired(required = false) 53 | private DatabaseIdProvider databaseIdProvider; 54 | 55 | 56 | private static Logger log = LoggerFactory.getLogger(MybatisConfig.class); 57 | 58 | /** 59 | * @desc: SQL执行效率插件 60 | */ 61 | public PerformanceInterceptor performanceInterceptor() { 62 | return new PerformanceInterceptor(); 63 | } 64 | 65 | /** 66 | * @desc: 配置druidDataSource 67 | */ 68 | @Bean 69 | public DataSource druidDataSource() { 70 | this.propertyResolver = new RelaxedPropertyResolver(environment, "spring.datasource."); 71 | 72 | log.info("=========================== 注入druid ============================="); 73 | DruidDataSource druidDataSource = new DruidDataSource(); 74 | druidDataSource.setUrl(propertyResolver.getProperty("url")); 75 | druidDataSource.setDriverClassName(propertyResolver.getProperty("driver-class-name")); 76 | druidDataSource.setUsername(propertyResolver.getProperty("username")); 77 | druidDataSource.setPassword(propertyResolver.getProperty("password")); 78 | druidDataSource.setInitialSize(Integer.valueOf(propertyResolver.getProperty("initial-size"))); 79 | druidDataSource.setMinIdle(Integer.valueOf(propertyResolver.getProperty("min-idle"))); 80 | druidDataSource.setMaxWait(Long.valueOf(propertyResolver.getProperty("max-wait"))); 81 | druidDataSource.setMaxActive(Integer.valueOf(propertyResolver.getProperty("max-active"))); 82 | druidDataSource.setMinEvictableIdleTimeMillis(Long.valueOf(propertyResolver.getProperty("min-evictable-idle-time-millis"))); 83 | try { 84 | druidDataSource.setFilters(propertyResolver.getProperty("filters")); 85 | } catch (SQLException e) { 86 | e.printStackTrace(); 87 | } 88 | return druidDataSource; 89 | } 90 | 91 | /** 92 | * @desc: mybatis-plus分页插件 93 | */ 94 | @Bean 95 | public PaginationInterceptor paginationInterceptor() { 96 | PaginationInterceptor page = new PaginationInterceptor(); 97 | page.setDialectType("mysql"); 98 | return page; 99 | } 100 | /** 101 | * @desc: 这里全部使用mybatis-autoconfigure 已经自动加载的资源。不手动指定 配置文件和mybatis-boot的配置文件同步 102 | */ 103 | @Bean 104 | public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() { 105 | MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean(); 106 | mybatisPlus.setDataSource(dataSource); 107 | mybatisPlus.setVfs(SpringBootVFS.class); 108 | if (StringUtils.hasText(this.properties.getConfigLocation())) { 109 | mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation())); 110 | } 111 | mybatisPlus.setConfiguration(properties.getConfiguration()); 112 | if (!ObjectUtils.isEmpty(this.interceptors)) { 113 | mybatisPlus.setPlugins(this.interceptors); 114 | } 115 | // MP 全局配置,更多内容进入类看注释 116 | GlobalConfiguration globalConfig = new GlobalConfiguration(); 117 | globalConfig.setDbType(DBType.MYSQL.name()); 118 | // ID 策略 AUTO->`0`("数据库ID自增") 119 | // INPUT->`1`(用户输入ID") ID_WORKER->`2`("全局唯一ID") UUID->`3`("全局唯一ID") 120 | globalConfig.setIdType(3); 121 | mybatisPlus.setGlobalConfig(globalConfig); 122 | MybatisConfiguration mc = new MybatisConfiguration(); 123 | mc.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); 124 | mc.setMapUnderscoreToCamelCase(false); 125 | mc.setUseColumnLabel(true); 126 | mybatisPlus.setConfiguration(mc); 127 | if (this.databaseIdProvider != null) { 128 | mybatisPlus.setDatabaseIdProvider(this.databaseIdProvider); 129 | } 130 | if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) { 131 | mybatisPlus.setTypeAliasesPackage(this.properties.getTypeAliasesPackage()); 132 | } 133 | if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) { 134 | mybatisPlus.setTypeHandlersPackage(this.properties.getTypeHandlersPackage()); 135 | } 136 | if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) { 137 | mybatisPlus.setMapperLocations(this.properties.resolveMapperLocations()); 138 | } 139 | return mybatisPlus; 140 | } 141 | 142 | /** 143 | * 参数校验功能 144 | */ 145 | @Bean 146 | public MethodValidationPostProcessor methodValidationPostProcessor() { 147 | 148 | return new MethodValidationPostProcessor(); 149 | } 150 | 151 | 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/config/ShiroConfig.java: -------------------------------------------------------------------------------- 1 | package com.qxf.config; 2 | 3 | import com.qxf.shiro.AuthRealm; 4 | import com.qxf.shiro.CredentialsMatcher; 5 | import org.apache.shiro.mgt.SecurityManager; 6 | import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; 7 | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; 8 | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | import java.util.LinkedHashMap; 15 | import java.util.Map; 16 | 17 | @Configuration 18 | public class ShiroConfig { 19 | 20 | /** 21 | * 日志打印 22 | */ 23 | private final static Logger log = LoggerFactory.getLogger(ShiroConfig.class); 24 | 25 | /** 26 | * ShiroFilterFactoryBean 处理拦截资源文件问题。 27 | * 注意:单独一个ShiroFilterFactoryBean配置是或报错的,以为在 28 | * 初始化ShiroFilterFactoryBean的时候需要注入:SecurityManager 29 | * 30 | * Filter Chain定义说明 1、一个URL可以配置多个Filter,使用逗号分隔 2、当设置多个过滤器时,全部验证通过,才视为通过 31 | * 3、部分过滤器可指定参数,如perms,roles 32 | * 33 | */ 34 | @Bean 35 | public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) { 36 | 37 | log.info("====================== shrio拦截器工厂注入开始 ====================="); 38 | 39 | ShiroFilterFactoryBean sffb = new ShiroFilterFactoryBean(); 40 | // 必须设置 SecurityManager 41 | sffb.setSecurityManager(securityManager); 42 | // 登录页面 43 | sffb.setLoginUrl("/user/login"); 44 | // 登录成功后要跳转的链接 45 | // 未授权界面; 46 | sffb.setUnauthorizedUrl("/login"); 47 | // 拦截器 48 | Map filterMap = new LinkedHashMap<>(); 49 | // 可以匿名访问 50 | filterMap.put("/user/login", "anon"); 51 | filterMap.put("/user/logout", "anon"); 52 | filterMap.put("/user/uploadHander", "anon"); 53 | // 需要认证才可以访问 54 | filterMap.put("/*", "authc"); 55 | filterMap.put("/**", "authc"); 56 | filterMap.put("/*.*", "authc"); 57 | sffb.setFilterChainDefinitionMap(filterMap); 58 | 59 | log.info("====================== shrio拦截器工厂注入成功 ====================="); 60 | return sffb; 61 | } 62 | 63 | /** 64 | * @desc: 配置核心安全事务管理 65 | * 66 | * @date: 2017/12/18 67 | */ 68 | @Bean 69 | public SecurityManager securityManager() { 70 | log.info("========================shiro已经加载======================"); 71 | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); 72 | securityManager.setRealm(authRealm()); 73 | return securityManager; 74 | } 75 | 76 | /** 77 | * 配置自定义的权限登录器 78 | * 79 | * @return 80 | */ 81 | @Bean 82 | public AuthRealm authRealm() { 83 | AuthRealm authRealm = new AuthRealm(); 84 | authRealm.setCredentialsMatcher(credentialsMatcher()); 85 | return authRealm; 86 | } 87 | 88 | //配置自定义的密码比较器 89 | @Bean 90 | public CredentialsMatcher credentialsMatcher() { 91 | return new CredentialsMatcher(); 92 | } 93 | 94 | @Bean 95 | public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() { 96 | AuthorizationAttributeSourceAdvisor advisor=new AuthorizationAttributeSourceAdvisor(); 97 | advisor.setSecurityManager(securityManager()); 98 | return advisor; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.User; 4 | import org.apache.shiro.SecurityUtils; 5 | import org.apache.shiro.subject.Subject; 6 | import org.springframework.web.context.request.RequestContextHolder; 7 | import org.springframework.web.context.request.ServletRequestAttributes; 8 | 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | 12 | public class BaseController { 13 | 14 | 15 | /** 16 | * 获取 request 17 | */ 18 | protected HttpServletRequest getRequest() { 19 | 20 | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder 21 | .getRequestAttributes()) 22 | .getRequest(); 23 | return request; 24 | 25 | } 26 | 27 | /** 28 | * 获取用户名称 29 | * @return 30 | */ 31 | protected String getUserName() { 32 | 33 | Subject subject = SecurityUtils.getSubject(); 34 | User user = (User) subject.getPrincipal(); 35 | if (null == user) { 36 | return null; 37 | } 38 | return null == user.getUsername() ? null : user.getUsername(); 39 | 40 | } 41 | 42 | /** 43 | * 获取用户名id 44 | * @return 45 | */ 46 | protected String getUserId() { 47 | 48 | Subject subject = SecurityUtils.getSubject(); 49 | User user = (User) subject.getPrincipal(); 50 | if (null == user) { 51 | return null; 52 | } 53 | return null == user.getId() ? null : user.getId(); 54 | 55 | } 56 | 57 | /** 58 | * 获取角色id 59 | * @return 60 | */ 61 | protected String getRoleId() { 62 | 63 | Subject subject = SecurityUtils.getSubject(); 64 | User user = (User) subject.getPrincipal(); 65 | if (null == user) { 66 | return null; 67 | } 68 | return null == user.getRoleId() ? null : user.getRoleId(); 69 | 70 | } 71 | 72 | /** 73 | * 获取角色名称 74 | * @return 75 | */ 76 | protected String getRoleName() { 77 | 78 | Subject subject = SecurityUtils.getSubject(); 79 | User user = (User) subject.getPrincipal(); 80 | if (null == user) { 81 | return null; 82 | } 83 | return null == user.getRoleName() ? null : user.getRoleName(); 84 | 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/ClazzController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Clazz; 5 | import com.qxf.service.ClazzService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Auther: qiuxinfa 18 | * @Date: 2019/11/24 19 | * @Description: com.qxf.controller 20 | */ 21 | @RestController 22 | @RequestMapping("clazz") 23 | public class ClazzController { 24 | @Autowired 25 | private ClazzService clazzService; 26 | 27 | @GetMapping("/list") 28 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 29 | Page page = new Page<>(startPage,pageSize); 30 | List list = clazzService.getListByPage(page,name); 31 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 32 | } 33 | 34 | @PostMapping("/add") 35 | public Object addClazz(Clazz clazz){ 36 | return clazzService.addClazz(clazz); 37 | } 38 | 39 | @PostMapping("/delete") 40 | public Object deleteClazz(Clazz clazz){ 41 | String[] ids = clazz.getIds(); 42 | if (null == ids || ids.length == 0) { 43 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 44 | } 45 | return clazzService.deleteClazz(ids); 46 | } 47 | 48 | @GetMapping("/findAllClazz") 49 | public Object getAllClazz(String majorId){ 50 | List list = clazzService.getAllClazz(majorId); 51 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/CourseController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Course; 5 | import com.qxf.pojo.User; 6 | import com.qxf.service.CourseService; 7 | import com.qxf.utils.EnumCode; 8 | import com.qxf.utils.ResultUtil; 9 | import org.apache.shiro.SecurityUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.PostMapping; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import javax.servlet.http.HttpSession; 17 | import java.text.ParseException; 18 | import java.util.List; 19 | 20 | /** 21 | * @Auther: qiuxinfa 22 | * @Date: 2019/11/24 23 | * @Description: com.qxf.controller 24 | */ 25 | @RestController 26 | @RequestMapping("/course") 27 | public class CourseController { 28 | @Autowired 29 | private CourseService courseService; 30 | 31 | //管理员:课程列表 32 | @GetMapping("/list") 33 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 34 | Page page = new Page<>(startPage,pageSize); 35 | List list = courseService.getListByPage(page,name); 36 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 37 | } 38 | 39 | //管理员:添加新课程 40 | @PostMapping("/add") 41 | public Object addCourse(Course course) throws ParseException { 42 | return courseService.addCourse(course); 43 | } 44 | 45 | //管理员:删除课程 46 | @PostMapping("/delete") 47 | public Object deleteCourse(Course course){ 48 | String[] ids = course.getIds(); 49 | if (null == ids || ids.length == 0) { 50 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 51 | } 52 | return courseService.deleteCourse(ids); 53 | } 54 | 55 | //学生:我的未选课程 56 | @GetMapping("/choice") 57 | public Object getNotSelectedCourse(Integer startPage, Integer pageSize, HttpSession session){ 58 | Page page = new Page<>(startPage,pageSize); 59 | User user = (User) session.getAttribute("user"); 60 | List list = courseService.getNotSelectedCourse(page,user.getId()); 61 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 62 | } 63 | 64 | //学生:我的课程列表 65 | @GetMapping("/mycourse") 66 | public Object getSelectedCourse(Integer startPage, Integer pageSize, HttpSession session){ 67 | Page page = new Page<>(startPage,pageSize); 68 | User user = (User) session.getAttribute("user"); 69 | if(user == null){ 70 | user = (User) SecurityUtils.getSubject().getPrincipal(); 71 | session.setAttribute("user",user); 72 | } 73 | List list = courseService.getSelectedCourse(page,user.getId()); 74 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 75 | } 76 | 77 | //学生:将未选课程添加到我的课程 78 | @PostMapping("/student") 79 | public Object addCourseToStudent(Course course){ 80 | return courseService.addCourseToStudent(course); 81 | } 82 | 83 | //老师:个人中心-课程中心列表 84 | @GetMapping("/center") 85 | public Object getCourseByTeacher(Integer startPage, Integer pageSize, HttpSession session){ 86 | Page page = new Page<>(startPage,pageSize); 87 | User user = (User) SecurityUtils.getSubject().getPrincipal(); 88 | List list = courseService.getCourseByTeacher(page,user.getId()); 89 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 90 | } 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/DictController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.SysDict; 5 | import com.qxf.service.DictService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @Auther: qiuxinfa 15 | * @Date: 2019/11/23 16 | * @Description: 字典 17 | */ 18 | @RestController 19 | @RequestMapping("dict") 20 | public class DictController { 21 | 22 | @Autowired 23 | private DictService dictService; 24 | 25 | //查询字典列表 26 | @GetMapping(value = "/list") 27 | public Object findDictByPage(Integer startPage,Integer pageSize,SysDict dict) { 28 | Page page = new Page(startPage,pageSize); 29 | List list = dictService.findDictByPage(page,dict); 30 | return ResultUtil.result(EnumCode.OK.getValue(), "请求成功", list, page.getTotal()); 31 | } 32 | 33 | //根据字典类别查询字典下拉列表 34 | @GetMapping("/findListByDictTypeCode") 35 | public Object findListByDictTypeCode(String dictTypeCode){ 36 | List list = dictService.findListByDictTypeCode(dictTypeCode); 37 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list); 38 | } 39 | 40 | //根据字典类别查询字典下拉列表 41 | @PostMapping("/add") 42 | public Object addDict(SysDict dict){ 43 | return dictService.addDict(dict); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.utils.EnumCode; 4 | import com.qxf.utils.ResultUtil; 5 | import org.apache.commons.fileupload.util.Streams; 6 | import org.apache.commons.io.IOUtils; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.RestController; 10 | import org.springframework.web.multipart.MultipartFile; 11 | 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.*; 14 | import java.nio.file.Files; 15 | import java.nio.file.Path; 16 | import java.nio.file.Paths; 17 | 18 | /** 19 | * @Auther: qiuxinfa 20 | * @Date: 2020/4/25 21 | * @Description: 文件上传下载 22 | */ 23 | @RestController 24 | @RequestMapping("/file") 25 | public class FileController { 26 | 27 | private final static String rootPath = "D:/attachment/"; 28 | @RequestMapping("/upload") 29 | public Object uploadFile(MultipartFile[] multipartFiles){ 30 | File fileDir = new File(rootPath); 31 | if (!fileDir.exists() && !fileDir.isDirectory()) { 32 | fileDir.mkdirs(); 33 | } 34 | try { 35 | if (multipartFiles != null && multipartFiles.length > 0) { 36 | for(int i = 0;i page = new Page<>(startPage,pageSize); 31 | List list = gradeService.viewStudent(page,id); 32 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 33 | } 34 | 35 | //老师:给某个学生的某门课程打分 36 | @PostMapping("/update") 37 | public Object updateScore(Grade grade){ 38 | return gradeService.updateScore(grade); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/InstituteController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Institute; 5 | import com.qxf.service.InstituteService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Auther: qiuxinfa 18 | * @Date: 2019/11/24 19 | * @Description: com.qxf.controller 20 | */ 21 | @RestController 22 | @RequestMapping("institute") 23 | public class InstituteController { 24 | 25 | @Autowired 26 | private InstituteService instituteService; 27 | 28 | @GetMapping("/list") 29 | public Object getInstituteByPage(Integer startPage,Integer pageSize,String name){ 30 | Page page = new Page<>(startPage,pageSize); 31 | List list = instituteService.getInstituteByPage(page,name); 32 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 33 | } 34 | 35 | //添加学院 36 | @PostMapping("/add") 37 | public Object addInstitute(Institute institute){ 38 | return instituteService.addInstitute(institute); 39 | } 40 | //添加学院 41 | @PostMapping("/delete") 42 | public Object deleteInstitute(Institute institute){ 43 | String[] ids = institute.getIds(); 44 | if (null == ids || ids.length == 0) { 45 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 46 | } 47 | return instituteService.deleteInstitute(ids); 48 | } 49 | //学院下拉列表 50 | @GetMapping("/findAllInstitute") 51 | public Object findAllInstitute(){ 52 | List list = instituteService.findAllInstitute(); 53 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.User; 4 | import com.qxf.service.LoginLogService; 5 | import com.qxf.service.UserService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.apache.shiro.SecurityUtils; 9 | import org.apache.shiro.subject.Subject; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpSession; 17 | 18 | @RestController 19 | @RequestMapping(value = "user") 20 | public class LoginController extends BaseController{ 21 | 22 | @Autowired 23 | private UserService userService; 24 | 25 | @Autowired 26 | private LoginLogService loginLogService; 27 | 28 | @RequestMapping(value = "/login",method = RequestMethod.POST) 29 | public Object login(String name,String pass, HttpSession session, HttpServletRequest request) { 30 | User user = new User(); 31 | user.setUsername(name); 32 | user.setPassword(pass); 33 | return userService.login(user, session, request); 34 | } 35 | 36 | @RequestMapping(value = "/loginOut",method = RequestMethod.GET) 37 | public Object logout() { 38 | try { 39 | Subject subject = SecurityUtils.getSubject(); 40 | subject.logout(); 41 | return ResultUtil.result(EnumCode.OK.getValue(), "退出登陆成功"); 42 | } catch (Exception e) { 43 | return "/login"; 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/MajorController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Major; 5 | import com.qxf.service.MajorService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Auther: qiuxinfa 18 | * @Date: 2019/11/24 19 | * @Description: com.qxf.controller 20 | */ 21 | @RestController 22 | @RequestMapping("major") 23 | public class MajorController { 24 | 25 | @Autowired 26 | private MajorService majorService; 27 | 28 | @GetMapping("/list") 29 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 30 | Page page = new Page<>(startPage,pageSize); 31 | List list = majorService.getListByPage(page,name); 32 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 33 | } 34 | 35 | //添加学院 36 | @PostMapping("/add") 37 | public Object addMajor(Major major){ 38 | return majorService.addMajor(major); 39 | } 40 | //添加学院 41 | @PostMapping("/delete") 42 | public Object deleteMajor(Major major){ 43 | String[] ids = major.getIds(); 44 | if (null == ids || ids.length == 0) { 45 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 46 | } 47 | return majorService.deleteMajor(ids); 48 | } 49 | @GetMapping("/findAllMajor") 50 | public Object findAllMajor(String instituteId){ 51 | List list = majorService.findAllMajor(instituteId); 52 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/PermsController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Perms; 5 | import com.qxf.service.PermsService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.validation.BindingResult; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.validation.Valid; 15 | import java.util.List; 16 | 17 | @RestController 18 | @RequestMapping(value = "perms") 19 | public class PermsController extends BaseController{ 20 | 21 | @Autowired 22 | private PermsService permissionService; 23 | 24 | /** 25 | * @desc: 查询菜单 26 | */ 27 | @RequestMapping(value = "/list" ,method = RequestMethod.GET) 28 | public Object findPermissionByPage(Integer startPage,Integer pageSize,String permsName) { 29 | 30 | Page page = new Page(startPage,pageSize); 31 | List list = permissionService.findPermissionByPage(page,permsName); 32 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(),list,page.getTotal()); 33 | } 34 | 35 | /** 36 | * @desc: 新增菜单 37 | */ 38 | @RequestMapping(value = "/add" ,method = RequestMethod.POST) 39 | public Object addPermissions(@Valid Perms vo, BindingResult bindingResult) { 40 | return permissionService.addPermissions(vo); 41 | } 42 | 43 | /** 44 | * @desc: 删除菜单 45 | */ 46 | @RequestMapping(value = "/delete",method = RequestMethod.POST) 47 | public Object delPermis(Perms perms) { 48 | String[] ids = perms.getIds(); 49 | if (null == ids || ids.length == 0) { 50 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 51 | } 52 | return permissionService.delPermis(ids); 53 | } 54 | 55 | /** 56 | * @desc: 查询父级菜单为1的所有菜单 57 | */ 58 | @RequestMapping(value = "/findLastPermissionByType" ,method = RequestMethod.GET) 59 | public Object findAllBasePermission(String type) { 60 | List list = permissionService.findLastPermissionByType(type); 61 | if (null == list ||list.isEmpty()) { 62 | return ResultUtil.result(EnumCode.GONE.getValue(),"没有记录"); 63 | } 64 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(),list); 65 | } 66 | 67 | /** 68 | * @desc: 绑定树形菜单 69 | */ 70 | @RequestMapping(value = "/findBasePermission" ,method = RequestMethod.GET) 71 | public Object findBasePermission() { 72 | List list = permissionService.findBasePermission(); 73 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(),list); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/QuestionChoicController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.QuestionChoic; 4 | import com.qxf.service.QuestionChoicService; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * 选择题库,question_type2单选,3多选(QuestionChoic)表控制层 11 | * 12 | * @author makejava 13 | * @since 2020-02-15 16:56:52 14 | */ 15 | @RestController 16 | @RequestMapping("questionChoic") 17 | public class QuestionChoicController { 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/QuestionExamController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.QuestionExam; 6 | import com.qxf.service.QuestionExamService; 7 | import com.qxf.utils.EnumCode; 8 | import com.qxf.utils.ResultUtil; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import javax.annotation.Resource; 12 | import java.util.List; 13 | 14 | /** 15 | * 考试安排(QuestionExam)表控制层 16 | * 17 | * @author makejava 18 | * @since 2020-02-15 16:56:56 19 | */ 20 | @RestController 21 | @RequestMapping("exam") 22 | public class QuestionExamController { 23 | /** 24 | * 服务对象 25 | */ 26 | @Resource 27 | private QuestionExamService questionExamService; 28 | 29 | //分页查询考试列表 30 | @GetMapping("/list") 31 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 32 | Page page = new Page<>(startPage,pageSize); 33 | List list = questionExamService.getListByPage(page,name); 34 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 35 | } 36 | 37 | //根据ID查询考试安排 38 | @GetMapping("/getExamById") 39 | public Object getExamById(String id){ 40 | QuestionExam result = questionExamService.getExamById(id); 41 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功", JSONObject.toJSONString(result)); 42 | } 43 | 44 | @PostMapping("/add") 45 | public Object add(QuestionExam exam) { 46 | return this.questionExamService.add(exam); 47 | } 48 | 49 | 50 | @PostMapping("/delete") 51 | public Object delete(QuestionExam exam){ 52 | String[] ids = exam.getIds(); 53 | if (null == ids || ids.length == 0) { 54 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 55 | } 56 | return questionExamService.delete(ids); 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/QuestionExamRecordController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.QuestionExamRecord; 4 | import com.qxf.service.QuestionExamRecordService; 5 | import com.qxf.utils.EnumCode; 6 | import com.qxf.utils.ResultUtil; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | 11 | /** 12 | * 考试记录表(QuestionExamRecord)表控制层 13 | * 14 | * @author makejava 15 | * @since 2020-02-15 16:56:57 16 | */ 17 | @RestController 18 | @RequestMapping("exam/record") 19 | public class QuestionExamRecordController { 20 | /** 21 | * 服务对象 22 | */ 23 | @Resource 24 | private QuestionExamRecordService questionExamRecordService; 25 | 26 | //插入考试记录 27 | @PostMapping("/add") 28 | public Object add(QuestionExamRecord questionExamRecord) { 29 | return this.questionExamRecordService.add(questionExamRecord); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/QuestionFillJudgeController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.QuestionFillJudge; 4 | import com.qxf.service.QuestionFillJudgeService; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * 填空题和判断题库,question_type,0填空1判断(QuestionFillJudge)表控制层 11 | * 12 | * @author makejava 13 | * @since 2020-02-15 16:56:57 14 | */ 15 | @RestController 16 | @RequestMapping("questionFillJudge") 17 | public class QuestionFillJudgeController { 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/QuestionPaperController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.qxf.pojo.ExamVo; 4 | import com.qxf.pojo.QuestionExam; 5 | import com.qxf.pojo.QuestionPaper; 6 | import com.qxf.service.QuestionPaperService; 7 | import com.qxf.utils.EnumCode; 8 | import com.qxf.utils.ResultUtil; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import javax.annotation.Resource; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * 试卷(QuestionPaper)表控制层 17 | * 18 | * @author makejava 19 | * @since 2020-02-15 16:56:56 20 | */ 21 | @RestController 22 | @RequestMapping("paper") 23 | public class QuestionPaperController { 24 | /** 25 | * 服务对象 26 | */ 27 | @Resource 28 | private QuestionPaperService questionPaperService; 29 | 30 | /** 31 | * 通过主键查询单条数据 32 | * 33 | * @param paperId 主键 34 | * @return 单条数据 35 | */ 36 | @GetMapping("getPaperById") 37 | public Object getPaperById(String paperId) { 38 | Map> map = this.questionPaperService.getPaperById(paperId); 39 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",map); 40 | } 41 | 42 | //随机组卷(暂时不考虑多选题) 43 | @PostMapping("/add") 44 | public Object add(ExamVo exam) { 45 | return this.questionPaperService.add(exam); 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Role; 5 | import com.qxf.pojo.RolePerms; 6 | import com.qxf.service.RolePermsService; 7 | import com.qxf.service.RoleService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.validation.BindingResult; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import javax.validation.Valid; 17 | import java.util.List; 18 | 19 | @RestController 20 | @RequestMapping(value = "role") 21 | public class RoleController { 22 | 23 | @Autowired 24 | private RoleService roleService; 25 | 26 | @Autowired 27 | private RolePermsService rolePermissionService; 28 | 29 | /** 30 | * @desc: 查询角色 31 | */ 32 | @RequestMapping(value = "/list" ,method = RequestMethod.GET) 33 | public Object findRoleByPage(Integer startPage,Integer pageSize,String roleName) { 34 | 35 | Page page = new Page(startPage,pageSize); 36 | List list = roleService.findRoleByPage(page,roleName); 37 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(),list,page.getTotal()); 38 | } 39 | 40 | /** 41 | * @desc: 新增角色 42 | */ 43 | @RequestMapping(value = "/add" ,method = RequestMethod.POST) 44 | public Object addRoles(@Valid Role vo, BindingResult bindingResult) { 45 | return roleService.addRoles(vo); 46 | } 47 | 48 | /** 49 | * @desc: 删除角色 50 | */ 51 | @RequestMapping(value = "/delete",method = RequestMethod.POST) 52 | public Object delRoles(Role role) { 53 | String[] ids = role.getIds(); 54 | if (null == ids || ids.length == 0) { 55 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 56 | } 57 | return roleService.delRole(ids); 58 | } 59 | 60 | /** 61 | * 根据角色查询角色权限 62 | */ 63 | @RequestMapping(value = "/findRolesPermisByRole",method = RequestMethod.GET) 64 | public Object findRolesPermisByRole(String roleId) { 65 | if (null == roleId) { 66 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 67 | } 68 | List list = rolePermissionService.findRolesPermisByRole(roleId); 69 | String[] arr = new String[list.size()]; 70 | for (int i = 0,j=list.size(); i < j; i++) { 71 | arr[i] = list.get(i).getPermsId(); 72 | } 73 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(), arr); 74 | } 75 | 76 | /** 77 | * 添加角色权限 78 | */ 79 | @RequestMapping(value = "/perms",method = RequestMethod.POST) 80 | public Object addRolesPermis(RolePerms vo, BindingResult bindingResult) { 81 | return rolePermissionService.addRolesPermis(vo); 82 | } 83 | 84 | /** 85 | * 绑定角色下拉框 86 | */ 87 | @RequestMapping(value = "/findAllRoles",method = RequestMethod.GET) 88 | public Object findAllRoles(RolePerms vo,BindingResult bindingResult) { 89 | List list = roleService.findAllRoles(); 90 | return ResultUtil.result(EnumCode.OK.getValue(),EnumCode.OK.getText(),list); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Student; 5 | import com.qxf.service.StudentService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Auther: qiuxinfa 18 | * @Date: 2019/11/24 19 | * @Description: com.qxf.controller 20 | */ 21 | @RestController 22 | @RequestMapping("student") 23 | public class StudentController { 24 | @Autowired 25 | private StudentService studentService; 26 | 27 | @GetMapping("/list") 28 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 29 | Page page = new Page<>(startPage,pageSize); 30 | List list = studentService.getListByPage(page,name); 31 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 32 | } 33 | 34 | @PostMapping("/add") 35 | public Object addStudent(Student student){ 36 | return studentService.addStudent(student); 37 | } 38 | 39 | @PostMapping("/delete") 40 | public Object deleteStudent(Student student){ 41 | String[] ids = student.getIds(); 42 | if (null == ids || ids.length == 0) { 43 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), EnumCode.BAD_REQUEST.getText()); 44 | } 45 | return studentService.deleteStudent(ids); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/SysController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.LoginLog; 5 | import com.qxf.pojo.OperateRecord; 6 | import com.qxf.service.LoginLogService; 7 | import com.qxf.service.OperateRecordService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @Auther: qiuxinfa 19 | * @Date: 2019/11/23 20 | * @Description: com.qxf.controller 21 | */ 22 | @RestController 23 | @RequestMapping("sys") 24 | public class SysController { 25 | @Autowired 26 | private LoginLogService loginLogService; 27 | 28 | @Autowired 29 | private OperateRecordService operateRecordService; 30 | 31 | //登录日志列表 32 | @GetMapping("/loginLog/list") 33 | public Object getLoginLogByPage(Integer startPage,Integer pageSize,String searchKeyWord){ 34 | Page page = new Page(startPage,pageSize); 35 | List list = loginLogService.findUserLoginLogByPage(page,searchKeyWord); 36 | return ResultUtil.result(EnumCode.OK.getValue(), EnumCode.OK.getText(), list, page.getTotal()); 37 | } 38 | //登录日志列表 39 | @GetMapping("/operateRecord/list") 40 | public Object getOperateRecordByPage(Integer startPage,Integer pageSize,String searchKeyWord){ 41 | Page page = new Page(startPage,pageSize); 42 | List list = operateRecordService.findOperatingRecordByPage(page,searchKeyWord); 43 | return ResultUtil.result(EnumCode.OK.getValue(), EnumCode.OK.getText(), list, page.getTotal()); 44 | } 45 | 46 | //用户登录统计 47 | @GetMapping(value = "/findUserLoginTotal") 48 | public Object findUserLoginTotal() { 49 | return loginLogService.findUserLoginTotal(); 50 | } 51 | 52 | //用户请求统计 53 | @GetMapping(value = "/findUserReqTotal") 54 | public Object findUserReqTotal() { 55 | return operateRecordService.findUserReqTotal(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/controller/TeacherController.java: -------------------------------------------------------------------------------- 1 | package com.qxf.controller; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.qxf.pojo.Teacher; 5 | import com.qxf.service.TeacherService; 6 | import com.qxf.utils.EnumCode; 7 | import com.qxf.utils.ResultUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Auther: qiuxinfa 18 | * @Date: 2019/11/24 19 | * @Description: com.qxf.controller 20 | */ 21 | @RestController 22 | @RequestMapping("teacher") 23 | public class TeacherController { 24 | @Autowired 25 | private TeacherService teacherService; 26 | 27 | @GetMapping("/list") 28 | public Object getListByPage(Integer startPage,Integer pageSize,String name){ 29 | Page page = new Page<>(startPage,pageSize); 30 | List list = teacherService.getListByPage(page,name); 31 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",list,page.getTotal()); 32 | } 33 | 34 | @PostMapping("/add") 35 | public Object addTeacher (Teacher teacher){ 36 | return teacherService.addTeacher(teacher); 37 | } 38 | 39 | @GetMapping("/findAllTeacher") 40 | public Object findAllTeacher() { 41 | List allTeacher = teacherService.findAllTeacher(); 42 | return ResultUtil.result(EnumCode.OK.getValue(),"请求成功",allTeacher); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/exception/ExceptionHandle.java: -------------------------------------------------------------------------------- 1 | package com.qxf.exception; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.qxf.controller.BaseController; 5 | import com.qxf.pojo.OperateRecord; 6 | import com.qxf.service.OperateRecordService; 7 | import com.qxf.utils.EnumCode; 8 | import com.qxf.utils.ResultUtil; 9 | import org.apache.shiro.authc.AuthenticationException; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.ControllerAdvice; 14 | import org.springframework.web.bind.annotation.ExceptionHandler; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | import org.springframework.web.context.request.RequestContextHolder; 17 | import org.springframework.web.context.request.ServletRequestAttributes; 18 | 19 | import javax.servlet.http.HttpServletRequest; 20 | import java.util.Date; 21 | 22 | /** 23 | * @Auther: qiuxinfa 24 | * @Date: 2019/11/15 25 | * @Description: 统一异常处理 26 | */ 27 | @ControllerAdvice 28 | public class ExceptionHandle extends BaseController { 29 | 30 | @Autowired 31 | private OperateRecordService operatingRecordService; 32 | 33 | private final static Logger log = LoggerFactory.getLogger(ExceptionHandle.class); 34 | 35 | @ExceptionHandler(value = {Exception.class}) 36 | @ResponseBody 37 | public Object handle(Exception e) { 38 | 39 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); 40 | HttpServletRequest request = attributes.getRequest(); 41 | 42 | String remoteAddr = request.getRemoteAddr(); 43 | String method = request.getMethod(); 44 | 45 | OperateRecord or = new OperateRecord(); 46 | or.setRequestUrl(request.getRequestURI()); 47 | or.setRemoteAddr(remoteAddr); 48 | or.setMethod(method); 49 | or.setCreateTime(new Date()); 50 | or.setUserId(super.getUserId()); 51 | or.setIsSuccess(0); 52 | operatingRecordService.insert(or); 53 | 54 | 55 | if (e instanceof MyException) { 56 | MyException myException = (MyException)e; 57 | return myException.getResult(); 58 | } else if (e instanceof AuthenticationException) { 59 | AuthenticationException authenticationException = (AuthenticationException)e; 60 | return JSONArray.toJSON(ResultUtil.result(EnumCode.LOGIN_FAIL.getValue(), authenticationException.getMessage())); 61 | } 62 | else { 63 | log.info("系统异常 {}",e); 64 | return ResultUtil.result(-1, "未知错误"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/exception/MyException.java: -------------------------------------------------------------------------------- 1 | package com.qxf.exception; 2 | 3 | /** 4 | * @Auther: qiuxinfa 5 | * @Date: 2019/11/15 6 | * @Description: com.qxf.exception 7 | */ 8 | public class MyException extends RuntimeException{ 9 | 10 | /** 11 | * 返回结果 12 | */ 13 | private Object result; 14 | 15 | public MyException(Object result) { 16 | this.result = result; 17 | } 18 | 19 | public Object getResult() { 20 | return result; 21 | } 22 | 23 | public void setResult(Object result) { 24 | this.result = result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/ClazzMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Clazz; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper 14 | */ 15 | public interface ClazzMapper extends BaseMapper{ 16 | List getListByPage(Page page,@Param("name") String name); 17 | 18 | List getAllClazz(@Param("majorId") String majorId); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/CourseMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Course; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper 14 | */ 15 | public interface CourseMapper extends BaseMapper{ 16 | List getListByPage(Page page,@Param("name") String name); 17 | 18 | List getNotSelectedCourse(Page page, @Param("studentId") String studentId); 19 | 20 | List getSelectedCourse(Page page, @Param("studentId") String studentId); 21 | 22 | List getCourseByTeacher(Page page, @Param("teacherId") String teacherId); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/CourseTeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.qxf.pojo.CourseTeacher; 5 | 6 | /** 7 | * @Auther: qiuxinfa 8 | * @Date: 2019/11/25 9 | * @Description: com.qxf.mapper 10 | */ 11 | public interface CourseTeacherMapper extends BaseMapper{ 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/DictMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.SysDict; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/23 12 | * @Description: com.qxf.mapper 13 | */ 14 | public interface DictMapper extends BaseMapper{ 15 | List findDictByPage(Page page, SysDict dict); 16 | 17 | List findListByDictTypeCode(String dictTypeCode); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/GradeMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.qxf.pojo.CourseTeacher; 5 | import com.qxf.pojo.Grade; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/26 12 | * @Description: com.qxf.mapper 13 | */ 14 | public interface GradeMapper extends BaseMapper{ 15 | List viewStudent(CourseTeacher courseTeacher); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/InstituteMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Institute; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper 14 | */ 15 | public interface InstituteMapper extends BaseMapper{ 16 | List getInstituteByPage(Page page,@Param("name") String name); 17 | 18 | public List findAllInstitute(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/LoginLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 5 | import com.qxf.pojo.LoginLog; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface LoginLogMapper extends BaseMapper { 11 | 12 | /** 13 | * 查询登录次数 14 | */ 15 | Integer findMaxLoginTatalByUserId(@Param("userId") String userId); 16 | 17 | /** 18 | * 用户登录日志,searchKeyWord查询关键字,可以是用户名,可以是ip,模糊查询 19 | */ 20 | List findUserLoginLogByPage(Pagination page,@Param("searchKeyWord") String searchKeyWord); 21 | 22 | /** 23 | * 查询用户登录总次数 24 | */ 25 | List findUserLoginTotal(); 26 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/MajorMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Major; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper.xml 14 | */ 15 | public interface MajorMapper extends BaseMapper{ 16 | public List getListByPage(Page page, @Param("name") String name); 17 | 18 | public List findAllMajor(@Param("instituteId") String instituteId); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/OperateRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 5 | import com.qxf.pojo.OperateRecord; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface OperateRecordMapper extends BaseMapper { 11 | 12 | /** 13 | * 查询操作记录 14 | */ 15 | List findOperateRecordByPage(Pagination page, @Param("searchKeyWord") String searchKeyWord); 16 | 17 | /** 18 | * 统计所有 请求 19 | */ 20 | List findAllRequstCount(); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/PermsMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 5 | import com.qxf.pojo.Perms; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface PermsMapper extends BaseMapper { 11 | 12 | /** 13 | * @desc: 查询菜单 14 | */ 15 | List findPermissionByPage(Pagination page, @Param("permsName") String permsName); 16 | 17 | /** 18 | * @desc: 根据菜单查询菜单 19 | */ 20 | List findPermissionByName(@Param("name") String name); 21 | 22 | /** 23 | * @desc: 查询所有父级菜单绑定下拉框 24 | */ 25 | List findLastPermissionByType(@Param("type") String type); 26 | 27 | /** 28 | * @desc: 查询所有父级菜单绑定树形 29 | */ 30 | List findBasePermission(); 31 | 32 | /** 33 | * @desc: 根据父级id查询菜单 34 | */ 35 | List findPermissionByFatherId(@Param("fatherId") String fatherId); 36 | 37 | /** 38 | * 根据url查询记录 39 | */ 40 | Integer findCountByUrl(@Param("requestUrl") String requestUrl); 41 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/QuestionChoicDao.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.qxf.pojo.QuestionChoic; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 选择题库,question_type2单选,3多选(QuestionChoic)表数据库访问层 10 | * 11 | * @author makejava 12 | * @since 2020-02-15 16:56:51 13 | */ 14 | public interface QuestionChoicDao { 15 | List getQuestionChoicList(@Param("questionType") String questionType, @Param("paperId") String paperId); 16 | 17 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/QuestionExamDao.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.QuestionExam; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * 考试安排(QuestionExam)表数据库访问层 13 | * 14 | * @author makejava 15 | * @since 2020-02-15 16:56:56 16 | */ 17 | public interface QuestionExamDao extends BaseMapper{ 18 | List getListByPage(Page page, @Param("name") String name); 19 | 20 | QuestionExam getExamById(String id); 21 | 22 | int add(QuestionExam questionExam); 23 | 24 | int updateScoreByPaperId(QuestionExam questionExam); 25 | 26 | int deleteExamById(String id); 27 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/QuestionExamRecordDao.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.qxf.pojo.QuestionExamRecord; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 考试记录表(QuestionExamRecord)表数据库访问层 10 | * 11 | * @author makejava 12 | * @since 2020-02-15 16:56:57 13 | */ 14 | public interface QuestionExamRecordDao { 15 | int add(QuestionExamRecord questionExamRecord); 16 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/QuestionFillJudgeDao.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.qxf.pojo.QuestionFillJudge; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 填空题和判断题库,question_type,0填空1判断(QuestionFillJudge)表数据库访问层 10 | * 11 | * @author makejava 12 | * @since 2020-02-15 16:56:56 13 | */ 14 | public interface QuestionFillJudgeDao { 15 | List getQuestionFillJudgeList(@Param("questionType") String questionType, @Param("paperId") String paperId); 16 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/QuestionPaperDao.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.qxf.pojo.QuestionPaper; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 试卷(QuestionPaper)表数据库访问层 10 | * 11 | * @author makejava 12 | * @since 2020-02-15 16:56:56 13 | */ 14 | public interface QuestionPaperDao { 15 | int add(QuestionPaper questionPaper); 16 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 5 | import com.qxf.pojo.Role; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface RoleMapper extends BaseMapper { 11 | 12 | /** 13 | * @desc: 查询角色 14 | */ 15 | List findRoleByPage(Pagination page, @Param("roleName") String roleName); 16 | 17 | /** 18 | * 绑定角色下拉框 19 | */ 20 | List findAllRoles(); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/RolePermsMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.qxf.pojo.Perms; 5 | import com.qxf.pojo.RolePerms; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface RolePermsMapper extends BaseMapper { 11 | 12 | /** 13 | * 根据角色查询角色权限 14 | */ 15 | List findRolesPermisByRole(@Param("roleId") String roleId); 16 | 17 | /** 18 | * 根据角色id查询记录数 19 | */ 20 | Integer findCountByRole(@Param("roleId") String roleId, @Param("url") String url); 21 | 22 | /** 23 | * 根据父id\角色id查询角色菜单 24 | */ 25 | List findRolesPermisByFatherId(@Param("parentId") String parentId, @Param("roleId") String roleId); 26 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Student; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper 14 | */ 15 | public interface StudentMapper extends BaseMapper{ 16 | List getListByPage(Page page, @Param("name") String name); 17 | Integer getStudentCount(@Param("majorId") String majorId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.Page; 5 | import com.qxf.pojo.Teacher; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.mapper 14 | */ 15 | public interface TeacherMapper extends BaseMapper{ 16 | List getListByPage(Page page,@Param("name") String name); 17 | 18 | List findAllTeacher(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 5 | import com.qxf.pojo.User; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: com.qxf.mapper 13 | */ 14 | public interface UserMapper extends BaseMapper{ 15 | //分页查询 16 | List findUserByPage(Pagination page,User user); 17 | 18 | //登录验证 19 | List checkUser(User user); 20 | 21 | User findUserByUsername(String username); 22 | 23 | //不分页查询 24 | List findAllUser(User user); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.qxf.pojo.UserRole; 5 | 6 | public interface UserRoleMapper extends BaseMapper { 7 | 8 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/ClazzMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 22 | 23 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/CourseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 27 | 28 | 29 | 52 | 53 | 54 | 78 | 79 | 80 | 92 | 93 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/DictMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 22 | 23 | 24 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/GradeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/InstituteMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 19 | 20 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/LoginLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 25 | 26 | 42 | 43 | 44 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/MajorMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 21 | 22 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/OperateRecordMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 44 | 45 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/PermsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 32 | 33 | 34 | 46 | 47 | 48 | 49 | 57 | 58 | 59 | 68 | 69 | 70 | 78 | 79 | 80 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/QuestionChoicDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/QuestionExamDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 30 | 31 | 32 | 40 | 41 | 42 | INSERT INTO question_exam(id,exam_course,exam_desc,exam_date,total_time,major,institute,total_score,paper_id) 43 | VALUES (#{id},#{examCourse},#{examDesc},#{examDate},#{totalTime},#{major},#{institute},#{totalScore},#{paperId}) 44 | 45 | 46 | 47 | UPDATE question_exam set total_score=#{totalScore} WHERE paper_id=#{paperId} 48 | 49 | 50 | 51 | DELETE from question_exam where id=#{id} 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/QuestionExamRecordDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | insert into boot_shiro_vue_stu.question_exam_record(id,exam_id, join_id, join_date, join_time_cost, join_score, join_result_level, join_answer_fill, join_answer_judge, join_answer_single,join_answer_multiple) 22 | values (#{id}, #{examId}, #{joinId}, #{joinDate}, #{joinTimeCost}, #{joinScore}, #{joinResultLevel}, #{joinAnswerFill}, #{joinAnswerJudge}, #{joinAnswerSingle}, #{joinAnswerMultiple}) 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/QuestionFillJudgeDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/QuestionPaperDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | INSERT INTO question_paper(id,paper_id,question_id) 13 | VALUES (#{id},#{paperId},#{questionId}) 14 | 15 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 24 | 25 | 26 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/RolePermsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 31 | 32 | 33 | 34 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 29 | 30 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/TeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 24 | 25 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | SELECT 19 | u.id, 20 | u.username, 21 | u.email, 22 | u.photo_url AS photoUrl, 23 | u.enable, 24 | u.create_time AS createTime, 25 | u.last_login_time AS lastLoginTime, 26 | r.id AS roleId, 27 | r.name AS roleName 28 | FROM 29 | t_user AS u 30 | INNER JOIN t_user_role ur ON u.id = ur.user_id 31 | INNER JOIN t_role r ON ur.role_id = r.id 32 | WHERE 1=1 33 | 34 | AND u.username LIKE CONCAT('%',#{username},'%') 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 47 | 48 | 65 | 66 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/mapper/xml/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Clazz.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 班级 13 | */ 14 | @Data 15 | @TableName("t_clazz") 16 | public class Clazz implements Serializable{ 17 | private String id; 18 | private String name; //班级名 19 | @TableField("major_id") 20 | private String majorId; //班级所属专业id 21 | @TableField("institute_id") 22 | private String instituteId; //班级所属学院id 23 | @TableField(exist = false) 24 | private String majorName; //专业名称 25 | @TableField(exist = false) 26 | private String instituteName; //学院名称 27 | @TableField(exist = false) 28 | private String[] ids; //id集合 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Course.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import com.fasterxml.jackson.annotation.JsonSubTypes; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/15 13 | * @Description: 课程 14 | */ 15 | @Data 16 | @TableName("t_course") 17 | public class Course implements Serializable{ 18 | private String id; 19 | private String name; //课程名 20 | @TableField("course_type") 21 | private Integer courseType; //课程类型 22 | private Double credit; //学分 23 | @TableField("sign_stime") 24 | private String signStime; //报名开始时间 25 | @TableField("sign_etime") 26 | private String signEtime; //报名结束时间 27 | @TableField("exam_stime") 28 | private String examStime; //考试开始时间 29 | @TableField("exam_etime") 30 | private String examEtime; //考试结束时间 31 | @TableField(exist = false) 32 | private String courseTypeName; //课程类型名称 33 | @TableField(exist = false) 34 | private String teachersName; //任课老师,可能有多个 35 | @TableField(exist = false) 36 | private Integer studentNum; //选课人数 37 | @TableField(exist = false) 38 | private String[] teacherIds; //任课老师id 39 | @TableField(exist = false) 40 | private String[] ids; //id集合,可以是课程的id,也可能是课程-老师中间表的id 41 | @TableField(exist = false) 42 | private Double score; //得分 43 | @TableField(exist = false) 44 | private Integer status; //老师是否录入了成绩:1是,0否 45 | @TableField(exist = false) 46 | private String isCanDelete; //是否可以退订已选课程(还在选课期间就可以退订,暂时未做) 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/CourseTeacher.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 课程-老师中间表 13 | */ 14 | @Data 15 | @TableName("t_course_teacher") 16 | public class CourseTeacher implements Serializable{ 17 | private String id; 18 | @TableField("course_id") 19 | private String courseId; //课程id 20 | @TableField("teacher_id") 21 | private String teacherId; //老师id 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/ExamVo.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | /** 4 | * @Auther: qiuxinfa 5 | * @Date: 2020/2/19 6 | * @Description: com.qxf.pojo 7 | */ 8 | public class ExamVo { 9 | private String paperId; //试卷id 10 | private Integer fillCnt; //填空题数量 11 | private Integer fillScore; //填空题分数 12 | private Integer judgeCnt; //判断题数量 13 | private Integer judgeScore; //判断题分数 14 | private Integer singleCnt; //单选题数量 15 | private Integer singleScore; //单选题分数 16 | private Integer multipleCnt; //多选题数量 17 | private Integer multipleScore; //多选题分数 18 | 19 | public String getPaperId() { 20 | return paperId; 21 | } 22 | 23 | public void setPaperId(String paperId) { 24 | this.paperId = paperId; 25 | } 26 | 27 | public Integer getFillCnt() { 28 | return fillCnt; 29 | } 30 | 31 | public void setFillCnt(Integer fillCnt) { 32 | this.fillCnt = fillCnt; 33 | } 34 | 35 | public Integer getFillScore() { 36 | return fillScore; 37 | } 38 | 39 | public void setFillScore(Integer fillScore) { 40 | this.fillScore = fillScore; 41 | } 42 | 43 | public Integer getJudgeCnt() { 44 | return judgeCnt; 45 | } 46 | 47 | public void setJudgeCnt(Integer judgeCnt) { 48 | this.judgeCnt = judgeCnt; 49 | } 50 | 51 | public Integer getJudgeScore() { 52 | return judgeScore; 53 | } 54 | 55 | public void setJudgeScore(Integer judgeScore) { 56 | this.judgeScore = judgeScore; 57 | } 58 | 59 | public Integer getSingleCnt() { 60 | return singleCnt; 61 | } 62 | 63 | public void setSingleCnt(Integer singleCnt) { 64 | this.singleCnt = singleCnt; 65 | } 66 | 67 | public Integer getSingleScore() { 68 | return singleScore; 69 | } 70 | 71 | public void setSingleScore(Integer singleScore) { 72 | this.singleScore = singleScore; 73 | } 74 | 75 | public Integer getMultipleCnt() { 76 | return multipleCnt; 77 | } 78 | 79 | public void setMultipleCnt(Integer multipleCnt) { 80 | this.multipleCnt = multipleCnt; 81 | } 82 | 83 | public Integer getMultipleScore() { 84 | return multipleScore; 85 | } 86 | 87 | public void setMultipleScore(Integer multipleScore) { 88 | this.multipleScore = multipleScore; 89 | } 90 | 91 | @Override 92 | public String toString() { 93 | return "ExamVo{" + 94 | "paperId='" + paperId + '\'' + 95 | ", fillCnt='" + fillCnt + '\'' + 96 | ", fillScore='" + fillScore + '\'' + 97 | ", judgeCnt='" + judgeCnt + '\'' + 98 | ", judgeScore='" + judgeScore + '\'' + 99 | ", singleCnt='" + singleCnt + '\'' + 100 | ", singleScore='" + singleScore + '\'' + 101 | ", multipleCnt='" + multipleCnt + '\'' + 102 | ", multipleScore='" + multipleScore + '\'' + 103 | '}'; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Grade.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/15 13 | * @Description: 成绩 14 | */ 15 | @Data 16 | @TableName("t_grade") 17 | public class Grade implements Serializable{ 18 | private String id; 19 | @TableField("student_id") 20 | private String studentId; //学生id 21 | @TableField("course_id") 22 | private String courseId; //课程id 23 | @TableField("teacher_id") 24 | private String teacherId; //老师id 25 | @TableField("exam_type") 26 | private Integer examType; //考试类型 27 | @TableField("exam_time") 28 | private Date examTime; //考试时间 29 | private Double score; //得分 30 | private Integer status; //老师是否录入了成绩:1是,0否 31 | @TableField(exist = false) 32 | private String studentName; //学生姓名 33 | @TableField(exist = false) 34 | private String[] ids; //id集合 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Institute.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 学院 13 | */ 14 | @Data 15 | @TableName("t_institute") 16 | public class Institute implements Serializable{ 17 | private String id; 18 | private String name; //学院名 19 | @TableField("institute_number") 20 | private String instituteNumber; //学院编码 21 | @TableField(exist = false) 22 | private String[] ids; //id集合 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/LoginLog.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/15 13 | * @Description: 登录日志 14 | */ 15 | @Data 16 | @TableName("t_login_log") 17 | public class LoginLog implements Serializable{ 18 | private String id; 19 | @TableField("user_id") 20 | private String userId; //用户id 21 | @TableField("login_time") 22 | private Date loginTime; //登录时间 23 | @TableField("login_ip") 24 | private String loginIp; //登录IP 25 | @TableField("login_total") 26 | private Integer loginTotal; //登录次数 27 | @TableField(exist = false) 28 | private String username; //用户名 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Major.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 专业 13 | */ 14 | @Data 15 | @TableName("t_major") 16 | public class Major implements Serializable{ 17 | private String id; 18 | private String name; //专业名称 19 | @TableField("major_number") 20 | private String majorNumber; //专业编码 21 | @TableField("institute_id") 22 | private String instituteId; //学院id 23 | @TableField(exist = false) 24 | private String instituteName; //所属学院名称 25 | @TableField(exist = false) 26 | private String[] ids; //id集合 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/OperateRecord.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/15 13 | * @Description: 操作记录 14 | */ 15 | @Data 16 | @TableName("t_operate_record") 17 | public class OperateRecord implements Serializable{ 18 | private String id; 19 | @TableField("request_url") 20 | private String requestUrl; //请求url 21 | @TableField("remote_addr") 22 | private String remoteAddr; //请求IP 23 | private String params; //请求参数 24 | private String method; //请求方法 25 | @TableField("create_time") 26 | private Date createTime; //请求时间 27 | @TableField("user_id") 28 | private String userId; //用户id 29 | @TableField("is_success") 30 | private Integer isSuccess; //请求是否成功 31 | @TableField(exist = false) 32 | private String permName; //请求url 33 | @TableField(exist = false) 34 | private String username; //用户名 35 | @TableField(exist = false) 36 | private Integer total; //请求次数 37 | @TableField(exist = false) 38 | private Integer type; //请求类型 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Perms.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/15 13 | * @Description: 权限 14 | */ 15 | @Data 16 | @TableName("t_perms") 17 | public class Perms implements Serializable{ 18 | private String id; 19 | private String name; //权限名 20 | private String url; //权限地址 21 | @TableField("parent_id") 22 | private String parentId; //父权限id 23 | private Integer type; //权限类型 24 | private Integer sort; //权限排序号 25 | @TableField(exist = false) 26 | private List children; //子权限 27 | @TableField(exist = false) 28 | private String lastPermis; //上级菜单名称 29 | @TableField(exist = false) 30 | private String[] ids; //要删除的权限id 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/QuestionChoic.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 选择题库,question_type2单选,3多选(QuestionChoic)实体类 7 | * 8 | * @author makejava 9 | * @since 2020-02-15 16:56:47 10 | */ 11 | public class QuestionChoic implements Serializable { 12 | private static final long serialVersionUID = 234837659066006261L; 13 | /** 14 | * id 15 | */ 16 | private String id; 17 | /** 18 | * 题目创建人ID 19 | */ 20 | private String createId; 21 | /** 22 | * 题目创建时间 23 | */ 24 | private Object createTime; 25 | /** 26 | * 题目更新人ID 27 | */ 28 | private String updateId; 29 | /** 30 | * 题目更新时间 31 | */ 32 | private Object updateTime; 33 | /** 34 | * 题目内容 35 | */ 36 | private String questionContent; 37 | /** 38 | * 选项A 39 | */ 40 | private String choiceA; 41 | /** 42 | * 选项B 43 | */ 44 | private String choiceB; 45 | /** 46 | * 选项C 47 | */ 48 | private String choiceC; 49 | /** 50 | * 选项D 51 | */ 52 | private String choiceD; 53 | /** 54 | * 题目答案 55 | */ 56 | private String questionAnswer; 57 | /** 58 | * 题目解析 59 | */ 60 | private String questionExplain; 61 | /** 62 | * 题目分数 63 | */ 64 | private String questionScore; 65 | /** 66 | * 题目难度等级 67 | */ 68 | private String questionLevel; 69 | /** 70 | * 题目所属科目 71 | */ 72 | private String questionSubject; 73 | /** 74 | * 题目类型:2单选,3多选 75 | */ 76 | private Integer questionType; 77 | 78 | 79 | public String getId() { 80 | return id; 81 | } 82 | 83 | public void setId(String id) { 84 | this.id = id; 85 | } 86 | 87 | public String getCreateId() { 88 | return createId; 89 | } 90 | 91 | public void setCreateId(String createId) { 92 | this.createId = createId; 93 | } 94 | 95 | public Object getCreateTime() { 96 | return createTime; 97 | } 98 | 99 | public void setCreateTime(Object createTime) { 100 | this.createTime = createTime; 101 | } 102 | 103 | public String getUpdateId() { 104 | return updateId; 105 | } 106 | 107 | public void setUpdateId(String updateId) { 108 | this.updateId = updateId; 109 | } 110 | 111 | public Object getUpdateTime() { 112 | return updateTime; 113 | } 114 | 115 | public void setUpdateTime(Object updateTime) { 116 | this.updateTime = updateTime; 117 | } 118 | 119 | public String getQuestionContent() { 120 | return questionContent; 121 | } 122 | 123 | public void setQuestionContent(String questionContent) { 124 | this.questionContent = questionContent; 125 | } 126 | 127 | public String getChoiceA() { 128 | return choiceA; 129 | } 130 | 131 | public void setChoiceA(String choiceA) { 132 | this.choiceA = choiceA; 133 | } 134 | 135 | public String getChoiceB() { 136 | return choiceB; 137 | } 138 | 139 | public void setChoiceB(String choiceB) { 140 | this.choiceB = choiceB; 141 | } 142 | 143 | public String getChoiceC() { 144 | return choiceC; 145 | } 146 | 147 | public void setChoiceC(String choiceC) { 148 | this.choiceC = choiceC; 149 | } 150 | 151 | public String getChoiceD() { 152 | return choiceD; 153 | } 154 | 155 | public void setChoiceD(String choiceD) { 156 | this.choiceD = choiceD; 157 | } 158 | 159 | public String getQuestionAnswer() { 160 | return questionAnswer; 161 | } 162 | 163 | public void setQuestionAnswer(String questionAnswer) { 164 | this.questionAnswer = questionAnswer; 165 | } 166 | 167 | public String getQuestionExplain() { 168 | return questionExplain; 169 | } 170 | 171 | public void setQuestionExplain(String questionExplain) { 172 | this.questionExplain = questionExplain; 173 | } 174 | 175 | public String getQuestionScore() { 176 | return questionScore; 177 | } 178 | 179 | public void setQuestionScore(String questionScore) { 180 | this.questionScore = questionScore; 181 | } 182 | 183 | public String getQuestionLevel() { 184 | return questionLevel; 185 | } 186 | 187 | public void setQuestionLevel(String questionLevel) { 188 | this.questionLevel = questionLevel; 189 | } 190 | 191 | public String getQuestionSubject() { 192 | return questionSubject; 193 | } 194 | 195 | public void setQuestionSubject(String questionSubject) { 196 | this.questionSubject = questionSubject; 197 | } 198 | 199 | public Integer getQuestionType() { 200 | return questionType; 201 | } 202 | 203 | public void setQuestionType(Integer questionType) { 204 | this.questionType = questionType; 205 | } 206 | 207 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/QuestionExam.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 考试安排(QuestionExam)实体类 7 | * 8 | * @author makejava 9 | * @since 2020-02-15 16:56:56 10 | */ 11 | public class QuestionExam implements Serializable { 12 | private static final long serialVersionUID = 594854847476890487L; 13 | /** 14 | * id 15 | */ 16 | private String id; 17 | /** 18 | * 考试介绍 19 | */ 20 | private String examDesc; 21 | /** 22 | * 课程名称 23 | */ 24 | private String examCourse; 25 | /** 26 | * 试卷ID 27 | */ 28 | private String paperId; 29 | /** 30 | * 考试日期 31 | */ 32 | private Object examDate; 33 | /** 34 | * 考试时长 35 | */ 36 | private Integer totalTime; 37 | /** 38 | * 专业 39 | */ 40 | private String major; 41 | /** 42 | * 学院 43 | */ 44 | private String institute; 45 | /** 46 | * 总分 47 | */ 48 | private Integer totalScore; 49 | /** 50 | * 考试类型 51 | */ 52 | private String examType; 53 | 54 | 55 | private String[] ids; 56 | 57 | public String[] getIds() { 58 | return ids; 59 | } 60 | 61 | public void setIds(String[] ids) { 62 | this.ids = ids; 63 | } 64 | 65 | public String getId() { 66 | return id; 67 | } 68 | 69 | public void setId(String id) { 70 | this.id = id; 71 | } 72 | 73 | public String getExamDesc() { 74 | return examDesc; 75 | } 76 | 77 | public void setExamDesc(String examDesc) { 78 | this.examDesc = examDesc; 79 | } 80 | 81 | public String getExamCourse() { 82 | return examCourse; 83 | } 84 | 85 | public void setExamCourse(String examCourse) { 86 | this.examCourse = examCourse; 87 | } 88 | 89 | public String getPaperId() { 90 | return paperId; 91 | } 92 | 93 | public void setPaperId(String paperId) { 94 | this.paperId = paperId; 95 | } 96 | 97 | public Object getExamDate() { 98 | return examDate; 99 | } 100 | 101 | public void setExamDate(Object examDate) { 102 | this.examDate = examDate; 103 | } 104 | 105 | public Integer getTotalTime() { 106 | return totalTime; 107 | } 108 | 109 | public void setTotalTime(Integer totalTime) { 110 | this.totalTime = totalTime; 111 | } 112 | 113 | public String getMajor() { 114 | return major; 115 | } 116 | 117 | public void setMajor(String major) { 118 | this.major = major; 119 | } 120 | 121 | public String getInstitute() { 122 | return institute; 123 | } 124 | 125 | public void setInstitute(String institute) { 126 | this.institute = institute; 127 | } 128 | 129 | public Integer getTotalScore() { 130 | return totalScore; 131 | } 132 | 133 | public void setTotalScore(Integer totalScore) { 134 | this.totalScore = totalScore; 135 | } 136 | 137 | public String getExamType() { 138 | return examType; 139 | } 140 | 141 | public void setExamType(String examType) { 142 | this.examType = examType; 143 | } 144 | 145 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/QuestionExamRecord.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 考试记录表(QuestionExamRecord)实体类 7 | * 8 | * @author makejava 9 | * @since 2020-02-15 16:56:57 10 | */ 11 | public class QuestionExamRecord implements Serializable { 12 | private static final long serialVersionUID = -99076139299360705L; 13 | /** 14 | * 考试记录表的主键 15 | */ 16 | private String id; 17 | /** 18 | * 考试安排ID 19 | */ 20 | private String examId; 21 | /** 22 | * 考试参与者的用户id 23 | */ 24 | private String joinId; 25 | /** 26 | * 参加考试的时间 27 | */ 28 | private Object joinDate; 29 | /** 30 | * 完成考试所用的时间,单位分钟 31 | */ 32 | private Integer joinTimeCost; 33 | /** 34 | * 参与考试的实际得分 35 | */ 36 | private Integer joinScore; 37 | /** 38 | * 考试结果的等级 39 | */ 40 | private Integer joinResultLevel; 41 | /** 42 | * 考生填空题答案 43 | */ 44 | private String joinAnswerFill; 45 | /** 46 | * 考生判断题答案 47 | */ 48 | private String joinAnswerJudge; 49 | /** 50 | * 考生单选题答案 51 | */ 52 | private String joinAnswerSingle; 53 | /** 54 | * 考生多选题答案 55 | */ 56 | private String joinAnswerMultiple; 57 | 58 | public String getId() { 59 | return id; 60 | } 61 | 62 | public void setId(String id) { 63 | this.id = id; 64 | } 65 | 66 | public String getExamId() { 67 | return examId; 68 | } 69 | 70 | public void setExamId(String examId) { 71 | this.examId = examId; 72 | } 73 | 74 | public String getJoinId() { 75 | return joinId; 76 | } 77 | 78 | public void setJoinId(String joinId) { 79 | this.joinId = joinId; 80 | } 81 | 82 | public Object getJoinDate() { 83 | return joinDate; 84 | } 85 | 86 | public void setJoinDate(Object joinDate) { 87 | this.joinDate = joinDate; 88 | } 89 | 90 | public Integer getJoinTimeCost() { 91 | return joinTimeCost; 92 | } 93 | 94 | public void setJoinTimeCost(Integer joinTimeCost) { 95 | this.joinTimeCost = joinTimeCost; 96 | } 97 | 98 | public Integer getJoinScore() { 99 | return joinScore; 100 | } 101 | 102 | public void setJoinScore(Integer joinScore) { 103 | this.joinScore = joinScore; 104 | } 105 | 106 | public Integer getJoinResultLevel() { 107 | return joinResultLevel; 108 | } 109 | 110 | public void setJoinResultLevel(Integer joinResultLevel) { 111 | this.joinResultLevel = joinResultLevel; 112 | } 113 | 114 | public String getJoinAnswerFill() { 115 | return joinAnswerFill; 116 | } 117 | 118 | public void setJoinAnswerFill(String joinAnswerFill) { 119 | this.joinAnswerFill = joinAnswerFill; 120 | } 121 | 122 | public String getJoinAnswerJudge() { 123 | return joinAnswerJudge; 124 | } 125 | 126 | public void setJoinAnswerJudge(String joinAnswerJudge) { 127 | this.joinAnswerJudge = joinAnswerJudge; 128 | } 129 | 130 | public String getJoinAnswerSingle() { 131 | return joinAnswerSingle; 132 | } 133 | 134 | public void setJoinAnswerSingle(String joinAnswerSingle) { 135 | this.joinAnswerSingle = joinAnswerSingle; 136 | } 137 | 138 | public String getJoinAnswerMultiple() { 139 | return joinAnswerMultiple; 140 | } 141 | 142 | public void setJoinAnswerMultiple(String joinAnswerMultiple) { 143 | this.joinAnswerMultiple = joinAnswerMultiple; 144 | } 145 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/QuestionFillJudge.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 填空题和判断题库,question_type,0填空1判断(QuestionFillJudge)实体类 7 | * 8 | * @author makejava 9 | * @since 2020-02-15 16:56:56 10 | */ 11 | public class QuestionFillJudge implements Serializable { 12 | private static final long serialVersionUID = -29280519836422018L; 13 | /** 14 | * 填空题id 15 | */ 16 | private String id; 17 | /** 18 | * 题目创建人ID 19 | */ 20 | private String createId; 21 | /** 22 | * 题目创建时间 23 | */ 24 | private Object createTime; 25 | /** 26 | * 题目更新人ID 27 | */ 28 | private String updateId; 29 | /** 30 | * 题目更新时间 31 | */ 32 | private Object updateTime; 33 | /** 34 | * 题目内容 35 | */ 36 | private String questionContent; 37 | /** 38 | * 题目答案 39 | */ 40 | private String questionAnswer; 41 | /** 42 | * 题目解析 43 | */ 44 | private String questionExplain; 45 | /** 46 | * 题目分数 47 | */ 48 | private String questionScore; 49 | /** 50 | * 题目难度等级 51 | */ 52 | private String questionLevel; 53 | /** 54 | * 题目所属科目 55 | */ 56 | private String questionSubject; 57 | /** 58 | * 题目类型:0填空题,1判断题 59 | */ 60 | private Integer questionType; 61 | 62 | 63 | public String getId() { 64 | return id; 65 | } 66 | 67 | public void setId(String id) { 68 | this.id = id; 69 | } 70 | 71 | public String getCreateId() { 72 | return createId; 73 | } 74 | 75 | public void setCreateId(String createId) { 76 | this.createId = createId; 77 | } 78 | 79 | public Object getCreateTime() { 80 | return createTime; 81 | } 82 | 83 | public void setCreateTime(Object createTime) { 84 | this.createTime = createTime; 85 | } 86 | 87 | public String getUpdateId() { 88 | return updateId; 89 | } 90 | 91 | public void setUpdateId(String updateId) { 92 | this.updateId = updateId; 93 | } 94 | 95 | public Object getUpdateTime() { 96 | return updateTime; 97 | } 98 | 99 | public void setUpdateTime(Object updateTime) { 100 | this.updateTime = updateTime; 101 | } 102 | 103 | public String getQuestionContent() { 104 | return questionContent; 105 | } 106 | 107 | public void setQuestionContent(String questionContent) { 108 | this.questionContent = questionContent; 109 | } 110 | 111 | public String getQuestionAnswer() { 112 | return questionAnswer; 113 | } 114 | 115 | public void setQuestionAnswer(String questionAnswer) { 116 | this.questionAnswer = questionAnswer; 117 | } 118 | 119 | public String getQuestionExplain() { 120 | return questionExplain; 121 | } 122 | 123 | public void setQuestionExplain(String questionExplain) { 124 | this.questionExplain = questionExplain; 125 | } 126 | 127 | public String getQuestionScore() { 128 | return questionScore; 129 | } 130 | 131 | public void setQuestionScore(String questionScore) { 132 | this.questionScore = questionScore; 133 | } 134 | 135 | public String getQuestionLevel() { 136 | return questionLevel; 137 | } 138 | 139 | public void setQuestionLevel(String questionLevel) { 140 | this.questionLevel = questionLevel; 141 | } 142 | 143 | public String getQuestionSubject() { 144 | return questionSubject; 145 | } 146 | 147 | public void setQuestionSubject(String questionSubject) { 148 | this.questionSubject = questionSubject; 149 | } 150 | 151 | public Integer getQuestionType() { 152 | return questionType; 153 | } 154 | 155 | public void setQuestionType(Integer questionType) { 156 | this.questionType = questionType; 157 | } 158 | 159 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/QuestionPaper.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 试卷(QuestionPaper)实体类 7 | * 8 | * @author makejava 9 | * @since 2020-02-15 16:56:56 10 | */ 11 | public class QuestionPaper implements Serializable { 12 | private static final long serialVersionUID = -93130706258837099L; 13 | /** 14 | * id 15 | */ 16 | private String id; 17 | /** 18 | * 试卷ID 19 | */ 20 | private String paperId; 21 | /** 22 | * 题目ID 23 | */ 24 | private String questionId; 25 | 26 | 27 | public String getId() { 28 | return id; 29 | } 30 | 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | 35 | public String getPaperId() { 36 | return paperId; 37 | } 38 | 39 | public void setPaperId(String paperId) { 40 | this.paperId = paperId; 41 | } 42 | 43 | public String getQuestionId() { 44 | return questionId; 45 | } 46 | 47 | public void setQuestionId(String questionId) { 48 | this.questionId = questionId; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Role.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 角色 13 | */ 14 | @Data 15 | @TableName("t_role") 16 | public class Role implements Serializable{ 17 | private String id; 18 | private String name; //角色名称 19 | @TableField("role_desc") 20 | private String roleDesc; //角色描述 21 | @TableField(exist = false) 22 | private String[] ids; //要删除的角色id 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/RolePerms.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 角色-权限 13 | */ 14 | @Data 15 | @TableName("t_role_perms") 16 | public class RolePerms implements Serializable{ 17 | private String id; 18 | @TableField("role_id") 19 | private String roleId; //角色id 20 | @TableField("perms_id") 21 | private String permsId; //权限id 22 | @TableField(exist = false) 23 | private String[] permsIds; //某个角色的全部权限 24 | 25 | private String[] ids; // 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Student.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 学生实体 13 | */ 14 | @Data 15 | @TableName("t_student") 16 | public class Student implements Serializable{ 17 | private String id; 18 | private String name; //学生姓名 19 | @TableField("student_number") 20 | private String studentNumber; //学号 21 | private Integer age; //年龄 22 | private Integer sex; //性别 23 | private String phone; //联系电话 24 | @TableField("photo_url") 25 | private String photoUrl; //头像地址 26 | private String email; //邮箱 27 | @TableField("clazz_id") 28 | private String clazzId; //班级id 29 | @TableField("major_id") 30 | private String majorId; //专业id 31 | @TableField("institute_id") 32 | private String instituteId; //学院id 33 | @TableField(exist = false) 34 | private String clazzName; //班级名称 35 | @TableField(exist = false) 36 | private String majorName; //专业名称 37 | @TableField(exist = false) 38 | private String instituteName; //学院名称 39 | @TableField(exist = false) 40 | private String[] ids; //id集合 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/StudentCourse.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 学生-课程 13 | */ 14 | @Data 15 | @TableName("t_student_course") 16 | public class StudentCourse implements Serializable{ 17 | private String id; 18 | @TableField("student_id") 19 | private String studentId; //学生id 20 | @TableField("course_id") 21 | private String courseId; //课程id 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/SysDict.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 字典 13 | */ 14 | @Data 15 | @TableName("t_sys_dict") 16 | public class SysDict implements Serializable{ 17 | private String id; 18 | @TableField("dict_code") 19 | private String dictCode; //字典编码 20 | @TableField("dict_value") 21 | private String dictValue; //字典值 22 | @TableField("dict_type_code") 23 | private String dictTypeCode; //字典分类编码 24 | @TableField("dict_desc") 25 | private String dictDesc; //字典描述 26 | @TableField("dict_order") 27 | private Integer dictOrder; //字典拍序号 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 老师 13 | */ 14 | @Data 15 | @TableName("t_teacher") 16 | public class Teacher implements Serializable{ 17 | private String id; 18 | private String name; //老师姓名 19 | private Integer age; //年龄 20 | private Integer sex; //年龄 21 | private String title; //职称id 22 | private String email; //邮箱 23 | private String phone; //电话 24 | @TableField("photo_url") 25 | private String photoUrl; //头像地址 26 | @TableField(exist = false) 27 | private String titleName; //职称名称 28 | @TableField(exist = false) 29 | private String[] ids; //id集合 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * @Auther: qiuxinfa 13 | * @Date: 2019/11/15 14 | * @Description: 用户实体 15 | */ 16 | @Data 17 | @TableName("t_user") 18 | public class User implements Serializable{ 19 | private String id; 20 | private String username; //用户名 21 | private String password; //密码 22 | private String email; //邮箱 23 | @TableField("photo_url") 24 | private String photoUrl; //头像地址 25 | private Integer enable; //是否可用 26 | @TableField("create_time") 27 | private Date createTime; //创建时间 28 | @TableField("last_login_time") 29 | private Date lastLoginTime; //最近一次登录时间 30 | @TableField(exist = false) 31 | private String roleId; //角色id 32 | @TableField(exist = false) 33 | private String roleName; //角色名称 34 | @TableField(exist = false) 35 | private List userPerms; //用户拥有的权限 36 | @TableField(exist = false) 37 | private String[] ids; //批量删除用户的id 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/pojo/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.qxf.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/15 12 | * @Description: 用户-角色 13 | */ 14 | @Data 15 | @TableName("t_user_role") 16 | public class UserRole implements Serializable{ 17 | private String id; 18 | @TableField("user_id") 19 | private String userId; //用户id 20 | @TableField("role_id") 21 | private String roleId; //角色id 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/ClazzService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Clazz; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/24 12 | * @Description: com.qxf.service 13 | */ 14 | public interface ClazzService extends IService{ 15 | List getListByPage(Page page,String name); 16 | public Object addClazz(Clazz clazz); 17 | 18 | List getAllClazz(String majorId); 19 | 20 | Object deleteClazz(String[] ids); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/CourseService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Course; 6 | 7 | import java.text.ParseException; 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/24 13 | * @Description: com.qxf.service 14 | */ 15 | public interface CourseService extends IService{ 16 | List getListByPage(Page page, String name); 17 | 18 | Object addCourse(Course course) throws ParseException; 19 | 20 | Object deleteCourse(String[] ids); 21 | 22 | List getNotSelectedCourse(Page page, String studentId); 23 | 24 | List getSelectedCourse(Page page, String studentId); 25 | 26 | Object addCourseToStudent(Course course); 27 | 28 | List getCourseByTeacher(Page page,String teacherId); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/CourseTeacherService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.qxf.pojo.CourseTeacher; 5 | 6 | /** 7 | * @Auther: qiuxinfa 8 | * @Date: 2019/11/25 9 | * @Description: com.qxf.service 10 | */ 11 | public interface CourseTeacherService extends IService{ 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/DictService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.SysDict; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/23 12 | * @Description: com.qxf.service 13 | */ 14 | public interface DictService extends IService{ 15 | List findDictByPage(Page page, SysDict dict); 16 | 17 | List findListByDictTypeCode(String dictTypeCode); 18 | 19 | Object addDict(SysDict dict); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/GradeService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Grade; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/26 12 | * @Description: com.qxf.service 13 | */ 14 | public interface GradeService extends IService{ 15 | List viewStudent(Page page, String id); 16 | Object updateScore(Grade grade); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/InstituteService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Institute; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/24 12 | * @Description: com.qxf.service 13 | */ 14 | public interface InstituteService extends IService{ 15 | List getInstituteByPage(Page page, String name); 16 | 17 | public Object addInstitute(Institute institute); 18 | 19 | public List findAllInstitute(); 20 | 21 | Object deleteInstitute(String[] ids); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/LoginLogService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.LoginLog; 6 | 7 | import java.util.List; 8 | 9 | public interface LoginLogService extends IService { 10 | 11 | /** 12 | * 查询登录次数 13 | */ 14 | Integer findMaxLoginTatalByUserId(String userId); 15 | 16 | 17 | /** 18 | * 用户登录日志 19 | */ 20 | List findUserLoginLogByPage(Page page, String searchKeyWord); 21 | 22 | /** 23 | * 统计登陆 24 | */ 25 | Object findUserLoginTotal(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/MajorService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Major; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/24 12 | * @Description: com.qxf.service 13 | */ 14 | public interface MajorService extends IService{ 15 | public List getListByPage(Page page, String name); 16 | 17 | public Object addMajor(Major major); 18 | 19 | public Object deleteMajor(String[] ids); 20 | 21 | public List findAllMajor(String instituteId); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/OperateRecordService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.OperateRecord; 6 | 7 | 8 | import java.util.List; 9 | 10 | public interface OperateRecordService extends IService { 11 | 12 | /** 13 | * 查询操作记录 14 | */ 15 | List findOperatingRecordByPage(Page page, String searchKeyWord); 16 | 17 | /** 18 | * 访问统计 19 | */ 20 | Object findUserReqTotal(); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/PermsService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Perms; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * @Auther: qiuxinfa 12 | * @Date: 2019/11/16 13 | * @Description: com.qxf.service 14 | */ 15 | public interface PermsService extends IService { 16 | List loadUserResources(Map map); 17 | /** 18 | * @desc: 查询菜单 19 | */ 20 | List findPermissionByPage(Page page, String permsName); 21 | 22 | /** 23 | * @desc: 新增菜单 24 | */ 25 | Object addPermissions(Perms vo); 26 | 27 | /** 28 | * @desc: 删除菜单 29 | */ 30 | Object delPermis(String[] ids); 31 | 32 | /** 33 | * @desc: 根据菜单查询菜单 34 | */ 35 | List findPermissionByName(String name); 36 | 37 | /** 38 | * @desc: 根据父级id查询上级菜单 39 | */ 40 | List findLastPermissionByType(String type); 41 | 42 | /** 43 | * @desc: 查询所有父级菜单绑定树形 44 | */ 45 | List findBasePermission(); 46 | 47 | /** 48 | * 根据url查询记录 49 | */ 50 | Integer findCountByUrl(String requestUrl); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/QuestionChoicService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.qxf.pojo.QuestionChoic; 4 | import java.util.List; 5 | 6 | /** 7 | * 选择题库,question_type2单选,3多选(QuestionChoic)表服务接口 8 | * 9 | * @author makejava 10 | * @since 2020-02-15 16:56:52 11 | */ 12 | public interface QuestionChoicService { 13 | 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/QuestionExamRecordService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.qxf.pojo.QuestionExamRecord; 4 | import java.util.List; 5 | 6 | /** 7 | * 考试记录表(QuestionExamRecord)表服务接口 8 | * 9 | * @author makejava 10 | * @since 2020-02-15 16:56:57 11 | */ 12 | public interface QuestionExamRecordService { 13 | Object add(QuestionExamRecord questionExamRecord); 14 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/QuestionExamService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.QuestionExam; 6 | import java.util.List; 7 | 8 | /** 9 | * 考试安排(QuestionExam)表服务接口 10 | * 11 | * @author makejava 12 | * @since 2020-02-15 16:56:56 13 | */ 14 | public interface QuestionExamService extends IService{ 15 | 16 | List getListByPage(Page page, String name); 17 | 18 | QuestionExam getExamById(String id); 19 | 20 | Object add(QuestionExam exam); 21 | 22 | Object delete(String[] ids); 23 | 24 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/QuestionFillJudgeService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.qxf.pojo.QuestionFillJudge; 4 | import java.util.List; 5 | 6 | /** 7 | * 填空题和判断题库,question_type,0填空1判断(QuestionFillJudge)表服务接口 8 | * 9 | * @author makejava 10 | * @since 2020-02-15 16:56:56 11 | */ 12 | public interface QuestionFillJudgeService { 13 | 14 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/QuestionPaperService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.qxf.pojo.ExamVo; 5 | import com.qxf.pojo.QuestionPaper; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * 试卷(QuestionPaper)表服务接口 11 | * 12 | * @author makejava 13 | * @since 2020-02-15 16:56:56 14 | */ 15 | public interface QuestionPaperService{ 16 | 17 | Map> getPaperById(String paperId); 18 | 19 | Object add(ExamVo exam); 20 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/RolePermsService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.qxf.pojo.Perms; 5 | import com.qxf.pojo.RolePerms; 6 | 7 | import java.util.List; 8 | 9 | public interface RolePermsService extends IService { 10 | 11 | /** 12 | * 添加角色权限 13 | */ 14 | Object addRolesPermis(RolePerms vo); 15 | 16 | /** 17 | * 根据角色查询角色权限 18 | */ 19 | List findRolesPermisByRole(String roleId); 20 | 21 | /** 22 | * 根据角色id查询记录数 23 | */ 24 | Integer findCountByRole(String roleId, String url); 25 | 26 | /** 27 | * 根据父id\用户类型查询角色菜单 28 | */ 29 | List findRolesPermisByFatherId(String fatherId, String roleId); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Role; 6 | 7 | import java.util.List; 8 | 9 | public interface RoleService extends IService { 10 | 11 | /** 12 | * @desc: 查询角色 13 | */ 14 | List findRoleByPage(Page page, String roleName); 15 | 16 | /** 17 | * @desc: 新增角色 18 | */ 19 | Object addRoles(Role vo); 20 | 21 | /** 22 | * @desc: 删除角色 23 | */ 24 | Object delRole(String[] ids); 25 | 26 | /** 27 | * 绑定角色下拉框 28 | */ 29 | List findAllRoles(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Student; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/24 12 | * @Description: com.qxf.service 13 | */ 14 | public interface StudentService extends IService{ 15 | List getListByPage(Page page, String name); 16 | Object addStudent(Student student); 17 | Integer getStudentCount(String majorId); 18 | Object deleteStudent(String[] ids); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.Teacher; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/24 12 | * @Description: com.qxf.service 13 | */ 14 | public interface TeacherService extends IService{ 15 | List getListByPage(Page page,String name); 16 | Object addTeacher(Teacher teacher); 17 | List findAllTeacher(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/UserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.qxf.pojo.UserRole; 5 | 6 | 7 | public interface UserRoleService extends IService { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.qxf.pojo.User; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpSession; 9 | import java.util.List; 10 | 11 | /** 12 | * @Auther: qiuxinfa 13 | * @Date: 2019/11/15 14 | * @Description: com.qxf.service 15 | */ 16 | public interface UserService extends IService{ 17 | 18 | //不分页查询 19 | List findAllUser(User user); 20 | 21 | /** 22 | * 根据用户名查询用户 23 | */ 24 | User findUserByUsername(String username); 25 | 26 | /** 27 | * 登录 28 | */ 29 | Object login(User user, HttpSession session, HttpServletRequest request); 30 | 31 | /** 32 | * @desc: 新增用户 33 | */ 34 | Object addUser(User user); 35 | 36 | 37 | /** 38 | * @desc: 查询用户 39 | */ 40 | List findUserByPage(Page page, User user); 41 | 42 | /** 43 | * @desc: 批量删除用户 44 | */ 45 | Object delUsers(String[] ids); 46 | 47 | /** 48 | * @desc: 登陆验证 49 | */ 50 | List checkUser(User user); 51 | 52 | /** 53 | * 修改用户状态 54 | */ 55 | Object editUserStatus(User user); 56 | 57 | /** 58 | * 用户修改用户个人信息 59 | */ 60 | Object editUserInfo(User user); 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/ClazzServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.ClazzMapper; 7 | import com.qxf.pojo.Clazz; 8 | import com.qxf.pojo.Student; 9 | import com.qxf.service.ClazzService; 10 | import com.qxf.service.StudentService; 11 | import com.qxf.utils.EnumCode; 12 | import com.qxf.utils.ResultUtil; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.transaction.annotation.Propagation; 16 | import org.springframework.transaction.annotation.Transactional; 17 | 18 | import java.util.HashMap; 19 | import java.util.List; 20 | import java.util.Map; 21 | 22 | /** 23 | * @Auther: qiuxinfa 24 | * @Date: 2019/11/24 25 | * @Description: com.qxf.service.impl 26 | */ 27 | @Service 28 | public class ClazzServiceImpl extends ServiceImpl implements ClazzService { 29 | @Autowired 30 | private StudentService studentService; 31 | 32 | @Override 33 | public List getListByPage(Page page, String name) { 34 | return super.baseMapper.getListByPage(page,name); 35 | } 36 | 37 | @Override 38 | public Object addClazz(Clazz clazz) { 39 | Map map = new HashMap<>(); 40 | map.put("name",clazz.getName().trim()); 41 | map.put("major_id",clazz.getMajorId().trim()); 42 | map.put("institute_id",clazz.getInstituteId()); 43 | List list = super.selectByMap(map); 44 | if(list != null && list.size()>0){ 45 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "该班级已存在", null)); 46 | } 47 | super.baseMapper.insert(clazz); 48 | return ResultUtil.result(EnumCode.OK.getValue(),"新增成功"); 49 | } 50 | 51 | @Override 52 | public List getAllClazz(String majorId) { 53 | return super.baseMapper.getAllClazz(majorId); 54 | } 55 | 56 | @Override 57 | public Object deleteClazz(String[] ids) { 58 | Map map; 59 | for (String id : ids) { 60 | //根据班级查询学生,如果有学生则不能删除 61 | map = new HashMap<>(); 62 | map.put("clazz_id",id); 63 | List list = studentService.selectByMap(map); 64 | if(list != null && list.size()>0){ 65 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "选择的班级中有学生存在,删除失败",null); 66 | } 67 | } 68 | //逐个删除 69 | for (String id : ids){ 70 | baseMapper.deleteById(id); 71 | } 72 | 73 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/CourseServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.CourseMapper; 7 | import com.qxf.pojo.Course; 8 | import com.qxf.pojo.CourseTeacher; 9 | import com.qxf.pojo.Grade; 10 | import com.qxf.pojo.User; 11 | import com.qxf.service.CourseService; 12 | import com.qxf.service.CourseTeacherService; 13 | import com.qxf.service.GradeService; 14 | import com.qxf.utils.EnumCode; 15 | import com.qxf.utils.ResultUtil; 16 | import org.apache.shiro.SecurityUtils; 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.stereotype.Service; 19 | import org.springframework.transaction.annotation.Transactional; 20 | 21 | import java.text.ParseException; 22 | import java.text.SimpleDateFormat; 23 | import java.util.*; 24 | 25 | /** 26 | * @Auther: qiuxinfa 27 | * @Date: 2019/11/24 28 | * @Description: com.qxf.service.impl 29 | */ 30 | @Service 31 | public class CourseServiceImpl extends ServiceImpl implements CourseService { 32 | @Autowired 33 | private CourseTeacherService courseTeacherService; 34 | 35 | @Autowired 36 | private GradeService gradeService; 37 | 38 | @Override 39 | public List getListByPage(Page page, String name) { 40 | return super.baseMapper.getListByPage(page,name); 41 | } 42 | 43 | @Transactional 44 | @Override 45 | public Object addCourse(Course course) throws ParseException { 46 | Map map = new HashMap<>(); 47 | map.put("name",course.getName().trim()); 48 | map.put("course_type",course.getCourseType()); 49 | List list = selectByMap(map); 50 | if(list != null && list.size()>0){ 51 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "该课程已存在", null)); 52 | } 53 | 54 | super.baseMapper.insert(course); 55 | 56 | //插入t_course_teacher中间表,一门课程可以有多个任课老师 57 | String[] teacherIds = course.getTeacherIds(); 58 | if(teacherIds!=null && teacherIds.length>0){ 59 | for (int i=0;i map; 72 | for (String id : ids) { 73 | //根据课程查询选课情况,如果有学生选择了该课程,则不能删除 74 | map = new HashMap<>(); 75 | map.put("course_id",id); 76 | List list = gradeService.selectByMap(map); 77 | if(list != null && list.size()>0){ 78 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "有学生选择了其中的课程,删除失败",null); 79 | } 80 | } 81 | //逐个删除 82 | for (String id : ids){ 83 | baseMapper.deleteById(id); 84 | } 85 | 86 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 87 | } 88 | 89 | @Override 90 | public List getNotSelectedCourse(Page page, String studentId) { 91 | 92 | return super.baseMapper.getNotSelectedCourse(page,studentId); 93 | } 94 | 95 | @Override 96 | public List getSelectedCourse(Page page, String studentId) { 97 | return super.baseMapper.getSelectedCourse(page,studentId); 98 | } 99 | 100 | @Transactional 101 | @Override 102 | public Object addCourseToStudent(Course course) { 103 | String studentId = ((User) SecurityUtils.getSubject().getPrincipal()).getId(); //学生id 104 | String[] ctIds = course.getIds(); //课程-老师中间表的id 105 | Map map = new HashMap<>(); 106 | List list = new ArrayList<>(); 107 | //判断是否选择了一门课程的两个以上老师的课 108 | if(ctIds != null && ctIds.length>0){ 109 | for (int i=0;i0){ 121 | for (CourseTeacher ct: list){ 122 | Grade grade = new Grade(); 123 | grade.setStudentId(studentId); 124 | grade.setCourseId(ct.getCourseId()); 125 | grade.setTeacherId(ct.getTeacherId()); 126 | grade.setStatus(0); 127 | gradeService.insert(grade); 128 | } 129 | } 130 | return ResultUtil.result(EnumCode.OK.getValue(),"添加成功"); 131 | } 132 | 133 | @Override 134 | public List getCourseByTeacher(Page page, String teacherId) { 135 | return super.baseMapper.getCourseByTeacher(page,teacherId); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/CourseTeacherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.qxf.mapper.CourseTeacherMapper; 5 | import com.qxf.pojo.CourseTeacher; 6 | import com.qxf.service.CourseTeacherService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @Auther: qiuxinfa 11 | * @Date: 2019/11/25 12 | * @Description: com.qxf.service.impl 13 | */ 14 | @Service 15 | public class CourseTeacherServiceImpl extends ServiceImpl implements CourseTeacherService { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/DictServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.DictMapper; 7 | import com.qxf.pojo.SysDict; 8 | import com.qxf.service.DictService; 9 | import com.qxf.utils.EnumCode; 10 | import com.qxf.utils.ResultUtil; 11 | import com.xiaoleilu.hutool.crypto.SecureUtil; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.Date; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | 20 | /** 21 | * @Auther: qiuxinfa 22 | * @Date: 2019/11/23 23 | * @Description: com.qxf.service.impl 24 | */ 25 | @Service 26 | public class DictServiceImpl extends ServiceImpl implements DictService { 27 | 28 | 29 | @Override 30 | public List findDictByPage(Page page, SysDict dict) { 31 | return super.baseMapper.findDictByPage(page,dict); 32 | } 33 | 34 | @Override 35 | public List findListByDictTypeCode(String dictTypeCode) { 36 | return super.baseMapper.findListByDictTypeCode(dictTypeCode); 37 | } 38 | 39 | @Transactional 40 | @Override 41 | public Object addDict(SysDict dict) { 42 | Map map = new HashMap<>(); 43 | map.put("dict_code",dict.getDictCode().trim()); 44 | map.put("dict_type_code",dict.getDictTypeCode().trim()); 45 | List list = super.baseMapper.selectByMap(map); 46 | if (list.size() > 0) { 47 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "该字典已存在", null)); 48 | } 49 | SysDict d = new SysDict(); 50 | d.setDictCode(dict.getDictCode().trim()); 51 | d.setDictValue(dict.getDictValue().trim()); 52 | d.setDictTypeCode(dict.getDictTypeCode().trim()); 53 | d.setDictDesc(dict.getDictDesc()); 54 | d.setDictOrder(dict.getDictOrder()); 55 | super.baseMapper.insert(d); 56 | return ResultUtil.result(EnumCode.OK.getValue(), "新增成功"); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/GradeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.mapper.GradeMapper; 6 | import com.qxf.pojo.CourseTeacher; 7 | import com.qxf.pojo.Grade; 8 | import com.qxf.service.CourseTeacherService; 9 | import com.qxf.service.GradeService; 10 | import com.qxf.utils.EnumCode; 11 | import com.qxf.utils.ResultUtil; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | import org.springframework.transaction.annotation.Transactional; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * @Auther: qiuxinfa 20 | * @Date: 2019/11/27 21 | * @Description: com.qxf.service.impl 22 | */ 23 | @Service 24 | public class GradeServiceImpl extends ServiceImpl implements GradeService { 25 | @Autowired 26 | private CourseTeacherService courseTeacherService; 27 | 28 | @Override 29 | public List viewStudent(Page page,String id) { 30 | //根据id查找课程-老师表信息,拿到课程id和老师id 31 | CourseTeacher courseTeacher = courseTeacherService.selectById(id); 32 | return super.baseMapper.viewStudent(courseTeacher); 33 | } 34 | 35 | @Transactional 36 | @Override 37 | public Object updateScore(Grade grade) { 38 | Integer count = super.baseMapper.updateById(grade); 39 | if(count>0){ 40 | return ResultUtil.result(EnumCode.OK.getValue(),"录入成绩,成功"); 41 | }else { 42 | return ResultUtil.result(EnumCode.OK.getValue(),"录入成绩,失败"); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/InstituteServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.InstituteMapper; 7 | import com.qxf.pojo.Institute; 8 | import com.qxf.pojo.Major; 9 | import com.qxf.service.InstituteService; 10 | import com.qxf.service.MajorService; 11 | import com.qxf.utils.EnumCode; 12 | import com.qxf.utils.ResultUtil; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.transaction.annotation.Transactional; 16 | 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | /** 22 | * @Auther: qiuxinfa 23 | * @Date: 2019/11/24 24 | * @Description: com.qxf.service.impl 25 | */ 26 | @Service 27 | public class InstituteServiceImpl extends ServiceImpl implements InstituteService { 28 | 29 | @Autowired 30 | private MajorService majorService; 31 | 32 | @Override 33 | public List getInstituteByPage(Page page, String name) { 34 | return super.baseMapper.getInstituteByPage(page,name); 35 | } 36 | 37 | @Override 38 | public Object addInstitute(Institute institute) { 39 | Map map = new HashMap<>(); 40 | map.put("name",institute.getName().trim()); 41 | map.put("institute_number",institute.getInstituteNumber().trim()); 42 | List list = super.baseMapper.selectByMap(map); 43 | if (list.size() > 0) { 44 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "该学院已存在", null)); 45 | } 46 | super.baseMapper.insert(institute); 47 | return ResultUtil.result(EnumCode.OK.getValue(), "新增成功"); 48 | } 49 | 50 | @Override 51 | public List findAllInstitute() { 52 | return super.baseMapper.findAllInstitute(); 53 | } 54 | 55 | @Override 56 | public Object deleteInstitute(String[] ids) { 57 | Map map; 58 | for (String id : ids) { 59 | //根据课程查询选课情况,如果有学生选择了该课程,则不能删除 60 | map = new HashMap<>(); 61 | map.put("institute_id",id); 62 | List list = majorService.selectByMap(map); 63 | if(list != null && list.size()>0){ 64 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "选择的学院中存在专业,删除失败",null); 65 | } 66 | } 67 | //逐个删除 68 | for (String id : ids){ 69 | baseMapper.deleteById(id); 70 | } 71 | 72 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/LoginLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.mapper.LoginLogMapper; 6 | import com.qxf.pojo.LoginLog; 7 | import com.qxf.service.LoginLogService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | @Service 18 | public class LoginLogServiceImpl extends ServiceImpl implements LoginLogService { 19 | /** 20 | * 查询登录次数 21 | */ 22 | public Integer findMaxLoginTatalByUserId(String usrId) { 23 | return super.baseMapper.findMaxLoginTatalByUserId(usrId); 24 | } 25 | 26 | /** 27 | * 用户登录日志 28 | */ 29 | public List findUserLoginLogByPage(Page page, String searchKeyWord) { 30 | return super.baseMapper.findUserLoginLogByPage(page, searchKeyWord); 31 | } 32 | 33 | /** 34 | * 统计登陆 35 | */ 36 | public Object findUserLoginTotal() { 37 | 38 | List loignList = super.baseMapper.findUserLoginTotal(); 39 | String[] strName = new String[loignList.size()]; 40 | int[] itotal = new int[loignList.size()]; 41 | for (int i = 0, j = loignList.size(); i < j; i++) { 42 | strName[i] = loignList.get(i).getUsername(); 43 | itotal[i] = loignList.get(i).getLoginTotal(); 44 | } 45 | Map map = new HashMap<>(); 46 | map.put("name",strName); 47 | map.put("total",itotal); 48 | return ResultUtil.result(EnumCode.OK.getValue(), EnumCode.OK.getText(), map); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/MajorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.MajorMapper; 7 | import com.qxf.pojo.Clazz; 8 | import com.qxf.pojo.Major; 9 | import com.qxf.service.ClazzService; 10 | import com.qxf.service.MajorService; 11 | import com.qxf.utils.EnumCode; 12 | import com.qxf.utils.ResultUtil; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.transaction.annotation.Transactional; 16 | 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | /** 22 | * @Auther: qiuxinfa 23 | * @Date: 2019/11/24 24 | * @Description: com.qxf.service.impl 25 | */ 26 | @Service 27 | public class MajorServiceImpl extends ServiceImpl implements MajorService { 28 | @Autowired 29 | private ClazzService clazzService; 30 | 31 | @Override 32 | public List getListByPage(Page page, String name) { 33 | return super.baseMapper.getListByPage(page,name); 34 | } 35 | 36 | @Transactional 37 | @Override 38 | public Object addMajor(Major major) { 39 | Map map = new HashMap<>(); 40 | map.put("name",major.getName().trim()); 41 | map.put("major_number",major.getMajorNumber().trim()); 42 | map.put("institute_id",major.getInstituteId().trim()); 43 | List list = super.baseMapper.selectByMap(map); 44 | if (list.size() > 0) { 45 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "该专业已存在", null)); 46 | } 47 | super.baseMapper.insert(major); 48 | return ResultUtil.result(EnumCode.OK.getValue(), "新增成功"); 49 | } 50 | 51 | @Override 52 | public Object deleteMajor(String[] ids) { 53 | Map map; 54 | for (String id : ids) { 55 | //根据专业id查询班级情况,如果有班级存在,则不能删除 56 | map = new HashMap<>(); 57 | map.put("major_id",id); 58 | List list = clazzService.selectByMap(map); 59 | if(list != null && list.size()>0){ 60 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(), "选择的专业中存在班级,删除失败",null); 61 | } 62 | } 63 | //逐个删除 64 | for (String id : ids){ 65 | baseMapper.deleteById(id); 66 | } 67 | 68 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 69 | } 70 | 71 | @Override 72 | public List findAllMajor(String instituteId) { 73 | return super.baseMapper.findAllMajor(instituteId); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/OperateRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.mapper.OperateRecordMapper; 6 | import com.qxf.pojo.OperateRecord; 7 | import com.qxf.service.OperateRecordService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | @Service 18 | public class OperateRecordServiceImpl extends ServiceImpl implements OperateRecordService { 19 | 20 | /** 21 | * 查询操作记录 22 | */ 23 | public List findOperatingRecordByPage(Page page, String searchKeyWord){ 24 | return super.baseMapper.findOperateRecordByPage(page,searchKeyWord); 25 | } 26 | 27 | /** 28 | * 访问统计 29 | */ 30 | public Object findUserReqTotal() { 31 | List reqList = super.baseMapper.findAllRequstCount(); 32 | List> reqData1 = new ArrayList<>(); 33 | List> reqData2 = new ArrayList<>(); 34 | String[] arrNa = new String[reqList.size()]; 35 | for (int i = 0, j = reqList.size(); i < j; i++) { 36 | if (reqList.get(i).getType().equals(1)) { 37 | // 有请求方法 38 | Map map = new HashMap<>(); 39 | map.put("name",reqList.get(i).getMethod()); 40 | map.put("value",reqList.get(i).getTotal()); 41 | reqData1.add(map); 42 | } else { 43 | // 没有查到请求方法 44 | Map map = new HashMap<>(); 45 | map.put("name",reqList.get(i).getMethod()); 46 | map.put("value",reqList.get(i).getTotal()); 47 | reqData2.add(map); 48 | } 49 | arrNa[i] = reqList.get(i).getMethod(); 50 | } 51 | Map map = new HashMap<>(); 52 | map.put("methodList",reqData1); 53 | map.put("userList",reqData2); 54 | map.put("arrName",arrNa); 55 | 56 | return ResultUtil.result(EnumCode.OK.getValue(), EnumCode.OK.getText(), map); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/PermsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.mapper.PermsMapper; 6 | import com.qxf.pojo.Perms; 7 | import com.qxf.service.PermsService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.*; 14 | 15 | 16 | @Service 17 | public class PermsServiceImpl extends ServiceImpl implements PermsService { 18 | 19 | 20 | public List loadUserResources(Map map){ 21 | return null; 22 | } 23 | 24 | /** 25 | * @desc: 查询菜单 26 | */ 27 | public List findPermissionByPage(Page page,String dto) { 28 | return super.baseMapper.findPermissionByPage(page,dto); 29 | } 30 | 31 | /** 32 | * @desc: 新增菜单 33 | */ 34 | @Transactional 35 | public Object addPermissions(Perms vo) { 36 | 37 | Perms p = new Perms(); 38 | p.setId(UUID.randomUUID().toString()); 39 | p.setName(vo.getName()); 40 | p.setUrl(vo.getUrl()); 41 | p.setType(vo.getType()); 42 | p.setParentId(vo.getParentId()); 43 | baseMapper.insert(p); 44 | return ResultUtil.result(EnumCode.OK.getValue(), "新增成功"); 45 | 46 | } 47 | 48 | /** 49 | * @desc: 删除菜单 应该同时删掉t_role_perms表的相关记录 50 | */ 51 | @Transactional 52 | public Object delPermis(String[] ids) { 53 | 54 | for (String id : ids) { 55 | super.baseMapper.deleteById(id); 56 | 57 | 58 | } 59 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 60 | } 61 | 62 | /** 63 | * @desc: 根据菜单查询菜单 64 | */ 65 | public List findPermissionByName(String name) { 66 | return super.baseMapper.findPermissionByName(name); 67 | } 68 | 69 | /** 70 | * @desc: 根据父级id查询上级菜单 71 | */ 72 | public List findLastPermissionByType(String type) { 73 | return super.baseMapper.findLastPermissionByType(type); 74 | } 75 | 76 | /** 77 | * @desc: 查询所有父级菜单绑定树形 78 | */ 79 | public List findBasePermission() { 80 | List list = super.baseMapper.findBasePermission(); 81 | if (null != list && !list.isEmpty()) { 82 | for (int i = 0,j = list.size();i< j;i++) { 83 | List children = super.baseMapper.findPermissionByFatherId(list.get(i).getId()); 84 | if (null != children && !children.isEmpty()) { 85 | list.get(i).setChildren(children); 86 | for (int i1 = 0, j1 = children.size();i1 < j1; i1++) { 87 | List children1 = super.baseMapper.findPermissionByFatherId(children.get(i1).getId()); 88 | if (null != children1 && !children1.isEmpty()) { 89 | children.get(i1).setChildren(children1); 90 | } 91 | } 92 | } 93 | } 94 | } 95 | return list; 96 | } 97 | 98 | /** 99 | * 根据url查询记录 100 | */ 101 | public Integer findCountByUrl(String requestUrl) { 102 | return super.baseMapper.findCountByUrl(requestUrl); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/QuestionChoicServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.qxf.pojo.QuestionChoic; 4 | import com.qxf.mapper.QuestionChoicDao; 5 | import com.qxf.service.QuestionChoicService; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 选择题库,question_type2单选,3多选(QuestionChoic)表服务实现类 13 | * 14 | * @author makejava 15 | * @since 2020-02-15 16:56:52 16 | */ 17 | @Service("questionChoicService") 18 | public class QuestionChoicServiceImpl implements QuestionChoicService { 19 | 20 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/QuestionExamRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.qxf.pojo.QuestionExamRecord; 4 | import com.qxf.mapper.QuestionExamRecordDao; 5 | import com.qxf.pojo.User; 6 | import com.qxf.service.QuestionExamRecordService; 7 | import com.qxf.utils.EnumCode; 8 | import com.qxf.utils.ResultUtil; 9 | import org.apache.shiro.SecurityUtils; 10 | import org.apache.shiro.subject.Subject; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.Date; 15 | import java.util.List; 16 | import java.util.UUID; 17 | 18 | /** 19 | * 考试记录表(QuestionExamRecord)表服务实现类 20 | * 21 | * @author makejava 22 | * @since 2020-02-15 16:56:57 23 | */ 24 | @Service("questionExamRecordService") 25 | public class QuestionExamRecordServiceImpl implements QuestionExamRecordService { 26 | @Resource 27 | private QuestionExamRecordDao questionExamRecordDao; 28 | 29 | @Override 30 | public Object add(QuestionExamRecord questionExamRecord) { 31 | Subject subject = SecurityUtils.getSubject(); 32 | User user = (User) subject.getPrincipal(); 33 | questionExamRecord.setId(UUID.randomUUID().toString().replace("-","")); 34 | questionExamRecord.setJoinId(user.getId()); //当前考试人ID 35 | questionExamRecord.setJoinDate(new Date()); //考试日期 36 | //questionExamRecord.setJoinResultLevel(); 37 | this.questionExamRecordDao.add(questionExamRecord); 38 | return ResultUtil.result(EnumCode.OK.getValue(),"考试结束,成绩为:"+questionExamRecord.getJoinScore()+"分"); 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/QuestionExamServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.pojo.QuestionExam; 6 | import com.qxf.mapper.QuestionExamDao; 7 | import com.qxf.service.QuestionExamService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | import java.util.UUID; 17 | 18 | /** 19 | * 考试安排(QuestionExam)表服务实现类 20 | * 21 | * @author makejava 22 | * @since 2020-02-15 16:56:56 23 | */ 24 | @Service("questionExamService") 25 | public class QuestionExamServiceImpl extends ServiceImpl implements QuestionExamService { 26 | 27 | @Resource 28 | private QuestionExamDao questionExamDao; 29 | 30 | @Override 31 | public List getListByPage(Page page, String name) { 32 | return super.baseMapper.getListByPage(page,name); 33 | } 34 | 35 | @Override 36 | public QuestionExam getExamById(String id) { 37 | return super.baseMapper.getExamById(id); 38 | } 39 | 40 | @Override 41 | public Object add(QuestionExam exam) { 42 | exam.setId(UUID.randomUUID().toString().replace("-","")); 43 | exam.setTotalScore(0); //初始分数为0分,后面根据试卷题目计算总分,再更新 44 | exam.setPaperId(UUID.randomUUID().toString().replace("-","")); 45 | int cnt = super.baseMapper.add(exam); 46 | if(cnt > 0){ 47 | return ResultUtil.result(EnumCode.OK.getValue(),"新增成功"); 48 | }else { 49 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),"新增失败"); 50 | } 51 | 52 | } 53 | 54 | @Override 55 | public Object delete(String[] ids) { 56 | //逐个删除 57 | for (String id : ids){ 58 | questionExamDao.deleteExamById(id); 59 | } 60 | 61 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/QuestionFillJudgeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.qxf.pojo.QuestionFillJudge; 4 | import com.qxf.mapper.QuestionFillJudgeDao; 5 | import com.qxf.service.QuestionFillJudgeService; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 填空题和判断题库,question_type,0填空1判断(QuestionFillJudge)表服务实现类 13 | * 14 | * @author makejava 15 | * @since 2020-02-15 16:56:56 16 | */ 17 | @Service("questionFillJudgeService") 18 | public class QuestionFillJudgeServiceImpl implements QuestionFillJudgeService { 19 | 20 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/QuestionPaperServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.qxf.mapper.QuestionChoicDao; 4 | import com.qxf.mapper.QuestionExamDao; 5 | import com.qxf.mapper.QuestionFillJudgeDao; 6 | import com.qxf.pojo.*; 7 | import com.qxf.mapper.QuestionPaperDao; 8 | import com.qxf.service.QuestionPaperService; 9 | import com.qxf.utils.EnumCode; 10 | import com.qxf.utils.ResultUtil; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.*; 15 | 16 | /** 17 | * 试卷(QuestionPaper)表服务实现类 18 | * 19 | * @author makejava 20 | * @since 2020-02-15 16:56:56 21 | */ 22 | @Service("questionPaperService") 23 | public class QuestionPaperServiceImpl implements QuestionPaperService { 24 | @Resource 25 | private QuestionFillJudgeDao questionFillJudgeDao; 26 | 27 | @Resource 28 | private QuestionChoicDao questionChoicDao; 29 | 30 | @Resource 31 | private QuestionPaperDao questionPaperDao; 32 | 33 | @Resource 34 | private QuestionExamDao questionExamDao; 35 | 36 | @Override 37 | public Map> getPaperById(String paperId) { 38 | //0.填空题 39 | List fills = questionFillJudgeDao.getQuestionFillJudgeList("0",paperId); 40 | //1.判断题 41 | List judges = questionFillJudgeDao.getQuestionFillJudgeList("1",paperId); 42 | //2.单选题 43 | List singles = questionChoicDao.getQuestionChoicList("2",paperId); 44 | //3.多选题 45 | List multiples = questionChoicDao.getQuestionChoicList("3",paperId); 46 | Map> map = new HashMap<>(); 47 | map.put("0",fills); 48 | map.put("1",judges); 49 | map.put("2",singles); 50 | map.put("3",multiples); 51 | return map; 52 | } 53 | 54 | @Override 55 | public Object add(ExamVo exam) { 56 | String paperId = exam.getPaperId(); 57 | Integer fillCnt = exam.getFillCnt(); 58 | Integer judgeCnt = exam.getJudgeCnt(); 59 | Integer singleCnt = exam.getSingleCnt(); 60 | Integer totalScore = 0; 61 | String msg = "随机组卷失败,失败原因:"; 62 | //0.填空题的数量 63 | List fills = questionFillJudgeDao.getQuestionFillJudgeList("0",null); 64 | if(fills!=null && fillCnt > fills.size()){ 65 | msg += "填空题数量最多是"+fills.size()+"题"; 66 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),msg); 67 | } 68 | //1.判断题的数量 69 | List judges = questionFillJudgeDao.getQuestionFillJudgeList("1",null); 70 | if(judges!=null && judgeCnt > judges.size()){ 71 | msg += "判断题数量最多是"+judges.size()+"题"; 72 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),msg); 73 | } 74 | //2.单选题的数量 75 | List singles = questionChoicDao.getQuestionChoicList("2",null); 76 | if(singles!=null && singleCnt > singles.size()){ 77 | msg += "单选题数量最多是"+singles.size()+"题"; 78 | return ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),msg); 79 | } 80 | //3.多选题的数量(暂时不考虑多选题) 81 | // List multiples = questionChoicDao.getQuestionChoicList("3",null); 82 | 83 | //打乱list中的数据顺序 84 | Collections.shuffle(fills); 85 | Collections.shuffle(judges); 86 | Collections.shuffle(singles); 87 | 88 | //向question_paper表插入数据 89 | for (int i=0;i 0){ 97 | totalScore += Integer.valueOf(fill.getQuestionScore()); 98 | } 99 | } 100 | for (int i=0;i 0){ 108 | totalScore += Integer.valueOf(judge.getQuestionScore()); 109 | } 110 | } 111 | for (int i=0;i 0){ 119 | totalScore += Integer.valueOf(single.getQuestionScore()); 120 | } 121 | } 122 | //更新考试的总分 123 | QuestionExam questionExam = new QuestionExam(); 124 | questionExam.setPaperId(paperId); 125 | questionExam.setTotalScore(totalScore); 126 | int cnt = questionExamDao.updateScoreByPaperId(questionExam); 127 | if(cnt > 0){ 128 | return ResultUtil.result(EnumCode.OK.getValue(),"随机组卷成功"); 129 | }else { 130 | return ResultUtil.result(EnumCode.OK.getValue(),"随机组卷失败,失败原因:更新总分失败"); 131 | } 132 | 133 | } 134 | } -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/RolePermsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.qxf.mapper.RolePermsMapper; 5 | import com.qxf.pojo.Perms; 6 | import com.qxf.pojo.RolePerms; 7 | import com.qxf.service.RolePermsService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | @Service 18 | public class RolePermsServiceImpl extends ServiceImpl implements RolePermsService { 19 | 20 | /** 21 | * 根据角色查询角色权限 22 | */ 23 | public List findRolesPermisByRole(String roleId) { 24 | return baseMapper.findRolesPermisByRole(roleId); 25 | } 26 | 27 | /** 28 | * 添加角色权限 29 | */ 30 | @Transactional 31 | public Object addRolesPermis(RolePerms vo) { 32 | RolePerms rp = null; 33 | String roleId = vo.getRoleId(); 34 | String[] permisIds = vo.getPermsIds()==null?new String[0]:vo.getPermsIds(); 35 | 36 | Map map = new HashMap<>(); 37 | map.put("role_id",roleId); 38 | super.baseMapper.deleteByMap(map); 39 | 40 | for (int i = 0,j=permisIds.length; i < j; i++) { 41 | rp = new RolePerms(); 42 | rp.setRoleId(roleId); 43 | rp.setPermsId(permisIds[i]); 44 | super.baseMapper.insert(rp); 45 | } 46 | return ResultUtil.result(EnumCode.OK.getValue(), "保存成功"); 47 | } 48 | 49 | /** 50 | * 根据角色id查询记录数 51 | */ 52 | public Integer findCountByRole(String roleId,String url) { 53 | return super.baseMapper.findCountByRole(roleId, url); 54 | } 55 | 56 | /** 57 | * 根据父id\用户类型查询角色菜单 58 | */ 59 | public List findRolesPermisByFatherId(String fatherId, String roleId) { 60 | return super.baseMapper.findRolesPermisByFatherId(fatherId, roleId); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.mapper.RoleMapper; 6 | import com.qxf.pojo.Role; 7 | import com.qxf.service.RoleService; 8 | import com.qxf.utils.EnumCode; 9 | import com.qxf.utils.ResultUtil; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class RoleServiceImpl extends ServiceImpl implements RoleService { 17 | 18 | /** 19 | * @desc: 查询角色 20 | */ 21 | public List findRoleByPage(Page page,String roleName) { 22 | return super.baseMapper.findRoleByPage(page,roleName); 23 | } 24 | 25 | /** 26 | * @desc: 新增角色 27 | */ 28 | @Transactional 29 | public Object addRoles(Role vo) { 30 | Role r = new Role(); 31 | r.setName(vo.getName()); 32 | r.setRoleDesc(vo.getRoleDesc()); 33 | super.baseMapper.insert(r); 34 | return ResultUtil.result(EnumCode.OK.getValue(), "新增成功"); 35 | } 36 | 37 | /** 38 | * @desc: 删除角色 39 | */ 40 | @Transactional 41 | public Object delRole(String[] ids) { 42 | 43 | for (String id : ids) { 44 | super.baseMapper.deleteById(id); 45 | } 46 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 47 | } 48 | 49 | /** 50 | * 绑定角色下拉框 51 | */ 52 | public List findAllRoles() { 53 | return super.baseMapper.findAllRoles(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.StudentMapper; 7 | import com.qxf.pojo.Major; 8 | import com.qxf.pojo.Student; 9 | import com.qxf.pojo.User; 10 | import com.qxf.pojo.UserRole; 11 | import com.qxf.service.*; 12 | import com.qxf.utils.EnumCode; 13 | import com.qxf.utils.ResultUtil; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | import org.springframework.transaction.annotation.Transactional; 17 | 18 | import java.util.*; 19 | 20 | /** 21 | * @Auther: qiuxinfa 22 | * @Date: 2019/11/24 23 | * @Description: com.qxf.service.impl 24 | */ 25 | @Service 26 | public class StudentServiceImpl extends ServiceImpl implements StudentService { 27 | 28 | @Autowired 29 | private UserService userService; 30 | 31 | @Autowired 32 | private UserRoleService userRoleService; 33 | 34 | @Autowired 35 | private InstituteService instituteService; 36 | 37 | @Autowired 38 | private MajorService majorService; 39 | 40 | @Override 41 | public List getListByPage(Page page, String name) { 42 | return super.baseMapper.getListByPage(page,name); 43 | } 44 | 45 | @Transactional 46 | @Override 47 | public Object addStudent(Student student) { 48 | //生成学号:年份+学院代码+专业代码+四位随机数字,从1000开始 49 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00")); 50 | Integer year = calendar.get(Calendar.YEAR); 51 | String instituteNumber = instituteService.selectById(student.getInstituteId().trim()).getInstituteNumber(); 52 | String majorNumber = majorService.selectById(student.getMajorId().trim()).getMajorNumber(); 53 | Integer total = this.getStudentCount(student.getMajorId().trim()); //本专业学生总数 54 | String number = "1000"; //随机数字起始 55 | if(total!=null){ 56 | number = ""+(1000+total); 57 | } 58 | String studentNumber = year + instituteNumber +majorNumber + number; //学号 59 | 60 | //判断要插入的学生是否存在 61 | Map map = new HashMap<>(); 62 | map.put("student_number",studentNumber); 63 | map.put("clazz_id",student.getClazzId().trim()); 64 | map.put("major_id",student.getMajorId().trim()); 65 | map.put("institute_id",student.getInstituteId().trim()); 66 | List list = super.baseMapper.selectByMap(map); 67 | if(list!=null && list.size()>0){ 68 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),"该学生已存在",null)); 69 | } 70 | 71 | //插入学生 72 | student.setStudentNumber(studentNumber); 73 | super.baseMapper.insert(student); 74 | 75 | //把学生信息插入到t_user表和t_user_roel表,使得学生可以用姓名和默认密码a123456登录 76 | User u = new User(); 77 | u.setId(student.getId()); 78 | u.setUsername(student.getName().trim()); 79 | u.setPassword("d477887b0636e5d87f79cc25c99d7dc9"); 80 | if(student.getPhotoUrl()!=null){ 81 | u.setPhotoUrl(student.getPhotoUrl().trim()); 82 | } 83 | if(student.getEmail()!=null){ 84 | u.setEmail(student.getEmail().trim()); 85 | } 86 | u.setEnable(1); 87 | u.setCreateTime(new Date()); 88 | userService.insert(u); 89 | 90 | //再把user信息插入到_user_roel表中 91 | UserRole ur = new UserRole(); 92 | ur.setUserId(u.getId()); 93 | ur.setRoleId("3"); //角色为学生 94 | userRoleService.insert(ur); 95 | return ResultUtil.result(EnumCode.OK.getValue(),"新增成功"); 96 | } 97 | 98 | @Override 99 | public Integer getStudentCount(String majorId) { 100 | return super.baseMapper.getStudentCount(majorId); 101 | } 102 | 103 | @Override 104 | public Object deleteStudent(String[] ids) { 105 | //逐个删除 106 | for (String id : ids){ 107 | baseMapper.deleteById(id); 108 | } 109 | 110 | return ResultUtil.result(EnumCode.OK.getValue(), "删除成功"); 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/TeacherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.plugins.Page; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.qxf.exception.MyException; 6 | import com.qxf.mapper.TeacherMapper; 7 | import com.qxf.pojo.Teacher; 8 | import com.qxf.pojo.User; 9 | import com.qxf.pojo.UserRole; 10 | import com.qxf.service.TeacherService; 11 | import com.qxf.service.UserRoleService; 12 | import com.qxf.service.UserService; 13 | import com.qxf.utils.EnumCode; 14 | import com.qxf.utils.ResultUtil; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.transaction.annotation.Transactional; 18 | 19 | import java.util.Date; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | /** 25 | * @Auther: qiuxinfa 26 | * @Date: 2019/11/24 27 | * @Description: com.qxf.service.impl 28 | */ 29 | @Service 30 | public class TeacherServiceImpl extends ServiceImpl implements TeacherService{ 31 | 32 | @Autowired 33 | private UserService userService; 34 | 35 | @Autowired 36 | private UserRoleService userRoleService; 37 | 38 | @Override 39 | public List getListByPage(Page page, String name) { 40 | return super.baseMapper.getListByPage(page,name); 41 | } 42 | 43 | @Transactional 44 | @Override 45 | public Object addTeacher(Teacher teacher) { 46 | Map map = new HashMap<>(); 47 | map.put("name",teacher.getName().trim()); 48 | map.put("sex",teacher.getSex()); 49 | map.put("age",teacher.getAge()); 50 | map.put("phone",teacher.getPhone().trim()); 51 | List list = selectByMap(map); 52 | if(list!=null && list.size()>0){ 53 | throw new MyException(ResultUtil.result(EnumCode.BAD_REQUEST.getValue(),"该老师已存在",null)); 54 | } 55 | super.baseMapper.insert(teacher); 56 | 57 | //把老师信息插入到t_user表和t_user_roel表,使得老师可以用姓名和默认密码a123456登录 58 | User u = new User(); 59 | u.setId(teacher.getId()); 60 | u.setUsername(teacher.getName().trim()); 61 | u.setPassword("d477887b0636e5d87f79cc25c99d7dc9"); 62 | if(teacher.getPhotoUrl()!=null){ 63 | u.setPhotoUrl(teacher.getPhotoUrl().trim()); 64 | } 65 | if(teacher.getEmail()!=null){ 66 | u.setEmail(teacher.getEmail().trim()); 67 | } 68 | u.setEnable(1); 69 | u.setCreateTime(new Date()); 70 | userService.insert(u); 71 | 72 | //再把user信息插入到_user_roel表中 73 | UserRole ur = new UserRole(); 74 | ur.setUserId(u.getId()); 75 | ur.setRoleId("2"); //角色为老师 76 | userRoleService.insert(ur); 77 | 78 | return ResultUtil.result(EnumCode.OK.getValue(),"新增成功"); 79 | } 80 | 81 | @Override 82 | public List findAllTeacher() { 83 | return super.baseMapper.findAllTeacher(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/service/impl/UserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.qxf.service.impl; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.qxf.mapper.UserRoleMapper; 5 | import com.qxf.pojo.UserRole; 6 | import com.qxf.service.UserRoleService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/shiro/AuthRealm.java: -------------------------------------------------------------------------------- 1 | package com.qxf.shiro; 2 | 3 | import com.qxf.pojo.User; 4 | import com.qxf.service.UserService; 5 | import org.apache.shiro.authc.*; 6 | import org.apache.shiro.authz.AuthorizationInfo; 7 | import org.apache.shiro.realm.AuthorizingRealm; 8 | import org.apache.shiro.subject.PrincipalCollection; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | public class AuthRealm extends AuthorizingRealm { 17 | 18 | /** 19 | * 日志打印 20 | */ 21 | private final static Logger log = LoggerFactory.getLogger(AuthRealm.class); 22 | 23 | /** 24 | * 用户 25 | */ 26 | @Autowired 27 | private UserService userService; 28 | 29 | //授权 30 | @Override 31 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals){ 32 | return null; 33 | } 34 | 35 | /** 36 | * @desc: 认证 37 | */ 38 | @Override 39 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 40 | log.info("======================= 认证登陆 ======================"); 41 | // 获取用户输入的token 42 | UsernamePasswordToken upToken = (UsernamePasswordToken) token; 43 | String name = upToken.getUsername(); 44 | String pass = String.valueOf(upToken.getPassword()); 45 | User u = new User(); 46 | u.setUsername(name); 47 | u.setPassword(pass); 48 | List list = userService.checkUser(u); 49 | User userInfoDto = null; 50 | if (null == list || list.isEmpty()) { 51 | throw new AuthenticationException("账号或密码错误"); 52 | } else if (list.get(0).getEnable() == 0) { 53 | /** 54 | * 账号被禁用 55 | */ 56 | throw new AuthenticationException("账号已被禁止登陆"); 57 | }else{ 58 | userInfoDto = list.get(0); 59 | //登录成功 60 | userInfoDto.setLastLoginTime(new Date()); 61 | } 62 | log.info("======================= 登陆成功 ======================"); 63 | return new SimpleAuthenticationInfo(userInfoDto, userInfoDto.getPassword(), getName()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/shiro/CredentialsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.qxf.shiro; 2 | 3 | import org.apache.shiro.authc.AuthenticationInfo; 4 | import org.apache.shiro.authc.AuthenticationToken; 5 | import org.apache.shiro.authc.UsernamePasswordToken; 6 | import org.apache.shiro.authc.credential.SimpleCredentialsMatcher; 7 | 8 | public class CredentialsMatcher extends SimpleCredentialsMatcher { 9 | 10 | @Override 11 | public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { 12 | UsernamePasswordToken utoken=(UsernamePasswordToken) token; 13 | //获得用户输入的密码:(可以采用加盐(salt)的方式去检验) 14 | String inPassword = new String(utoken.getPassword()); 15 | //获得数据库中的密码 16 | String dbPassword=(String) info.getCredentials(); 17 | //进行密码的比对 18 | return this.equals(inPassword, dbPassword); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/utils/EnumCode.java: -------------------------------------------------------------------------------- 1 | package com.qxf.utils; 2 | 3 | /** 4 | * @Auther: qiuxinfa 5 | * @Date: 2019/11/15 6 | * @Description: com.qxf.utils 7 | */ 8 | public enum EnumCode { 9 | /** 10 | * 200请求成功 11 | */ 12 | OK(200, "请求成功"), 13 | /** 14 | * 303登录失败 15 | */ 16 | LOGIN_FAIL(303, "登录失败"), 17 | /** 18 | * 400请求参数出错 19 | */ 20 | BAD_REQUEST(400, "请求参数出错"), 21 | /** 22 | * 401没有登录 23 | */ 24 | UNAUTHORIZED(401, "没有登录"), 25 | /** 26 | * 403没有权限 27 | */ 28 | FORBIDDEN(403, "没有权限"), 29 | /** 30 | * 410已被删除 31 | */ 32 | GONE(410, "已被删除"), 33 | /** 34 | * 423已被锁定 35 | */ 36 | LOCKED(423, "已被锁定"), 37 | /** 38 | * 500服务器出错 39 | */ 40 | INTERNAL_SERVER_ERROR(500, "服务器出错"), 41 | /** 42 | * 异常 43 | */ 44 | EXCPTION_ERROR(4001, "异常"); 45 | 46 | private final Integer value; 47 | private final String text; 48 | 49 | private EnumCode(Integer value, String text) { 50 | this.value = value; 51 | this.text = text; 52 | } 53 | 54 | /** 55 | * 获取value 56 | */ 57 | public Integer getValue() { 58 | return this.value; 59 | } 60 | 61 | /** 62 | * 获取Text 63 | */ 64 | public String getText() { 65 | return this.text; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/qxf/utils/ResultUtil.java: -------------------------------------------------------------------------------- 1 | package com.qxf.utils; 2 | 3 | import org.json.JSONObject; 4 | 5 | /** 6 | * @Auther: qiuxinfa 7 | * @Date: 2019/11/15 8 | * @Description: com.qxf.utils 9 | */ 10 | //封装返回结果 11 | public class ResultUtil { 12 | public static String result(final Integer status,final String msg,final Object data,final Integer total) { 13 | JSONObject jsonObject = new JSONObject() { 14 | { 15 | put("status", status); 16 | put("msg", msg); 17 | put("data", data); 18 | put("total", total); 19 | } 20 | }; 21 | return jsonObject.toString(); 22 | } 23 | 24 | public static String result(final Integer status,final String msg,final Object data) { 25 | JSONObject jsonObject = new JSONObject() { 26 | { 27 | put("status", status); 28 | put("msg", msg); 29 | put("data", data); 30 | } 31 | }; 32 | return jsonObject.toString(); 33 | } 34 | 35 | public static String result(final Integer status,final String msg) { 36 | JSONObject jsonObject = new JSONObject() { 37 | { 38 | put("status", status); 39 | put("msg", msg); 40 | } 41 | }; 42 | return jsonObject.toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8089 3 | 4 | spring: 5 | datasource: 6 | driver-class-name: com.mysql.cj.jdbc.Driver 7 | url: jdbc:mysql://localhost:3306/boot_shiro_vue_stu?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false 8 | username: root 9 | password: 19930919 10 | type: com.alibaba.druid.pool.DruidDataSource 11 | filters: stat 12 | maxActive: 20 13 | initialSize: 1 14 | maxWait: 60000 15 | minIdle: 1 16 | timeBetweenEvictionRunsMillis: 60000 17 | minEvictableIdleTimeMillis: 300000 18 | validationQuery: select 'x' 19 | testWhileIdle: true 20 | testOnBorrow: false 21 | testOnReturn: false 22 | poolPreparedStatements: true 23 | maxOpenPreparedStatements: 20 24 | 25 | 26 | #mybatis 配置 27 | mybatis: 28 | mapper-locations: classpath:com/qxf/mapper/xml/*.xml 29 | type-aliases-package: com.qxf.pojo -------------------------------------------------------------------------------- /src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ${LOG_PATH}/info.log 7 | 8 | ${LOG_PATH}/info-%d{yyyyMMdd}.log.%i 9 | 10 | 500MB 11 | 12 | 2 13 | 14 | 15 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n 16 | 17 | 18 | 19 | 20 | 21 | 22 | ERROR 23 | 24 | ${LOG_PATH}/error.log 25 | 26 | ${LOG_PATH}/error-%d{yyyyMMdd}.log.%i 27 | 28 | 29 | 500MB 30 | 31 | 2 32 | 33 | 34 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------