├── pic └── logoin.png ├── src ├── main │ ├── resources │ │ ├── static │ │ │ └── config │ │ │ │ ├── image │ │ │ │ └── card.jpg │ │ │ │ └── mdui │ │ │ │ ├── fonts │ │ │ │ └── roboto │ │ │ │ │ ├── Roboto-Black.woff │ │ │ │ │ ├── Roboto-Black.woff2 │ │ │ │ │ ├── Roboto-Bold.woff │ │ │ │ │ ├── Roboto-Bold.woff2 │ │ │ │ │ ├── Roboto-Light.woff │ │ │ │ │ ├── Roboto-Light.woff2 │ │ │ │ │ ├── Roboto-Medium.woff │ │ │ │ │ ├── Roboto-Thin.woff │ │ │ │ │ ├── Roboto-Thin.woff2 │ │ │ │ │ ├── Roboto-Medium.woff2 │ │ │ │ │ ├── Roboto-Regular.woff │ │ │ │ │ ├── Roboto-Regular.woff2 │ │ │ │ │ ├── Roboto-BlackItalic.woff │ │ │ │ │ ├── Roboto-BoldItalic.woff │ │ │ │ │ ├── Roboto-BoldItalic.woff2 │ │ │ │ │ ├── Roboto-LightItalic.woff │ │ │ │ │ ├── Roboto-ThinItalic.woff │ │ │ │ │ ├── Roboto-ThinItalic.woff2 │ │ │ │ │ ├── Roboto-BlackItalic.woff2 │ │ │ │ │ ├── Roboto-LightItalic.woff2 │ │ │ │ │ ├── Roboto-MediumItalic.woff │ │ │ │ │ ├── Roboto-MediumItalic.woff2 │ │ │ │ │ ├── Roboto-RegularItalic.woff │ │ │ │ │ └── Roboto-RegularItalic.woff2 │ │ │ │ └── icons │ │ │ │ └── material-icons │ │ │ │ ├── MaterialIcons-Regular.woff │ │ │ │ └── MaterialIcons-Regular.woff2 │ │ ├── application.properties │ │ ├── templates │ │ │ ├── error.html │ │ │ ├── addColleges.html │ │ │ ├── addDepartment.html │ │ │ ├── addLevel.html │ │ │ ├── upColleges.html │ │ │ ├── upDepartment.html │ │ │ ├── upLevel.html │ │ │ ├── addUser.html │ │ │ ├── init.html │ │ │ ├── login.html │ │ │ ├── upResource.html │ │ │ ├── level.html │ │ │ ├── colleges.html │ │ │ ├── user.html │ │ │ ├── department.html │ │ │ ├── common.html │ │ │ ├── addResource.html │ │ │ ├── resource.html │ │ │ └── index.html │ │ ├── generatorConfig.xml │ │ └── mappers │ │ │ ├── CollegesMapper.xml │ │ │ ├── DepartmentMapper.xml │ │ │ ├── LevelMapper.xml │ │ │ ├── AdminResourceMapper.xml │ │ │ ├── AdminUserRoleResourceMapper.xml │ │ │ ├── AdminUserRoleMapper.xml │ │ │ └── AdminUserMapper.xml │ └── java │ │ └── top │ │ └── itning │ │ └── tmpp │ │ └── tmppadmin │ │ ├── config │ │ ├── BeansConfig.java │ │ ├── UserRealm.java │ │ └── ShiroConfig.java │ │ ├── controller │ │ ├── FrameController.java │ │ ├── SystemController.java │ │ ├── UserController.java │ │ ├── LevelController.java │ │ ├── CollegesController.java │ │ ├── DepartmentController.java │ │ ├── LoginController.java │ │ └── ResourceController.java │ │ ├── mapper │ │ ├── LevelMapper.java │ │ ├── CollegesMapper.java │ │ ├── DepartmentMapper.java │ │ ├── AdminResourceMapper.java │ │ ├── AdminUserMapper.java │ │ ├── AdminUserRoleMapper.java │ │ └── AdminUserRoleResourceMapper.java │ │ ├── TmppAdminApplication.java │ │ ├── service │ │ ├── AdminUserRoleService.java │ │ ├── AdminUserService.java │ │ ├── LoginService.java │ │ ├── CollegesService.java │ │ ├── LevelService.java │ │ ├── DepartmentService.java │ │ ├── AdminResourceService.java │ │ └── impl │ │ │ ├── LoginServiceImpl.java │ │ │ ├── CollegesServiceImpl.java │ │ │ ├── LevelServiceImpl.java │ │ │ ├── DepartmentServiceImpl.java │ │ │ ├── AdminUserRoleServiceImpl.java │ │ │ ├── AdminUserServiceImpl.java │ │ │ └── AdminResourceServiceImpl.java │ │ └── pojo │ │ ├── AdminUserRoleResourceKey.java │ │ ├── AdminUserRoleResource.java │ │ ├── Colleges.java │ │ ├── Department.java │ │ ├── Level.java │ │ ├── AdminResourceWithRoles.java │ │ ├── AdminUserRole.java │ │ ├── AdminResource.java │ │ └── AdminUser.java └── test │ └── java │ └── top │ └── itning │ └── tmpp │ └── tmppadmin │ ├── TmppAdminApplicationTests.java │ ├── service │ ├── AdminUserServiceTest.java │ └── AdminResourceServiceTest.java │ └── oshi │ └── OshiTest.java ├── .gitignore ├── README.md ├── pom.xml ├── mvnw.cmd ├── mvnw └── sql └── tmpp.sql /pic/logoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/pic/logoin.png -------------------------------------------------------------------------------- /src/main/resources/static/config/image/card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/image/card.jpg -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Black.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Black.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-BlackItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-BlackItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-BoldItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-BoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-LightItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-LightItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-ThinItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-ThinItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-ThinItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-ThinItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-BlackItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-BlackItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-LightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-LightItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-MediumItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-MediumItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-MediumItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-MediumItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-RegularItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-RegularItalic.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/fonts/roboto/Roboto-RegularItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/fonts/roboto/Roboto-RegularItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/icons/material-icons/MaterialIcons-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/icons/material-icons/MaterialIcons-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/config/mdui/icons/material-icons/MaterialIcons-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/tmpp-admin/master/src/main/resources/static/config/mdui/icons/material-icons/MaterialIcons-Regular.woff2 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !**/src/main/** 3 | !**/src/test/** 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | .mvn/ 31 | -------------------------------------------------------------------------------- /src/test/java/top/itning/tmpp/tmppadmin/TmppAdminApplicationTests.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class TmppAdminApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/config/BeansConfig.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.config; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/17 16:30 10 | */ 11 | @Configuration 12 | public class BeansConfig { 13 | @Bean 14 | public ModelMapper modelMapper() { 15 | return new ModelMapper(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/FrameController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * @author itning 8 | * @date 2019/6/17 14:53 9 | */ 10 | @Controller 11 | public class FrameController { 12 | 13 | /** 14 | * 主页 15 | * 16 | * @return index.html 17 | */ 18 | @GetMapping("/index") 19 | public String index() { 20 | return "index"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/LevelMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Level; 4 | 5 | import java.util.List; 6 | 7 | public interface LevelMapper { 8 | int deleteByPrimaryKey(String id); 9 | 10 | int insert(Level record); 11 | 12 | int insertSelective(Level record); 13 | 14 | Level selectByPrimaryKey(String id); 15 | 16 | int updateByPrimaryKeySelective(Level record); 17 | 18 | int updateByPrimaryKey(Level record); 19 | 20 | List selectAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/CollegesMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Colleges; 4 | 5 | import java.util.List; 6 | 7 | public interface CollegesMapper { 8 | int deleteByPrimaryKey(String id); 9 | 10 | int insert(Colleges record); 11 | 12 | int insertSelective(Colleges record); 13 | 14 | Colleges selectByPrimaryKey(String id); 15 | 16 | int updateByPrimaryKeySelective(Colleges record); 17 | 18 | int updateByPrimaryKey(Colleges record); 19 | 20 | List selectAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/TmppAdminApplication.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * @author itning 9 | */ 10 | @SpringBootApplication 11 | @MapperScan("top.itning.tmpp.tmppadmin.mapper") 12 | public class TmppAdminApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(TmppAdminApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/DepartmentMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Department; 4 | 5 | import java.util.List; 6 | 7 | public interface DepartmentMapper { 8 | int deleteByPrimaryKey(String id); 9 | 10 | int insert(Department record); 11 | 12 | int insertSelective(Department record); 13 | 14 | Department selectByPrimaryKey(String id); 15 | 16 | int updateByPrimaryKeySelective(Department record); 17 | 18 | int updateByPrimaryKey(Department record); 19 | 20 | List selectAll(); 21 | } -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8888 2 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 3 | spring.datasource.username=root 4 | spring.datasource.password=kingston 5 | spring.datasource.url=jdbc:mysql://docker:3307/tmpp?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=0&serverTimezone=UTC&allowPublicKeyRetrieval=true 6 | spring.jackson.time-zone=Asia/Shanghai 7 | mybatis.type-aliases-package=top.itning.tmpp.tmppadmin.pojo 8 | mybatis.mapper-locations=classpath:mappers/*.xml 9 | logging.level.top=debug 10 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/AdminResourceMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminResource; 4 | 5 | import java.util.List; 6 | 7 | public interface AdminResourceMapper { 8 | int deleteByPrimaryKey(String id); 9 | 10 | int insert(AdminResource record); 11 | 12 | int insertSelective(AdminResource record); 13 | 14 | AdminResource selectByPrimaryKey(String id); 15 | 16 | int updateByPrimaryKeySelective(AdminResource record); 17 | 18 | int updateByPrimaryKey(AdminResource record); 19 | 20 | List selectAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/AdminUserRoleService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/17 16:55 10 | */ 11 | public interface AdminUserRoleService { 12 | /** 13 | * 根据资源ID获取该资源下可访问的用户角色信息 14 | * 15 | * @param resourceId 资源ID 16 | * @return 用户角色信息集合 17 | */ 18 | List getAdminUserRoleByResourceId(String resourceId); 19 | 20 | /** 21 | * 获取所有用户角色信息 22 | * 23 | * @return 用户角色信息集合 24 | */ 25 | List getAdminUserRoles(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/AdminUserMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 4 | 5 | import java.util.List; 6 | 7 | public interface AdminUserMapper { 8 | int deleteByPrimaryKey(String id); 9 | 10 | int insert(AdminUser record); 11 | 12 | int insertSelective(AdminUser record); 13 | 14 | AdminUser selectByPrimaryKey(String id); 15 | 16 | int updateByPrimaryKeySelective(AdminUser record); 17 | 18 | int updateByPrimaryKey(AdminUser record); 19 | 20 | AdminUser selectByUserName(String username); 21 | 22 | long countByType(String type); 23 | 24 | List selectAll(); 25 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/AdminUserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 4 | 5 | import java.util.List; 6 | 7 | public interface AdminUserRoleMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(AdminUserRole record); 11 | 12 | int insertSelective(AdminUserRole record); 13 | 14 | AdminUserRole selectByPrimaryKey(Integer id); 15 | 16 | int updateByPrimaryKeySelective(AdminUserRole record); 17 | 18 | int updateByPrimaryKey(AdminUserRole record); 19 | 20 | List selectByResourceId(String resourceId); 21 | 22 | List selectAll(); 23 | 24 | String selectNameByType(String type); 25 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/AdminUserService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/17 17:56 10 | */ 11 | public interface AdminUserService { 12 | /** 13 | * 获取所有用户 14 | * 15 | * @return 用户集合 16 | */ 17 | List getAdminUsers(); 18 | 19 | /** 20 | * 根据用户ID删除用户 21 | * 22 | * @param id 用户ID 23 | */ 24 | void delAdminUserById(String id); 25 | 26 | /** 27 | * 添加用户 28 | * 29 | * @param name 昵称 30 | * @param username 用户名 31 | * @param type 角色 32 | */ 33 | void addAdminUser(String name, String username, String type); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/LoginService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 4 | 5 | import java.util.Optional; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/17 11:51 10 | */ 11 | public interface LoginService { 12 | /** 13 | * 根据用户名查找用户 14 | * 15 | * @param username 用户名 16 | * @return 如果没找到返回 {@link Optional#empty()} 17 | */ 18 | Optional getAdminUserByUserName(String username); 19 | 20 | /** 21 | * 检查是否有管理员账户 22 | * 23 | * @return 是返回真 24 | */ 25 | boolean haveAdminAccount(); 26 | 27 | /** 28 | * 初始化管理员账户 29 | * 30 | * @param username 用户名 31 | * @param password 密码 32 | */ 33 | void initAdminAccount(String username, String password); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/mapper/AdminUserRoleResourceMapper.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.mapper; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRoleResource; 4 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRoleResourceKey; 5 | 6 | import java.util.List; 7 | 8 | public interface AdminUserRoleResourceMapper { 9 | int deleteByPrimaryKey(AdminUserRoleResourceKey key); 10 | 11 | int insert(AdminUserRoleResource record); 12 | 13 | int insertSelective(AdminUserRoleResource record); 14 | 15 | AdminUserRoleResource selectByPrimaryKey(AdminUserRoleResourceKey key); 16 | 17 | int updateByPrimaryKeySelective(AdminUserRoleResource record); 18 | 19 | int updateByPrimaryKey(AdminUserRoleResource record); 20 | 21 | List selectByResourceId(String resourceId); 22 | 23 | List selectUserRoleByResourceId(String resourceId); 24 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminUserRoleResourceKey.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | public class AdminUserRoleResourceKey { 4 | private Integer userRoleId; 5 | 6 | private String resourceId; 7 | 8 | public AdminUserRoleResourceKey(Integer userRoleId, String resourceId) { 9 | this.userRoleId = userRoleId; 10 | this.resourceId = resourceId; 11 | } 12 | 13 | public AdminUserRoleResourceKey() { 14 | super(); 15 | } 16 | 17 | public Integer getUserRoleId() { 18 | return userRoleId; 19 | } 20 | 21 | public void setUserRoleId(Integer userRoleId) { 22 | this.userRoleId = userRoleId; 23 | } 24 | 25 | public String getResourceId() { 26 | return resourceId; 27 | } 28 | 29 | public void setResourceId(String resourceId) { 30 | this.resourceId = resourceId == null ? null : resourceId.trim(); 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/CollegesService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Colleges; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/19 11:45 10 | */ 11 | public interface CollegesService { 12 | /** 13 | * 获取所有学院 14 | * 15 | * @return 学院集合 16 | */ 17 | List getAllColleges(); 18 | 19 | /** 20 | * 获取学院 21 | * 22 | * @param id 学院ID 23 | * @return 学院 24 | */ 25 | Colleges getColleges(String id); 26 | 27 | /** 28 | * 保存学院 29 | * 30 | * @param name 学院名 31 | */ 32 | void saveColleges(String name); 33 | 34 | /** 35 | * 删除学院 36 | * 37 | * @param id 学院ID 38 | */ 39 | void delColleges(String id); 40 | 41 | /** 42 | * 修改学院 43 | * 44 | * @param id 学院ID 45 | * @param name 学院名 46 | */ 47 | void upColleges(String id, String name); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminUserRoleResource.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class AdminUserRoleResource extends AdminUserRoleResourceKey { 6 | private Date gmtCreate; 7 | 8 | private Date gmtModified; 9 | 10 | public AdminUserRoleResource(Integer userRoleId, String resourceId, Date gmtCreate, Date gmtModified) { 11 | super(userRoleId, resourceId); 12 | this.gmtCreate = gmtCreate; 13 | this.gmtModified = gmtModified; 14 | } 15 | 16 | public AdminUserRoleResource() { 17 | super(); 18 | } 19 | 20 | public Date getGmtCreate() { 21 | return gmtCreate; 22 | } 23 | 24 | public void setGmtCreate(Date gmtCreate) { 25 | this.gmtCreate = gmtCreate; 26 | } 27 | 28 | public Date getGmtModified() { 29 | return gmtModified; 30 | } 31 | 32 | public void setGmtModified(Date gmtModified) { 33 | this.gmtModified = gmtModified; 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/LevelService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Level; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/19 11:00 10 | */ 11 | public interface LevelService { 12 | /** 13 | * 获取所有层次 14 | * 15 | * @return 层次集合 16 | */ 17 | List getAllLevel(); 18 | 19 | /** 20 | * 保存层次 21 | * 22 | * @param educationalLevel 层次 23 | */ 24 | void saveLevel(String educationalLevel); 25 | 26 | /** 27 | * 删除层次 28 | * 29 | * @param id 层次ID 30 | */ 31 | void delLevel(String id); 32 | 33 | /** 34 | * 修改层次 35 | * 36 | * @param id 层次ID 37 | * @param newEducationalLevel 新层次 38 | */ 39 | void upLevel(String id, String newEducationalLevel); 40 | 41 | /** 42 | * 获取层次 43 | * 44 | * @param id 层次ID 45 | * @return 层次 46 | */ 47 | Level getLevel(String id); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/DepartmentService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.Department; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author itning 9 | * @date 2019/6/19 11:25 10 | */ 11 | public interface DepartmentService { 12 | /** 13 | * 获取所有授课部门 14 | * 15 | * @return 授课部门集合 16 | */ 17 | List getAllDepartment(); 18 | 19 | /** 20 | * 获取授课部门 21 | * 22 | * @param id 授课部门ID 23 | * @return 授课部门 24 | */ 25 | Department getDepartment(String id); 26 | 27 | /** 28 | * 保存授课部门 29 | * 30 | * @param name 授课部门名称 31 | */ 32 | void saveDepartment(String name); 33 | 34 | /** 35 | * 更新授课部门 36 | * 37 | * @param id 授课部门ID 38 | * @param newName 授课部门名称 39 | */ 40 | void upDepartment(String id, String newName); 41 | 42 | /** 43 | * 删除授课部门 44 | * 45 | * @param id 授课部门ID 46 | */ 47 | void delDepartment(String id); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/AdminResourceService.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import top.itning.tmpp.tmppadmin.pojo.AdminResource; 4 | import top.itning.tmpp.tmppadmin.pojo.AdminResourceWithRoles; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author itning 10 | * @date 2019/6/17 14:58 11 | */ 12 | public interface AdminResourceService { 13 | /** 14 | * 获取所有资源 15 | * 16 | * @return 资源集合 17 | */ 18 | List getAllAdminResources(); 19 | 20 | /** 21 | * 根据ID获取资源 22 | * 23 | * @param id ID 24 | * @return 资源 25 | */ 26 | AdminResource getAdminResourceById(String id); 27 | 28 | /** 29 | * 保存资源 30 | * 31 | * @param url 资源 32 | * @param method 方法 33 | * @param roles 角色 34 | */ 35 | void saveAdminResource(String url, String method, int[] roles); 36 | 37 | /** 38 | * 删除资源 39 | * 40 | * @param id 资源ID 41 | */ 42 | void delAdminResource(String id); 43 | 44 | /** 45 | * 修改资源 46 | * 47 | * @param id 资源ID 48 | * @param newUrl 新资源 49 | * @param newMethod 新方法 50 | * @param roles 角色 51 | */ 52 | void upAdminResource(String id, String newUrl, String newMethod, int[] roles); 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/Colleges.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Colleges { 6 | private String id; 7 | 8 | private String name; 9 | 10 | private Date gmtModified; 11 | 12 | private Date gmtCreate; 13 | 14 | public Colleges(String id, String name, Date gmtModified, Date gmtCreate) { 15 | this.id = id; 16 | this.name = name; 17 | this.gmtModified = gmtModified; 18 | this.gmtCreate = gmtCreate; 19 | } 20 | 21 | public Colleges() { 22 | super(); 23 | } 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id == null ? null : id.trim(); 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name == null ? null : name.trim(); 39 | } 40 | 41 | public Date getGmtModified() { 42 | return gmtModified; 43 | } 44 | 45 | public void setGmtModified(Date gmtModified) { 46 | this.gmtModified = gmtModified; 47 | } 48 | 49 | public Date getGmtCreate() { 50 | return gmtCreate; 51 | } 52 | 53 | public void setGmtCreate(Date gmtCreate) { 54 | this.gmtCreate = gmtCreate; 55 | } 56 | } -------------------------------------------------------------------------------- /src/test/java/top/itning/tmpp/tmppadmin/service/AdminUserServiceTest.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | import java.util.UUID; 10 | 11 | @RunWith(SpringRunner.class) 12 | @SpringBootTest 13 | public class AdminUserServiceTest { 14 | @Autowired 15 | private AdminUserService adminUserService; 16 | 17 | @Test 18 | public void getAdminUsers() { 19 | 20 | } 21 | 22 | @Test 23 | public void delAdminUserById() { 24 | } 25 | 26 | @Test 27 | public void addAdminUser() { 28 | for (int i = 0; i < 1000; i++) { 29 | adminUserService.addAdminUser( 30 | UUID.randomUUID().toString().replace("-", ""), 31 | UUID.randomUUID().toString().replace("-", ""), 32 | getRandomUserType()); 33 | } 34 | } 35 | 36 | private String getRandomUserType() { 37 | int v = (int) (Math.random() * 10); 38 | if (v < 4) { 39 | return "T"; 40 | } else if (v < 8) { 41 | return "O"; 42 | } else { 43 | return "A"; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/Department.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Department { 6 | private String id; 7 | 8 | private String name; 9 | 10 | private Date gmtModified; 11 | 12 | private Date gmtCreate; 13 | 14 | public Department(String id, String name, Date gmtModified, Date gmtCreate) { 15 | this.id = id; 16 | this.name = name; 17 | this.gmtModified = gmtModified; 18 | this.gmtCreate = gmtCreate; 19 | } 20 | 21 | public Department() { 22 | super(); 23 | } 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id == null ? null : id.trim(); 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name == null ? null : name.trim(); 39 | } 40 | 41 | public Date getGmtModified() { 42 | return gmtModified; 43 | } 44 | 45 | public void setGmtModified(Date gmtModified) { 46 | this.gmtModified = gmtModified; 47 | } 48 | 49 | public Date getGmtCreate() { 50 | return gmtCreate; 51 | } 52 | 53 | public void setGmtCreate(Date gmtCreate) { 54 | this.gmtCreate = gmtCreate; 55 | } 56 | } -------------------------------------------------------------------------------- /src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/SystemController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import oshi.SystemInfo; 7 | import oshi.hardware.CentralProcessor; 8 | import oshi.hardware.GlobalMemory; 9 | import oshi.hardware.HardwareAbstractionLayer; 10 | 11 | /** 12 | * @author itning 13 | * @date 2019/6/22 20:18 14 | */ 15 | @RestController 16 | @RequestMapping("/system") 17 | public class SystemController { 18 | 19 | private final CentralProcessor processor; 20 | private final GlobalMemory memory; 21 | 22 | public SystemController() { 23 | SystemInfo si = new SystemInfo(); 24 | HardwareAbstractionLayer hardware = si.getHardware(); 25 | processor = hardware.getProcessor(); 26 | memory = hardware.getMemory(); 27 | } 28 | 29 | @GetMapping("/systemCpuLoad") 30 | public int getSystemCpuLoad() { 31 | return (int) (processor.getSystemCpuLoad() * 100); 32 | } 33 | 34 | @GetMapping("/memoryAvailable") 35 | public long getMemoryAvailable() { 36 | return memory.getAvailable(); 37 | } 38 | 39 | @GetMapping("/memoryTotal") 40 | public long getMemoryTotal() { 41 | return memory.getTotal(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/Level.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Level { 6 | private String id; 7 | 8 | private String educationalLevel; 9 | 10 | private Date gmtModified; 11 | 12 | private Date gmtCreate; 13 | 14 | public Level(String id, String educationalLevel, Date gmtModified, Date gmtCreate) { 15 | this.id = id; 16 | this.educationalLevel = educationalLevel; 17 | this.gmtModified = gmtModified; 18 | this.gmtCreate = gmtCreate; 19 | } 20 | 21 | public Level() { 22 | super(); 23 | } 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id == null ? null : id.trim(); 31 | } 32 | 33 | public String getEducationalLevel() { 34 | return educationalLevel; 35 | } 36 | 37 | public void setEducationalLevel(String educationalLevel) { 38 | this.educationalLevel = educationalLevel == null ? null : educationalLevel.trim(); 39 | } 40 | 41 | public Date getGmtModified() { 42 | return gmtModified; 43 | } 44 | 45 | public void setGmtModified(Date gmtModified) { 46 | this.gmtModified = gmtModified; 47 | } 48 | 49 | public Date getGmtCreate() { 50 | return gmtCreate; 51 | } 52 | 53 | public void setGmtCreate(Date gmtCreate) { 54 | this.gmtCreate = gmtCreate; 55 | } 56 | } -------------------------------------------------------------------------------- /src/test/java/top/itning/tmpp/tmppadmin/oshi/OshiTest.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.oshi; 2 | 3 | import org.junit.Test; 4 | import oshi.SystemInfo; 5 | import oshi.hardware.CentralProcessor; 6 | import oshi.hardware.HardwareAbstractionLayer; 7 | import oshi.software.os.OperatingSystem; 8 | 9 | import java.text.DecimalFormat; 10 | 11 | /** 12 | * @author itning 13 | * @date 2019/6/22 17:53 14 | */ 15 | public class OshiTest { 16 | @Test 17 | public void test() throws InterruptedException { 18 | SystemInfo si = new SystemInfo(); 19 | HardwareAbstractionLayer hardware = si.getHardware(); 20 | } 21 | 22 | public static String getNetFileSizeDescription(long size) { 23 | StringBuilder bytes = new StringBuilder(); 24 | DecimalFormat format = new DecimalFormat("###.0"); 25 | if (size >= 1024 * 1024 * 1024) { 26 | double i = (size / (1024.0 * 1024.0 * 1024.0)); 27 | bytes.append(format.format(i)).append("GB"); 28 | } else if (size >= 1024 * 1024) { 29 | double i = (size / (1024.0 * 1024.0)); 30 | bytes.append(format.format(i)).append("MB"); 31 | } else if (size >= 1024) { 32 | double i = (size / (1024.0)); 33 | bytes.append(format.format(i)).append("KB"); 34 | } else { 35 | if (size <= 0) { 36 | bytes.append("0B"); 37 | } else { 38 | bytes.append((int) size).append("B"); 39 | } 40 | } 41 | return bytes.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminResourceWithRoles.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * @author itning 8 | * @date 2019/6/17 16:26 9 | */ 10 | public class AdminResourceWithRoles { 11 | private String id; 12 | 13 | private String url; 14 | 15 | private String method; 16 | 17 | private List roles; 18 | 19 | private Date gmtCreate; 20 | 21 | private Date gmtModified; 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String getUrl() { 32 | return url; 33 | } 34 | 35 | public void setUrl(String url) { 36 | this.url = url; 37 | } 38 | 39 | public String getMethod() { 40 | return method; 41 | } 42 | 43 | public void setMethod(String method) { 44 | this.method = method; 45 | } 46 | 47 | public List getRoles() { 48 | return roles; 49 | } 50 | 51 | public void setRoles(List roles) { 52 | this.roles = roles; 53 | } 54 | 55 | public Date getGmtCreate() { 56 | return gmtCreate; 57 | } 58 | 59 | public void setGmtCreate(Date gmtCreate) { 60 | this.gmtCreate = gmtCreate; 61 | } 62 | 63 | public Date getGmtModified() { 64 | return gmtModified; 65 | } 66 | 67 | public void setGmtModified(Date gmtModified) { 68 | this.gmtModified = gmtModified; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 教材采购系统 管理员后台 2 | 3 | [![GitHub stars](https://img.shields.io/github/stars/itning/tmpp-admin.svg?style=social&label=Stars)](https://github.com/itning/tmpp-admin/stargazers) 4 | [![GitHub forks](https://img.shields.io/github/forks/itning/tmpp-admin.svg?style=social&label=Fork)](https://github.com/itning/tmpp-admin/network/members) 5 | [![GitHub watchers](https://img.shields.io/github/watchers/itning/tmpp-admin.svg?style=social&label=Watch)](https://github.com/itning/tmpp-admin/watchers) 6 | [![GitHub followers](https://img.shields.io/github/followers/itning.svg?style=social&label=Follow)](https://github.com/itning?tab=followers) 7 | 8 | [![GitHub issues](https://img.shields.io/github/issues/itning/tmpp-admin.svg)](https://github.com/itning/tmpp-admin/issues) 9 | [![GitHub license](https://img.shields.io/github/license/itning/tmpp-admin.svg)](https://github.com/itning/tmpp-admin/blob/master/LICENSE) 10 | [![GitHub last commit](https://img.shields.io/github/last-commit/itning/tmpp-admin.svg)](https://github.com/itning/tmpp-admin/commits) 11 | [![GitHub release](https://img.shields.io/github/release/itning/tmpp-admin.svg)](https://github.com/itning/tmpp-admin/releases) 12 | [![GitHub repo size in bytes](https://img.shields.io/github/repo-size/itning/tmpp-admin.svg)](https://github.com/itning/tmpp-admin) 13 | [![HitCount](http://hits.dwyl.com/itning/tmpp-admin.svg)](http://hits.dwyl.com/itning/tmpp-admin) 14 | [![language](https://img.shields.io/badge/language-JAVA-green.svg)](https://github.com/itning/tmpp-admin) 15 | 16 | ![](https://raw.githubusercontent.com/itning/tmpp-admin/master/pic/logoin.png) 17 | -------------------------------------------------------------------------------- /src/main/resources/templates/addColleges.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/templates/addDepartment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/templates/addLevel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminUserRole.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class AdminUserRole { 6 | private Integer id; 7 | 8 | private String name; 9 | 10 | private Date gmtCreate; 11 | 12 | private Date gmtModified; 13 | 14 | private String type; 15 | 16 | public AdminUserRole(Integer id, String name, Date gmtCreate, Date gmtModified, String type) { 17 | this.id = id; 18 | this.name = name; 19 | this.gmtCreate = gmtCreate; 20 | this.gmtModified = gmtModified; 21 | this.type = type; 22 | } 23 | 24 | public AdminUserRole() { 25 | super(); 26 | } 27 | 28 | public Integer getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Integer id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name == null ? null : name.trim(); 42 | } 43 | 44 | public Date getGmtCreate() { 45 | return gmtCreate; 46 | } 47 | 48 | public void setGmtCreate(Date gmtCreate) { 49 | this.gmtCreate = gmtCreate; 50 | } 51 | 52 | public Date getGmtModified() { 53 | return gmtModified; 54 | } 55 | 56 | public void setGmtModified(Date gmtModified) { 57 | this.gmtModified = gmtModified; 58 | } 59 | 60 | public String getType() { 61 | return type; 62 | } 63 | 64 | public void setType(String type) { 65 | this.type = type == null ? null : type.trim(); 66 | } 67 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminResource.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class AdminResource { 6 | private String id; 7 | 8 | private String url; 9 | 10 | private String method; 11 | 12 | private Date gmtCreate; 13 | 14 | private Date gmtModified; 15 | 16 | public AdminResource(String id, String url, String method, Date gmtCreate, Date gmtModified) { 17 | this.id = id; 18 | this.url = url; 19 | this.method = method; 20 | this.gmtCreate = gmtCreate; 21 | this.gmtModified = gmtModified; 22 | } 23 | 24 | public AdminResource() { 25 | super(); 26 | } 27 | 28 | public String getId() { 29 | return id; 30 | } 31 | 32 | public void setId(String id) { 33 | this.id = id == null ? null : id.trim(); 34 | } 35 | 36 | public String getUrl() { 37 | return url; 38 | } 39 | 40 | public void setUrl(String url) { 41 | this.url = url == null ? null : url.trim(); 42 | } 43 | 44 | public String getMethod() { 45 | return method; 46 | } 47 | 48 | public void setMethod(String method) { 49 | this.method = method == null ? null : method.trim(); 50 | } 51 | 52 | public Date getGmtCreate() { 53 | return gmtCreate; 54 | } 55 | 56 | public void setGmtCreate(Date gmtCreate) { 57 | this.gmtCreate = gmtCreate; 58 | } 59 | 60 | public Date getGmtModified() { 61 | return gmtModified; 62 | } 63 | 64 | public void setGmtModified(Date gmtModified) { 65 | this.gmtModified = gmtModified; 66 | } 67 | } -------------------------------------------------------------------------------- /src/main/resources/templates/upColleges.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 | 22 |
23 | 24 | 25 |
26 | 27 |
28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/templates/upDepartment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 | 22 |
23 | 24 | 25 |
26 | 27 |
28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/templates/upLevel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 | 22 |
23 | 24 | 25 |
26 | 27 |
28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/test/java/top/itning/tmpp/tmppadmin/service/AdminResourceServiceTest.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 9 | 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | @RunWith(SpringRunner.class) 14 | @SpringBootTest 15 | public class AdminResourceServiceTest { 16 | @Autowired 17 | private AdminResourceService adminResourceService; 18 | 19 | @Autowired 20 | private AdminUserRoleService adminUserRoleService; 21 | 22 | @Test 23 | public void getAllAdminResources() { 24 | } 25 | 26 | @Test 27 | public void getAdminResourceById() { 28 | } 29 | 30 | @Test 31 | public void saveAdminResource() { 32 | List adminUserRoles = adminUserRoleService.getAdminUserRoles(); 33 | for (int i = 0; i < 1000; i++) { 34 | int index = (int) (Math.random() * adminUserRoles.size()); 35 | adminResourceService.saveAdminResource("/" + UUID.randomUUID().toString().replace("-", ""), 36 | getRandomMethod(), 37 | new int[]{adminUserRoles.get(index).getId()}); 38 | } 39 | } 40 | 41 | @Test 42 | public void delAdminResource() { 43 | } 44 | 45 | @Test 46 | public void upAdminResource() { 47 | } 48 | 49 | private String getRandomMethod() { 50 | int v = (int) (Math.random() * 10); 51 | if (v < 4) { 52 | return "GET"; 53 | } else if (v < 8) { 54 | return "POST"; 55 | } else { 56 | return "DELETE"; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/LoginServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | import top.itning.tmpp.tmppadmin.mapper.AdminUserMapper; 7 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 8 | import top.itning.tmpp.tmppadmin.service.LoginService; 9 | 10 | import java.util.Date; 11 | import java.util.Optional; 12 | import java.util.UUID; 13 | 14 | /** 15 | * @author itning 16 | * @date 2019/6/17 11:54 17 | */ 18 | @Service 19 | public class LoginServiceImpl implements LoginService { 20 | private final AdminUserMapper adminUserMapper; 21 | 22 | @Autowired 23 | public LoginServiceImpl(AdminUserMapper adminUserMapper) { 24 | this.adminUserMapper = adminUserMapper; 25 | } 26 | 27 | @Override 28 | public Optional getAdminUserByUserName(String username) { 29 | if (StringUtils.isBlank(username)) { 30 | //TODO 抛异常 31 | } 32 | return Optional.ofNullable(adminUserMapper.selectByUserName(username)); 33 | } 34 | 35 | @Override 36 | public boolean haveAdminAccount() { 37 | return adminUserMapper.countByType("ADMIN") != 0; 38 | } 39 | 40 | @Override 41 | public void initAdminAccount(String username, String password) { 42 | AdminUser adminUser = new AdminUser(); 43 | adminUser.setId(UUID.randomUUID().toString().replace("-", "")); 44 | adminUser.setName("管理员"); 45 | adminUser.setUsername(username); 46 | adminUser.setPassword(password); 47 | adminUser.setType("ADMIN"); 48 | Date date = new Date(); 49 | adminUser.setGmtCreate(date); 50 | adminUser.setGmtModified(date); 51 | adminUserMapper.insert(adminUser); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/CollegesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import top.itning.tmpp.tmppadmin.mapper.CollegesMapper; 5 | import top.itning.tmpp.tmppadmin.pojo.Colleges; 6 | import top.itning.tmpp.tmppadmin.service.CollegesService; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | import java.util.UUID; 11 | 12 | /** 13 | * @author itning 14 | * @date 2019/6/19 11:48 15 | */ 16 | @Service 17 | public class CollegesServiceImpl implements CollegesService { 18 | private final CollegesMapper collegesMapper; 19 | 20 | public CollegesServiceImpl(CollegesMapper collegesMapper) { 21 | this.collegesMapper = collegesMapper; 22 | } 23 | 24 | @Override 25 | public List getAllColleges() { 26 | return collegesMapper.selectAll(); 27 | } 28 | 29 | @Override 30 | public Colleges getColleges(String id) { 31 | return collegesMapper.selectByPrimaryKey(id); 32 | } 33 | 34 | @Override 35 | public void saveColleges(String name) { 36 | Colleges colleges = new Colleges(); 37 | colleges.setId(UUID.randomUUID().toString().replace("-", "")); 38 | colleges.setName(name); 39 | Date date = new Date(); 40 | colleges.setGmtModified(date); 41 | colleges.setGmtCreate(date); 42 | collegesMapper.insert(colleges); 43 | } 44 | 45 | @Override 46 | public void delColleges(String id) { 47 | collegesMapper.deleteByPrimaryKey(id); 48 | } 49 | 50 | @Override 51 | public void upColleges(String id, String name) { 52 | Colleges colleges = new Colleges(); 53 | colleges.setId(id); 54 | colleges.setName(name); 55 | colleges.setGmtModified(new Date()); 56 | collegesMapper.updateByPrimaryKeySelective(colleges); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/LevelServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import top.itning.tmpp.tmppadmin.mapper.LevelMapper; 6 | import top.itning.tmpp.tmppadmin.pojo.Level; 7 | import top.itning.tmpp.tmppadmin.service.LevelService; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | /** 14 | * @author itning 15 | * @date 2019/6/19 11:01 16 | */ 17 | @Service 18 | public class LevelServiceImpl implements LevelService { 19 | private final LevelMapper levelMapper; 20 | 21 | @Autowired 22 | public LevelServiceImpl(LevelMapper levelMapper) { 23 | this.levelMapper = levelMapper; 24 | } 25 | 26 | @Override 27 | public List getAllLevel() { 28 | return levelMapper.selectAll(); 29 | } 30 | 31 | @Override 32 | public void saveLevel(String educationalLevel) { 33 | Level level = new Level(); 34 | level.setId(UUID.randomUUID().toString().replace("-", "")); 35 | level.setEducationalLevel(educationalLevel); 36 | Date date = new Date(); 37 | level.setGmtModified(date); 38 | level.setGmtCreate(date); 39 | levelMapper.insert(level); 40 | } 41 | 42 | @Override 43 | public void delLevel(String id) { 44 | levelMapper.deleteByPrimaryKey(id); 45 | } 46 | 47 | @Override 48 | public void upLevel(String id, String newEducationalLevel) { 49 | Level level = new Level(); 50 | level.setId(id); 51 | level.setEducationalLevel(newEducationalLevel); 52 | level.setGmtModified(new Date()); 53 | levelMapper.updateByPrimaryKeySelective(level); 54 | } 55 | 56 | @Override 57 | public Level getLevel(String id) { 58 | return levelMapper.selectByPrimaryKey(id); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/config/UserRealm.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.config; 2 | 3 | import org.apache.shiro.authc.*; 4 | import org.apache.shiro.authz.AuthorizationInfo; 5 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 6 | import org.apache.shiro.realm.AuthorizingRealm; 7 | import org.apache.shiro.subject.PrincipalCollection; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 12 | import top.itning.tmpp.tmppadmin.service.LoginService; 13 | 14 | import java.util.Optional; 15 | 16 | /** 17 | * @author itning 18 | * @date 2019/6/17 10:06 19 | */ 20 | public class UserRealm extends AuthorizingRealm { 21 | private static final Logger logger = LoggerFactory.getLogger(UserRealm.class); 22 | 23 | private final LoginService loginService; 24 | 25 | @Autowired 26 | public UserRealm(LoginService loginService) { 27 | this.loginService = loginService; 28 | } 29 | 30 | 31 | @Override 32 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { 33 | AdminUser adminUser = (AdminUser) principals.getPrimaryPrincipal(); 34 | SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); 35 | simpleAuthorizationInfo.addRole(adminUser.getType()); 36 | return simpleAuthorizationInfo; 37 | } 38 | 39 | @Override 40 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 41 | UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) token; 42 | Optional adminUserOptional = loginService.getAdminUserByUserName(usernamePasswordToken.getUsername()); 43 | if (!adminUserOptional.isPresent()) { 44 | return null; 45 | } 46 | AdminUser adminUser = adminUserOptional.get(); 47 | return new SimpleAuthenticationInfo(adminUser, adminUser.getPassword(), "userrealm"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/DepartmentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import top.itning.tmpp.tmppadmin.mapper.DepartmentMapper; 6 | import top.itning.tmpp.tmppadmin.pojo.Department; 7 | import top.itning.tmpp.tmppadmin.service.DepartmentService; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | /** 14 | * @author itning 15 | * @date 2019/6/19 11:28 16 | */ 17 | @Service 18 | public class DepartmentServiceImpl implements DepartmentService { 19 | private final DepartmentMapper departmentMapper; 20 | 21 | @Autowired 22 | public DepartmentServiceImpl(DepartmentMapper departmentMapper) { 23 | this.departmentMapper = departmentMapper; 24 | } 25 | 26 | @Override 27 | public List getAllDepartment() { 28 | return departmentMapper.selectAll(); 29 | } 30 | 31 | @Override 32 | public Department getDepartment(String id) { 33 | return departmentMapper.selectByPrimaryKey(id); 34 | } 35 | 36 | @Override 37 | public void saveDepartment(String name) { 38 | Department department = new Department(); 39 | department.setId(UUID.randomUUID().toString().replace("-", "")); 40 | department.setName(name); 41 | Date date = new Date(); 42 | department.setGmtModified(date); 43 | department.setGmtCreate(date); 44 | departmentMapper.insert(department); 45 | } 46 | 47 | @Override 48 | public void upDepartment(String id, String newName) { 49 | Department department = new Department(); 50 | department.setId(id); 51 | department.setName(newName); 52 | department.setGmtModified(new Date()); 53 | departmentMapper.updateByPrimaryKeySelective(department); 54 | } 55 | 56 | @Override 57 | public void delDepartment(String id) { 58 | departmentMapper.deleteByPrimaryKey(id); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/AdminUserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import top.itning.tmpp.tmppadmin.mapper.AdminUserRoleMapper; 6 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 7 | import top.itning.tmpp.tmppadmin.service.AdminUserRoleService; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | 13 | /** 14 | * @author itning 15 | * @date 2019/6/17 16:57 16 | */ 17 | @Service 18 | public class AdminUserRoleServiceImpl implements AdminUserRoleService { 19 | private final AdminUserRoleMapper adminUserRoleMapper; 20 | 21 | @Autowired 22 | public AdminUserRoleServiceImpl(AdminUserRoleMapper adminUserRoleMapper) { 23 | this.adminUserRoleMapper = adminUserRoleMapper; 24 | Date date = new Date(); 25 | try { 26 | adminUserRoleMapper.insert(new AdminUserRole(1, "管理员", date, date, "ADMIN")); 27 | } catch (Exception ignore) { 28 | } 29 | try { 30 | adminUserRoleMapper.insert(new AdminUserRole(2, "教务处", date, date, "A")); 31 | } catch (Exception ignore) { 32 | } 33 | try { 34 | adminUserRoleMapper.insert(new AdminUserRole(3, "办公室主任", date, date, "O")); 35 | } catch (Exception ignore) { 36 | } 37 | try { 38 | adminUserRoleMapper.insert(new AdminUserRole(4, "教师", date, date, "T")); 39 | } catch (Exception ignore) { 40 | } 41 | } 42 | 43 | @Override 44 | public List getAdminUserRoleByResourceId(String resourceId) { 45 | return adminUserRoleMapper.selectByResourceId(resourceId).stream().filter(adminUserRole -> !"ADMIN".equals(adminUserRole.getType())).collect(Collectors.toList()); 46 | } 47 | 48 | @Override 49 | public List getAdminUserRoles() { 50 | return adminUserRoleMapper.selectAll().stream().filter(adminUserRole -> !"ADMIN".equals(adminUserRole.getType())).collect(Collectors.toList()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/config/ShiroConfig.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.config; 2 | 3 | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; 4 | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import top.itning.tmpp.tmppadmin.service.LoginService; 8 | 9 | import java.util.LinkedHashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * @author itning 14 | * @date 2019/6/17 10:07 15 | */ 16 | @Configuration 17 | public class ShiroConfig { 18 | @Bean 19 | public UserRealm userRealm(LoginService loginService) { 20 | return new UserRealm(loginService); 21 | } 22 | 23 | @Bean 24 | public DefaultWebSecurityManager securityManager(UserRealm userRealm) { 25 | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); 26 | securityManager.setRealm(userRealm); 27 | return securityManager; 28 | } 29 | 30 | @Bean 31 | public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { 32 | ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); 33 | shiroFilterFactoryBean.setSecurityManager(securityManager); 34 | shiroFilterFactoryBean.setLoginUrl("/login"); 35 | shiroFilterFactoryBean.setSuccessUrl("/"); 36 | shiroFilterFactoryBean.setUnauthorizedUrl("/login"); 37 | 38 | //注意此处使用的是LinkedHashMap,是有顺序的,shiro会按从上到下的顺序匹配验证,匹配了就不再继续验证 39 | //所以上面的url要苛刻,宽松的url要放在下面,尤其是"/**"要放到最下面,如果放前面的话其后的验证规则就没作用了。 40 | Map filterChainDefinitionMap = new LinkedHashMap<>(); 41 | filterChainDefinitionMap.put("/logout", "logout"); 42 | filterChainDefinitionMap.put("/config/**", "anon"); 43 | filterChainDefinitionMap.put("/init", "anon"); 44 | filterChainDefinitionMap.put("/login", "anon"); 45 | filterChainDefinitionMap.put("/favicon.ico", "anon"); 46 | filterChainDefinitionMap.put("/**", "authc"); 47 | 48 | shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); 49 | return shiroFilterFactoryBean; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/AdminUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import top.itning.tmpp.tmppadmin.mapper.AdminUserMapper; 6 | import top.itning.tmpp.tmppadmin.mapper.AdminUserRoleMapper; 7 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 8 | import top.itning.tmpp.tmppadmin.service.AdminUserService; 9 | 10 | import java.util.Date; 11 | import java.util.List; 12 | import java.util.UUID; 13 | import java.util.stream.Collectors; 14 | 15 | /** 16 | * @author itning 17 | * @date 2019/6/17 17:58 18 | */ 19 | @Service 20 | public class AdminUserServiceImpl implements AdminUserService { 21 | private final AdminUserMapper adminUserMapper; 22 | private final AdminUserRoleMapper adminUserRoleMapper; 23 | 24 | @Autowired 25 | public AdminUserServiceImpl(AdminUserMapper adminUserMapper, AdminUserRoleMapper adminUserRoleMapper) { 26 | this.adminUserMapper = adminUserMapper; 27 | this.adminUserRoleMapper = adminUserRoleMapper; 28 | } 29 | 30 | @Override 31 | public List getAdminUsers() { 32 | return adminUserMapper.selectAll() 33 | .stream() 34 | .filter(adminUser -> !"ADMIN".equals(adminUser.getType())) 35 | .peek(adminUser -> adminUser.setType(adminUserRoleMapper.selectNameByType(adminUser.getType()))) 36 | .collect(Collectors.toList()); 37 | } 38 | 39 | @Override 40 | public void delAdminUserById(String id) { 41 | adminUserMapper.deleteByPrimaryKey(id); 42 | } 43 | 44 | @Override 45 | public void addAdminUser(String name, String username, String type) { 46 | AdminUser adminUser = new AdminUser(); 47 | adminUser.setId(UUID.randomUUID().toString().replace("-", "")); 48 | adminUser.setName(name); 49 | adminUser.setUsername(username); 50 | adminUser.setPassword(""); 51 | adminUser.setType(type.toUpperCase()); 52 | Date date = new Date(); 53 | adminUser.setGmtCreate(date); 54 | adminUser.setGmtModified(date); 55 | adminUserMapper.insert(adminUser); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/pojo/AdminUser.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class AdminUser { 6 | private String id; 7 | 8 | private String name; 9 | 10 | private String username; 11 | 12 | private String password; 13 | 14 | private String type; 15 | 16 | private Date gmtCreate; 17 | 18 | private Date gmtModified; 19 | 20 | public AdminUser(String id, String name, String username, String password, String type, Date gmtCreate, Date gmtModified) { 21 | this.id = id; 22 | this.name = name; 23 | this.username = username; 24 | this.password = password; 25 | this.type = type; 26 | this.gmtCreate = gmtCreate; 27 | this.gmtModified = gmtModified; 28 | } 29 | 30 | public AdminUser() { 31 | super(); 32 | } 33 | 34 | public String getId() { 35 | return id; 36 | } 37 | 38 | public void setId(String id) { 39 | this.id = id == null ? null : id.trim(); 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name == null ? null : name.trim(); 48 | } 49 | 50 | public String getUsername() { 51 | return username; 52 | } 53 | 54 | public void setUsername(String username) { 55 | this.username = username == null ? null : username.trim(); 56 | } 57 | 58 | public String getPassword() { 59 | return password; 60 | } 61 | 62 | public void setPassword(String password) { 63 | this.password = password == null ? null : password.trim(); 64 | } 65 | 66 | public String getType() { 67 | return type; 68 | } 69 | 70 | public void setType(String type) { 71 | this.type = type == null ? null : type.trim(); 72 | } 73 | 74 | public Date getGmtCreate() { 75 | return gmtCreate; 76 | } 77 | 78 | public void setGmtCreate(Date gmtCreate) { 79 | this.gmtCreate = gmtCreate; 80 | } 81 | 82 | public Date getGmtModified() { 83 | return gmtModified; 84 | } 85 | 86 | public void setGmtModified(Date gmtModified) { 87 | this.gmtModified = gmtModified; 88 | } 89 | } -------------------------------------------------------------------------------- /src/main/resources/templates/addUser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |
34 | 39 |
40 | 41 |
42 |
43 | 44 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/resources/templates/init.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 设置账户-哈信息教材采购管理系统 10 | 11 | 12 | 16 | 22 | 23 | 24 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 登陆-哈信息教材采购管理系统 10 | 11 | 12 | 16 | 22 | 23 | 24 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/templates/upResource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 | 22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 |
30 | 35 |
36 | 37 |
38 |
39 | 40 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/templates/level.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 45 |
#层次修改时间操作
1MarkMark修改 删除 42 |
46 |
47 | 50 |
51 | 52 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import top.itning.tmpp.tmppadmin.pojo.AdminUser; 10 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 11 | import top.itning.tmpp.tmppadmin.service.AdminUserRoleService; 12 | import top.itning.tmpp.tmppadmin.service.AdminUserService; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @author itning 18 | * @date 2019/6/17 18:03 19 | */ 20 | @Controller 21 | public class UserController { 22 | private final AdminUserService adminUserService; 23 | private final AdminUserRoleService adminUserRoleService; 24 | 25 | @Autowired 26 | public UserController(AdminUserService adminUserService, AdminUserRoleService adminUserRoleService) { 27 | this.adminUserService = adminUserService; 28 | this.adminUserRoleService = adminUserRoleService; 29 | } 30 | 31 | /** 32 | * 获取所有用户 33 | * 34 | * @param model {@link Model} 35 | * @return user.html 36 | */ 37 | @GetMapping("/user") 38 | public String user(Model model) { 39 | List adminUsers = adminUserService.getAdminUsers(); 40 | model.addAttribute("adminUsers", adminUsers); 41 | return "user"; 42 | } 43 | 44 | /** 45 | * 添加用户页面 46 | * 47 | * @param model {@link Model} 48 | * @return addUser.html 49 | */ 50 | @GetMapping("/addUser") 51 | public String addUser(Model model) { 52 | List allAdminUserRoleList = adminUserRoleService.getAdminUserRoles(); 53 | model.addAttribute("allAdminUserRoleList", allAdminUserRoleList); 54 | return "addUser"; 55 | } 56 | 57 | /** 58 | * 添加用户 59 | * 60 | * @param name 昵称 61 | * @param username 登录ID 62 | * @param type 角色 63 | * @return user.html 64 | */ 65 | @PostMapping("/addUser") 66 | public String handleAddUser(@RequestParam String name, @RequestParam String username, @RequestParam String type) { 67 | adminUserService.addAdminUser(name, username, type); 68 | return "redirect:user"; 69 | } 70 | 71 | /** 72 | * 删除用户 73 | * 74 | * @param id 用户ID 75 | * @return user.html 76 | */ 77 | @GetMapping("delUser") 78 | public String delUser(@RequestParam String id) { 79 | adminUserService.delAdminUserById(id); 80 | return "redirect:user"; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/resources/templates/colleges.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 45 |
#学院修改时间操作
1MarkMark修改 删除 42 |
46 |
47 | 50 |
51 | 52 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/resources/templates/user.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
#登录ID昵称角色修改时间操作
1MarkMarkMark删除
48 |
49 | 52 |
53 | 54 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/main/resources/templates/department.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 45 |
#授课部门修改时间操作
1MarkMark修改 删除 42 |
46 |
47 | 50 |
51 | 52 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/resources/templates/common.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | menu 7 |

哈信息教材采购管理系统控制面板

8 |
9 | refresh 11 |
12 |
13 | -------------------------------------------------------------------------------- /src/main/resources/templates/addResource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 |
26 | 请求方法: 27 | 32 | 37 | 42 | 47 |
48 | 53 |
54 | 55 |
56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/main/resources/templates/resource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 49 | 50 | 51 |
#URL方法授权角色修改时间操作
1MarkMark 43 | 44 | Mark修改 删除 48 |
52 |
53 | 56 |
57 | 58 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/LevelController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import top.itning.tmpp.tmppadmin.pojo.Level; 10 | import top.itning.tmpp.tmppadmin.service.LevelService; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 层次 16 | * 17 | * @author itning 18 | * @date 2019/6/18 12:42 19 | */ 20 | @Controller 21 | public class LevelController { 22 | private final LevelService levelService; 23 | 24 | @Autowired 25 | public LevelController(LevelService levelService) { 26 | this.levelService = levelService; 27 | } 28 | 29 | /** 30 | * 层次 31 | * 32 | * @param model {@link Model} 33 | * @return level.html 34 | */ 35 | @GetMapping("/level") 36 | public String level(Model model) { 37 | List levels = levelService.getAllLevel(); 38 | model.addAttribute("levels", levels); 39 | return "level"; 40 | } 41 | 42 | /** 43 | * 添加层次页面 44 | * 45 | * @return addLevel.html 46 | */ 47 | @GetMapping("/addLevel") 48 | public String addLevel() { 49 | return "addLevel"; 50 | } 51 | 52 | /** 53 | * 添加层次 54 | * 55 | * @param educationalLevel 层次 56 | * @return level.html 57 | */ 58 | @PostMapping("/addLevel") 59 | public String handleAddLevel(@RequestParam String educationalLevel) { 60 | levelService.saveLevel(educationalLevel); 61 | return "redirect:level"; 62 | } 63 | 64 | /** 65 | * 修改层次页面 66 | * 67 | * @param id 层次ID 68 | * @param model {@link Model} 69 | * @return upLevel.html 70 | */ 71 | @GetMapping("/upLevel") 72 | public String upLevel(@RequestParam String id, Model model) { 73 | Level level = levelService.getLevel(id); 74 | if (level == null) { 75 | model.addAttribute("error", "层次ID:" + id + "不存在"); 76 | return "error"; 77 | } 78 | model.addAttribute("level", level); 79 | return "upLevel"; 80 | } 81 | 82 | /** 83 | * 修改层次 84 | * 85 | * @param id 层次ID 86 | * @param educationalLevel 层次 87 | * @return level.html 88 | */ 89 | @PostMapping("/upLevel") 90 | public String handleUpLevel(@RequestParam String id, @RequestParam String educationalLevel) { 91 | levelService.upLevel(id, educationalLevel); 92 | return "redirect:level"; 93 | } 94 | 95 | /** 96 | * 删除层次 97 | * 98 | * @param id 层次ID 99 | * @return level.html 100 | */ 101 | @GetMapping("/delLevel") 102 | public String delLevel(@RequestParam String id) { 103 | levelService.delLevel(id); 104 | return "redirect:level"; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/CollegesController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import top.itning.tmpp.tmppadmin.pojo.Colleges; 10 | import top.itning.tmpp.tmppadmin.service.CollegesService; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 学院 16 | * 17 | * @author itning 18 | * @date 2019/6/18 12:42 19 | */ 20 | @Controller 21 | public class CollegesController { 22 | private final CollegesService collegesService; 23 | 24 | @Autowired 25 | public CollegesController(CollegesService collegesService) { 26 | this.collegesService = collegesService; 27 | } 28 | 29 | /** 30 | * 学院 31 | * 32 | * @param model {@link Model} 33 | * @return colleges.html 34 | */ 35 | @GetMapping("/colleges") 36 | public String colleges(Model model) { 37 | List colleges = collegesService.getAllColleges(); 38 | model.addAttribute("colleges", colleges); 39 | return "colleges"; 40 | } 41 | 42 | /** 43 | * 添加学院页面 44 | * 45 | * @return addColleges.html 46 | */ 47 | @GetMapping("/addColleges") 48 | public String addColleges() { 49 | return "addColleges"; 50 | } 51 | 52 | /** 53 | * 添加学院 54 | * 55 | * @param name 学院名 56 | * @return colleges.html 57 | */ 58 | @PostMapping("addColleges") 59 | public String handleAddColleges(@RequestParam String name) { 60 | collegesService.saveColleges(name); 61 | return "redirect:colleges"; 62 | } 63 | 64 | /** 65 | * 修改学院页面 66 | * 67 | * @param id 学院ID 68 | * @param model {@link Model} 69 | * @return upColleges.html 70 | */ 71 | @GetMapping("upColleges") 72 | public String upColleges(@RequestParam String id, Model model) { 73 | Colleges colleges = collegesService.getColleges(id); 74 | if (colleges == null) { 75 | model.addAttribute("error", colleges); 76 | return "error"; 77 | } 78 | model.addAttribute("colleges", colleges); 79 | return "upColleges"; 80 | } 81 | 82 | /** 83 | * 修改学院 84 | * 85 | * @param id 学院ID 86 | * @param name 学院名 87 | * @return colleges.html 88 | */ 89 | @PostMapping("upColleges") 90 | public String upColleges(@RequestParam String id, @RequestParam String name) { 91 | collegesService.upColleges(id, name); 92 | return "redirect:colleges"; 93 | } 94 | 95 | /** 96 | * 删除学员 97 | * 98 | * @param id 学院ID 99 | * @return colleges.html 100 | */ 101 | @GetMapping("delColleges") 102 | public String delColleges(@RequestParam String id) { 103 | collegesService.delColleges(id); 104 | return "redirect:colleges"; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/DepartmentController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import top.itning.tmpp.tmppadmin.pojo.Department; 10 | import top.itning.tmpp.tmppadmin.service.DepartmentService; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 授课部门 16 | * 17 | * @author itning 18 | * @date 2019/6/18 12:42 19 | */ 20 | @Controller 21 | public class DepartmentController { 22 | private final DepartmentService departmentService; 23 | 24 | @Autowired 25 | public DepartmentController(DepartmentService departmentService) { 26 | this.departmentService = departmentService; 27 | } 28 | 29 | /** 30 | * 授课部门页面 31 | * 32 | * @param model {@link Model} 33 | * @return department.html 34 | */ 35 | @GetMapping("/department") 36 | public String department(Model model) { 37 | List departments = departmentService.getAllDepartment(); 38 | model.addAttribute("departments", departments); 39 | return "department"; 40 | } 41 | 42 | /** 43 | * 保存授课部门页面 44 | * 45 | * @return saveDepartment.html 46 | */ 47 | @GetMapping("addDepartment") 48 | public String saveDepartment() { 49 | return "addDepartment"; 50 | } 51 | 52 | /** 53 | * 保存授课部门 54 | * 55 | * @param name 授课部门名 56 | * @return department.html 57 | */ 58 | @PostMapping("addDepartment") 59 | public String handleSaveDepartment(@RequestParam String name) { 60 | departmentService.saveDepartment(name); 61 | return "redirect:department"; 62 | } 63 | 64 | /** 65 | * 更新授课部门页面 66 | * 67 | * @param id 授课部门id 68 | * @param model {@link Model} 69 | * @return upDepartment.html 70 | */ 71 | @GetMapping("upDepartment") 72 | public String upDepartment(@RequestParam String id, Model model) { 73 | Department department = departmentService.getDepartment(id); 74 | if (department == null) { 75 | model.addAttribute("error", "授课部门ID:" + id + "不存在"); 76 | return "error"; 77 | } 78 | model.addAttribute("department", department); 79 | return "upDepartment"; 80 | } 81 | 82 | /** 83 | * 更新授课部门 84 | * 85 | * @param id 授课部门ID 86 | * @param name 授课部门名 87 | * @return department.html 88 | */ 89 | @PostMapping("upDepartment") 90 | public String handleUpDepartment(@RequestParam String id, @RequestParam String name) { 91 | departmentService.upDepartment(id, name); 92 | return "redirect:department"; 93 | } 94 | 95 | /** 96 | * 删除授课部门 97 | * 98 | * @param id 授课部门ID 99 | * @return department.html 100 | */ 101 | @GetMapping("delDepartment") 102 | public String delDepartment(@RequestParam String id) { 103 | departmentService.delDepartment(id); 104 | return "redirect:department"; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.apache.shiro.SecurityUtils; 4 | import org.apache.shiro.authc.DisabledAccountException; 5 | import org.apache.shiro.authc.IncorrectCredentialsException; 6 | import org.apache.shiro.authc.UnknownAccountException; 7 | import org.apache.shiro.authc.UsernamePasswordToken; 8 | import org.apache.shiro.subject.Subject; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.PostMapping; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import top.itning.tmpp.tmppadmin.service.LoginService; 16 | 17 | /** 18 | * @author itning 19 | * @date 2019/6/17 12:15 20 | */ 21 | @Controller 22 | public class LoginController { 23 | private final LoginService loginService; 24 | 25 | @Autowired 26 | public LoginController(LoginService loginService) { 27 | this.loginService = loginService; 28 | } 29 | 30 | 31 | /** 32 | * get请求,登录页面跳转 33 | * 34 | * @return login.html 35 | */ 36 | @GetMapping("/login") 37 | public String login() { 38 | //如果已经认证通过,直接跳转到首页 39 | if (SecurityUtils.getSubject().isAuthenticated()) { 40 | return "redirect:/index"; 41 | } 42 | if (!loginService.haveAdminAccount()) { 43 | return "init"; 44 | } 45 | return "login"; 46 | } 47 | 48 | 49 | /** 50 | * post表单提交,登录 51 | * 52 | * @param username 用户名 53 | * @param password 密码 54 | * @param model {@link Model} 55 | * @return 登陆成功重定向到index 56 | */ 57 | @PostMapping("/login") 58 | public String login(@RequestParam String username, @RequestParam String password, Model model) { 59 | Subject user = SecurityUtils.getSubject(); 60 | UsernamePasswordToken token = new UsernamePasswordToken(username, password); 61 | try { 62 | //shiro帮我们匹配密码什么的,我们只需要把东西传给它,它会根据我们在UserRealm里认证方法设置的来验证 63 | user.login(token); 64 | return "redirect:/index"; 65 | } catch (UnknownAccountException e) { 66 | //账号不存在和下面密码错误一般都合并为一个账号或密码错误,这样可以增加暴力破解难度 67 | model.addAttribute("message", "账号不存在!"); 68 | } catch (DisabledAccountException e) { 69 | model.addAttribute("message", "账号未启用!"); 70 | } catch (IncorrectCredentialsException e) { 71 | model.addAttribute("message", "密码错误!"); 72 | } catch (Throwable e) { 73 | model.addAttribute("message", "未知错误!"); 74 | } 75 | return "login"; 76 | } 77 | 78 | /** 79 | * 初始化管理员账户 80 | * 81 | * @param username 用户名 82 | * @param password 密码 83 | * @param model {@link Model} 84 | * @return login.html 85 | */ 86 | @PostMapping("/init") 87 | public String init(@RequestParam String username, @RequestParam String password, Model model) { 88 | if (loginService.haveAdminAccount()) { 89 | model.addAttribute("message", "管理员账户已存在!"); 90 | return "login"; 91 | } 92 | loginService.initAdminAccount(username, password); 93 | model.addAttribute("message", "管理员账户设置成功!"); 94 | return "login"; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/resources/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 |
56 |
57 |
58 |
59 |
60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/mappers/CollegesMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | id, 14 | name, 15 | gmt_modified, 16 | gmt_create 17 | 18 | 24 | 25 | delete 26 | from colleges 27 | where id = #{id,jdbcType=VARCHAR} 28 | 29 | 30 | insert into colleges (id, name, gmt_modified, 31 | gmt_create) 32 | values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{gmtModified,jdbcType=TIMESTAMP}, 33 | #{gmtCreate,jdbcType=TIMESTAMP}) 34 | 35 | 36 | insert into colleges 37 | 38 | 39 | id, 40 | 41 | 42 | name, 43 | 44 | 45 | gmt_modified, 46 | 47 | 48 | gmt_create, 49 | 50 | 51 | 52 | 53 | #{id,jdbcType=VARCHAR}, 54 | 55 | 56 | #{name,jdbcType=VARCHAR}, 57 | 58 | 59 | #{gmtModified,jdbcType=TIMESTAMP}, 60 | 61 | 62 | #{gmtCreate,jdbcType=TIMESTAMP}, 63 | 64 | 65 | 66 | 67 | update colleges 68 | 69 | 70 | name = #{name,jdbcType=VARCHAR}, 71 | 72 | 73 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 74 | 75 | 76 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 77 | 78 | 79 | where id = #{id,jdbcType=VARCHAR} 80 | 81 | 82 | update colleges 83 | set name = #{name,jdbcType=VARCHAR}, 84 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 85 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP} 86 | where id = #{id,jdbcType=VARCHAR} 87 | 88 | 93 | -------------------------------------------------------------------------------- /src/main/resources/mappers/DepartmentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | id, 14 | name, 15 | gmt_modified, 16 | gmt_create 17 | 18 | 24 | 25 | delete 26 | from department 27 | where id = #{id,jdbcType=VARCHAR} 28 | 29 | 30 | insert into department (id, name, gmt_modified, 31 | gmt_create) 32 | values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{gmtModified,jdbcType=TIMESTAMP}, 33 | #{gmtCreate,jdbcType=TIMESTAMP}) 34 | 35 | 36 | insert into department 37 | 38 | 39 | id, 40 | 41 | 42 | name, 43 | 44 | 45 | gmt_modified, 46 | 47 | 48 | gmt_create, 49 | 50 | 51 | 52 | 53 | #{id,jdbcType=VARCHAR}, 54 | 55 | 56 | #{name,jdbcType=VARCHAR}, 57 | 58 | 59 | #{gmtModified,jdbcType=TIMESTAMP}, 60 | 61 | 62 | #{gmtCreate,jdbcType=TIMESTAMP}, 63 | 64 | 65 | 66 | 67 | update department 68 | 69 | 70 | name = #{name,jdbcType=VARCHAR}, 71 | 72 | 73 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 74 | 75 | 76 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 77 | 78 | 79 | where id = #{id,jdbcType=VARCHAR} 80 | 81 | 82 | update department 83 | set name = #{name,jdbcType=VARCHAR}, 84 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 85 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP} 86 | where id = #{id,jdbcType=VARCHAR} 87 | 88 | 93 | -------------------------------------------------------------------------------- /src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 哈信息教材采购管理系统 9 | 10 | 11 | 15 | 16 | 17 | 18 |
19 | 20 |
21 | 22 |
23 |
24 |
25 | 26 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/main/resources/mappers/LevelMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | id, 14 | educational_level, 15 | gmt_modified, 16 | gmt_create 17 | 18 | 24 | 25 | delete 26 | from level 27 | where id = #{id,jdbcType=VARCHAR} 28 | 29 | 30 | insert into level (id, educational_level, gmt_modified, 31 | gmt_create) 32 | values (#{id,jdbcType=VARCHAR}, #{educationalLevel,jdbcType=VARCHAR}, #{gmtModified,jdbcType=TIMESTAMP}, 33 | #{gmtCreate,jdbcType=TIMESTAMP}) 34 | 35 | 36 | insert into level 37 | 38 | 39 | id, 40 | 41 | 42 | educational_level, 43 | 44 | 45 | gmt_modified, 46 | 47 | 48 | gmt_create, 49 | 50 | 51 | 52 | 53 | #{id,jdbcType=VARCHAR}, 54 | 55 | 56 | #{educationalLevel,jdbcType=VARCHAR}, 57 | 58 | 59 | #{gmtModified,jdbcType=TIMESTAMP}, 60 | 61 | 62 | #{gmtCreate,jdbcType=TIMESTAMP}, 63 | 64 | 65 | 66 | 67 | update level 68 | 69 | 70 | educational_level = #{educationalLevel,jdbcType=VARCHAR}, 71 | 72 | 73 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 74 | 75 | 76 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 77 | 78 | 79 | where id = #{id,jdbcType=VARCHAR} 80 | 81 | 82 | update level 83 | set educational_level = #{educationalLevel,jdbcType=VARCHAR}, 84 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 85 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP} 86 | where id = #{id,jdbcType=VARCHAR} 87 | 88 | 93 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/controller/ResourceController.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import top.itning.tmpp.tmppadmin.pojo.AdminResource; 10 | import top.itning.tmpp.tmppadmin.pojo.AdminUserRole; 11 | import top.itning.tmpp.tmppadmin.service.AdminResourceService; 12 | import top.itning.tmpp.tmppadmin.service.AdminUserRoleService; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @author itning 18 | * @date 2019/6/17 14:53 19 | */ 20 | @Controller 21 | public class ResourceController { 22 | private final AdminResourceService adminResourceService; 23 | private final AdminUserRoleService adminUserRoleService; 24 | 25 | @Autowired 26 | public ResourceController(AdminResourceService adminResourceService, AdminUserRoleService adminUserRoleService) { 27 | this.adminResourceService = adminResourceService; 28 | this.adminUserRoleService = adminUserRoleService; 29 | } 30 | 31 | /** 32 | * 资源 33 | * 34 | * @return resource.html 35 | */ 36 | @GetMapping("/resource") 37 | public String resource(Model model) { 38 | model.addAttribute("adminResources", adminResourceService.getAllAdminResources()); 39 | return "resource"; 40 | } 41 | 42 | /** 43 | * 添加资源页面 44 | * 45 | * @return addResource.html 46 | */ 47 | @GetMapping("/addResource") 48 | public String addResource(Model model) { 49 | List allAdminUserRoleList = adminUserRoleService.getAdminUserRoles(); 50 | model.addAttribute("allAdminUserRoleList", allAdminUserRoleList); 51 | return "addResource"; 52 | } 53 | 54 | /** 55 | * 添加资源 56 | * 57 | * @param url 资源 58 | * @param method 方法 59 | * @return resource.html 60 | */ 61 | @PostMapping("/addResource") 62 | public String handleAddResource(@RequestParam String url, @RequestParam String method, @RequestParam int[] roles) { 63 | adminResourceService.saveAdminResource(url, method,roles); 64 | return "redirect:resource"; 65 | } 66 | 67 | /** 68 | * 更新资源页面 69 | * 70 | * @param id 要更新的ID 71 | * @param model {@link Model} 72 | * @return upResource.html 73 | */ 74 | @GetMapping("/upResource") 75 | public String upResource(@RequestParam String id, Model model) { 76 | AdminResource adminResource = adminResourceService.getAdminResourceById(id); 77 | if (adminResource == null) { 78 | model.addAttribute("error", "resource id " + id + " not found"); 79 | return "error"; 80 | } 81 | List adminUserRoleList = adminUserRoleService.getAdminUserRoleByResourceId(id); 82 | List allAdminUserRoleList = adminUserRoleService.getAdminUserRoles(); 83 | model.addAttribute("allAdminUserRoleList", allAdminUserRoleList); 84 | model.addAttribute("adminUserRoleList", adminUserRoleList); 85 | model.addAttribute("adminResource", adminResource); 86 | return "upResource"; 87 | } 88 | 89 | /** 90 | * 更新资源 91 | * 92 | * @param id 资源ID 93 | * @param url 新URL 94 | * @param method 新方法 95 | * @param roles 角色ID 96 | * @return resource.html 97 | */ 98 | @PostMapping("/upResource") 99 | public String handleUpResource(@RequestParam String id, 100 | @RequestParam String url, 101 | @RequestParam String method, 102 | @RequestParam int[] roles) { 103 | adminResourceService.upAdminResource(id, url, method, roles); 104 | return "redirect:resource"; 105 | } 106 | 107 | /** 108 | * 删除资源 109 | * 110 | * @param id 资源ID 111 | * @return resource.html 112 | */ 113 | @GetMapping("/delResource") 114 | public String delResource(@RequestParam String id) { 115 | adminResourceService.delAdminResource(id); 116 | return "redirect:resource"; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/resources/mappers/AdminResourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | id, 15 | url, 16 | method, 17 | gmt_create, 18 | gmt_modified 19 | 20 | 26 | 27 | delete 28 | from admin_resource 29 | where id = #{id,jdbcType=VARCHAR} 30 | 31 | 32 | insert into admin_resource (id, url, method, 33 | gmt_create, gmt_modified) 34 | values (#{id,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, 35 | #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}) 36 | 37 | 38 | insert into admin_resource 39 | 40 | 41 | id, 42 | 43 | 44 | url, 45 | 46 | 47 | method, 48 | 49 | 50 | gmt_create, 51 | 52 | 53 | gmt_modified, 54 | 55 | 56 | 57 | 58 | #{id,jdbcType=VARCHAR}, 59 | 60 | 61 | #{url,jdbcType=VARCHAR}, 62 | 63 | 64 | #{method,jdbcType=VARCHAR}, 65 | 66 | 67 | #{gmtCreate,jdbcType=TIMESTAMP}, 68 | 69 | 70 | #{gmtModified,jdbcType=TIMESTAMP}, 71 | 72 | 73 | 74 | 75 | update admin_resource 76 | 77 | 78 | url = #{url,jdbcType=VARCHAR}, 79 | 80 | 81 | method = #{method,jdbcType=VARCHAR}, 82 | 83 | 84 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 85 | 86 | 87 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 88 | 89 | 90 | where id = #{id,jdbcType=VARCHAR} 91 | 92 | 93 | update admin_resource 94 | set url = #{url,jdbcType=VARCHAR}, 95 | method = #{method,jdbcType=VARCHAR}, 96 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 97 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} 98 | where id = #{id,jdbcType=VARCHAR} 99 | 100 | 104 | -------------------------------------------------------------------------------- /src/main/resources/mappers/AdminUserRoleResourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | user_role_id, 14 | resource_id, 15 | gmt_create, 16 | gmt_modified 17 | 18 | 26 | 27 | delete 28 | from admin_user_role_resource 29 | where user_role_id = #{userRoleId,jdbcType=INTEGER} 30 | and resource_id = #{resourceId,jdbcType=VARCHAR} 31 | 32 | 33 | insert into admin_user_role_resource (user_role_id, resource_id, gmt_create, 34 | gmt_modified) 35 | values (#{userRoleId,jdbcType=INTEGER}, #{resourceId,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, 36 | #{gmtModified,jdbcType=TIMESTAMP}) 37 | 38 | 39 | insert into admin_user_role_resource 40 | 41 | 42 | user_role_id, 43 | 44 | 45 | resource_id, 46 | 47 | 48 | gmt_create, 49 | 50 | 51 | gmt_modified, 52 | 53 | 54 | 55 | 56 | #{userRoleId,jdbcType=INTEGER}, 57 | 58 | 59 | #{resourceId,jdbcType=VARCHAR}, 60 | 61 | 62 | #{gmtCreate,jdbcType=TIMESTAMP}, 63 | 64 | 65 | #{gmtModified,jdbcType=TIMESTAMP}, 66 | 67 | 68 | 69 | 70 | update admin_user_role_resource 71 | 72 | 73 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 74 | 75 | 76 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 77 | 78 | 79 | where user_role_id = #{userRoleId,jdbcType=INTEGER} 80 | and resource_id = #{resourceId,jdbcType=VARCHAR} 81 | 82 | 83 | update admin_user_role_resource 84 | set gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 85 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} 86 | where user_role_id = #{userRoleId,jdbcType=INTEGER} 87 | and resource_id = #{resourceId,jdbcType=VARCHAR} 88 | 89 | 94 | 99 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.6.RELEASE 9 | 10 | 11 | top.itning.tmpp 12 | tmpp-admin 13 | 0.0.1-SNAPSHOT 14 | tmpp-admin 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-thymeleaf 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | org.mybatis.spring.boot 32 | mybatis-spring-boot-starter 33 | 2.1.2 34 | 35 | 36 | 37 | com.google.guava 38 | guava 39 | 28.2-jre 40 | 41 | 42 | 43 | org.apache.commons 44 | commons-lang3 45 | 46 | 47 | 48 | mysql 49 | mysql-connector-java 50 | 51 | 52 | 53 | org.apache.shiro 54 | shiro-spring-boot-starter 55 | 1.5.2 56 | 57 | 58 | 59 | org.modelmapper 60 | modelmapper 61 | 2.3.7 62 | 63 | 64 | 65 | com.github.oshi 66 | oshi-core 67 | 4.5.2 68 | 69 | 70 | 71 | net.java.dev.jna 72 | jna 73 | 5.5.0 74 | 75 | 76 | 77 | net.java.dev.jna 78 | jna-platform 79 | 5.5.0 80 | 81 | 82 | 83 | org.springframework.boot 84 | spring-boot-starter-test 85 | test 86 | 87 | 88 | 89 | 90 | 91 | 92 | org.springframework.boot 93 | spring-boot-maven-plugin 94 | 95 | 96 | org.mybatis.generator 97 | mybatis-generator-maven-plugin 98 | 1.4.0 99 | 100 | 101 | true 102 | 103 | 104 | 105 | 106 | mysql 107 | mysql-connector-java 108 | 8.0.19 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/resources/mappers/AdminUserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | id, 15 | name, 16 | gmt_create, 17 | gmt_modified, 18 | type 19 | 20 | 26 | 27 | delete 28 | from admin_user_role 29 | where id = #{id,jdbcType=INTEGER} 30 | 31 | 32 | insert into admin_user_role (id, name, gmt_create, 33 | gmt_modified, type) 34 | values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, 35 | #{gmtModified,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR}) 36 | 37 | 38 | insert into admin_user_role 39 | 40 | 41 | id, 42 | 43 | 44 | name, 45 | 46 | 47 | gmt_create, 48 | 49 | 50 | gmt_modified, 51 | 52 | 53 | type, 54 | 55 | 56 | 57 | 58 | #{id,jdbcType=INTEGER}, 59 | 60 | 61 | #{name,jdbcType=VARCHAR}, 62 | 63 | 64 | #{gmtCreate,jdbcType=TIMESTAMP}, 65 | 66 | 67 | #{gmtModified,jdbcType=TIMESTAMP}, 68 | 69 | 70 | #{type,jdbcType=VARCHAR}, 71 | 72 | 73 | 74 | 75 | update admin_user_role 76 | 77 | 78 | name = #{name,jdbcType=VARCHAR}, 79 | 80 | 81 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 82 | 83 | 84 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 85 | 86 | 87 | type = #{type,jdbcType=VARCHAR}, 88 | 89 | 90 | where id = #{id,jdbcType=INTEGER} 91 | 92 | 93 | update admin_user_role 94 | set name = #{name,jdbcType=VARCHAR}, 95 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 96 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 97 | type = #{type,jdbcType=VARCHAR} 98 | where id = #{id,jdbcType=INTEGER} 99 | 100 | 111 | 116 | 121 | -------------------------------------------------------------------------------- /src/main/java/top/itning/tmpp/tmppadmin/service/impl/AdminResourceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package top.itning.tmpp.tmppadmin.service.impl; 2 | 3 | import org.apache.commons.lang3.ArrayUtils; 4 | import org.modelmapper.ModelMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | import top.itning.tmpp.tmppadmin.mapper.AdminResourceMapper; 9 | import top.itning.tmpp.tmppadmin.mapper.AdminUserRoleMapper; 10 | import top.itning.tmpp.tmppadmin.mapper.AdminUserRoleResourceMapper; 11 | import top.itning.tmpp.tmppadmin.pojo.*; 12 | import top.itning.tmpp.tmppadmin.service.AdminResourceService; 13 | 14 | import java.util.Date; 15 | import java.util.List; 16 | import java.util.UUID; 17 | import java.util.stream.Collectors; 18 | 19 | /** 20 | * @author itning 21 | * @date 2019/6/17 15:00 22 | */ 23 | @Service 24 | @Transactional(rollbackFor = Exception.class) 25 | public class AdminResourceServiceImpl implements AdminResourceService { 26 | private final AdminResourceMapper adminResourceMapper; 27 | private final ModelMapper modelMapper; 28 | private final AdminUserRoleMapper adminUserRoleMapper; 29 | private final AdminUserRoleResourceMapper adminUserRoleResourceMapper; 30 | 31 | @Autowired 32 | public AdminResourceServiceImpl(AdminResourceMapper adminResourceMapper, ModelMapper modelMapper, AdminUserRoleMapper adminUserRoleMapper, AdminUserRoleResourceMapper adminUserRoleResourceMapper) { 33 | this.adminResourceMapper = adminResourceMapper; 34 | this.modelMapper = modelMapper; 35 | this.adminUserRoleMapper = adminUserRoleMapper; 36 | this.adminUserRoleResourceMapper = adminUserRoleResourceMapper; 37 | } 38 | 39 | @Override 40 | public List getAllAdminResources() { 41 | return adminResourceMapper.selectAll().stream().sorted((o1, o2) -> { 42 | if (o1.getGmtModified().before(o2.getGmtModified())) { 43 | return 1; 44 | } else if (o1.getGmtModified().after(o2.getGmtModified())) { 45 | return -1; 46 | } else { 47 | return 0; 48 | } 49 | }).map(adminResource -> { 50 | AdminResourceWithRoles adminResourceWithRoles = modelMapper.map(adminResource, AdminResourceWithRoles.class); 51 | List adminUserRoleResources = adminUserRoleMapper.selectByResourceId(adminResource.getId()); 52 | adminResourceWithRoles.setRoles(adminUserRoleResources); 53 | return adminResourceWithRoles; 54 | }).collect(Collectors.toList()); 55 | } 56 | 57 | @Override 58 | public AdminResource getAdminResourceById(String id) { 59 | return adminResourceMapper.selectByPrimaryKey(id); 60 | } 61 | 62 | @Override 63 | public void saveAdminResource(String url, String method, int[] roles) { 64 | String id = UUID.randomUUID().toString().replace("-", ""); 65 | AdminResource adminResource = new AdminResource(); 66 | adminResource.setId(id); 67 | adminResource.setUrl(url); 68 | adminResource.setMethod(method.toUpperCase()); 69 | adminResource.setGmtCreate(new Date()); 70 | adminResource.setGmtModified(new Date()); 71 | adminResourceMapper.insert(adminResource); 72 | Date date = new Date(); 73 | List adminUserRoleResources = adminUserRoleResourceMapper.selectUserRoleByResourceId(id); 74 | for (int role : roles) { 75 | if (adminUserRoleResources.contains(role)) { 76 | continue; 77 | } 78 | AdminUserRoleResource adminUserRoleResource = new AdminUserRoleResource(); 79 | adminUserRoleResource.setGmtCreate(date); 80 | adminUserRoleResource.setGmtModified(date); 81 | adminUserRoleResource.setUserRoleId(role); 82 | adminUserRoleResource.setResourceId(id); 83 | adminUserRoleResourceMapper.insert(adminUserRoleResource); 84 | } 85 | } 86 | 87 | @Override 88 | public void delAdminResource(String id) { 89 | adminResourceMapper.deleteByPrimaryKey(id); 90 | } 91 | 92 | @Override 93 | public void upAdminResource(String id, String newUrl, String newMethod, int[] roles) { 94 | AdminResource adminResource = new AdminResource(); 95 | adminResource.setId(id); 96 | adminResource.setUrl(newUrl); 97 | adminResource.setMethod(newMethod.toUpperCase()); 98 | adminResource.setGmtModified(new Date()); 99 | adminResourceMapper.updateByPrimaryKeySelective(adminResource); 100 | 101 | Date date = new Date(); 102 | List adminUserRoleResources = adminUserRoleResourceMapper.selectUserRoleByResourceId(id); 103 | adminUserRoleMapper.selectAll().forEach(adminUserRole -> { 104 | if (ArrayUtils.contains(roles, adminUserRole.getId())) { 105 | if (!adminUserRoleResources.contains(adminUserRole.getId())) { 106 | AdminUserRoleResource adminUserRoleResource = new AdminUserRoleResource(); 107 | adminUserRoleResource.setGmtCreate(date); 108 | adminUserRoleResource.setGmtModified(date); 109 | adminUserRoleResource.setUserRoleId(adminUserRole.getId()); 110 | adminUserRoleResource.setResourceId(id); 111 | adminUserRoleResourceMapper.insert(adminUserRoleResource); 112 | } 113 | } else { 114 | adminUserRoleResourceMapper.deleteByPrimaryKey(new AdminUserRoleResourceKey(adminUserRole.getId(), id)); 115 | } 116 | }); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/resources/mappers/AdminUserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | id, 17 | name, 18 | username, 19 | password, 20 | type, 21 | gmt_create, 22 | gmt_modified 23 | 24 | 30 | 31 | delete 32 | from admin_user 33 | where id = #{id,jdbcType=VARCHAR} 34 | 35 | 36 | insert into admin_user (id, name, username, 37 | password, type, gmt_create, 38 | gmt_modified) 39 | values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, 40 | #{password,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, 41 | #{gmtModified,jdbcType=TIMESTAMP}) 42 | 43 | 44 | insert into admin_user 45 | 46 | 47 | id, 48 | 49 | 50 | name, 51 | 52 | 53 | username, 54 | 55 | 56 | password, 57 | 58 | 59 | type, 60 | 61 | 62 | gmt_create, 63 | 64 | 65 | gmt_modified, 66 | 67 | 68 | 69 | 70 | #{id,jdbcType=VARCHAR}, 71 | 72 | 73 | #{name,jdbcType=VARCHAR}, 74 | 75 | 76 | #{username,jdbcType=VARCHAR}, 77 | 78 | 79 | #{password,jdbcType=VARCHAR}, 80 | 81 | 82 | #{type,jdbcType=VARCHAR}, 83 | 84 | 85 | #{gmtCreate,jdbcType=TIMESTAMP}, 86 | 87 | 88 | #{gmtModified,jdbcType=TIMESTAMP}, 89 | 90 | 91 | 92 | 93 | update admin_user 94 | 95 | 96 | name = #{name,jdbcType=VARCHAR}, 97 | 98 | 99 | username = #{username,jdbcType=VARCHAR}, 100 | 101 | 102 | password = #{password,jdbcType=VARCHAR}, 103 | 104 | 105 | type = #{type,jdbcType=VARCHAR}, 106 | 107 | 108 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 109 | 110 | 111 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, 112 | 113 | 114 | where id = #{id,jdbcType=VARCHAR} 115 | 116 | 117 | update admin_user 118 | set name = #{name,jdbcType=VARCHAR}, 119 | username = #{username,jdbcType=VARCHAR}, 120 | password = #{password,jdbcType=VARCHAR}, 121 | type = #{type,jdbcType=VARCHAR}, 122 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, 123 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} 124 | where id = #{id,jdbcType=VARCHAR} 125 | 126 | 137 | 142 | 147 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | ########################################################################################## 204 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 205 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 206 | ########################################################################################## 207 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 208 | if [ "$MVNW_VERBOSE" = true ]; then 209 | echo "Found .mvn/wrapper/maven-wrapper.jar" 210 | fi 211 | else 212 | if [ "$MVNW_VERBOSE" = true ]; then 213 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 214 | fi 215 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 216 | while IFS="=" read key value; do 217 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 218 | esac 219 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 220 | if [ "$MVNW_VERBOSE" = true ]; then 221 | echo "Downloading from: $jarUrl" 222 | fi 223 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 224 | 225 | if command -v wget > /dev/null; then 226 | if [ "$MVNW_VERBOSE" = true ]; then 227 | echo "Found wget ... using wget" 228 | fi 229 | wget "$jarUrl" -O "$wrapperJarPath" 230 | elif command -v curl > /dev/null; then 231 | if [ "$MVNW_VERBOSE" = true ]; then 232 | echo "Found curl ... using curl" 233 | fi 234 | curl -o "$wrapperJarPath" "$jarUrl" 235 | else 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Falling back to using Java to download" 238 | fi 239 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 240 | if [ -e "$javaClass" ]; then 241 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 242 | if [ "$MVNW_VERBOSE" = true ]; then 243 | echo " - Compiling MavenWrapperDownloader.java ..." 244 | fi 245 | # Compiling the Java class 246 | ("$JAVA_HOME/bin/javac" "$javaClass") 247 | fi 248 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 249 | # Running the downloader 250 | if [ "$MVNW_VERBOSE" = true ]; then 251 | echo " - Running MavenWrapperDownloader.java ..." 252 | fi 253 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 254 | fi 255 | fi 256 | fi 257 | fi 258 | ########################################################################################## 259 | # End of extension 260 | ########################################################################################## 261 | 262 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 263 | if [ "$MVNW_VERBOSE" = true ]; then 264 | echo $MAVEN_PROJECTBASEDIR 265 | fi 266 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 267 | 268 | # For Cygwin, switch paths to Windows format before running java 269 | if $cygwin; then 270 | [ -n "$M2_HOME" ] && 271 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 272 | [ -n "$JAVA_HOME" ] && 273 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 274 | [ -n "$CLASSPATH" ] && 275 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 276 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 277 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 278 | fi 279 | 280 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 281 | 282 | exec "$JAVACMD" \ 283 | $MAVEN_OPTS \ 284 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 285 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 286 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 287 | -------------------------------------------------------------------------------- /sql/tmpp.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : MySql8016dockerVM 5 | Source Server Type : MySQL 6 | Source Server Version : 80016 7 | Source Host : docker:3307 8 | Source Schema : tmpp 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 80016 12 | File Encoding : 65001 13 | 14 | Date: 19/06/2019 15:40:48 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for admin_resource 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `admin_resource`; 24 | CREATE TABLE `admin_resource` ( 25 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '资源ID', 26 | `url` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'URL', 27 | `method` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 28 | `gmt_create` datetime(0) NOT NULL, 29 | `gmt_modified` datetime(0) NOT NULL, 30 | PRIMARY KEY (`id`) USING BTREE 31 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '资源' ROW_FORMAT = Dynamic; 32 | 33 | -- ---------------------------- 34 | -- Records of admin_resource 35 | -- ---------------------------- 36 | INSERT INTO `admin_resource` VALUES ('2a5dbed01de34d3689917f88167f4f7f', '/discount', 'DELETE', '2019-06-17 09:48:16', '2019-06-17 09:48:16'); 37 | INSERT INTO `admin_resource` VALUES ('a', '/discount', 'POST', '2019-06-17 15:16:32', '2019-06-17 09:38:37'); 38 | INSERT INTO `admin_resource` VALUES ('e6353bb45e5f4a0aa932ec6a4f159774', '/discounts', 'GET', '2019-06-17 07:31:00', '2019-06-17 12:49:49'); 39 | 40 | -- ---------------------------- 41 | -- Table structure for admin_user 42 | -- ---------------------------- 43 | DROP TABLE IF EXISTS `admin_user`; 44 | CREATE TABLE `admin_user` ( 45 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 46 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 47 | `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, 48 | `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, 49 | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 50 | `gmt_create` datetime(0) NOT NULL, 51 | `gmt_modified` datetime(0) NOT NULL, 52 | PRIMARY KEY (`id`) USING BTREE, 53 | INDEX `fk_type`(`type`) USING BTREE, 54 | CONSTRAINT `fk_type` FOREIGN KEY (`type`) REFERENCES `admin_user_role` (`type`) ON DELETE RESTRICT ON UPDATE RESTRICT 55 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 56 | 57 | -- ---------------------------- 58 | -- Records of admin_user 59 | -- ---------------------------- 60 | INSERT INTO `admin_user` VALUES ('08ce7c6f2c604a7ea5ee43ddd8f2174f', '教师A', '144', '', 'T', '2019-06-17 10:23:33', '2019-06-17 10:23:33'); 61 | INSERT INTO `admin_user` VALUES ('90b4f557101e4256a9bd9d6cd8052fe5', '办公室', 'asd', '', 'O', '2019-06-17 10:23:53', '2019-06-17 10:23:53'); 62 | INSERT INTO `admin_user` VALUES ('c687bf7728be41eeab36c79dcae67881', '管理员', 'admin', 'admin', 'ADMIN', '2019-06-17 06:43:07', '2019-06-17 06:43:07'); 63 | INSERT INTO `admin_user` VALUES ('d980ebbe57e8498d9a050f797a6aa803', '舒露', '14008', '', 'A', '2019-06-17 10:23:19', '2019-06-17 10:23:19'); 64 | 65 | -- ---------------------------- 66 | -- Table structure for admin_user_role 67 | -- ---------------------------- 68 | DROP TABLE IF EXISTS `admin_user_role`; 69 | CREATE TABLE `admin_user_role` ( 70 | `id` int(11) NOT NULL COMMENT '用户类型ID', 71 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户类型名', 72 | `gmt_create` datetime(0) NOT NULL, 73 | `gmt_modified` datetime(0) NOT NULL, 74 | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 75 | PRIMARY KEY (`id`) USING BTREE, 76 | UNIQUE INDEX `index_type`(`type`) USING BTREE 77 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '用户角色表\r\nT 教师 A 教务处 O 办公室主任' ROW_FORMAT = Dynamic; 78 | 79 | -- ---------------------------- 80 | -- Records of admin_user_role 81 | -- ---------------------------- 82 | INSERT INTO `admin_user_role` VALUES (1, '管理员', '2019-06-17 11:45:03', '2019-06-17 11:45:05', 'ADMIN'); 83 | INSERT INTO `admin_user_role` VALUES (2, '教师', '2019-06-17 11:45:54', '2019-06-17 11:45:56', 'T'); 84 | INSERT INTO `admin_user_role` VALUES (3, '教务处', '2019-06-17 11:46:09', '2019-06-17 11:46:12', 'A'); 85 | INSERT INTO `admin_user_role` VALUES (4, '办公室主任', '2019-06-17 11:46:29', '2019-06-17 11:46:32', 'O'); 86 | 87 | -- ---------------------------- 88 | -- Table structure for admin_user_role_resource 89 | -- ---------------------------- 90 | DROP TABLE IF EXISTS `admin_user_role_resource`; 91 | CREATE TABLE `admin_user_role_resource` ( 92 | `user_role_id` int(11) NOT NULL, 93 | `resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 94 | `gmt_create` datetime(0) NOT NULL, 95 | `gmt_modified` datetime(0) NOT NULL, 96 | PRIMARY KEY (`user_role_id`, `resource_id`) USING BTREE, 97 | INDEX `fk_resource`(`resource_id`) USING BTREE, 98 | CONSTRAINT `fk_resource` FOREIGN KEY (`resource_id`) REFERENCES `admin_resource` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT, 99 | CONSTRAINT `fk_user_role` FOREIGN KEY (`user_role_id`) REFERENCES `admin_user_role` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT 100 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 101 | 102 | -- ---------------------------- 103 | -- Records of admin_user_role_resource 104 | -- ---------------------------- 105 | INSERT INTO `admin_user_role_resource` VALUES (3, '2a5dbed01de34d3689917f88167f4f7f', '2019-06-17 09:48:16', '2019-06-17 09:48:16'); 106 | INSERT INTO `admin_user_role_resource` VALUES (3, 'e6353bb45e5f4a0aa932ec6a4f159774', '2019-06-17 12:49:49', '2019-06-17 12:49:49'); 107 | INSERT INTO `admin_user_role_resource` VALUES (4, 'a', '2019-06-17 09:27:27', '2019-06-17 09:27:27'); 108 | 109 | -- ---------------------------- 110 | -- Table structure for book 111 | -- ---------------------------- 112 | DROP TABLE IF EXISTS `book`; 113 | CREATE TABLE `book` ( 114 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '书籍唯一标识符', 115 | `isbn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '书籍isbn', 116 | `text_book_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '书籍名称', 117 | `text_book_category` int(11) NULL DEFAULT NULL COMMENT '教材类别 0:自编,1:出版', 118 | `press` int(11) NULL DEFAULT NULL COMMENT '出版社', 119 | `author` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '作者', 120 | `unit_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '单价', 121 | `teacher_book_number` int(11) NULL DEFAULT NULL COMMENT '教师样书数量', 122 | `award_Information` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '获奖信息和丛书名称', 123 | `publication_date` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '出版日期', 124 | `subscriber` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '征订人', 125 | `subscriber_tel` int(11) NULL DEFAULT NULL COMMENT '联系电话', 126 | `is_book_purchase` int(11) NULL DEFAULT NULL COMMENT '是否购书1:是,2:否', 127 | `reason` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '购买书籍原因', 128 | `course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '课程编号', 129 | `discount_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '折扣id', 130 | `affairs_number` int(11) NULL DEFAULT NULL COMMENT '教务处样书数量', 131 | `login_user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '记录哪个用户添加的记录', 132 | `is_buy_book` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '1:是,0:否,购买样书', 133 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 134 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 135 | PRIMARY KEY (`id`) USING BTREE, 136 | INDEX `fk_course_id`(`course_id`) USING BTREE, 137 | INDEX `fk_discount_id`(`discount_id`) USING BTREE, 138 | INDEX `fk_user_id`(`login_user_id`) USING BTREE, 139 | CONSTRAINT `fk_course_id` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 140 | CONSTRAINT `fk_discount_id` FOREIGN KEY (`discount_id`) REFERENCES `discounts` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 141 | CONSTRAINT `fk_user_id` FOREIGN KEY (`login_user_id`) REFERENCES `login_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 142 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 143 | 144 | -- ---------------------------- 145 | -- Table structure for book_status 146 | -- ---------------------------- 147 | DROP TABLE IF EXISTS `book_status`; 148 | CREATE TABLE `book_status` ( 149 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'book_id 用书籍id作为状态唯一标识符', 150 | `status` int(11) NOT NULL COMMENT '购书计划状态审核状态(0:未审核,1:审核通过,2:办公室主任驳回,3:教务处驳回)', 151 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 152 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 153 | PRIMARY KEY (`id`) USING BTREE 154 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 155 | 156 | -- ---------------------------- 157 | -- Table structure for colleges 158 | -- ---------------------------- 159 | DROP TABLE IF EXISTS `colleges`; 160 | CREATE TABLE `colleges` ( 161 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '学院id', 162 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '学院名称', 163 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 164 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 165 | PRIMARY KEY (`id`) USING BTREE 166 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 167 | 168 | -- ---------------------------- 169 | -- Table structure for course 170 | -- ---------------------------- 171 | DROP TABLE IF EXISTS `course`; 172 | CREATE TABLE `course` ( 173 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '课程唯一标识', 174 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '课程名称', 175 | `code` varchar(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '课程号', 176 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 177 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 178 | PRIMARY KEY (`id`) USING BTREE 179 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 180 | 181 | -- ---------------------------- 182 | -- Table structure for department 183 | -- ---------------------------- 184 | DROP TABLE IF EXISTS `department`; 185 | CREATE TABLE `department` ( 186 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '开课院系部id', 187 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '开课院系部名称', 188 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 189 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 190 | PRIMARY KEY (`id`) USING BTREE 191 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 192 | 193 | -- ---------------------------- 194 | -- Records of department 195 | -- ---------------------------- 196 | INSERT INTO `department` VALUES ('16d7094d3c2244378284a967d47189a9', '政教处1', '2019-06-19 03:43:38', '2019-06-19 03:43:37'); 197 | 198 | -- ---------------------------- 199 | -- Table structure for discounts 200 | -- ---------------------------- 201 | DROP TABLE IF EXISTS `discounts`; 202 | CREATE TABLE `discounts` ( 203 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '折扣唯一标识符', 204 | `discount` decimal(10, 2) NOT NULL COMMENT '折扣', 205 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 206 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 207 | PRIMARY KEY (`id`) USING BTREE 208 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 209 | 210 | -- ---------------------------- 211 | -- Table structure for level 212 | -- ---------------------------- 213 | DROP TABLE IF EXISTS `level`; 214 | CREATE TABLE `level` ( 215 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '层次id', 216 | `educational_level` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '层次:本科,高职等', 217 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 218 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 219 | PRIMARY KEY (`id`) USING BTREE 220 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 221 | 222 | -- ---------------------------- 223 | -- Records of level 224 | -- ---------------------------- 225 | INSERT INTO `level` VALUES ('1b14fd0ed7e4468aab0023c6e13886fb', '专科1', '2019-06-19 03:23:18', '2019-06-19 03:23:17'); 226 | INSERT INTO `level` VALUES ('3f3ef6fb28754966a89563a467d7464a', '11', '2019-06-19 03:23:29', '2019-06-19 03:23:29'); 227 | 228 | -- ---------------------------- 229 | -- Table structure for login_user 230 | -- ---------------------------- 231 | DROP TABLE IF EXISTS `login_user`; 232 | CREATE TABLE `login_user` ( 233 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'userId', 234 | `name` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '登陆名', 235 | `user_type` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户类别', 236 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 237 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 238 | PRIMARY KEY (`id`) USING BTREE 239 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 240 | 241 | -- ---------------------------- 242 | -- Table structure for plan 243 | -- ---------------------------- 244 | DROP TABLE IF EXISTS `plan`; 245 | CREATE TABLE `plan` ( 246 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, 247 | `year` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '学年', 248 | `term` int(11) NOT NULL COMMENT '学期', 249 | `level_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '教育层次id', 250 | `college_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '学院名称', 251 | `department_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '开课院系部id', 252 | `course_major` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '开课专业', 253 | `course_type` int(11) NOT NULL COMMENT '0:考试,1:考察', 254 | `use_school_year` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '17本', 255 | `clazz` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '开课班级', 256 | `clazz_number` int(11) NOT NULL COMMENT '班级人数', 257 | `teacher` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '授课老师', 258 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 259 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 260 | PRIMARY KEY (`id`) USING BTREE, 261 | INDEX `fk_level_id`(`level_id`) USING BTREE, 262 | INDEX `fk_college_id`(`college_id`) USING BTREE, 263 | INDEX `fk_department_id`(`department_id`) USING BTREE, 264 | CONSTRAINT `fk_college_id` FOREIGN KEY (`college_id`) REFERENCES `colleges` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 265 | CONSTRAINT `fk_department_id` FOREIGN KEY (`department_id`) REFERENCES `department` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 266 | CONSTRAINT `fk_level_id` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 267 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 268 | 269 | -- ---------------------------- 270 | -- Table structure for plan_status 271 | -- ---------------------------- 272 | DROP TABLE IF EXISTS `plan_status`; 273 | CREATE TABLE `plan_status` ( 274 | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'plan_id 用计划id作为计划状态标识符', 275 | `status` int(11) NOT NULL COMMENT '0:进行中,1:已完成', 276 | `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', 277 | `gmt_create` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', 278 | PRIMARY KEY (`id`) USING BTREE 279 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 280 | 281 | SET FOREIGN_KEY_CHECKS = 1; 282 | --------------------------------------------------------------------------------