├── .idea ├── .gitignore ├── campus-gang-api-master.iml ├── compiler.xml ├── encodings.xml ├── jarRepositories.xml └── misc.xml ├── pom.xml ├── readme.md ├── src ├── main │ ├── java │ │ └── com │ │ │ └── yqn │ │ │ ├── CampusGangApplication.java │ │ │ ├── common │ │ │ ├── config │ │ │ │ └── CorsConfig.java │ │ │ ├── constant │ │ │ │ ├── Constants.java │ │ │ │ └── HttpStatus.java │ │ │ ├── core │ │ │ │ ├── controller │ │ │ │ │ └── BaseController.java │ │ │ │ ├── domain │ │ │ │ │ ├── AjaxResult.java │ │ │ │ │ ├── BaseEntity.java │ │ │ │ │ └── TreeEntity.java │ │ │ │ ├── page │ │ │ │ │ ├── PageDomain.java │ │ │ │ │ ├── TableDataInfo.java │ │ │ │ │ └── TableSupport.java │ │ │ │ └── text │ │ │ │ │ ├── CharsetKit.java │ │ │ │ │ ├── Convert.java │ │ │ │ │ └── StrFormatter.java │ │ │ ├── exception │ │ │ │ └── UtilException.java │ │ │ ├── tools │ │ │ │ ├── MessageTools.java │ │ │ │ └── PocketMoney.java │ │ │ └── utils │ │ │ │ ├── DateUtils.java │ │ │ │ ├── PageUtils.java │ │ │ │ ├── ServletUtils.java │ │ │ │ ├── StringUtils.java │ │ │ │ └── sql │ │ │ │ └── SqlUtil.java │ │ │ ├── controller │ │ │ ├── AdminController.java │ │ │ ├── ClassController.java │ │ │ ├── DeptController.java │ │ │ ├── NoticeController.java │ │ │ ├── SchoolController.java │ │ │ ├── SxcRemarkController.java │ │ │ ├── SxcStudentController.java │ │ │ ├── TaskController.java │ │ │ └── UserController.java │ │ │ ├── mapper │ │ │ ├── AdminMapper.java │ │ │ ├── ClassMapper.java │ │ │ ├── DeptMapper.java │ │ │ ├── NoticeMapper.java │ │ │ ├── SchoolMapper.java │ │ │ ├── SxcRemarkMapper.java │ │ │ ├── SxcStudentMapper.java │ │ │ ├── TaskMapper.java │ │ │ └── UserMapper.java │ │ │ ├── pojo │ │ │ ├── Admin.java │ │ │ ├── Class.java │ │ │ ├── Dept.java │ │ │ ├── Notice.java │ │ │ ├── School.java │ │ │ ├── SxcRemark.java │ │ │ ├── SxcStudent.java │ │ │ ├── Task.java │ │ │ └── User.java │ │ │ └── service │ │ │ ├── AdminService.java │ │ │ ├── ClassService.java │ │ │ ├── DeptService.java │ │ │ ├── INoticeService.java │ │ │ ├── ISxcRemarkService.java │ │ │ ├── ISxcStudentService.java │ │ │ ├── SchoolService.java │ │ │ ├── TaskService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ ├── AdminServiceImpl.java │ │ │ ├── ClassServiceImpl.java │ │ │ ├── DeptServiceImpl.java │ │ │ ├── NoticeServiceImpl.java │ │ │ ├── SchoolServiceImpl.java │ │ │ ├── SxcRemarkServiceImpl.java │ │ │ ├── SxcStudentServiceImpl.java │ │ │ ├── TaskServiceImpl.java │ │ │ └── UserServiceImpl.java │ ├── main.iml │ └── resources │ │ ├── application.yml │ │ ├── mapper │ │ ├── ClassMapper.xml │ │ ├── DeptMapper.xml │ │ ├── NoticeMapper.xml │ │ ├── SchoolMapper.xml │ │ ├── SxcRemarkMapper.xml │ │ ├── SxcStudentMapper.xml │ │ ├── TaskMapper.xml │ │ └── UserMapper.xml │ │ └── sql │ │ └── campus_help.sql └── test │ ├── java │ └── com │ │ └── yqn │ │ └── CampusGangApplicationTests.java │ └── test.iml └── 前端 └── campus-web ├── .idea ├── .gitignore ├── campus-web.iml ├── misc.xml └── modules.xml ├── babel.config.js ├── campus-gang-web-master.iml ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── api │ ├── notice │ │ └── advise.js │ ├── remark │ │ └── remark.js │ └── student │ │ └── stuage.js ├── assets │ ├── icon.png │ ├── images │ │ ├── pic.jpg │ │ ├── pic01.png │ │ ├── pic02.png │ │ └── pic03.png │ ├── img │ │ ├── bg.jpg │ │ ├── emoji.png │ │ ├── test.jpg │ │ └── test1.jpg │ ├── logo.jpg │ ├── logo.png │ ├── logo_transparent.png │ ├── logo_transparent1.png │ └── z_logo.png ├── main.js ├── plugin │ ├── index.js │ └── myPlugin.js ├── router │ └── index.js ├── store │ ├── index.js │ └── module │ │ ├── admin.js │ │ ├── theme.js │ │ └── user.js ├── util │ ├── date.js │ ├── request.js │ └── util.js └── views │ ├── Error.vue │ ├── admin │ ├── Home.vue │ ├── Login.vue │ ├── children │ │ ├── Index.vue │ │ ├── School.vue │ │ ├── Student.vue │ │ └── Task.vue │ └── student │ │ └── index.vue │ ├── notice │ ├── advise.vue │ └── adviseuser.vue │ ├── remark │ ├── myremark.vue │ ├── remark.vue │ └── userremark.vue │ └── user │ ├── Home.vue │ ├── Login.vue │ └── children │ ├── Accept.vue │ ├── Accepted.vue │ ├── Index.vue │ ├── MyProfile.vue │ ├── Published.vue │ └── Task.vue └── vue.config.js /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/campus-gang-api-master.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.5.0 9 | 10 | 11 | com.yqn 12 | campus_gang 13 | 0.0.1-SNAPSHOT 14 | campus_gang 15 | Demo project for Spring Boot 16 | 17 | 1.8 18 | 8.0.18 19 | 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-logging 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-redis 36 | 37 | 38 | 39 | 40 | com.baomidou 41 | mybatis-plus-boot-starter 42 | 3.4.3 43 | 44 | 45 | 46 | org.projectlombok 47 | lombok 48 | true 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-starter-test 54 | test 55 | 56 | 57 | 58 | 59 | mysql 60 | mysql-connector-java 61 | 62 | 63 | 64 | com.alibaba 65 | druid-spring-boot-starter 66 | 1.2.6 67 | 68 | 69 | 70 | org.springframework.boot 71 | spring-boot-configuration-processor 72 | true 73 | 74 | 75 | 76 | 77 | org.apache.commons 78 | commons-lang3 79 | 80 | 81 | 82 | 83 | com.github.pagehelper 84 | pagehelper 85 | 5.1.10 86 | 87 | 88 | 89 | 90 | io.jsonwebtoken 91 | jjwt 92 | 0.9.1 93 | 94 | 95 | 96 | 97 | commons-io 98 | commons-io 99 | 2.6 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | org.springframework.boot 111 | spring-boot-maven-plugin 112 | 113 | 114 | 115 | org.projectlombok 116 | lombok 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ![2022年11月10日15时:16分:06秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:16分:06秒) 2 | ![2022年11月10日15时:25分:23秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:25分:23秒) 3 | ![2022年11月10日15时:25分:42秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:25分:42秒) 4 | ![2022年11月10日15时:25分:55秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:25分:55秒) 5 | ![2022年11月10日15时:26分:07秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:26分:07秒) 6 | ![2022年11月10日15时:27分:03秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:27分:03秒) 7 | ![2022年11月10日15时:27分:23秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:27分:23秒) 8 | ![2022年11月10日15时:27分:34秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:27分:34秒) 9 | ![2022年11月10日15时:27分:48秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:27分:48秒) 10 | ![2022年11月10日15时:28分:04秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:28分:04秒) 11 | ![2022年11月10日15时:28分:17秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:28分:17秒) 12 | ![2022年11月10日15时:28分:30秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:28分:30秒) 13 | ![2022年11月10日15时:28分:44秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:28分:44秒) 14 | ![2022年11月10日15时:29分:04秒](https://cyymacbookpro.oss-cn-shanghai.aliyuncs.com/Macbookpro/2022年11月10日15时:29分:04秒) 15 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/CampusGangApplication.java: -------------------------------------------------------------------------------- 1 | package com.yqn; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @MapperScan("com.yqn.mapper") 8 | @SpringBootApplication 9 | public class CampusGangApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(CampusGangApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * @author sxc 9 | */ 10 | @Configuration 11 | public class CorsConfig implements WebMvcConfigurer { 12 | @Override 13 | public void addCorsMappings(CorsRegistry registry) { 14 | registry.addMapping("/**") 15 | .allowCredentials(true) 16 | .allowedOriginPatterns("*") 17 | .allowedMethods("GET", "POST", "PUT", "DELETE") 18 | .allowedHeaders("*") 19 | .exposedHeaders("*"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/constant/Constants.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.constant; 2 | 3 | import io.jsonwebtoken.Claims; 4 | 5 | /** 6 | * 通用常量信息 7 | * 8 | * @author ruoyi 9 | */ 10 | public class Constants 11 | { 12 | /** 13 | * UTF-8 字符集 14 | */ 15 | public static final String UTF8 = "UTF-8"; 16 | 17 | /** 18 | * GBK 字符集 19 | */ 20 | public static final String GBK = "GBK"; 21 | 22 | /** 23 | * http请求 24 | */ 25 | public static final String HTTP = "http://"; 26 | 27 | /** 28 | * https请求 29 | */ 30 | public static final String HTTPS = "https://"; 31 | 32 | /** 33 | * 通用成功标识 34 | */ 35 | public static final String SUCCESS = "0"; 36 | 37 | /** 38 | * 通用失败标识 39 | */ 40 | public static final String FAIL = "1"; 41 | 42 | /** 43 | * 登录成功 44 | */ 45 | public static final String LOGIN_SUCCESS = "Success"; 46 | 47 | /** 48 | * 注销 49 | */ 50 | public static final String LOGOUT = "Logout"; 51 | 52 | /** 53 | * 注册 54 | */ 55 | public static final String REGISTER = "Register"; 56 | 57 | /** 58 | * 登录失败 59 | */ 60 | public static final String LOGIN_FAIL = "Error"; 61 | 62 | /** 63 | * 验证码 redis key 64 | */ 65 | public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; 66 | 67 | /** 68 | * 登录用户 redis key 69 | */ 70 | public static final String LOGIN_TOKEN_KEY = "login_tokens:"; 71 | 72 | /** 73 | * 防重提交 redis key 74 | */ 75 | public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; 76 | 77 | /** 78 | * 限流 redis key 79 | */ 80 | public static final String RATE_LIMIT_KEY = "rate_limit:"; 81 | 82 | /** 83 | * 验证码有效期(分钟) 84 | */ 85 | public static final Integer CAPTCHA_EXPIRATION = 2; 86 | 87 | /** 88 | * 令牌 89 | */ 90 | public static final String TOKEN = "token"; 91 | 92 | /** 93 | * 令牌前缀 94 | */ 95 | public static final String TOKEN_PREFIX = "Bearer "; 96 | 97 | /** 98 | * 令牌前缀 99 | */ 100 | public static final String LOGIN_USER_KEY = "login_user_key"; 101 | 102 | /** 103 | * 用户ID 104 | */ 105 | public static final String JWT_USERID = "userid"; 106 | 107 | /** 108 | * 用户名称 109 | */ 110 | public static final String JWT_USERNAME = Claims.SUBJECT; 111 | 112 | /** 113 | * 用户头像 114 | */ 115 | public static final String JWT_AVATAR = "avatar"; 116 | 117 | /** 118 | * 创建时间 119 | */ 120 | public static final String JWT_CREATED = "created"; 121 | 122 | /** 123 | * 用户权限 124 | */ 125 | public static final String JWT_AUTHORITIES = "authorities"; 126 | 127 | /** 128 | * 参数管理 cache key 129 | */ 130 | public static final String SYS_CONFIG_KEY = "sys_config:"; 131 | 132 | /** 133 | * 字典管理 cache key 134 | */ 135 | public static final String SYS_DICT_KEY = "sys_dict:"; 136 | 137 | /** 138 | * 资源映射路径 前缀 139 | */ 140 | public static final String RESOURCE_PREFIX = "/profile"; 141 | 142 | /** 143 | * RMI 远程方法调用 144 | */ 145 | public static final String LOOKUP_RMI = "rmi:"; 146 | 147 | /** 148 | * LDAP 远程方法调用 149 | */ 150 | public static final String LOOKUP_LDAP = "ldap:"; 151 | 152 | /** 153 | * LDAPS 远程方法调用 154 | */ 155 | public static final String LOOKUP_LDAPS = "ldaps:"; 156 | 157 | /** 158 | * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) 159 | */ 160 | public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; 161 | 162 | /** 163 | * 定时任务违规的字符 164 | */ 165 | public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", 166 | "org.springframework", "org.apache", "com.ruoyi.common.utils.file" }; 167 | } 168 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/constant/HttpStatus.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.constant; 2 | 3 | /** 4 | * 返回状态码 5 | * 6 | * @author ruoyi 7 | */ 8 | public class HttpStatus 9 | { 10 | /** 11 | * 操作成功 12 | */ 13 | public static final int SUCCESS = 200; 14 | 15 | /** 16 | * 对象创建成功 17 | */ 18 | public static final int CREATED = 201; 19 | 20 | /** 21 | * 请求已经被接受 22 | */ 23 | public static final int ACCEPTED = 202; 24 | 25 | /** 26 | * 操作已经执行成功,但是没有返回数据 27 | */ 28 | public static final int NO_CONTENT = 204; 29 | 30 | /** 31 | * 资源已被移除 32 | */ 33 | public static final int MOVED_PERM = 301; 34 | 35 | /** 36 | * 重定向 37 | */ 38 | public static final int SEE_OTHER = 303; 39 | 40 | /** 41 | * 资源没有被修改 42 | */ 43 | public static final int NOT_MODIFIED = 304; 44 | 45 | /** 46 | * 参数列表错误(缺少,格式不匹配) 47 | */ 48 | public static final int BAD_REQUEST = 400; 49 | 50 | /** 51 | * 未授权 52 | */ 53 | public static final int UNAUTHORIZED = 401; 54 | 55 | /** 56 | * 访问受限,授权过期 57 | */ 58 | public static final int FORBIDDEN = 403; 59 | 60 | /** 61 | * 资源,服务未找到 62 | */ 63 | public static final int NOT_FOUND = 404; 64 | 65 | /** 66 | * 不允许的http方法 67 | */ 68 | public static final int BAD_METHOD = 405; 69 | 70 | /** 71 | * 资源冲突,或者资源被锁 72 | */ 73 | public static final int CONFLICT = 409; 74 | 75 | /** 76 | * 不支持的数据,媒体类型 77 | */ 78 | public static final int UNSUPPORTED_TYPE = 415; 79 | 80 | /** 81 | * 系统内部错误 82 | */ 83 | public static final int ERROR = 500; 84 | 85 | /** 86 | * 接口未实现 87 | */ 88 | public static final int NOT_IMPLEMENTED = 501; 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.yqn.common.constant.HttpStatus; 6 | import com.yqn.common.core.domain.AjaxResult; 7 | import com.yqn.common.core.page.PageDomain; 8 | import com.yqn.common.core.page.TableDataInfo; 9 | import com.yqn.common.core.page.TableSupport; 10 | import com.yqn.common.utils.DateUtils; 11 | import com.yqn.common.utils.PageUtils; 12 | import com.yqn.common.utils.StringUtils; 13 | import com.yqn.common.utils.sql.SqlUtil; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.springframework.web.bind.WebDataBinder; 17 | import org.springframework.web.bind.annotation.InitBinder; 18 | 19 | import java.beans.PropertyEditorSupport; 20 | import java.util.Date; 21 | import java.util.List; 22 | 23 | /** 24 | * web层通用数据处理 25 | * 26 | * @author ruoyi 27 | */ 28 | public class BaseController 29 | { 30 | protected final Logger logger = LoggerFactory.getLogger(this.getClass()); 31 | 32 | /** 33 | * 将前台传递过来的日期格式的字符串,自动转化为Date类型 34 | */ 35 | @InitBinder 36 | public void initBinder(WebDataBinder binder) 37 | { 38 | // Date 类型转换 39 | binder.registerCustomEditor(Date.class, new PropertyEditorSupport() 40 | { 41 | @Override 42 | public void setAsText(String text) 43 | { 44 | setValue(DateUtils.parseDate(text)); 45 | } 46 | }); 47 | } 48 | 49 | /** 50 | * 设置请求分页数据 51 | */ 52 | protected void startPage() 53 | { 54 | PageUtils.startPage(); 55 | } 56 | 57 | /** 58 | * 设置请求排序数据 59 | */ 60 | protected void startOrderBy() 61 | { 62 | PageDomain pageDomain = TableSupport.buildPageRequest(); 63 | if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) 64 | { 65 | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); 66 | PageHelper.orderBy(orderBy); 67 | } 68 | } 69 | 70 | /** 71 | * 清理分页的线程变量 72 | */ 73 | protected void clearPage() 74 | { 75 | PageUtils.clearPage(); 76 | } 77 | 78 | /** 79 | * 响应请求分页数据 80 | */ 81 | @SuppressWarnings({ "rawtypes", "unchecked" }) 82 | protected TableDataInfo getDataTable(List list) 83 | { 84 | TableDataInfo rspData = new TableDataInfo(); 85 | rspData.setCode(HttpStatus.SUCCESS); 86 | rspData.setMsg("查询成功"); 87 | rspData.setRows(list); 88 | rspData.setTotal(new PageInfo(list).getTotal()); 89 | return rspData; 90 | } 91 | 92 | /** 93 | * 返回成功 94 | */ 95 | public AjaxResult success() 96 | { 97 | return AjaxResult.success(); 98 | } 99 | 100 | /** 101 | * 返回失败消息 102 | */ 103 | public AjaxResult error() 104 | { 105 | return AjaxResult.error(); 106 | } 107 | 108 | /** 109 | * 返回成功消息 110 | */ 111 | public AjaxResult success(String message) 112 | { 113 | return AjaxResult.success(message); 114 | } 115 | 116 | /** 117 | * 返回失败消息 118 | */ 119 | public AjaxResult error(String message) 120 | { 121 | return AjaxResult.error(message); 122 | } 123 | 124 | /** 125 | * 响应返回结果 126 | * 127 | * @param rows 影响行数 128 | * @return 操作结果 129 | */ 130 | protected AjaxResult toAjax(int rows) 131 | { 132 | return rows > 0 ? AjaxResult.success() : AjaxResult.error(); 133 | } 134 | 135 | /** 136 | * 响应返回结果 137 | * 138 | * @param result 结果 139 | * @return 操作结果 140 | */ 141 | protected AjaxResult toAjax(boolean result) 142 | { 143 | return result ? success() : error(); 144 | } 145 | 146 | /** 147 | * 页面跳转 148 | */ 149 | public String redirect(String url) 150 | { 151 | return StringUtils.format("redirect:{}", url); 152 | } 153 | 154 | 155 | 156 | } 157 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/domain/AjaxResult.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.domain; 2 | 3 | import com.yqn.common.constant.HttpStatus; 4 | import com.yqn.common.utils.StringUtils; 5 | import java.util.HashMap; 6 | 7 | /** 8 | * 操作消息提醒 9 | * 10 | * @author ruoyi 11 | */ 12 | public class AjaxResult extends HashMap 13 | { 14 | private static final long serialVersionUID = 1L; 15 | 16 | /** 状态码 */ 17 | public static final String CODE_TAG = "code"; 18 | 19 | /** 返回内容 */ 20 | public static final String MSG_TAG = "msg"; 21 | 22 | /** 数据对象 */ 23 | public static final String DATA_TAG = "data"; 24 | 25 | /** 26 | * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 27 | */ 28 | public AjaxResult() 29 | { 30 | } 31 | 32 | /** 33 | * 初始化一个新创建的 AjaxResult 对象 34 | * 35 | * @param code 状态码 36 | * @param msg 返回内容 37 | */ 38 | public AjaxResult(int code, String msg) 39 | { 40 | super.put(CODE_TAG, code); 41 | super.put(MSG_TAG, msg); 42 | } 43 | 44 | /** 45 | * 初始化一个新创建的 AjaxResult 对象 46 | * 47 | * @param code 状态码 48 | * @param msg 返回内容 49 | * @param data 数据对象 50 | */ 51 | public AjaxResult(int code, String msg, Object data) 52 | { 53 | super.put(CODE_TAG, code); 54 | super.put(MSG_TAG, msg); 55 | if (StringUtils.isNotNull(data)) 56 | { 57 | super.put(DATA_TAG, data); 58 | } 59 | } 60 | 61 | /** 62 | * 返回成功消息 63 | * 64 | * @return 成功消息 65 | */ 66 | public static AjaxResult success() 67 | { 68 | return AjaxResult.success("操作成功"); 69 | } 70 | 71 | /** 72 | * 返回成功数据 73 | * 74 | * @return 成功消息 75 | */ 76 | public static AjaxResult success(Object data) 77 | { 78 | return AjaxResult.success("操作成功", data); 79 | } 80 | 81 | /** 82 | * 返回成功消息 83 | * 84 | * @param msg 返回内容 85 | * @return 成功消息 86 | */ 87 | public static AjaxResult success(String msg) 88 | { 89 | return AjaxResult.success(msg, null); 90 | } 91 | 92 | /** 93 | * 返回成功消息 94 | * 95 | * @param msg 返回内容 96 | * @param data 数据对象 97 | * @return 成功消息 98 | */ 99 | public static AjaxResult success(String msg, Object data) 100 | { 101 | return new AjaxResult(HttpStatus.SUCCESS, msg, data); 102 | } 103 | 104 | /** 105 | * 返回错误消息 106 | * 107 | * @return 108 | */ 109 | public static AjaxResult error() 110 | { 111 | return AjaxResult.error("操作失败"); 112 | } 113 | 114 | /** 115 | * 返回错误消息 116 | * 117 | * @param msg 返回内容 118 | * @return 警告消息 119 | */ 120 | public static AjaxResult error(String msg) 121 | { 122 | return AjaxResult.error(msg, null); 123 | } 124 | 125 | /** 126 | * 返回错误消息 127 | * 128 | * @param msg 返回内容 129 | * @param data 数据对象 130 | * @return 警告消息 131 | */ 132 | public static AjaxResult error(String msg, Object data) 133 | { 134 | return new AjaxResult(HttpStatus.ERROR, msg, data); 135 | } 136 | 137 | /** 138 | * 返回错误消息 139 | * 140 | * @param code 状态码 141 | * @param msg 返回内容 142 | * @return 警告消息 143 | */ 144 | public static AjaxResult error(int code, String msg) 145 | { 146 | return new AjaxResult(code, msg, null); 147 | } 148 | 149 | /** 150 | * 方便链式调用 151 | * 152 | * @param key 键 153 | * @param value 值 154 | * @return 数据对象 155 | */ 156 | @Override 157 | public AjaxResult put(String key, Object value) 158 | { 159 | super.put(key, value); 160 | return this; 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/domain/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Entity基类 12 | * 13 | * @author ruoyi 14 | */ 15 | public class BaseEntity implements Serializable 16 | { 17 | private static final long serialVersionUID = 1L; 18 | 19 | /** 搜索值 */ 20 | private String searchValue; 21 | 22 | /** 创建者 */ 23 | private String createBy; 24 | 25 | /** 创建时间 */ 26 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 27 | private Date createTime; 28 | 29 | /** 更新者 */ 30 | private String updateBy; 31 | 32 | /** 更新时间 */ 33 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 34 | private Date updateTime; 35 | 36 | /** 备注 */ 37 | private String remark; 38 | 39 | /** 请求参数 */ 40 | private Map params; 41 | 42 | public String getSearchValue() 43 | { 44 | return searchValue; 45 | } 46 | 47 | public void setSearchValue(String searchValue) 48 | { 49 | this.searchValue = searchValue; 50 | } 51 | 52 | public String getCreateBy() 53 | { 54 | return createBy; 55 | } 56 | 57 | public void setCreateBy(String createBy) 58 | { 59 | this.createBy = createBy; 60 | } 61 | 62 | public Date getCreateTime() 63 | { 64 | return createTime; 65 | } 66 | 67 | public void setCreateTime(Date createTime) 68 | { 69 | this.createTime = createTime; 70 | } 71 | 72 | public String getUpdateBy() 73 | { 74 | return updateBy; 75 | } 76 | 77 | public void setUpdateBy(String updateBy) 78 | { 79 | this.updateBy = updateBy; 80 | } 81 | 82 | public Date getUpdateTime() 83 | { 84 | return updateTime; 85 | } 86 | 87 | public void setUpdateTime(Date updateTime) 88 | { 89 | this.updateTime = updateTime; 90 | } 91 | 92 | public String getRemark() 93 | { 94 | return remark; 95 | } 96 | 97 | public void setRemark(String remark) 98 | { 99 | this.remark = remark; 100 | } 101 | 102 | public Map getParams() 103 | { 104 | if (params == null) 105 | { 106 | params = new HashMap<>(); 107 | } 108 | return params; 109 | } 110 | 111 | public void setParams(Map params) 112 | { 113 | this.params = params; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/domain/TreeEntity.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Tree基类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class TreeEntity extends BaseEntity 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 父菜单名称 */ 16 | private String parentName; 17 | 18 | /** 父菜单ID */ 19 | private Long parentId; 20 | 21 | /** 显示顺序 */ 22 | private Integer orderNum; 23 | 24 | /** 祖级列表 */ 25 | private String ancestors; 26 | 27 | /** 子部门 */ 28 | private List children = new ArrayList<>(); 29 | 30 | public String getParentName() 31 | { 32 | return parentName; 33 | } 34 | 35 | public void setParentName(String parentName) 36 | { 37 | this.parentName = parentName; 38 | } 39 | 40 | public Long getParentId() 41 | { 42 | return parentId; 43 | } 44 | 45 | public void setParentId(Long parentId) 46 | { 47 | this.parentId = parentId; 48 | } 49 | 50 | public Integer getOrderNum() 51 | { 52 | return orderNum; 53 | } 54 | 55 | public void setOrderNum(Integer orderNum) 56 | { 57 | this.orderNum = orderNum; 58 | } 59 | 60 | public String getAncestors() 61 | { 62 | return ancestors; 63 | } 64 | 65 | public void setAncestors(String ancestors) 66 | { 67 | this.ancestors = ancestors; 68 | } 69 | 70 | public List getChildren() 71 | { 72 | return children; 73 | } 74 | 75 | public void setChildren(List children) 76 | { 77 | this.children = children; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/page/PageDomain.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.page; 2 | 3 | import com.yqn.common.utils.StringUtils; 4 | 5 | /** 6 | * 分页数据 7 | * 8 | * @author ruoyi 9 | */ 10 | public class PageDomain 11 | { 12 | /** 当前记录起始索引 */ 13 | private Integer pageNum; 14 | 15 | /** 每页显示记录数 */ 16 | private Integer pageSize; 17 | 18 | /** 排序列 */ 19 | private String orderByColumn; 20 | 21 | /** 排序的方向desc或者asc */ 22 | private String isAsc = "asc"; 23 | 24 | /** 分页参数合理化 */ 25 | private Boolean reasonable = true; 26 | 27 | public String getOrderBy() 28 | { 29 | if (StringUtils.isEmpty(orderByColumn)) 30 | { 31 | return ""; 32 | } 33 | return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; 34 | } 35 | 36 | public Integer getPageNum() 37 | { 38 | return pageNum; 39 | } 40 | 41 | public void setPageNum(Integer pageNum) 42 | { 43 | this.pageNum = pageNum; 44 | } 45 | 46 | public Integer getPageSize() 47 | { 48 | return pageSize; 49 | } 50 | 51 | public void setPageSize(Integer pageSize) 52 | { 53 | this.pageSize = pageSize; 54 | } 55 | 56 | public String getOrderByColumn() 57 | { 58 | return orderByColumn; 59 | } 60 | 61 | public void setOrderByColumn(String orderByColumn) 62 | { 63 | this.orderByColumn = orderByColumn; 64 | } 65 | 66 | public String getIsAsc() 67 | { 68 | return isAsc; 69 | } 70 | 71 | public void setIsAsc(String isAsc) 72 | { 73 | if (StringUtils.isNotEmpty(isAsc)) 74 | { 75 | // 兼容前端排序类型 76 | if ("ascending".equals(isAsc)) 77 | { 78 | isAsc = "asc"; 79 | } 80 | else if ("descending".equals(isAsc)) 81 | { 82 | isAsc = "desc"; 83 | } 84 | this.isAsc = isAsc; 85 | } 86 | } 87 | 88 | public Boolean getReasonable() 89 | { 90 | if (StringUtils.isNull(reasonable)) 91 | { 92 | return Boolean.TRUE; 93 | } 94 | return reasonable; 95 | } 96 | 97 | public void setReasonable(Boolean reasonable) 98 | { 99 | this.reasonable = reasonable; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/page/TableDataInfo.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.page; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * 表格分页数据对象 8 | * 9 | * @author ruoyi 10 | */ 11 | public class TableDataInfo implements Serializable 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 总记录数 */ 16 | private long total; 17 | 18 | /** 列表数据 */ 19 | private List rows; 20 | 21 | /** 消息状态码 */ 22 | private int code; 23 | 24 | /** 消息内容 */ 25 | private String msg; 26 | 27 | /** 28 | * 表格数据对象 29 | */ 30 | public TableDataInfo() 31 | { 32 | } 33 | 34 | /** 35 | * 分页 36 | * 37 | * @param list 列表数据 38 | * @param total 总记录数 39 | */ 40 | public TableDataInfo(List list, int total) 41 | { 42 | this.rows = list; 43 | this.total = total; 44 | } 45 | 46 | public long getTotal() 47 | { 48 | return total; 49 | } 50 | 51 | public void setTotal(long total) 52 | { 53 | this.total = total; 54 | } 55 | 56 | public List getRows() 57 | { 58 | return rows; 59 | } 60 | 61 | public void setRows(List rows) 62 | { 63 | this.rows = rows; 64 | } 65 | 66 | public int getCode() 67 | { 68 | return code; 69 | } 70 | 71 | public void setCode(int code) 72 | { 73 | this.code = code; 74 | } 75 | 76 | public String getMsg() 77 | { 78 | return msg; 79 | } 80 | 81 | public void setMsg(String msg) 82 | { 83 | this.msg = msg; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/page/TableSupport.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.page; 2 | 3 | import com.yqn.common.utils.ServletUtils; 4 | 5 | /** 6 | * 表格数据处理 7 | * 8 | * @author ruoyi 9 | */ 10 | public class TableSupport 11 | { 12 | /** 13 | * 当前记录起始索引 14 | */ 15 | public static final String PAGE_NUM = "pageNum"; 16 | 17 | /** 18 | * 每页显示记录数 19 | */ 20 | public static final String PAGE_SIZE = "pageSize"; 21 | 22 | /** 23 | * 排序列 24 | */ 25 | public static final String ORDER_BY_COLUMN = "orderByColumn"; 26 | 27 | /** 28 | * 排序的方向 "desc" 或者 "asc". 29 | */ 30 | public static final String IS_ASC = "isAsc"; 31 | 32 | /** 33 | * 分页参数合理化 34 | */ 35 | public static final String REASONABLE = "reasonable"; 36 | 37 | /** 38 | * 封装分页对象 39 | */ 40 | public static PageDomain getPageDomain() 41 | { 42 | PageDomain pageDomain = new PageDomain(); 43 | pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); 44 | pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); 45 | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); 46 | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); 47 | pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); 48 | return pageDomain; 49 | } 50 | 51 | public static PageDomain buildPageRequest() 52 | { 53 | return getPageDomain(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/text/CharsetKit.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.text; 2 | 3 | import com.yqn.common.utils.StringUtils; 4 | 5 | import java.nio.charset.Charset; 6 | import java.nio.charset.StandardCharsets; 7 | 8 | /** 9 | * 字符集工具类 10 | * 11 | * @author ruoyi 12 | */ 13 | public class CharsetKit 14 | { 15 | /** ISO-8859-1 */ 16 | public static final String ISO_8859_1 = "ISO-8859-1"; 17 | /** UTF-8 */ 18 | public static final String UTF_8 = "UTF-8"; 19 | /** GBK */ 20 | public static final String GBK = "GBK"; 21 | 22 | /** ISO-8859-1 */ 23 | public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); 24 | /** UTF-8 */ 25 | public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); 26 | /** GBK */ 27 | public static final Charset CHARSET_GBK = Charset.forName(GBK); 28 | 29 | /** 30 | * 转换为Charset对象 31 | * 32 | * @param charset 字符集,为空则返回默认字符集 33 | * @return Charset 34 | */ 35 | public static Charset charset(String charset) 36 | { 37 | return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); 38 | } 39 | 40 | /** 41 | * 转换字符串的字符集编码 42 | * 43 | * @param source 字符串 44 | * @param srcCharset 源字符集,默认ISO-8859-1 45 | * @param destCharset 目标字符集,默认UTF-8 46 | * @return 转换后的字符集 47 | */ 48 | public static String convert(String source, String srcCharset, String destCharset) 49 | { 50 | return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); 51 | } 52 | 53 | /** 54 | * 转换字符串的字符集编码 55 | * 56 | * @param source 字符串 57 | * @param srcCharset 源字符集,默认ISO-8859-1 58 | * @param destCharset 目标字符集,默认UTF-8 59 | * @return 转换后的字符集 60 | */ 61 | public static String convert(String source, Charset srcCharset, Charset destCharset) 62 | { 63 | if (null == srcCharset) 64 | { 65 | srcCharset = StandardCharsets.ISO_8859_1; 66 | } 67 | 68 | if (null == destCharset) 69 | { 70 | destCharset = StandardCharsets.UTF_8; 71 | } 72 | 73 | if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) 74 | { 75 | return source; 76 | } 77 | return new String(source.getBytes(srcCharset), destCharset); 78 | } 79 | 80 | /** 81 | * @return 系统字符集编码 82 | */ 83 | public static String systemCharset() 84 | { 85 | return Charset.defaultCharset().name(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/core/text/StrFormatter.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.core.text; 2 | 3 | import com.yqn.common.utils.StringUtils; 4 | 5 | /** 6 | * 字符串格式化 7 | * 8 | * @author ruoyi 9 | */ 10 | public class StrFormatter 11 | { 12 | public static final String EMPTY_JSON = "{}"; 13 | public static final char C_BACKSLASH = '\\'; 14 | public static final char C_DELIM_START = '{'; 15 | public static final char C_DELIM_END = '}'; 16 | 17 | /** 18 | * 格式化字符串
19 | * 此方法只是简单将占位符 {} 按照顺序替换为参数
20 | * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
21 | * 例:
22 | * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
23 | * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
24 | * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
25 | * 26 | * @param strPattern 字符串模板 27 | * @param argArray 参数列表 28 | * @return 结果 29 | */ 30 | public static String format(final String strPattern, final Object... argArray) 31 | { 32 | if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) 33 | { 34 | return strPattern; 35 | } 36 | final int strPatternLength = strPattern.length(); 37 | 38 | // 初始化定义好的长度以获得更好的性能 39 | StringBuilder sbuf = new StringBuilder(strPatternLength + 50); 40 | 41 | int handledPosition = 0; 42 | int delimIndex;// 占位符所在位置 43 | for (int argIndex = 0; argIndex < argArray.length; argIndex++) 44 | { 45 | delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); 46 | if (delimIndex == -1) 47 | { 48 | if (handledPosition == 0) 49 | { 50 | return strPattern; 51 | } 52 | else 53 | { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 54 | sbuf.append(strPattern, handledPosition, strPatternLength); 55 | return sbuf.toString(); 56 | } 57 | } 58 | else 59 | { 60 | if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) 61 | { 62 | if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) 63 | { 64 | // 转义符之前还有一个转义符,占位符依旧有效 65 | sbuf.append(strPattern, handledPosition, delimIndex - 1); 66 | sbuf.append(Convert.utf8Str(argArray[argIndex])); 67 | handledPosition = delimIndex + 2; 68 | } 69 | else 70 | { 71 | // 占位符被转义 72 | argIndex--; 73 | sbuf.append(strPattern, handledPosition, delimIndex - 1); 74 | sbuf.append(C_DELIM_START); 75 | handledPosition = delimIndex + 1; 76 | } 77 | } 78 | else 79 | { 80 | // 正常占位符 81 | sbuf.append(strPattern, handledPosition, delimIndex); 82 | sbuf.append(Convert.utf8Str(argArray[argIndex])); 83 | handledPosition = delimIndex + 2; 84 | } 85 | } 86 | } 87 | // 加入最后一个占位符后所有的字符 88 | sbuf.append(strPattern, handledPosition, strPattern.length()); 89 | 90 | return sbuf.toString(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/exception/UtilException.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.exception; 2 | 3 | /** 4 | * 工具类异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class UtilException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 8247610319171014183L; 11 | 12 | public UtilException(Throwable e) 13 | { 14 | super(e.getMessage(), e); 15 | } 16 | 17 | public UtilException(String message) 18 | { 19 | super(message); 20 | } 21 | 22 | public UtilException(String message, Throwable throwable) 23 | { 24 | super(message, throwable); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/tools/MessageTools.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.tools; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * @author sxc 10 | */ 11 | // @Configuration 12 | @Component 13 | public class MessageTools { 14 | // 返回json信息 15 | /*public Map message(boolean status, Object o) { 16 | Map map = new HashMap<>(); 17 | map.put("status", status); 18 | map.put("msg", o); 19 | return map; 20 | }*/ 21 | 22 | public Map message(boolean status, String msg, String oMsg, Object o) { 23 | Map map = new HashMap<>(); 24 | map.put("status", status); 25 | map.put("msg", msg); 26 | if (!msg.equals("") && o != null) { 27 | map.put(oMsg, o); 28 | } 29 | return map; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/tools/PocketMoney.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.tools; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 4 | import com.yqn.pojo.User; 5 | import com.yqn.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * @author sxc 13 | */ 14 | @Component 15 | public class PocketMoney { 16 | @Autowired 17 | private UserService userService; 18 | @Autowired 19 | private MessageTools tools; 20 | 21 | // 零钱通用方法 22 | public Map transfer(String condition, Double balance, String studentId) { 23 | UpdateWrapper wrapper = new UpdateWrapper<>(); 24 | wrapper.setSql(condition + balance) 25 | .eq("student_id", studentId); 26 | boolean update = userService.update(wrapper); 27 | if (update) { 28 | return tools.message(true, "success", "", null); 29 | } 30 | return tools.message(false, "error", "", null); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.utils; 2 | 3 | import org.apache.commons.lang3.time.DateFormatUtils; 4 | 5 | import java.lang.management.ManagementFactory; 6 | import java.text.ParseException; 7 | import java.text.SimpleDateFormat; 8 | import java.time.*; 9 | import java.util.Date; 10 | 11 | /** 12 | * 时间工具类 13 | * 14 | * @author ruoyi 15 | */ 16 | public class DateUtils extends org.apache.commons.lang3.time.DateUtils 17 | { 18 | public static String YYYY = "yyyy"; 19 | 20 | public static String YYYY_MM = "yyyy-MM"; 21 | 22 | public static String YYYY_MM_DD = "yyyy-MM-dd"; 23 | 24 | public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; 25 | 26 | public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; 27 | 28 | private static String[] parsePatterns = { 29 | "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", 30 | "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", 31 | "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; 32 | 33 | /** 34 | * 获取当前Date型日期 35 | * 36 | * @return Date() 当前日期 37 | */ 38 | public static Date getNowDate() 39 | { 40 | return new Date(); 41 | } 42 | 43 | /** 44 | * 获取当前日期, 默认格式为yyyy-MM-dd 45 | * 46 | * @return String 47 | */ 48 | public static String getDate() 49 | { 50 | return dateTimeNow(YYYY_MM_DD); 51 | } 52 | 53 | public static final String getTime() 54 | { 55 | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); 56 | } 57 | 58 | public static final String dateTimeNow() 59 | { 60 | return dateTimeNow(YYYYMMDDHHMMSS); 61 | } 62 | 63 | public static final String dateTimeNow(final String format) 64 | { 65 | return parseDateToStr(format, new Date()); 66 | } 67 | 68 | public static final String dateTime(final Date date) 69 | { 70 | return parseDateToStr(YYYY_MM_DD, date); 71 | } 72 | 73 | public static final String parseDateToStr(final String format, final Date date) 74 | { 75 | return new SimpleDateFormat(format).format(date); 76 | } 77 | 78 | public static final Date dateTime(final String format, final String ts) 79 | { 80 | try 81 | { 82 | return new SimpleDateFormat(format).parse(ts); 83 | } 84 | catch (ParseException e) 85 | { 86 | throw new RuntimeException(e); 87 | } 88 | } 89 | 90 | /** 91 | * 日期路径 即年/月/日 如2018/08/08 92 | */ 93 | public static final String datePath() 94 | { 95 | Date now = new Date(); 96 | return DateFormatUtils.format(now, "yyyy/MM/dd"); 97 | } 98 | 99 | /** 100 | * 日期路径 即年/月/日 如20180808 101 | */ 102 | public static final String dateTime() 103 | { 104 | Date now = new Date(); 105 | return DateFormatUtils.format(now, "yyyyMMdd"); 106 | } 107 | 108 | /** 109 | * 日期型字符串转化为日期 格式 110 | */ 111 | public static Date parseDate(Object str) 112 | { 113 | if (str == null) 114 | { 115 | return null; 116 | } 117 | try 118 | { 119 | return parseDate(str.toString(), parsePatterns); 120 | } 121 | catch (ParseException e) 122 | { 123 | return null; 124 | } 125 | } 126 | 127 | /** 128 | * 获取服务器启动时间 129 | */ 130 | public static Date getServerStartDate() 131 | { 132 | long time = ManagementFactory.getRuntimeMXBean().getStartTime(); 133 | return new Date(time); 134 | } 135 | 136 | /** 137 | * 计算相差天数 138 | */ 139 | public static int differentDaysByMillisecond(Date date1, Date date2) 140 | { 141 | return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); 142 | } 143 | 144 | /** 145 | * 计算两个时间差 146 | */ 147 | public static String getDatePoor(Date endDate, Date nowDate) 148 | { 149 | long nd = 1000 * 24 * 60 * 60; 150 | long nh = 1000 * 60 * 60; 151 | long nm = 1000 * 60; 152 | // long ns = 1000; 153 | // 获得两个时间的毫秒时间差异 154 | long diff = endDate.getTime() - nowDate.getTime(); 155 | // 计算差多少天 156 | long day = diff / nd; 157 | // 计算差多少小时 158 | long hour = diff % nd / nh; 159 | // 计算差多少分钟 160 | long min = diff % nd % nh / nm; 161 | // 计算差多少秒//输出结果 162 | // long sec = diff % nd % nh % nm / ns; 163 | return day + "天" + hour + "小时" + min + "分钟"; 164 | } 165 | 166 | /** 167 | * 增加 LocalDateTime ==> Date 168 | */ 169 | public static Date toDate(LocalDateTime temporalAccessor) 170 | { 171 | ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); 172 | return Date.from(zdt.toInstant()); 173 | } 174 | 175 | /** 176 | * 增加 LocalDate ==> Date 177 | */ 178 | public static Date toDate(LocalDate temporalAccessor) 179 | { 180 | LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); 181 | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); 182 | return Date.from(zdt.toInstant()); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.utils; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.yqn.common.core.page.PageDomain; 5 | import com.yqn.common.core.page.TableSupport; 6 | import com.yqn.common.utils.sql.SqlUtil; 7 | 8 | /** 9 | * 分页工具类 10 | * 11 | * @author ruoyi 12 | */ 13 | public class PageUtils extends PageHelper 14 | { 15 | /** 16 | * 设置请求分页数据 17 | */ 18 | public static void startPage() 19 | { 20 | PageDomain pageDomain = TableSupport.buildPageRequest(); 21 | Integer pageNum = pageDomain.getPageNum(); 22 | Integer pageSize = pageDomain.getPageSize(); 23 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) 24 | { 25 | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); 26 | Boolean reasonable = pageDomain.getReasonable(); 27 | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); 28 | } 29 | } 30 | 31 | /** 32 | * 清理分页的线程变量 33 | */ 34 | public static void clearPage() 35 | { 36 | PageHelper.clearPage(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/utils/ServletUtils.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.utils; 2 | 3 | import com.yqn.common.core.text.Convert; 4 | import org.springframework.web.context.request.RequestAttributes; 5 | import org.springframework.web.context.request.RequestContextHolder; 6 | import org.springframework.web.context.request.ServletRequestAttributes; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import javax.servlet.http.HttpSession; 11 | import java.io.IOException; 12 | 13 | /** 14 | * 客户端工具类 15 | * 16 | * @author ruoyi 17 | */ 18 | public class ServletUtils 19 | { 20 | /** 21 | * 获取String参数 22 | */ 23 | public static String getParameter(String name) 24 | { 25 | return getRequest().getParameter(name); 26 | } 27 | 28 | /** 29 | * 获取String参数 30 | */ 31 | public static String getParameter(String name, String defaultValue) 32 | { 33 | return Convert.toStr(getRequest().getParameter(name), defaultValue); 34 | } 35 | 36 | /** 37 | * 获取Integer参数 38 | */ 39 | public static Integer getParameterToInt(String name) 40 | { 41 | return Convert.toInt(getRequest().getParameter(name)); 42 | } 43 | 44 | /** 45 | * 获取Integer参数 46 | */ 47 | public static Integer getParameterToInt(String name, Integer defaultValue) 48 | { 49 | return Convert.toInt(getRequest().getParameter(name), defaultValue); 50 | } 51 | 52 | /** 53 | * 获取Boolean参数 54 | */ 55 | public static Boolean getParameterToBool(String name) 56 | { 57 | return Convert.toBool(getRequest().getParameter(name)); 58 | } 59 | 60 | /** 61 | * 获取Boolean参数 62 | */ 63 | public static Boolean getParameterToBool(String name, Boolean defaultValue) 64 | { 65 | return Convert.toBool(getRequest().getParameter(name), defaultValue); 66 | } 67 | 68 | /** 69 | * 获取request 70 | */ 71 | public static HttpServletRequest getRequest() 72 | { 73 | return getRequestAttributes().getRequest(); 74 | } 75 | 76 | /** 77 | * 获取response 78 | */ 79 | public static HttpServletResponse getResponse() 80 | { 81 | return getRequestAttributes().getResponse(); 82 | } 83 | 84 | /** 85 | * 获取session 86 | */ 87 | public static HttpSession getSession() 88 | { 89 | return getRequest().getSession(); 90 | } 91 | 92 | public static ServletRequestAttributes getRequestAttributes() 93 | { 94 | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); 95 | return (ServletRequestAttributes) attributes; 96 | } 97 | 98 | /** 99 | * 将字符串渲染到客户端 100 | * 101 | * @param response 渲染对象 102 | * @param string 待渲染的字符串 103 | */ 104 | public static void renderString(HttpServletResponse response, String string) 105 | { 106 | try 107 | { 108 | response.setStatus(200); 109 | response.setContentType("application/json"); 110 | response.setCharacterEncoding("utf-8"); 111 | response.getWriter().print(string); 112 | } 113 | catch (IOException e) 114 | { 115 | e.printStackTrace(); 116 | } 117 | } 118 | 119 | /** 120 | * 是否是Ajax异步请求 121 | * 122 | * @param request 123 | */ 124 | public static boolean isAjaxRequest(HttpServletRequest request) 125 | { 126 | String accept = request.getHeader("accept"); 127 | if (accept != null && accept.contains("application/json")) 128 | { 129 | return true; 130 | } 131 | 132 | String xRequestedWith = request.getHeader("X-Requested-With"); 133 | if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) 134 | { 135 | return true; 136 | } 137 | 138 | String uri = request.getRequestURI(); 139 | if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) 140 | { 141 | return true; 142 | } 143 | 144 | String ajax = request.getParameter("__ajax"); 145 | return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/common/utils/sql/SqlUtil.java: -------------------------------------------------------------------------------- 1 | package com.yqn.common.utils.sql; 2 | 3 | import com.yqn.common.exception.UtilException; 4 | import com.yqn.common.utils.StringUtils; 5 | 6 | /** 7 | * sql操作工具类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SqlUtil 12 | { 13 | /** 14 | * 定义常用的 sql关键字 15 | */ 16 | public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare "; 17 | 18 | /** 19 | * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) 20 | */ 21 | public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; 22 | 23 | /** 24 | * 检查字符,防止注入绕过 25 | */ 26 | public static String escapeOrderBySql(String value) 27 | { 28 | if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) 29 | { 30 | throw new UtilException("参数不符合规范,不能进行查询"); 31 | } 32 | return value; 33 | } 34 | 35 | /** 36 | * 验证 order by 语法是否符合规范 37 | */ 38 | public static boolean isValidOrderBySql(String value) 39 | { 40 | return value.matches(SQL_PATTERN); 41 | } 42 | 43 | /** 44 | * SQL关键字检查 45 | */ 46 | public static void filterKeyword(String value) 47 | { 48 | if (StringUtils.isEmpty(value)) 49 | { 50 | return; 51 | } 52 | String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|"); 53 | for (String sqlKeyword : sqlKeywords) 54 | { 55 | if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) 56 | { 57 | throw new UtilException("参数存在SQL注入风险"); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.yqn.pojo.Admin; 5 | import com.yqn.service.AdminService; 6 | import com.yqn.common.tools.MessageTools; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import javax.servlet.http.HttpSession; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author sxc 15 | */ 16 | @RestController 17 | @RequestMapping("/admin") 18 | public class AdminController { 19 | @Autowired 20 | private AdminService adminService; 21 | 22 | @Autowired 23 | private MessageTools message; 24 | 25 | @GetMapping 26 | public Map checkAdminLogin(String account, String password, HttpSession session) { 27 | QueryWrapper wrapper = new QueryWrapper<>(); 28 | wrapper.eq("account", account); 29 | wrapper.eq("password", password); 30 | 31 | Admin admin = adminService.getOne(wrapper); 32 | if (admin != null) { 33 | session.setAttribute("admin", admin); 34 | // return message.message(true, admin); 35 | return message.message(true, "请求成功", "admin", admin); 36 | } 37 | 38 | // return message.message(false, "账号或密码错误"); 39 | return message.message(false, "账号或密码错误", "", null); 40 | } 41 | 42 | @PostMapping 43 | public Map saveAdmin(Admin admin) { 44 | boolean result = adminService.save(admin); 45 | if (result) { 46 | return message.message(true, "Admin,添加成功", "", null); 47 | } 48 | return message.message(false, "Admin已存在,添加失败", "", null); 49 | } 50 | 51 | @DeleteMapping("/{id}") 52 | public Map delAdmin(@PathVariable Long id) { 53 | boolean b = adminService.removeById(id); 54 | if (b) { 55 | return message.message(true, "Admin,删除成功", "", null); 56 | } 57 | return message.message(false, "Admin,删除失败", "", null); 58 | } 59 | 60 | @PutMapping 61 | public Map putadmin(Admin admin) { 62 | boolean b = adminService.updateById(admin); 63 | if (b) { 64 | return message.message(true, "Admin,更新信息成功", "", null); 65 | } 66 | return message.message(false, "Admin,更新信息失败", "", null); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/ClassController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.yqn.pojo.Class; 5 | import com.yqn.service.ClassService; 6 | import com.yqn.common.tools.MessageTools; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author sxc 15 | */ 16 | @RestController 17 | @RequestMapping("/class") 18 | public class ClassController { 19 | @Autowired 20 | private ClassService classService; 21 | @Autowired 22 | private MessageTools message; 23 | 24 | // 获取全部class 25 | @GetMapping 26 | public Map myClass() { 27 | List c = classService.list(); 28 | return message.message(true, "请求成功", "class", c); 29 | } 30 | 31 | // 根据id获取myClass 32 | @GetMapping("/{id}") 33 | public Map myClass(@PathVariable Long id) { 34 | Class c = classService.getById(id); 35 | return message.message(true, "请求成功", "class", c); 36 | } 37 | 38 | // 添加myClass 39 | @PostMapping 40 | public Map saveClass(Class c) { 41 | QueryWrapper wrapper = new QueryWrapper<>(); 42 | wrapper.eq("school_id", c.getSchoolId()) 43 | .eq("dept_id", c.getDeptId()) 44 | .eq("name", c.getName()); 45 | 46 | Class one = classService.getOne(wrapper); 47 | if (one == null) { 48 | classService.save(c); 49 | return message.message(true, "添加班级成功", "", null); 50 | } 51 | 52 | return message.message(true, "error, 班级已存在", "", null); 53 | } 54 | 55 | // 删除 56 | @DeleteMapping("/{id}") 57 | public Map delClass(@PathVariable Long id) { 58 | boolean remove = classService.removeById(id); 59 | if (remove) { 60 | return message.message(true, "删除成功", "", null); 61 | } 62 | return message.message(true, "error, 删除失败", "", null); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/DeptController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.yqn.pojo.Dept; 5 | import com.yqn.service.DeptService; 6 | import com.yqn.common.tools.MessageTools; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author sxc 15 | */ 16 | @RestController 17 | @RequestMapping("/dept") 18 | public class DeptController { 19 | @Autowired 20 | private DeptService deptService; 21 | @Autowired 22 | private MessageTools message; 23 | 24 | // 获取全部dept 25 | @GetMapping 26 | public Map depts() { 27 | List depts = deptService.list(); 28 | return message.message(true, "请求成功", "dept", depts); 29 | } 30 | 31 | // 根据id获取dept 32 | @GetMapping("/{id}") 33 | public Map dept(@PathVariable Long id) { 34 | Dept dept = deptService.getById(id); 35 | return message.message(true, "请求成功", "dept", dept); 36 | } 37 | 38 | // 添加dept 39 | @PostMapping 40 | public Map saveDept(Dept dept) { 41 | QueryWrapper wrapper = new QueryWrapper<>(); 42 | wrapper.eq("school_id", dept.getSchoolId()) 43 | .eq("name", dept.getName()); 44 | 45 | Dept one = deptService.getOne(wrapper); 46 | if (one == null) { 47 | deptService.save(dept); 48 | return message.message(true, "添加系别成功", "", null); 49 | } 50 | 51 | return message.message(true, "error, 该系已存在", "", null); 52 | } 53 | 54 | // 删除 55 | @DeleteMapping("/{id}") 56 | public Map delDept(@PathVariable Long id) { 57 | boolean remove = deptService.removeById(id); 58 | if (remove) { 59 | return message.message(true, "删除成功", "", null); 60 | } 61 | return message.message(true, "error, 删除失败", "", null); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/NoticeController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.yqn.common.core.controller.BaseController; 4 | import com.yqn.common.core.domain.AjaxResult; 5 | import com.yqn.common.core.page.TableDataInfo; 6 | import com.yqn.pojo.Notice; 7 | import com.yqn.service.INoticeService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | 14 | 15 | /** 16 | * 通知公告公告Controller 17 | * 18 | * @author sxc 19 | * @date 2022-05-13 20 | */ 21 | @RestController 22 | @RequestMapping("/notice/advise") 23 | public class NoticeController extends BaseController 24 | { 25 | @Autowired 26 | private INoticeService noticeService; 27 | 28 | /** 29 | * 查询通知公告公告列表 30 | */ 31 | @GetMapping("/list") 32 | public TableDataInfo list(Notice notice) 33 | { 34 | startPage(); 35 | List list = noticeService.selectNoticeList(notice); 36 | return getDataTable(list); 37 | } 38 | 39 | 40 | /** 41 | * 获取通知公告公告详细信息 42 | */ 43 | @GetMapping(value = "/{noticeId}") 44 | public AjaxResult getInfo(@PathVariable("noticeId") Integer noticeId) 45 | { 46 | return AjaxResult.success(noticeService.selectNoticeByNoticeId(noticeId)); 47 | } 48 | 49 | /** 50 | * 新增通知公告公告 51 | */ 52 | @PostMapping 53 | public AjaxResult add(@RequestBody Notice notice) 54 | { 55 | 56 | return toAjax(noticeService.insertNotice(notice)); 57 | } 58 | 59 | /** 60 | * 修改通知公告公告 61 | */ 62 | @PutMapping 63 | public AjaxResult edit(@RequestBody Notice notice) 64 | { 65 | return toAjax(noticeService.updateNotice(notice)); 66 | } 67 | 68 | /** 69 | * 删除通知公告公告 70 | */ 71 | @DeleteMapping("/{noticeIds}") 72 | public AjaxResult remove(@PathVariable Integer[] noticeIds) 73 | { 74 | return toAjax(noticeService.deleteNoticeByNoticeIds(noticeIds)); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/SchoolController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.yqn.common.tools.MessageTools; 4 | import com.yqn.pojo.School; 5 | import com.yqn.service.SchoolService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @RestController 16 | @RequestMapping("/school") 17 | public class SchoolController { 18 | @Autowired 19 | private SchoolService schoolService; 20 | @Autowired 21 | private MessageTools message; 22 | 23 | // 获取全部school 24 | @GetMapping 25 | public Map schools() { 26 | List schools = schoolService.list(); 27 | return message.message(true, "请求成功", "school", schools); 28 | } 29 | 30 | // 根据id获取school 31 | @GetMapping("/{id}") 32 | public Map findSchoolsById(@PathVariable String id) { 33 | School school = schoolService.getById(id); 34 | return message.message(true, "请求成功", "school", school); 35 | } 36 | 37 | // 添加school 38 | @PostMapping 39 | public Map saveSchool(School school) { 40 | boolean save = schoolService.save(school); 41 | if (save) { 42 | return message.message(true, "添加学校成功", "", null); 43 | } 44 | return message.message(false, "error,学校已存在", "", null); 45 | } 46 | 47 | 48 | // 删除school 49 | @DeleteMapping("/{id}") 50 | public Map delSchool(@PathVariable Long id) { 51 | boolean remove = schoolService.removeById(id); 52 | if (remove) { 53 | return message.message(true, "删除学校成功", "", null); 54 | } 55 | return message.message(false, "error,删除学校失败", "", null); 56 | } 57 | 58 | // 更新school 59 | @PutMapping 60 | public Map putSchool(School school) { 61 | boolean update = schoolService.updateById(school); 62 | if (update) { 63 | return message.message(true, "更新学校信息成功", "", null); 64 | } 65 | return message.message(false, "error,更新学校信息失败", "", null); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/SxcRemarkController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.yqn.common.core.controller.BaseController; 4 | import com.yqn.common.core.domain.AjaxResult; 5 | import com.yqn.common.core.page.TableDataInfo; 6 | import com.yqn.pojo.SxcRemark; 7 | import com.yqn.service.ISxcRemarkService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | import java.util.List; 11 | 12 | /** 13 | * remarkController 14 | * 15 | * @author sxc 16 | * @date 2022-05-16 17 | */ 18 | @RestController 19 | @RequestMapping("/student/remark") 20 | public class SxcRemarkController extends BaseController 21 | { 22 | @Autowired 23 | private ISxcRemarkService sxcRemarkService; 24 | 25 | /** 26 | * 查询remark列表 27 | */ 28 | @GetMapping("/list") 29 | public TableDataInfo list(SxcRemark sxcRemark) 30 | { 31 | startPage(); 32 | List list = sxcRemarkService.selectSxcRemarkList(sxcRemark); 33 | return getDataTable(list); 34 | } 35 | 36 | /** 37 | * 获取remark详细信息 38 | */ 39 | @GetMapping(value = "/{id}") 40 | public AjaxResult getInfo(@PathVariable("id") Long id) 41 | { 42 | return AjaxResult.success(sxcRemarkService.selectSxcRemarkById(id)); 43 | } 44 | 45 | /** 46 | * 新增remark 47 | */ 48 | @PostMapping 49 | public AjaxResult add(@RequestBody SxcRemark sxcRemark) 50 | { 51 | return toAjax(sxcRemarkService.insertSxcRemark(sxcRemark)); 52 | } 53 | 54 | /** 55 | * 修改remark 56 | */ 57 | @PutMapping 58 | public AjaxResult edit(@RequestBody SxcRemark sxcRemark) 59 | { 60 | return toAjax(sxcRemarkService.updateSxcRemark(sxcRemark)); 61 | } 62 | 63 | /** 64 | * 删除remark 65 | */ 66 | @DeleteMapping("/{ids}") 67 | public AjaxResult remove(@PathVariable Long[] ids) 68 | { 69 | return toAjax(sxcRemarkService.deleteSxcRemarkByIds(ids)); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/SxcStudentController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.yqn.common.core.controller.BaseController; 4 | import com.yqn.common.core.domain.AjaxResult; 5 | import com.yqn.common.core.page.TableDataInfo; 6 | import com.yqn.common.tools.MessageTools; 7 | import com.yqn.pojo.SxcStudent; 8 | import com.yqn.service.ISxcStudentService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * 学生管理Controller 17 | * 18 | * @author sxc 19 | * @date 2022-05-05 20 | */ 21 | @RestController 22 | @RequestMapping("/student/stuage") 23 | public class SxcStudentController extends BaseController 24 | { 25 | @Autowired 26 | private ISxcStudentService sxcStudentService; 27 | 28 | @Autowired 29 | private MessageTools message; 30 | 31 | /** 32 | * 查询学生管理列表 33 | */ 34 | @GetMapping("/list") 35 | public TableDataInfo list(SxcStudent sxcStudent) 36 | { 37 | startPage(); 38 | List list = sxcStudentService.selectSxcStudentList(sxcStudent); 39 | return getDataTable(list); 40 | } 41 | 42 | /** 43 | * 获取学生管理详细信息 44 | */ 45 | // @GetMapping("/{id}") 46 | // public AjaxResult getInfo(@PathVariable("id") Long id) 47 | // { 48 | // return AjaxResult.success(sxcStudentService.selectSxcStudentById(id)); 49 | // } 50 | 51 | @GetMapping("/{id}") 52 | public Map findSxcStudentById(@PathVariable Long id) { 53 | SxcStudent student = sxcStudentService.selectSxcStudentById(id); 54 | return message.message(true, "请求成功", "student", student); 55 | } 56 | 57 | /** 58 | * 新增学生管理 59 | */ 60 | @PostMapping 61 | public AjaxResult add(@RequestBody SxcStudent sxcStudent) 62 | { 63 | return toAjax(sxcStudentService.insertSxcStudent(sxcStudent)); 64 | } 65 | 66 | /** 67 | * 修改学生管理 68 | */ 69 | @PutMapping 70 | public AjaxResult edit(@RequestBody SxcStudent sxcStudent) 71 | { 72 | return toAjax(sxcStudentService.updateSxcStudent(sxcStudent)); 73 | } 74 | 75 | /** 76 | * 删除学生管理 77 | */ 78 | @DeleteMapping("/{ids}") 79 | public AjaxResult remove(@PathVariable Long[] ids) 80 | { 81 | return toAjax(sxcStudentService.deleteSxcStudentByIds(ids)); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/TaskController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 5 | import com.yqn.pojo.Task; 6 | import com.yqn.pojo.User; 7 | import com.yqn.service.TaskService; 8 | import com.yqn.common.tools.MessageTools; 9 | import com.yqn.common.tools.PocketMoney; 10 | import com.yqn.service.UserService; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | import javax.servlet.http.HttpSession; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * @author sxc 20 | */ 21 | @RestController 22 | @RequestMapping("/task") 23 | @Slf4j 24 | public class TaskController { 25 | @Autowired 26 | private TaskService taskService; 27 | @Autowired 28 | private UserService userService; 29 | @Autowired 30 | private MessageTools message; 31 | @Autowired 32 | private PocketMoney money; 33 | 34 | // 获取当前登录user所在学校的任务 35 | @GetMapping 36 | public Map tasks(Long id) { 37 | User user = userService.getById(id); 38 | if (user != null) { 39 | QueryWrapper wrapper = new QueryWrapper<>(); 40 | wrapper.eq("user_school_id", user.getSchool().getId()); 41 | 42 | return message.message(true, "请求成功", "task", taskService.list(wrapper)); 43 | } 44 | List tasks = taskService.list(); 45 | return message.message(true, "请求成功", "task", tasks); 46 | } 47 | 48 | // 根据id获取task 49 | @GetMapping("/{id}") 50 | public Map task(@PathVariable String id) { 51 | Task task = taskService.getById(id); 52 | return message.message(true, "请求成功", "task", task); 53 | } 54 | 55 | // 当前登录User, 已发布的task 56 | @GetMapping("/published") 57 | public Map published(Long id) { 58 | return message.message(true, "请求成功", "task", publishAndAcceptMethods(id, "publish_user_id")); 59 | } 60 | 61 | // 当前登录User, 已接受的task 62 | @GetMapping("/accepted") 63 | public Map accepted(Long id) { 64 | return message.message(true, "请求成功", "task", publishAndAcceptMethods(id, "accept_user_id")); 65 | } 66 | 67 | // 获取发布和接受的task 68 | public List publishAndAcceptMethods(Long id, String field) { 69 | // User user = (User) session.getAttribute("user"); 70 | QueryWrapper wrapper = new QueryWrapper<>(); 71 | wrapper.eq(field, id); 72 | return taskService.list(wrapper); 73 | } 74 | 75 | // 发布新task 76 | @PostMapping 77 | public Map saveTask(Task task) { 78 | User user = userService.getById(task.getPublishId()); 79 | if (user.getBalance() >= task.getReward()) { 80 | boolean save = taskService.save(task); 81 | if (save) { 82 | money.transfer("balance=balance-", task.getReward(), user.getStudentId()); 83 | } 84 | return message.message(true, "发布任务成功", "", null); 85 | } else { 86 | return message.message(false, "余额不足", "", null); 87 | } 88 | } 89 | 90 | // 发布人取消task 91 | @DeleteMapping("/{id}") 92 | public Map delTask(@PathVariable Long id) { 93 | Task task = taskService.getById(id); 94 | System.out.println(task); 95 | if (task != null) { 96 | taskService.removeById(id); 97 | money.transfer("balance=balance+", task.getReward(), task.getPublish().getStudentId()); 98 | } 99 | return message.message(true, "取消任务成功", "", null); 100 | } 101 | 102 | // 接单人取消task 103 | @PutMapping("/takerCancel/{id}") 104 | public Map takerCancel(@PathVariable Long id) { 105 | 106 | UpdateWrapper wrapper = new UpdateWrapper<>(); 107 | wrapper.setSql("accept_user_id=null") 108 | .setSql("order_time=null") 109 | .setSql("state=0") 110 | .eq("id", id); 111 | 112 | boolean update = taskService.update(wrapper); 113 | 114 | 115 | if (update) { 116 | return message.message(true, "取消任务成功", "", null); 117 | } 118 | return message.message(false, "取消任务失败", "", null); 119 | } 120 | 121 | // 接单人接受task 122 | @PutMapping("/takerAccept") 123 | public Map takerAccept(Long id, Long acceptId) { 124 | 125 | UpdateWrapper wrapper = new UpdateWrapper<>(); 126 | wrapper.setSql("accept_user_id=" + acceptId) 127 | .setSql("order_time=now()") 128 | .setSql("state=1") 129 | .eq("id", id); 130 | boolean b = taskService.update(wrapper); 131 | 132 | if (b) { 133 | return message.message(true, "接收任务成功", "", null); 134 | } 135 | return message.message(false, "接受任务失败", "", null); 136 | } 137 | 138 | // 完成task 139 | @PutMapping("/{id}") 140 | public Map missionCompleted(@PathVariable Long id) { 141 | 142 | UpdateWrapper wrapper = new UpdateWrapper<>(); 143 | wrapper.setSql("end_time=now()") 144 | .setSql("state=2") 145 | .eq("id", id); 146 | boolean b = taskService.update(wrapper); 147 | 148 | if (b) { 149 | Task task = taskService.getById(id); 150 | if (task != null) { 151 | money.transfer("balance=balance+", task.getReward(), task.getAccept().getStudentId()); 152 | } 153 | return message.message(true, "任务完成", "", null); 154 | } 155 | return message.message(false, "任务完成失败", "", null); 156 | } 157 | 158 | // 修改task 159 | @PutMapping("/edit") 160 | public Map editTask(Task task, HttpSession session) { 161 | 162 | User user = (User) session.getAttribute("user"); 163 | 164 | Task byId = taskService.getById(task.getId()); 165 | 166 | //判断是否为自己发布的任务 167 | if (user.getId().equals(byId.getPublish().getId())) { 168 | 169 | boolean update = taskService.updateById(task); 170 | 171 | if (update) { 172 | return message.message(true, "编辑任务成功", "", null); 173 | } 174 | return message.message(false, "编辑任务失败", "", null); 175 | } 176 | return message.message(false, "无权编辑该任务", "", null); 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.yqn.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.yqn.pojo.User; 5 | import com.yqn.service.UserService; 6 | import com.yqn.common.tools.MessageTools; 7 | import com.yqn.common.tools.PocketMoney; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | import javax.servlet.http.HttpSession; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @author sxc 16 | */ 17 | @RestController 18 | @RequestMapping("/user") 19 | public class UserController { 20 | @Autowired 21 | private UserService userService; 22 | @Autowired 23 | private MessageTools message; 24 | @Autowired 25 | private PocketMoney money; 26 | 27 | // 检查登录 28 | @GetMapping("/login") 29 | public Map checkUserLogin(User checkUser, HttpSession session) { 30 | QueryWrapper wrapper = new QueryWrapper<>(); 31 | wrapper.eq("student_id", checkUser.getStudentId()) 32 | .eq("password", checkUser.getPassword()) 33 | .eq("school_id", checkUser.getSchoolId()); 34 | User user = userService.getOne(wrapper); 35 | 36 | if (user != null) { 37 | session.setAttribute("user", user); 38 | return message.message(true, "请求成功", "user", user); 39 | } 40 | return message.message(false, "账号或密码错误", "", null); 41 | } 42 | 43 | // 获取全部User 44 | @GetMapping 45 | public Map users(String studentId, String username) { 46 | QueryWrapper wrapper = new QueryWrapper<>(); 47 | if (studentId != null) { 48 | wrapper.eq("student_id", studentId); 49 | return message.message(true, "请求成功", "user", userService.list(wrapper)); 50 | } 51 | if (username != null) { 52 | wrapper.like("username", username); 53 | return message.message(true, "请求成功", "user", userService.list(wrapper)); 54 | } 55 | List users = userService.list(); 56 | return message.message(true, "请求成功", "user", users); 57 | } 58 | 59 | // 根据id获取User 60 | @GetMapping("/{id}") 61 | public Map user(@PathVariable String id) { 62 | User user = userService.getById(id); 63 | return message.message(true, "请求成功", "user", user); 64 | } 65 | 66 | // 添加User 67 | @PostMapping 68 | public Map saveUser( User user) { 69 | QueryWrapper wrapper = new QueryWrapper<>(); 70 | wrapper.eq("school_id", user.getSchoolId()) 71 | .eq("student_id", user.getStudentId()); 72 | User one = userService.getOne(wrapper); 73 | if (one == null) { 74 | userService.save(user); 75 | return message.message(true, "注册成功", "", null); 76 | } 77 | return message.message(false, "error, 该学号已被注册", "", null); 78 | } 79 | 80 | // 更新信息 81 | @PutMapping 82 | public Map putUser(User user) { 83 | boolean update = userService.updateById(user); 84 | if (update) { 85 | return message.message(true, "更新信息成功", "", null); 86 | } 87 | return message.message(false, "error, 更新信息失败", "", null); 88 | } 89 | 90 | // 删除学生 91 | @DeleteMapping("/{id}") 92 | public Map delUser(@PathVariable Long id) { 93 | boolean remove = userService.removeById(id); 94 | if (remove) { 95 | return message.message(true, "删除学生成功", "", null); 96 | } 97 | return message.message(false, "error,删除学生失败", "", null); 98 | } 99 | 100 | // 零钱转入 101 | @PutMapping("rollIn") 102 | public Map rollIn(String studentId, Double balance) { 103 | return money.transfer("balance=balance+", balance, studentId); 104 | } 105 | 106 | // 零钱转出 107 | @PutMapping("rollOut") 108 | public Map rollOut(String studentId, Double balance) { 109 | return money.transfer("balance=balance-", balance, studentId); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.Admin; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface AdminMapper extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/ClassMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.Class; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface ClassMapper extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/DeptMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.Dept; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface DeptMapper extends BaseMapper { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/NoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.yqn.pojo.Notice; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 通知公告公告Mapper接口 9 | * 10 | * @author sxc 11 | * @date 2022-05-13 12 | */ 13 | public interface NoticeMapper 14 | { 15 | /** 16 | * 查询通知公告公告 17 | * 18 | * @param noticeId 通知公告公告主键 19 | * @return 通知公告公告 20 | */ 21 | public Notice selectNoticeByNoticeId(Integer noticeId); 22 | 23 | /** 24 | * 查询通知公告公告列表 25 | * 26 | * @param notice 通知公告公告 27 | * @return 通知公告公告集合 28 | */ 29 | public List selectNoticeList(Notice notice); 30 | 31 | /** 32 | * 新增通知公告公告 33 | * 34 | * @param notice 通知公告公告 35 | * @return 结果 36 | */ 37 | public int insertNotice(Notice notice); 38 | 39 | /** 40 | * 修改通知公告公告 41 | * 42 | * @param notice 通知公告公告 43 | * @return 结果 44 | */ 45 | public int updateNotice(Notice notice); 46 | 47 | /** 48 | * 删除通知公告公告 49 | * 50 | * @param noticeId 通知公告公告主键 51 | * @return 结果 52 | */ 53 | public int deleteNoticeByNoticeId(Integer noticeId); 54 | 55 | /** 56 | * 批量删除通知公告公告 57 | * 58 | * @param noticeIds 需要删除的数据主键集合 59 | * @return 结果 60 | */ 61 | public int deleteNoticeByNoticeIds(Integer[] noticeIds); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/SchoolMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.School; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface SchoolMapper extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/SxcRemarkMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.yqn.pojo.SxcRemark; 4 | import java.util.List; 5 | 6 | /** 7 | * remarkMapper接口 8 | * 9 | * @author sxc 10 | * @date 2022-05-16 11 | */ 12 | public interface SxcRemarkMapper 13 | { 14 | /** 15 | * 查询remark 16 | * 17 | * @param id remark主键 18 | * @return remark 19 | */ 20 | public SxcRemark selectSxcRemarkById(Long id); 21 | 22 | /** 23 | * 查询remark列表 24 | * 25 | * @param sxcRemark remark 26 | * @return remark集合 27 | */ 28 | public List selectSxcRemarkList(SxcRemark sxcRemark); 29 | 30 | /** 31 | * 新增remark 32 | * 33 | * @param sxcRemark remark 34 | * @return 结果 35 | */ 36 | public int insertSxcRemark(SxcRemark sxcRemark); 37 | 38 | /** 39 | * 修改remark 40 | * 41 | * @param sxcRemark remark 42 | * @return 结果 43 | */ 44 | public int updateSxcRemark(SxcRemark sxcRemark); 45 | 46 | /** 47 | * 删除remark 48 | * 49 | * @param id remark主键 50 | * @return 结果 51 | */ 52 | public int deleteSxcRemarkById(Long id); 53 | 54 | /** 55 | * 批量删除remark 56 | * 57 | * @param ids 需要删除的数据主键集合 58 | * @return 结果 59 | */ 60 | public int deleteSxcRemarkByIds(Long[] ids); 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/SxcStudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import com.yqn.pojo.SxcStudent; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 学生管理Mapper接口 11 | * 12 | * @author sxc 13 | * @date 2022-05-05 14 | */ 15 | public interface SxcStudentMapper extends BaseMapper 16 | { 17 | /** 18 | * 查询学生管理 19 | * 20 | * @param id 学生管理主键 21 | * @return 学生管理 22 | */ 23 | public SxcStudent selectSxcStudentById(Long id); 24 | 25 | /** 26 | * 查询学生管理列表 27 | * 28 | * @param sxcStudent 学生管理 29 | * @return 学生管理集合 30 | */ 31 | public List selectSxcStudentList(SxcStudent sxcStudent); 32 | 33 | /** 34 | * 新增学生管理 35 | * 36 | * @param sxcStudent 学生管理 37 | * @return 结果 38 | */ 39 | public int insertSxcStudent(SxcStudent sxcStudent); 40 | 41 | /** 42 | * 修改学生管理 43 | * 44 | * @param sxcStudent 学生管理 45 | * @return 结果 46 | */ 47 | public int updateSxcStudent(SxcStudent sxcStudent); 48 | 49 | /** 50 | * 删除学生管理 51 | * 52 | * @param id 学生管理主键 53 | * @return 结果 54 | */ 55 | public int deleteSxcStudentById(Long id); 56 | 57 | /** 58 | * 批量删除学生管理 59 | * 60 | * @param ids 需要删除的数据主键集合 61 | * @return 结果 62 | */ 63 | public int deleteSxcStudentByIds(Long[] ids); 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/TaskMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.Task; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface TaskMapper extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.yqn.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yqn.pojo.User; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface UserMapper extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/Admin.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import lombok.Data; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * @author sxc 12 | */ 13 | @Data 14 | @ToString 15 | public class Admin { 16 | 17 | @TableId(value = "id",type = IdType.AUTO) 18 | private Long id; 19 | private String account; 20 | private String password; 21 | private String username; 22 | private Date createTime; 23 | private Integer state; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/Class.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @ToString 16 | @Data 17 | @TableName(resultMap = "classResultMap") 18 | public class Class { 19 | @TableId(value = "id",type = IdType.AUTO) 20 | private Long id; 21 | private String name; 22 | private Integer schoolId; 23 | private Integer deptId; 24 | 25 | @TableField(exist = false) 26 | private List users; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/Dept.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @ToString 16 | @Data 17 | @TableName(resultMap = "deptResultMap") 18 | public class Dept { 19 | @TableId(value = "id", type = IdType.AUTO) 20 | private Long id; 21 | private String name; 22 | private Integer schoolId; 23 | 24 | @TableField(exist = false) 25 | private List classes; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/Notice.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.yqn.common.core.domain.BaseEntity; 4 | import org.apache.commons.lang3.builder.ToStringBuilder; 5 | import org.apache.commons.lang3.builder.ToStringStyle; 6 | 7 | /** 8 | * 通知公告公告对象 notice 9 | * 10 | * @author sxc 11 | * @date 2022-05-13 12 | */ 13 | public class Notice extends BaseEntity 14 | { 15 | private static final long serialVersionUID = 1L; 16 | 17 | /** 公告ID */ 18 | private Integer noticeId; 19 | 20 | /** 公告标题 */ 21 | private String noticeTitle; 22 | 23 | /** 公告内容 */ 24 | private String noticeContent; 25 | 26 | public void setNoticeId(Integer noticeId) 27 | { 28 | this.noticeId = noticeId; 29 | } 30 | 31 | public Integer getNoticeId() 32 | { 33 | return noticeId; 34 | } 35 | public void setNoticeTitle(String noticeTitle) 36 | { 37 | this.noticeTitle = noticeTitle; 38 | } 39 | 40 | public String getNoticeTitle() 41 | { 42 | return noticeTitle; 43 | } 44 | public void setNoticeContent(String noticeContent) 45 | { 46 | this.noticeContent = noticeContent; 47 | } 48 | 49 | public String getNoticeContent() 50 | { 51 | return noticeContent; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 57 | .append("noticeId", getNoticeId()) 58 | .append("noticeTitle", getNoticeTitle()) 59 | .append("noticeContent", getNoticeContent()) 60 | .append("createBy", getCreateBy()) 61 | .append("createTime", getCreateTime()) 62 | .append("remark", getRemark()) 63 | .toString(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/School.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @ToString 16 | @Data 17 | @TableName(resultMap = "schoolResultMap") 18 | public class School { 19 | @TableId(value = "id", type = IdType.AUTO) 20 | private Long id; 21 | private String name; 22 | 23 | @TableField(exist = false) 24 | private List depts; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/SxcRemark.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.yqn.common.core.domain.BaseEntity; 4 | import org.apache.commons.lang3.builder.ToStringBuilder; 5 | import org.apache.commons.lang3.builder.ToStringStyle; 6 | 7 | /** 8 | * remark对象 sxc_remark 9 | * 10 | * @author sxc 11 | * @date 2022-05-16 12 | */ 13 | public class SxcRemark extends BaseEntity 14 | { 15 | private static final long serialVersionUID = 1L; 16 | 17 | /** 评价id */ 18 | private Long id; 19 | 20 | /** 星级 */ 21 | private Long star; 22 | 23 | /** 任务id */ 24 | private Long taskId; 25 | 26 | /** 送货人id */ 27 | private Long acceptId; 28 | 29 | /** 评价人id */ 30 | private Long publishId; 31 | 32 | public void setId(Long id) 33 | { 34 | this.id = id; 35 | } 36 | 37 | public Long getId() 38 | { 39 | return id; 40 | } 41 | public void setStar(Long star) 42 | { 43 | this.star = star; 44 | } 45 | 46 | public Long getStar() 47 | { 48 | return star; 49 | } 50 | public void setTaskId(Long taskId) 51 | { 52 | this.taskId = taskId; 53 | } 54 | 55 | public Long getTaskId() 56 | { 57 | return taskId; 58 | } 59 | public void setAcceptId(Long acceptId) 60 | { 61 | this.acceptId = acceptId; 62 | } 63 | 64 | public Long getAcceptId() 65 | { 66 | return acceptId; 67 | } 68 | public void setPublishId(Long publishId) 69 | { 70 | this.publishId = publishId; 71 | } 72 | 73 | public Long getPublishId() 74 | { 75 | return publishId; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 81 | .append("id", getId()) 82 | .append("star", getStar()) 83 | .append("remark", getRemark()) 84 | .append("taskId", getTaskId()) 85 | .append("acceptId", getAcceptId()) 86 | .append("publishId", getPublishId()) 87 | .toString(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/SxcStudent.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 学生管理对象 sxc_student 10 | * 11 | * @author sxc 12 | * @date 2022-05-05 13 | */ 14 | public class SxcStudent implements Serializable 15 | { 16 | // private static final long serialVersionUID = 1L; 17 | 18 | /** 学生编号 */ 19 | private Long id; 20 | 21 | /** 姓名 */ 22 | private String name; 23 | 24 | /** 年龄 */ 25 | private Long age; 26 | 27 | public void setId(Long id) 28 | { 29 | this.id = id; 30 | } 31 | 32 | public Long getId() 33 | { 34 | return id; 35 | } 36 | public void setName(String name) 37 | { 38 | this.name = name; 39 | } 40 | 41 | public String getName() 42 | { 43 | return name; 44 | } 45 | public void setAge(Long age) 46 | { 47 | this.age = age; 48 | } 49 | 50 | public Long getAge() 51 | { 52 | return age; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 58 | .append("id", getId()) 59 | .append("name", getName()) 60 | .append("age", getAge()) 61 | .toString(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/Task.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.ToString; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @Data 16 | @ToString 17 | @TableName(resultMap = "taskResultMap") 18 | public class Task { 19 | @TableId(value = "id", type = IdType.AUTO) 20 | private Long id; 21 | @TableField(value = "publish_user_id") 22 | private Long publishId; 23 | @TableField(value = "accept_user_id") 24 | private Long acceptId; 25 | @TableField(value = "user_school_id") 26 | private Long schoolId; 27 | private Double reward; 28 | private Date createTime; 29 | private Date orderTime; 30 | private Date endTime; 31 | private String taskTitle; 32 | private String taskContext; 33 | private Integer state; 34 | 35 | @TableField(exist = false) 36 | private User publish; 37 | @TableField(exist = false) 38 | private User accept; 39 | @TableField(exist = false) 40 | private School school; 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.yqn.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.ToString; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * @author sxc 14 | */ 15 | @ToString 16 | @Data 17 | @TableName(resultMap = "userResultMap") 18 | public class User { 19 | @TableId(value = "id", type = IdType.AUTO) 20 | private Long id; 21 | private String studentId; 22 | private String password; 23 | private String phone; 24 | private Long schoolId; 25 | private Long deptId; 26 | private Long classId; 27 | private Integer sex; 28 | private String username; 29 | private Date createTime; 30 | private Double balance; 31 | private Integer state; 32 | 33 | @TableField(exist = false) 34 | private School school; 35 | @TableField(exist = false) 36 | private Dept dept; 37 | @TableField(exist = false) 38 | private Class aClass; 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.Admin; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface AdminService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/ClassService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.Class; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface ClassService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/DeptService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.Dept; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface DeptService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/INoticeService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.yqn.pojo.Notice; 4 | import java.util.List; 5 | 6 | /** 7 | * 通知公告公告Service接口 8 | * 9 | * @author sxc 10 | * @date 2022-05-13 11 | */ 12 | public interface INoticeService 13 | { 14 | /** 15 | * 查询通知公告公告 16 | * 17 | * @param noticeId 通知公告公告主键 18 | * @return 通知公告公告 19 | */ 20 | public Notice selectNoticeByNoticeId(Integer noticeId); 21 | 22 | /** 23 | * 查询通知公告公告列表 24 | * 25 | * @param notice 通知公告公告 26 | * @return 通知公告公告集合 27 | */ 28 | public List selectNoticeList(Notice notice); 29 | 30 | /** 31 | * 新增通知公告公告 32 | * 33 | * @param notice 通知公告公告 34 | * @return 结果 35 | */ 36 | public int insertNotice(Notice notice); 37 | 38 | /** 39 | * 修改通知公告公告 40 | * 41 | * @param notice 通知公告公告 42 | * @return 结果 43 | */ 44 | public int updateNotice(Notice notice); 45 | 46 | /** 47 | * 批量删除通知公告公告 48 | * 49 | * @param noticeIds 需要删除的通知公告公告主键集合 50 | * @return 结果 51 | */ 52 | public int deleteNoticeByNoticeIds(Integer[] noticeIds); 53 | 54 | /** 55 | * 删除通知公告公告信息 56 | * 57 | * @param noticeId 通知公告公告主键 58 | * @return 结果 59 | */ 60 | public int deleteNoticeByNoticeId(Integer noticeId); 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/ISxcRemarkService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.yqn.pojo.SxcRemark; 4 | import java.util.List; 5 | 6 | /** 7 | * remarkService接口 8 | * 9 | * @author sxc 10 | * @date 2022-05-16 11 | */ 12 | public interface ISxcRemarkService 13 | { 14 | /** 15 | * 查询remark 16 | * 17 | * @param id remark主键 18 | * @return remark 19 | */ 20 | public SxcRemark selectSxcRemarkById(Long id); 21 | 22 | /** 23 | * 查询remark列表 24 | * 25 | * @param sxcRemark remark 26 | * @return remark集合 27 | */ 28 | public List selectSxcRemarkList(SxcRemark sxcRemark); 29 | 30 | /** 31 | * 新增remark 32 | * 33 | * @param sxcRemark remark 34 | * @return 结果 35 | */ 36 | public int insertSxcRemark(SxcRemark sxcRemark); 37 | 38 | /** 39 | * 修改remark 40 | * 41 | * @param sxcRemark remark 42 | * @return 结果 43 | */ 44 | public int updateSxcRemark(SxcRemark sxcRemark); 45 | 46 | /** 47 | * 批量删除remark 48 | * 49 | * @param ids 需要删除的remark主键集合 50 | * @return 结果 51 | */ 52 | public int deleteSxcRemarkByIds(Long[] ids); 53 | 54 | /** 55 | * 删除remark信息 56 | * 57 | * @param id remark主键 58 | * @return 结果 59 | */ 60 | public int deleteSxcRemarkById(Long id); 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/ISxcStudentService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.yqn.pojo.SxcStudent; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 学生管理Service接口 9 | * 10 | * @author sxc 11 | * @date 2022-05-05 12 | */ 13 | public interface ISxcStudentService 14 | { 15 | /** 16 | * 查询学生管理 17 | * 18 | * @param id 学生管理主键 19 | * @return 学生管理 20 | */ 21 | public SxcStudent selectSxcStudentById(Long id); 22 | 23 | /** 24 | * 查询学生管理列表 25 | * 26 | * @param sxcStudent 学生管理 27 | * @return 学生管理集合 28 | */ 29 | public List selectSxcStudentList(SxcStudent sxcStudent); 30 | 31 | /** 32 | * 新增学生管理 33 | * 34 | * @param sxcStudent 学生管理 35 | * @return 结果 36 | */ 37 | public int insertSxcStudent(SxcStudent sxcStudent); 38 | 39 | /** 40 | * 修改学生管理 41 | * 42 | * @param sxcStudent 学生管理 43 | * @return 结果 44 | */ 45 | public int updateSxcStudent(SxcStudent sxcStudent); 46 | 47 | /** 48 | * 批量删除学生管理 49 | * 50 | * @param ids 需要删除的学生管理主键集合 51 | * @return 结果 52 | */ 53 | public int deleteSxcStudentByIds(Long[] ids); 54 | 55 | /** 56 | * 删除学生管理信息 57 | * 58 | * @param id 学生管理主键 59 | * @return 结果 60 | */ 61 | public int deleteSxcStudentById(Long id); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/SchoolService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.School; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface SchoolService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/TaskService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.Task; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface TaskService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yqn.pojo.User; 5 | 6 | /** 7 | * @author sxc 8 | */ 9 | public interface UserService extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/AdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.yqn.mapper.AdminMapper; 6 | import com.yqn.pojo.Admin; 7 | import com.yqn.service.AdminService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | * @author sxc 13 | */ 14 | @Service 15 | public class AdminServiceImpl extends ServiceImpl implements AdminService { 16 | @Autowired 17 | private AdminMapper adminMapper; 18 | 19 | @Override 20 | public boolean save(Admin entity) { 21 | QueryWrapper wrapper = new QueryWrapper<>(); 22 | wrapper.eq("account", entity.getAccount()); 23 | 24 | Admin admin = adminMapper.selectOne(wrapper); 25 | if (admin == null) { 26 | adminMapper.insert(entity); 27 | return true; 28 | } 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/ClassServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yqn.mapper.ClassMapper; 5 | import com.yqn.pojo.Class; 6 | import com.yqn.service.ClassService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author sxc 11 | */ 12 | @Service 13 | public class ClassServiceImpl extends ServiceImpl implements ClassService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/DeptServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yqn.mapper.DeptMapper; 5 | import com.yqn.pojo.Dept; 6 | import com.yqn.service.DeptService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author sxc 11 | */ 12 | @Service 13 | public class DeptServiceImpl extends ServiceImpl implements DeptService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/NoticeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.yqn.pojo.Notice; 4 | import com.yqn.common.utils.DateUtils; 5 | import com.yqn.mapper.NoticeMapper; 6 | import com.yqn.service.INoticeService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 通知公告公告Service业务层处理 14 | * 15 | * @author sxc 16 | * @date 2022-05-13 17 | */ 18 | @Service 19 | public class NoticeServiceImpl implements INoticeService 20 | { 21 | @Autowired 22 | private NoticeMapper noticeMapper; 23 | 24 | /** 25 | * 查询通知公告公告 26 | * 27 | * @param noticeId 通知公告公告主键 28 | * @return 通知公告公告 29 | */ 30 | @Override 31 | public Notice selectNoticeByNoticeId(Integer noticeId) 32 | { 33 | return noticeMapper.selectNoticeByNoticeId(noticeId); 34 | } 35 | 36 | /** 37 | * 查询通知公告公告列表 38 | * 39 | * @param notice 通知公告公告 40 | * @return 通知公告公告 41 | */ 42 | @Override 43 | public List selectNoticeList(Notice notice) 44 | { 45 | return noticeMapper.selectNoticeList(notice); 46 | } 47 | 48 | /** 49 | * 新增通知公告公告 50 | * 51 | * @param notice 通知公告公告 52 | * @return 结果 53 | */ 54 | @Override 55 | public int insertNotice(Notice notice) 56 | { 57 | notice.setCreateTime(DateUtils.getNowDate()); 58 | return noticeMapper.insertNotice(notice); 59 | } 60 | 61 | /** 62 | * 修改通知公告公告 63 | * 64 | * @param notice 通知公告公告 65 | * @return 结果 66 | */ 67 | @Override 68 | public int updateNotice(Notice notice) 69 | { 70 | return noticeMapper.updateNotice(notice); 71 | } 72 | 73 | /** 74 | * 批量删除通知公告公告 75 | * 76 | * @param noticeIds 需要删除的通知公告公告主键 77 | * @return 结果 78 | */ 79 | @Override 80 | public int deleteNoticeByNoticeIds(Integer[] noticeIds) 81 | { 82 | return noticeMapper.deleteNoticeByNoticeIds(noticeIds); 83 | } 84 | 85 | /** 86 | * 删除通知公告公告信息 87 | * 88 | * @param noticeId 通知公告公告主键 89 | * @return 结果 90 | */ 91 | @Override 92 | public int deleteNoticeByNoticeId(Integer noticeId) 93 | { 94 | return noticeMapper.deleteNoticeByNoticeId(noticeId); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/SchoolServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.yqn.mapper.SchoolMapper; 6 | import com.yqn.pojo.School; 7 | import com.yqn.service.SchoolService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | * @author sxc 13 | */ 14 | @Service 15 | public class SchoolServiceImpl extends ServiceImpl implements SchoolService { 16 | @Autowired 17 | private SchoolMapper schoolMapper; 18 | 19 | @Override 20 | public boolean save(School entity) { 21 | QueryWrapper wrapper = new QueryWrapper<>(); 22 | wrapper.eq("name", entity.getName()); 23 | 24 | School school = schoolMapper.selectOne(wrapper); 25 | if (school == null) { 26 | schoolMapper.insert(entity); 27 | return true; 28 | } 29 | 30 | return false; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/SxcRemarkServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.yqn.mapper.SxcRemarkMapper; 4 | import com.yqn.pojo.SxcRemark; 5 | import com.yqn.service.ISxcRemarkService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * remarkService业务层处理 13 | * 14 | * @author sxc 15 | * @date 2022-05-16 16 | */ 17 | @Service 18 | public class SxcRemarkServiceImpl implements ISxcRemarkService 19 | { 20 | @Autowired 21 | private SxcRemarkMapper sxcRemarkMapper; 22 | 23 | /** 24 | * 查询remark 25 | * 26 | * @param id remark主键 27 | * @return remark 28 | */ 29 | @Override 30 | public SxcRemark selectSxcRemarkById(Long id) 31 | { 32 | return sxcRemarkMapper.selectSxcRemarkById(id); 33 | } 34 | 35 | /** 36 | * 查询remark列表 37 | * 38 | * @param sxcRemark remark 39 | * @return remark 40 | */ 41 | @Override 42 | public List selectSxcRemarkList(SxcRemark sxcRemark) 43 | { 44 | return sxcRemarkMapper.selectSxcRemarkList(sxcRemark); 45 | } 46 | 47 | /** 48 | * 新增remark 49 | * 50 | * @param sxcRemark remark 51 | * @return 结果 52 | */ 53 | @Override 54 | public int insertSxcRemark(SxcRemark sxcRemark) 55 | { 56 | return sxcRemarkMapper.insertSxcRemark(sxcRemark); 57 | } 58 | 59 | /** 60 | * 修改remark 61 | * 62 | * @param sxcRemark remark 63 | * @return 结果 64 | */ 65 | @Override 66 | public int updateSxcRemark(SxcRemark sxcRemark) 67 | { 68 | return sxcRemarkMapper.updateSxcRemark(sxcRemark); 69 | } 70 | 71 | /** 72 | * 批量删除remark 73 | * 74 | * @param ids 需要删除的remark主键 75 | * @return 结果 76 | */ 77 | @Override 78 | public int deleteSxcRemarkByIds(Long[] ids) 79 | { 80 | return sxcRemarkMapper.deleteSxcRemarkByIds(ids); 81 | } 82 | 83 | /** 84 | * 删除remark信息 85 | * 86 | * @param id remark主键 87 | * @return 结果 88 | */ 89 | @Override 90 | public int deleteSxcRemarkById(Long id) 91 | { 92 | return sxcRemarkMapper.deleteSxcRemarkById(id); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/SxcStudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.yqn.mapper.SxcStudentMapper; 4 | import com.yqn.pojo.SxcStudent; 5 | import com.yqn.service.ISxcStudentService; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 学生管理Service业务层处理 13 | * 14 | * @author sxc 15 | * @date 2022-05-05 16 | */ 17 | @Service 18 | public class SxcStudentServiceImpl implements ISxcStudentService 19 | { 20 | @Resource 21 | private SxcStudentMapper sxcStudentMapper; 22 | 23 | /** 24 | * 查询学生管理 25 | * 26 | * @param id 学生管理主键 27 | * @return 学生管理 28 | */ 29 | @Override 30 | public SxcStudent selectSxcStudentById(Long id) 31 | { 32 | return sxcStudentMapper.selectSxcStudentById(id); 33 | } 34 | 35 | /** 36 | * 查询学生管理列表 37 | * 38 | * @param sxcStudent 学生管理 39 | * @return 学生管理 40 | */ 41 | @Override 42 | public List selectSxcStudentList(SxcStudent sxcStudent) 43 | { 44 | return sxcStudentMapper.selectSxcStudentList(sxcStudent); 45 | // return sxcStudentMapper.selectList(null); 46 | } 47 | 48 | /** 49 | * 新增学生管理 50 | * 51 | * @param sxcStudent 学生管理 52 | * @return 结果 53 | */ 54 | @Override 55 | public int insertSxcStudent(SxcStudent sxcStudent) 56 | { 57 | return sxcStudentMapper.insertSxcStudent(sxcStudent); 58 | } 59 | 60 | /** 61 | * 修改学生管理 62 | * 63 | * @param sxcStudent 学生管理 64 | * @return 结果 65 | */ 66 | @Override 67 | public int updateSxcStudent(SxcStudent sxcStudent) 68 | { 69 | return sxcStudentMapper.updateSxcStudent(sxcStudent); 70 | } 71 | 72 | /** 73 | * 批量删除学生管理 74 | * 75 | * @param ids 需要删除的学生管理主键 76 | * @return 结果 77 | */ 78 | @Override 79 | public int deleteSxcStudentByIds(Long[] ids) 80 | { 81 | return sxcStudentMapper.deleteSxcStudentByIds(ids); 82 | } 83 | 84 | /** 85 | * 删除学生管理信息 86 | * 87 | * @param id 学生管理主键 88 | * @return 结果 89 | */ 90 | @Override 91 | public int deleteSxcStudentById(Long id) 92 | { 93 | return sxcStudentMapper.deleteSxcStudentById(id); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/TaskServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yqn.mapper.TaskMapper; 5 | import com.yqn.pojo.Task; 6 | import com.yqn.service.TaskService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author sxc 11 | */ 12 | @Service 13 | public class TaskServiceImpl extends ServiceImpl implements TaskService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/yqn/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yqn.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yqn.mapper.UserMapper; 5 | import com.yqn.pojo.User; 6 | import com.yqn.service.UserService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author sxc 11 | */ 12 | @Service 13 | public class UserServiceImpl extends ServiceImpl implements UserService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/main.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.cj.jdbc.Driver 4 | url: jdbc:mysql://localhost:3306/campus_help 5 | username: root 6 | password: 12345678 7 | 8 | druid: 9 | aop-patterns: com.yqn.* 10 | filters: stat,wall 11 | 12 | stat-view-servlet: 13 | enabled: true 14 | login-username: admin 15 | login-password: admin 16 | 17 | web-stat-filter: 18 | enabled: true 19 | url-pattern: /* 20 | logging: 21 | level: 22 | com.yqn.mapper: debug 23 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ClassMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/mapper/DeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/NoticeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | select notice_id, notice_title, notice_content, create_by, create_time, remark from notice 18 | 19 | 20 | 27 | 28 | 32 | 33 | 34 | insert into notice 35 | 36 | notice_title, 37 | notice_content, 38 | create_by, 39 | create_time, 40 | remark, 41 | 42 | 43 | #{noticeTitle}, 44 | #{noticeContent}, 45 | #{createBy}, 46 | #{createTime}, 47 | #{remark}, 48 | 49 | 50 | 51 | 52 | update notice 53 | 54 | notice_title = #{noticeTitle}, 55 | notice_content = #{noticeContent}, 56 | create_by = #{createBy}, 57 | create_time = #{createTime}, 58 | remark = #{remark}, 59 | 60 | where notice_id = #{noticeId} 61 | 62 | 63 | 64 | delete from notice where notice_id = #{noticeId} 65 | 66 | 67 | 68 | delete from notice where notice_id in 69 | 70 | #{noticeId} 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SchoolMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SxcRemarkMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | select id, star, remark, task_id, accept_id, publish_id from sxc_remark 18 | 19 | 20 | 29 | 30 | 34 | 35 | 36 | insert into sxc_remark 37 | 38 | star, 39 | remark, 40 | task_id, 41 | accept_id, 42 | publish_id, 43 | 44 | 45 | #{star}, 46 | #{remark}, 47 | #{taskId}, 48 | #{acceptId}, 49 | #{publishId}, 50 | 51 | 52 | 53 | 54 | update sxc_remark 55 | 56 | star = #{star}, 57 | remark = #{remark}, 58 | task_id = #{taskId}, 59 | accept_id = #{acceptId}, 60 | publish_id = #{publishId}, 61 | 62 | where id = #{id} 63 | 64 | 65 | 66 | delete from sxc_remark where id = #{id} 67 | 68 | 69 | 70 | delete from sxc_remark where id in 71 | 72 | #{id} 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SxcStudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | select id, name, age from sxc_student 16 | 17 | 18 | 25 | 26 | 30 | 31 | 32 | insert into sxc_student 33 | 34 | name, 35 | age, 36 | 37 | 38 | #{name}, 39 | #{age}, 40 | 41 | 42 | 43 | 44 | update sxc_student 45 | 46 | name = #{name}, 47 | age = #{age}, 48 | 49 | where id = #{id} 50 | 51 | 52 | 53 | delete from sxc_student where id = #{id} 54 | 55 | 56 | 57 | delete from sxc_student where id in 58 | 59 | #{id} 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TaskMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 22 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/sql/campus_help.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : yqn 5 | Source Server Type : MySQL 6 | Source Server Version : 80018 7 | Source Host : localhost:3306 8 | Source Schema : campus_help 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 80018 12 | File Encoding : 65001 13 | 14 | Date: 25/06/2021 15:30:47 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for admin 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `admin`; 24 | CREATE TABLE `admin` ( 25 | `id` int(11) NOT NULL AUTO_INCREMENT, 26 | `account` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号', 27 | `password` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', 28 | `username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', 29 | `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', 30 | `state` int(11) NOT NULL DEFAULT 0 COMMENT '状态', 31 | PRIMARY KEY (`id`) USING BTREE 32 | ) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 33 | 34 | -- ---------------------------- 35 | -- Table structure for class 36 | -- ---------------------------- 37 | DROP TABLE IF EXISTS `class`; 38 | CREATE TABLE `class` ( 39 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '班级id', 40 | `name` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '班级名', 41 | `school_id` int(11) NOT NULL COMMENT '学校id', 42 | `dept_id` int(11) NOT NULL COMMENT '系别id', 43 | PRIMARY KEY (`id`) USING BTREE, 44 | INDEX `FK_CLASS_SCHOOL`(`school_id`) USING BTREE, 45 | INDEX `FK_CLASS_DEPT`(`dept_id`) USING BTREE, 46 | CONSTRAINT `FK_CLASS_DEPT` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 47 | CONSTRAINT `FK_CLASS_SCHOOL` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 48 | ) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 49 | 50 | -- ---------------------------- 51 | -- Table structure for dept 52 | -- ---------------------------- 53 | DROP TABLE IF EXISTS `dept`; 54 | CREATE TABLE `dept` ( 55 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '系别id', 56 | `name` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '系别名称', 57 | `school_id` int(11) NOT NULL COMMENT '学校id', 58 | PRIMARY KEY (`id`) USING BTREE, 59 | INDEX `FK_DEPT_SCHOOL`(`school_id`) USING BTREE, 60 | CONSTRAINT `FK_DEPT_SCHOOL` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 61 | ) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 62 | 63 | -- ---------------------------- 64 | -- Table structure for school 65 | -- ---------------------------- 66 | DROP TABLE IF EXISTS `school`; 67 | CREATE TABLE `school` ( 68 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学校id', 69 | `name` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学校名称', 70 | PRIMARY KEY (`id`) USING BTREE 71 | ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 72 | 73 | -- ---------------------------- 74 | -- Table structure for task 75 | -- ---------------------------- 76 | DROP TABLE IF EXISTS `task`; 77 | CREATE TABLE `task` ( 78 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '任务id', 79 | `publish_user_id` int(11) NOT NULL COMMENT '用户发布id', 80 | `accept_user_id` int(11) NULL DEFAULT NULL COMMENT '接受任务用户id', 81 | `user_school_id` int(11) NOT NULL COMMENT '用户所在的学校id', 82 | `reward` double NULL DEFAULT 0 COMMENT '任务奖励', 83 | `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', 84 | `order_time` timestamp(0) NULL DEFAULT NULL COMMENT '接单时间', 85 | `end_time` timestamp(0) NULL DEFAULT NULL COMMENT '结束时间', 86 | `task_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务标题', 87 | `task_context` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务内容', 88 | `state` int(11) NOT NULL DEFAULT 0 COMMENT '状态', 89 | PRIMARY KEY (`id`) USING BTREE, 90 | INDEX `FK_TASK_PUBLISH_USER`(`publish_user_id`) USING BTREE, 91 | INDEX `FK_TASK_ACCEPT_USER`(`accept_user_id`) USING BTREE, 92 | INDEX `FK_TASK_USER_SCHOOL`(`user_school_id`) USING BTREE, 93 | CONSTRAINT `FK_TASK_ACCEPT_USER` FOREIGN KEY (`accept_user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 94 | CONSTRAINT `FK_TASK_PUBLISH_USER` FOREIGN KEY (`publish_user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 95 | CONSTRAINT `FK_TASK_USER_SCHOOL` FOREIGN KEY (`user_school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 96 | ) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 97 | 98 | -- ---------------------------- 99 | -- Table structure for user 100 | -- ---------------------------- 101 | DROP TABLE IF EXISTS `user`; 102 | CREATE TABLE `user` ( 103 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id', 104 | `student_id` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学号', 105 | `password` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', 106 | `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号', 107 | `school_id` int(11) NOT NULL COMMENT '学校id', 108 | `dept_id` int(11) NULL DEFAULT NULL COMMENT '系别id', 109 | `class_id` int(11) NULL DEFAULT NULL COMMENT '班级id', 110 | `sex` int(11) NULL DEFAULT 0 COMMENT '性别', 111 | `username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名', 112 | `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', 113 | `balance` double NULL DEFAULT 0 COMMENT '余额', 114 | `state` int(11) NOT NULL DEFAULT 0 COMMENT '状态', 115 | PRIMARY KEY (`id`) USING BTREE, 116 | INDEX `FK_USER_SCHOOL`(`school_id`) USING BTREE, 117 | INDEX `FK_USER_DEPT`(`dept_id`) USING BTREE, 118 | INDEX `FK_USER_CLASS`(`class_id`) USING BTREE, 119 | CONSTRAINT `FK_USER_CLASS` FOREIGN KEY (`class_id`) REFERENCES `class` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 120 | CONSTRAINT `FK_USER_DEPT` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 121 | CONSTRAINT `FK_USER_SCHOOL` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 122 | ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 123 | 124 | SET FOREIGN_KEY_CHECKS = 1; 125 | -------------------------------------------------------------------------------- /src/test/java/com/yqn/CampusGangApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.yqn; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | 7 | @SpringBootTest 8 | class CampusGangApplicationTests { 9 | 10 | @Test 11 | void contextLoads() { 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/test/test.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /前端/campus-web/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /前端/campus-web/.idea/campus-web.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /前端/campus-web/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /前端/campus-web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /前端/campus-web/campus-gang-web-master.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /前端/campus-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "campus_help", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "axios": "^0.21.1", 11 | "boqii-modal": "^1.1.4", 12 | "core-js": "^3.6.5", 13 | "element-ui": "^2.15.8", 14 | "js-md5": "^0.7.3", 15 | "nprogress": "^0.2.0", 16 | "vant": "^2.12.18", 17 | "vue": "^2.6.11", 18 | "vue-quill-editor": "^3.0.6", 19 | "vue-router": "^3.2.0", 20 | "vuex": "^3.4.0" 21 | }, 22 | "devDependencies": { 23 | "@vue/cli-plugin-babel": "~4.5.0", 24 | "@vue/cli-plugin-router": "~4.5.0", 25 | "@vue/cli-plugin-vuex": "~4.5.0", 26 | "@vue/cli-service": "~4.5.0", 27 | "less": "^3.0.4", 28 | "less-loader": "^5.0.0", 29 | "vue-template-compiler": "^2.6.11" 30 | }, 31 | "browserslist": [ 32 | "> 1%", 33 | "last 2 versions", 34 | "not dead" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /前端/campus-web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/public/favicon.ico -------------------------------------------------------------------------------- /前端/campus-web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /前端/campus-web/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 31 | 58 | -------------------------------------------------------------------------------- /前端/campus-web/src/api/notice/advise.js: -------------------------------------------------------------------------------- 1 | import request from '@/util/request' 2 | 3 | // 查询通知公告公告列表 4 | export function listAdvise(query) { 5 | return request({ 6 | url: '/notice/advise/list', 7 | method: 'get', 8 | params: query 9 | }) 10 | } 11 | 12 | // 查询通知公告公告详细 13 | export function getAdvise(noticeId) { 14 | return request({ 15 | url: '/notice/advise/' + noticeId, 16 | method: 'get' 17 | }) 18 | } 19 | 20 | // 新增通知公告公告 21 | export function addAdvise(data) { 22 | return request({ 23 | url: '/notice/advise', 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | // 修改通知公告公告 30 | export function updateAdvise(data) { 31 | return request({ 32 | url: '/notice/advise', 33 | method: 'put', 34 | data: data 35 | }) 36 | } 37 | 38 | // 删除通知公告公告 39 | export function delAdvise(noticeId) { 40 | return request({ 41 | url: '/notice/advise/' + noticeId, 42 | method: 'delete' 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /前端/campus-web/src/api/remark/remark.js: -------------------------------------------------------------------------------- 1 | import request from '@/util/request' 2 | 3 | // 查询remark列表 4 | export function listRemark(query) { 5 | return request({ 6 | url: '/student/remark/list', 7 | method: 'get', 8 | params: query 9 | }) 10 | } 11 | 12 | // 查询remark详细 13 | export function getRemark(id) { 14 | return request({ 15 | url: '/student/remark/' + id, 16 | method: 'get' 17 | }) 18 | } 19 | 20 | // 新增remark 21 | export function addRemark(data) { 22 | return request({ 23 | url: '/student/remark', 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | // 修改remark 30 | export function updateRemark(data) { 31 | return request({ 32 | url: '/student/remark', 33 | method: 'put', 34 | data: data 35 | }) 36 | } 37 | 38 | // 删除remark 39 | export function delRemark(id) { 40 | return request({ 41 | url: '/student/remark/' + id, 42 | method: 'delete' 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /前端/campus-web/src/api/student/stuage.js: -------------------------------------------------------------------------------- 1 | import request from '@/util/request' 2 | 3 | // 查询学生管理列表 4 | export function listStuage(query) { 5 | return request({ 6 | url: '/student/stuage/list', 7 | method: 'get', 8 | params: query 9 | }) 10 | } 11 | 12 | // 查询学生管理详细 13 | export function getStuage(id) { 14 | return request({ 15 | url: '/student/stuage/' + id, 16 | method: 'get' 17 | }) 18 | } 19 | 20 | // 新增学生管理 21 | export function addStuage(data) { 22 | return request({ 23 | url: '/student/stuage', 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | // 修改学生管理 30 | export function updateStuage(data) { 31 | return request({ 32 | url: '/student/stuage', 33 | method: 'put', 34 | data: data 35 | }) 36 | } 37 | 38 | // 删除学生管理 39 | export function delStuage(id) { 40 | return request({ 41 | url: '/student/stuage/' + id, 42 | method: 'delete' 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /前端/campus-web/src/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/icon.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/images/pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/images/pic.jpg -------------------------------------------------------------------------------- /前端/campus-web/src/assets/images/pic01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/images/pic01.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/images/pic02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/images/pic02.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/images/pic03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/images/pic03.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/img/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/img/bg.jpg -------------------------------------------------------------------------------- /前端/campus-web/src/assets/img/emoji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/img/emoji.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/img/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/img/test.jpg -------------------------------------------------------------------------------- /前端/campus-web/src/assets/img/test1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/img/test1.jpg -------------------------------------------------------------------------------- /前端/campus-web/src/assets/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/logo.jpg -------------------------------------------------------------------------------- /前端/campus-web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/logo.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/logo_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/logo_transparent.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/logo_transparent1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/logo_transparent1.png -------------------------------------------------------------------------------- /前端/campus-web/src/assets/z_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Monologuter/springbootVue-campus/049a229ea17fd7197aba480338d7595156128656/前端/campus-web/src/assets/z_logo.png -------------------------------------------------------------------------------- /前端/campus-web/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import md5 from 'js-md5' 6 | 7 | import'./plugin' // plugins 8 | 9 | //引入element ui 10 | import ElementUI from 'element-ui' 11 | import 'element-ui/lib/theme-chalk/index.css' 12 | Vue.use(ElementUI) 13 | 14 | //将request注册到全局 15 | import request from '@/util/request' 16 | Vue.prototype.$request = request; 17 | 18 | // 富文本组件 19 | import VueQuillEditor from 'vue-quill-editor' 20 | import 'quill/dist/quill.core.css' 21 | import 'quill/dist/quill.snow.css' 22 | import 'quill/dist/quill.bubble.css' 23 | Vue.use(VueQuillEditor) 24 | 25 | 26 | 27 | //阻止启动生产消息 28 | 29 | Vue.prototype.$md5 = md5; 30 | new Vue({ 31 | router, 32 | store, 33 | render: h => h(App), 34 | methods: { 35 | getData(){ 36 | var param = { 37 | params:{ 38 | devid:'8479593759372', 39 | user:'akdi', 40 | key:'8aad46f68c77e83ee2bcc3d9f9ec818a' 41 | } 42 | } 43 | this.$http.get('/campus-gang-web-master',param).then(res=>{ 44 | console.log(res) 45 | }) 46 | } 47 | } 48 | }).$mount('#app') 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /前端/campus-web/src/plugin/index.js: -------------------------------------------------------------------------------- 1 | // 注册element-ui组件库 2 | import Vue from 'vue' 3 | import ElementUI from 'element-ui' 4 | import 'element-ui/lib/theme-chalk/index.css' 5 | import Vant from 'vant' 6 | import 'vant/lib/index.css' 7 | Vue.use(ElementUI); 8 | Vue.use(Vant) 9 | 10 | // 注册myPlugin插件 11 | import myPlugin from "./myPlugin"; 12 | 13 | Vue.use(myPlugin) -------------------------------------------------------------------------------- /前端/campus-web/src/plugin/myPlugin.js: -------------------------------------------------------------------------------- 1 | //加载自己开发的插件 2 | import {del, get, post, put} from "../util/request"; 3 | import th from "element-ui/src/locale/lang/th"; 4 | 5 | export default { 6 | // 插件中,必须包含一个install方法 7 | install: function (Vue) { 8 | //注入组件选项 9 | Vue.mixin({ 10 | methods: { 11 | //get方法 12 | $get(url, params) { 13 | return get(url, params); 14 | }, 15 | //post方法 16 | $post(url, params) { 17 | return post(url, params); 18 | }, 19 | $put(url, params) { 20 | return put(url, params); 21 | }, 22 | $del(url, params) { 23 | return del(url, params) 24 | }, 25 | $msg(message, type, duration = 2000) { 26 | this.$message({ 27 | message: message, 28 | type: type, 29 | duration: duration, 30 | showClose: true 31 | }); 32 | }, 33 | $notifyMsg(title, message, type, duration = 2500) { 34 | this.$notify({ 35 | title: title, 36 | message: message, 37 | type: type, 38 | duration: duration 39 | }) 40 | } 41 | } 42 | }) 43 | } 44 | } -------------------------------------------------------------------------------- /前端/campus-web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | Vue.use(VueRouter) 5 | 6 | const routes = [ 7 | { 8 | path: "*", 9 | component: () => import("@v/Error.vue") 10 | }, 11 | 12 | //用户 13 | { 14 | path: "/", 15 | redirect: "/login" 16 | }, 17 | 18 | { 19 | path: "/login", 20 | component: () => import("@v/user/Login.vue") 21 | }, 22 | 23 | { 24 | path: "/home", 25 | component: () => import("@v/user/Home.vue"), 26 | children: [ 27 | { 28 | path: "/", 29 | meta: {title: '首页'}, 30 | component: () => import("@v/user/children/Index.vue") 31 | }, 32 | { 33 | path: "task", 34 | meta: {title: "发布任务"}, 35 | component:()=>import('@v/user/children/Task.vue') 36 | }, 37 | { 38 | path: "published", 39 | meta: {title: "已发布任务"}, 40 | component:()=>import('@v/user/children/Published.vue') 41 | }, 42 | { 43 | path: "accepted", 44 | meta: {title: "已接收任务"}, 45 | component:()=>import('@v/user/children/Accepted.vue') 46 | }, 47 | { 48 | path: "accept", 49 | meta: {title: "已接收任务"}, 50 | component:()=>import('@v/user/children/Accept.vue') 51 | }, 52 | { 53 | path: "myProfile", 54 | meta: {title: "个人信息"}, 55 | component:()=>import('@v/user/children/MyProfile.vue') 56 | }, 57 | { 58 | path: "noticeu", 59 | meta: {title: "查看公告"}, 60 | component:()=>import('@v/notice/adviseuser.vue') 61 | }, 62 | { 63 | name:"myremark", 64 | path:"myremark", 65 | meta:{title:"我的评价"}, 66 | component:() => import("@v/remark/myremark.vue") 67 | }, 68 | { 69 | name:"userremark", 70 | path:"userremark", 71 | meta:{title:"评价我的"}, 72 | component:() => import("@v/remark/userremark.vue") 73 | }, 74 | ] 75 | }, 76 | 77 | //管理员 78 | { 79 | path: "/admin", 80 | component: () => import("@v/admin/Login.vue"), 81 | }, 82 | { 83 | path: "/admin/home", 84 | component: () => import("@v/admin/Home.vue"), 85 | children:[ 86 | { 87 | path: "/", 88 | meta:{title:"首页"}, 89 | component:()=>import("@v/admin/children/Index.vue") 90 | }, 91 | { 92 | name: "adminSchool", 93 | path:"school", 94 | meta:{title:"学校信息"}, 95 | component:() => import("@v/admin/children/School.vue") 96 | }, 97 | { 98 | name:"adminStudent", 99 | path:"student", 100 | meta:{title:"用户信息"}, 101 | component:() => import("@v/admin/children/Student.vue") 102 | }, 103 | { 104 | name:"task", 105 | path:"task", 106 | meta:{title:"任务信息"}, 107 | component:() => import("@v/admin/children/Task.vue") 108 | }, 109 | { 110 | name:"notice", 111 | path:"notice", 112 | meta:{title:"公告管理"}, 113 | component:() => import("@v/notice/advise.vue") 114 | }, 115 | { 116 | name:"remark", 117 | path:"remark", 118 | meta:{title:"评价信息"}, 119 | component:() => import("@v/remark/remark.vue") 120 | }, 121 | ] 122 | }, 123 | ] 124 | 125 | const router = new VueRouter({ 126 | routes 127 | }) 128 | 129 | export default router 130 | -------------------------------------------------------------------------------- /前端/campus-web/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | import admin from "./module/admin"; 7 | import user from "./module/user"; 8 | import theme from "./module/theme"; 9 | export default new Vuex.Store({ 10 | // state中存放的就是全局共享的数据 11 | // state提供唯一的公共数据源,所有共享的数据都要统一放到Store的State中进行存储 12 | state: { 13 | active:0 14 | }, 15 | // Mutation用于变更Store中的数据 16 | // 只能通过mutation变更store数据,不可以直接操作store中的数据 17 | mutations: { 18 | setActive(state,val){ 19 | state.active = val 20 | } 21 | }, 22 | // Action用于处理异步任务 23 | // 如果通过异步操作变更数据,必须通过Action,而不能使用mutations,但是在action中还是要通过触发 24 | // Mutation的方式间接变更数据 25 | actions: { 26 | }, 27 | modules: { 28 | admin,user,theme 29 | }, 30 | //相当于 31 | getters:{ 32 | 33 | } 34 | }) 35 | -------------------------------------------------------------------------------- /前端/campus-web/src/store/module/admin.js: -------------------------------------------------------------------------------- 1 | export default { 2 | namespaced:true, 3 | state:{ 4 | admin:{ 5 | 6 | } 7 | }, 8 | // Mutation用于变更Store中的数据 9 | // 只能通过mutation变更store数据,不可以直接操作store中的数据 10 | mutations:{ 11 | // 该方法用于对admin对象赋值 12 | // state是当前的state val是传递过来的值 13 | setAdmin(state,val){ 14 | state.admin = val 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /前端/campus-web/src/store/module/theme.js: -------------------------------------------------------------------------------- 1 | export default { 2 | // 设置为私有命名空间 3 | namespaced:true, 4 | state:{ 5 | /*theme:{ 6 | blue:"#101f30", 7 | gley:"#2b333e", 8 | red :"#7c1823", 9 | black:"#000000", 10 | green:"#15231b" 11 | }*/ 12 | theme:[ 13 | { 14 | name: "白色主题", 15 | value: "#FFFFFF", 16 | color: '#000' 17 | }, 18 | { 19 | name:"蓝色主题", 20 | value:"#101f30", 21 | color:"#fff" 22 | }, 23 | { 24 | name:"灰色主题", 25 | value:"#2b333e", 26 | color:"#fff" 27 | }, 28 | { 29 | name:"黑色主题", 30 | value:"#000000", 31 | color:"#fff" 32 | }, 33 | { 34 | name:"绿色主题", 35 | value:"#314a43", 36 | color:"#fff" 37 | } 38 | ] 39 | } 40 | } -------------------------------------------------------------------------------- /前端/campus-web/src/store/module/user.js: -------------------------------------------------------------------------------- 1 | export default { 2 | namespaced:true, 3 | state:{ 4 | user:{ 5 | } 6 | }, 7 | mutations:{ 8 | // 该方法用于对admin对象赋值 9 | setUser(state,val){ 10 | state.user = val 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /前端/campus-web/src/util/date.js: -------------------------------------------------------------------------------- 1 | export function formatDate(date, fmt) { 2 | if (/(y+)/.test(fmt)) { 3 | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); 4 | } 5 | let o = { 6 | 'M+': date.getMonth() + 1, 7 | 'd+': date.getDate(), 8 | 'h+': date.getHours(), 9 | 'm+': date.getMinutes(), 10 | 's+': date.getSeconds() 11 | }; 12 | for (let k in o) { 13 | if (new RegExp(`(${k})`).test(fmt)) { 14 | let str = o[k] + ''; 15 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str)); 16 | } 17 | } 18 | return fmt; 19 | }; 20 | 21 | function padLeftZero(str) { 22 | return ('00' + str).substr(str.length); 23 | } -------------------------------------------------------------------------------- /前端/campus-web/src/util/request.js: -------------------------------------------------------------------------------- 1 | // 工具包 2 | import axios from "axios" 3 | import NProgress from 'nprogress' 4 | import 'nprogress/nprogress.css' 5 | 6 | const Qs = require("querystring"); 7 | 8 | /** 9 | * instance封装axios 10 | */ 11 | var instance = axios.create({ 12 | // 本地測試 13 | baseURL: 'http://localhost:8080', 14 | // 超时时间 15 | timeout: 20000 16 | }); 17 | 18 | // 添加请求拦截器 19 | instance.interceptors.request.use(function (config) { 20 | NProgress.start();//开启 21 | // 在发送请求之前做些什么 22 | return config; 23 | }, function (error) { 24 | NProgress.done();//关闭 25 | // 对请求错误做些什么 26 | return Promise.reject(error); 27 | }); 28 | 29 | // 添加响应拦截器 30 | instance.interceptors.response.use(function (response) { 31 | NProgress.done();//关闭 32 | // 对响应数据做点什么 33 | return response; 34 | }, function (error) { 35 | NProgress.done();//关闭 36 | // 对响应错误做点什么 37 | return Promise.reject(error); 38 | }); 39 | 40 | /** 41 | * service封装axios 42 | */ 43 | var service = axios.create({ 44 | // 本地測試 45 | baseURL: 'http://localhost:8080', 46 | // headers:{ 47 | // 'Content-Type':'application/json;charset=UTF-8' 48 | // }, 49 | // 超时时间 50 | timeout: 20000 51 | }); 52 | 53 | // 添加响应拦截器 54 | service.interceptors.response.use(function (response) { 55 | NProgress.done();//关闭 56 | // 对响应数据做点什么 57 | return response; 58 | }, function (error) { 59 | NProgress.done();//关闭 60 | // 对响应错误做点什么 61 | return Promise.reject(error); 62 | }); 63 | 64 | // 添加请求拦截器 65 | service.interceptors.request.use(function (config) { 66 | NProgress.start();//开启 67 | // 在发送请求之前做些什么 68 | return config; 69 | }, function (error) { 70 | NProgress.done();//关闭 71 | // 对请求错误做些什么 72 | return Promise.reject(error); 73 | }); 74 | 75 | 76 | 77 | let get = function (url, params) { 78 | return instance.get(url, {params}); 79 | } 80 | let post = function (url, params) { 81 | //form 82 | return instance.post(url, Qs.stringify(params)); 83 | } 84 | let put = function (url, params) { 85 | return instance.put(url, Qs.stringify(params)); 86 | } 87 | let del = function (url, params) { 88 | return instance.delete(url, {params}); 89 | } 90 | 91 | // 导出get和post方法 92 | export { 93 | get, put, del, post 94 | } 95 | 96 | export default service 97 | 98 | -------------------------------------------------------------------------------- /前端/campus-web/src/util/util.js: -------------------------------------------------------------------------------- 1 | export { 2 | setCookie, 3 | getCookie, 4 | delCookie, 5 | } 6 | 7 | /** 8 | * 設置Cookie 9 | * 固定30天 10 | * @param value 11 | * @param name 12 | */ 13 | function setCookie(name, value) { 14 | var days = 30; 15 | var date = new Date(); 16 | date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 17 | var expires = "; expires=" + date.toGMTString(); 18 | document.cookie = name + "=" + value + expires + "; path=/"; 19 | } 20 | 21 | /** 22 | * 獲取Cookie 23 | * @param name 24 | */ 25 | function getCookie(name) { 26 | var nameEQ = name + "="; 27 | var ca = document.cookie.split(';'); 28 | for (var i = 0; i < ca.length; i++) { 29 | var c = ca[i]; 30 | while (c.charAt(0) === ' ') c = c.substring(1, c.length); 31 | if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); 32 | } 33 | return null; 34 | } 35 | 36 | /** 37 | * 清除Cookie 38 | * @param name 39 | */ 40 | function delCookie(name) { 41 | var days = 0; 42 | var date = new Date(); 43 | date.setTime(date.getTime() + days); 44 | var expires = "; expires=" + date.toGMTString(); 45 | 46 | document.cookie = name + "=" + expires + "; path=/"; 47 | } -------------------------------------------------------------------------------- /前端/campus-web/src/views/Error.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 23 | 24 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/admin/Login.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 102 | 103 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/admin/children/Student.vue: -------------------------------------------------------------------------------- 1 | 99 | 100 | 167 | 168 | 193 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/admin/children/Task.vue: -------------------------------------------------------------------------------- 1 | 94 | 95 | 175 | 176 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/notice/adviseuser.vue: -------------------------------------------------------------------------------- 1 | 98 | 99 | 185 | 186 | 193 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/remark/userremark.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 183 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/user/children/Accept.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 105 | 106 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/user/children/Accepted.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | 124 | 125 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/user/children/Index.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 56 | 57 | -------------------------------------------------------------------------------- /前端/campus-web/src/views/user/children/MyProfile.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 57 | 58 | 76 | -------------------------------------------------------------------------------- /前端/campus-web/vue.config.js: -------------------------------------------------------------------------------- 1 | // 添加全局配置文件 2 | 3 | //引入path 4 | const path = require('path'); 5 | module.exports = { 6 | publicPath: './', 7 | // 输出文件目录 8 | outputDir: 'dist', 9 | //关闭esList语法检测功能 10 | lintOnSave: false, 11 | // 开发服务器相关的配置 12 | devServer:{ 13 | // 配置静态资源目录 14 | contentBase : path.join(__dirname,'public'), 15 | //默认启动打开浏览器 16 | open: true, 17 | // 设置开发服务器的端口号 18 | port: 8848 19 | }, 20 | // 配置webpack相关 21 | configureWebpack:{ 22 | // 解析 23 | resolve:{ 24 | // 配置路径别名 25 | alias:{ 26 | // 全部视图 __dirname当前项目 27 | '@v': path.resolve(__dirname,'src/views'), 28 | // 全部组件 29 | "@c": path.resolve(__dirname,'src/components'), 30 | //src路径 31 | "@s": path.resolve(__dirname,'src'), 32 | 33 | "@a": path.resolve(__dirname,'src/assets'), 34 | } 35 | } 36 | } 37 | } --------------------------------------------------------------------------------