├── .DS_Store ├── .gitattributes ├── README.md ├── pom.xml └── src └── main ├── java └── com │ └── book │ └── manager │ ├── ManagerApplication.java │ ├── cache │ └── UserCache.java │ ├── config │ ├── SwaggerConfiguration.java │ ├── WebConfig.java │ └── WebSecurityConfig.java │ ├── controller │ ├── BookController.java │ ├── BorrowController.java │ ├── LoginController.java │ ├── RouteController.java │ └── UsersController.java │ ├── dao │ ├── BookMapper.java │ ├── BorrowMapper.java │ └── UsersMapper.java │ ├── entity │ ├── Book.java │ ├── Borrow.java │ └── Users.java │ ├── interceptor │ └── LoginInterceptor.java │ ├── repos │ ├── BookRepository.java │ ├── BorrowRepository.java │ └── UsersRepository.java │ ├── service │ ├── BookService.java │ ├── BorrowService.java │ └── UserService.java │ └── util │ ├── R.java │ ├── consts │ ├── Constants.java │ └── ConvertUtil.java │ ├── http │ └── CodeEnum.java │ ├── ro │ ├── PageIn.java │ └── RetBookIn.java │ └── vo │ ├── BackOut.java │ ├── BookOut.java │ ├── PageOut.java │ └── UserOut.java └── resources ├── application.yml ├── mapper ├── BookMapper.xml ├── BorrowMapper.xml └── UsersMapper.xml ├── static └── javaex │ ├── img │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ ├── 7.jpg │ ├── 8.jpg │ └── 9.jpg │ ├── layer │ ├── layer.js │ ├── mobile │ │ ├── layer.js │ │ └── need │ │ │ └── layer.css │ └── theme │ │ └── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── layer.css │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif │ ├── m │ ├── css │ │ ├── animate.css │ │ ├── common.css │ │ ├── fonts │ │ │ ├── icomoon.eot │ │ │ ├── icomoon.svg │ │ │ ├── icomoon.ttf │ │ │ └── icomoon.woff │ │ ├── icomoon.css │ │ └── skin │ │ │ └── tina.css │ ├── images │ │ ├── border.png │ │ ├── link-arrow.png │ │ ├── loading.gif │ │ ├── loading.png │ │ ├── loading_screen.gif │ │ ├── logo.png │ │ └── more.png │ ├── js │ │ ├── common.js │ │ ├── flexible.js │ │ ├── javaex-formVerify.js │ │ ├── javaex.js │ │ └── javaex.min.js │ └── lib │ │ └── jquery-3.3.1.min.js │ └── pc │ ├── css │ ├── animate.css │ ├── common.css │ ├── fonts │ │ ├── icomoon.eot │ │ ├── icomoon.svg │ │ ├── icomoon.ttf │ │ └── icomoon.woff │ ├── icomoon.css │ └── skin │ │ └── tina.css │ ├── images │ ├── arrow-down.png │ ├── arrow-left.png │ ├── arrow-right.png │ ├── arrow-up.png │ ├── calendar.png │ ├── close.png │ ├── con-loading.gif │ ├── date_color.png │ ├── dialog-opt.png │ ├── grey.gif │ ├── javaex-loading.gif │ ├── javaex-process.gif │ ├── loading-circle.gif │ ├── loading-white.gif │ ├── loading.gif │ ├── loading.png │ ├── message-icon.png │ └── upAvatar.jpg │ ├── js │ ├── common.js │ ├── javaex-formVerify.js │ ├── javaex.js │ ├── javaex.min.js │ └── layer.js │ └── lib │ ├── highlight │ ├── highlight.css │ └── highlight.min.js │ └── jquery-1.7.2.min.js └── templates ├── book ├── book-add.html ├── book-list.html └── book-update.html ├── borrow ├── back.html ├── book-search.html └── borrow.html ├── empty.html ├── index.html ├── login.html ├── reader ├── reader-add.html ├── reader-list.html └── reader-update.html ├── user ├── user-add.html ├── user-info.html └── user-list.html └── welcome.html /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=java 2 | *.css linguist-language=java 3 | *.html linguist-language=java -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 全目录 2 | 3 | [更多系统、论文,供君选择 ~~>](https://www.yuque.com/wisebit/blog) 4 | 5 | # 96.LibraryBackgroundManagementSystem 6 | 7 |

群: 983063232(大佬群 2TB学习资料,讲解)(入群获取sql文件)

8 |

QQ: 206157502(加好友获取sql文件)

9 | 10 |

96.图书后台管理系统

11 | 12 |

13 | 14 | 15 | 16 | 17 | 18 |

19 | 20 | 21 | # 简介 22 | 23 | > 本代码来源于网络, 请入群(983063232)后联系群主索要sql文件! 24 | > 25 | 26 | 27 | 28 | # 环境 29 | 30 | - IntelliJ IDEA 2009.3 31 | 32 | - Mysql 5.7.26 33 | 34 | - Tomcat 7.0.73 35 | 36 | - JDK 1.8 37 | 38 | 39 | ## 缩略图 40 | 41 | ![](https://bitwise.oss-cn-heyuan.aliyuncs.com/2024/9/10/187ab115-2404-4ffb-9d46-cf65316c1d78.png) 42 | ![](https://bitwise.oss-cn-heyuan.aliyuncs.com/2024/9/10/034d2b62-2829-445d-85a0-30b684d96599.png) 43 | ![](https://bitwise.oss-cn-heyuan.aliyuncs.com/2024/9/10/e7c0cc79-0dc1-4647-b997-87eacb027ad2.png) 44 | ![](https://bitwise.oss-cn-heyuan.aliyuncs.com/2024/9/10/879c46bc-aea1-4a84-a71b-526c2f218e2c.png) 45 | ![](https://bitwise.oss-cn-heyuan.aliyuncs.com/2024/9/10/8a16481f-160d-4215-a759-6330bdef24bc.png) 46 | 47 | 48 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.3.1.RELEASE 9 | 10 | 11 | com.book 12 | manager 13 | 0.0.1-SNAPSHOT 14 | manager 15 | the book management system 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-security 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-thymeleaf 31 | 32 | 33 | 34 | com.github.pagehelper 35 | pagehelper-spring-boot-starter 36 | 1.2.3 37 | 38 | 39 | 40 | org.mybatis.spring.boot 41 | mybatis-spring-boot-starter 42 | 2.1.3 43 | 44 | 45 | 46 | 47 | io.springfox 48 | springfox-swagger2 49 | 2.7.0 50 | 51 | 52 | io.springfox 53 | springfox-swagger-ui 54 | 2.7.0 55 | 56 | 57 | 58 | com.github.xiaoymin 59 | swagger-bootstrap-ui 60 | 1.9.3 61 | 62 | 63 | 64 | org.springframework.boot 65 | spring-boot-starter-data-jpa 66 | 67 | 68 | 69 | org.springframework.boot 70 | spring-boot-starter-web 71 | 72 | 73 | 74 | mysql 75 | mysql-connector-java 76 | runtime 77 | 78 | 79 | 80 | org.projectlombok 81 | lombok 82 | true 83 | 84 | 85 | 86 | cn.hutool 87 | hutool-all 88 | 5.2.5 89 | 90 | 91 | 92 | org.springframework.boot 93 | spring-boot-starter-test 94 | test 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | org.springframework.boot 103 | spring-boot-maven-plugin 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/ManagerApplication.java: -------------------------------------------------------------------------------- 1 | package com.book.manager; 2 | 3 | import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 7 | 8 | @EnableSwaggerBootstrapUI 9 | @EnableJpaRepositories 10 | @SpringBootApplication 11 | public class ManagerApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(ManagerApplication.class, args); 15 | System.out.println("| ---------------------------------------------------------------------------------- |"); 16 | System.out.println("| Started Success |"); 17 | System.out.println("| ---------------------------------------------------------------------------------- |"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/cache/UserCache.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.cache; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * @Description 用户缓存, new: 现已使用SpringSecurity , 弃用此类 7 | *

8 | * 摒弃Session, 自己在服务器端维护一个会话 9 | * 1. 记录用户信息 10 | * 2. 用户URL地址拦截 11 | * 3. 方便多个使用同一个账户 12 | * 13 | * 注意, 负载, 分布式情况下不适用, 可使用redis实现会话信息共享 14 | *

15 | * @Date 2020/7/21 11:52 16 | * @Author by 尘心 17 | */ 18 | public class UserCache{ 19 | 20 | private static HashMap userMap = new HashMap<>(); 21 | 22 | /** 23 | * 用户登录时 放入缓存 24 | * @param username 用户名 25 | * @param password 密码 26 | */ 27 | public static void login(String username, String password) { 28 | userMap.put(username,password); 29 | } 30 | 31 | /** 32 | * 用户登出时 清除缓存 33 | * @param username 用户名 34 | */ 35 | public static void logout(String username) { 36 | userMap.remove(username); 37 | } 38 | 39 | /** 40 | * 获取用户信息 41 | * @param key 键 42 | * @return 43 | */ 44 | public static Object get(String key) { 45 | return userMap.get(key); 46 | } 47 | 48 | /** 49 | * key 是否存在 50 | * @param key key 51 | * @return 52 | */ 53 | public static boolean isExist(String key) { 54 | return userMap.containsKey(key); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/config/SwaggerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.service.Contact; 10 | import springfox.documentation.spi.DocumentationType; 11 | import springfox.documentation.spring.web.plugins.Docket; 12 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 13 | 14 | /** 15 | * @Description swagger 配置 16 | * @Date 2020/7/14 18:36 17 | * @Author by 尘心 18 | */ 19 | @Configuration 20 | @EnableSwagger2 21 | public class SwaggerConfiguration { 22 | 23 | @Bean 24 | public Docket createRestApi() { 25 | return new Docket(DocumentationType.SWAGGER_2) 26 | .apiInfo(apiInfo()) 27 | .select() 28 | .apis(RequestHandlerSelectors.basePackage("com.book.manager.controller")) 29 | .paths(PathSelectors.any()) 30 | .build(); 31 | } 32 | 33 | private ApiInfo apiInfo() { 34 | Contact contact = new Contact("尘心(Jason)","http://www.diqiyuzhou.tk","amazingjava@163.com"); 35 | return new ApiInfoBuilder() 36 | .title("【图书管理后台Swagger UI】") 37 | .description("图书管理后台接口") 38 | .contact(contact) 39 | .version("1.0") 40 | .build(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.config; 2 | 3 | import com.book.manager.interceptor.LoginInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 7 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | 10 | /** 11 | * @Description web mvc 配置 12 | * @Date 2020/7/15 20:47 13 | * @Author by 尘心 14 | */ 15 | @Configuration 16 | public class WebConfig implements WebMvcConfigurer { 17 | 18 | @Autowired 19 | private LoginInterceptor loginInterceptor; 20 | 21 | @Override 22 | public void addInterceptors(InterceptorRegistry registry) { 23 | // 添加拦截器 使用spring security 无需登录拦截 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.config; 2 | 3 | import com.book.manager.service.UserService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 11 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 12 | import org.springframework.security.crypto.password.PasswordEncoder; 13 | 14 | import javax.sql.DataSource; 15 | 16 | /** 17 | * @Description web security 安全配置 18 | * @Date 2020/7/21 15:19 19 | * @Author by 尘心 20 | */ 21 | @EnableWebSecurity 22 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ 23 | 24 | 25 | @Autowired 26 | private UserService userService; 27 | 28 | @Override 29 | protected void configure(HttpSecurity http) throws Exception { 30 | //授权 31 | http.formLogin() 32 | //自定义登陆页面 33 | .loginPage("/login") 34 | //如果URL为loginPage,则用SpringSecurity中自带的过滤器去处理该请求 35 | .successForwardUrl("/index") 36 | .loginProcessingUrl("/user/login") 37 | .and() 38 | //请求授权 39 | .authorizeRequests() 40 | //在访问我们的URL时,我们是不需要省份认证,可以立即访问 41 | .antMatchers("/javaex/**","/","/login","/user/login").permitAll() 42 | //所有请求都被拦截,都需认证 43 | .anyRequest().authenticated() 44 | .and() 45 | // 请求头允许X-ContentType-Options 46 | //.headers().contentTypeOptions().disable() 47 | //.and() 48 | // 请求头允许X-Frame-Options, 否则所有iframe将失效 49 | .headers().frameOptions().disable() 50 | // 注销, 回到首页 51 | // .logout().logoutSuccessUrl("/") 52 | //SpringSecurity保护机制 53 | .and() 54 | .csrf().disable(); 55 | 56 | // 开启记住我功能 57 | http.rememberMe().rememberMeParameter("remember"); 58 | } 59 | 60 | 61 | @Override 62 | protected void configure(AuthenticationManagerBuilder auth) throws Exception { 63 | // 认证 64 | auth.userDetailsService(userService).passwordEncoder(passwordEncoder()); 65 | } 66 | 67 | @Override 68 | public void configure(WebSecurity web) throws Exception { 69 | // swagger 资源放行 70 | web.ignoring().antMatchers("/webjars/**","/v2/**","/swagger-resources/**","/doc.html","/docs.html","swagger-ui.html"); 71 | } 72 | 73 | /** 74 | * 指定加密方式 75 | */ 76 | @Bean 77 | public PasswordEncoder passwordEncoder(){ 78 | // 使用BCrypt加密密码 79 | return new BCryptPasswordEncoder(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/controller/BookController.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.controller; 2 | 3 | import com.book.manager.entity.Book; 4 | import com.book.manager.service.BookService; 5 | import com.book.manager.util.R; 6 | import com.book.manager.util.http.CodeEnum; 7 | import com.book.manager.util.ro.PageIn; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | /** 15 | * @Description 用户管理 16 | * @Date 2020/7/14 16:35 17 | * @Author by 尘心 18 | */ 19 | @Api(tags = "图书管理") 20 | @RestController 21 | @RequestMapping("/book") 22 | public class BookController { 23 | 24 | @Autowired 25 | private BookService bookService; 26 | 27 | @ApiOperation("图书搜索列表") 28 | @PostMapping("/list") 29 | public R getBookList(@RequestBody PageIn pageIn) { 30 | if (pageIn == null) { 31 | return R.fail(CodeEnum.PARAM_ERROR); 32 | } 33 | 34 | return R.success(CodeEnum.SUCCESS,bookService.getBookList(pageIn)); 35 | } 36 | 37 | @ApiOperation("添加图书") 38 | @PostMapping("/add") 39 | public R addBook(@RequestBody Book book) { 40 | return R.success(CodeEnum.SUCCESS,bookService.addBook(book)); 41 | } 42 | 43 | @ApiOperation("编辑图书") 44 | @PostMapping("/update") 45 | public R modifyBook(@RequestBody Book book) { 46 | return R.success(CodeEnum.SUCCESS,bookService.updateBook(book)); 47 | } 48 | 49 | 50 | @ApiOperation("图书详情") 51 | @GetMapping("/detail") 52 | public R bookDetail(Integer id) { 53 | return R.success(CodeEnum.SUCCESS,bookService.findBookById(id)); 54 | } 55 | 56 | @ApiOperation("图书详情 根据ISBN获取") 57 | @GetMapping("/detailByIsbn") 58 | public R bookDetailByIsbn(String isbn) { 59 | return R.success(CodeEnum.SUCCESS,bookService.findBookByIsbn(isbn)); 60 | } 61 | 62 | @ApiOperation("删除图书") 63 | @GetMapping("/delete") 64 | public R delBook(Integer id) { 65 | bookService.deleteBook(id); 66 | return R.success(CodeEnum.SUCCESS); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/controller/BorrowController.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.controller; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import com.book.manager.entity.Borrow; 5 | import com.book.manager.service.BookService; 6 | import com.book.manager.service.BorrowService; 7 | import com.book.manager.util.R; 8 | import com.book.manager.util.consts.Constants; 9 | import com.book.manager.util.http.CodeEnum; 10 | import com.book.manager.util.ro.RetBookIn; 11 | import com.book.manager.util.vo.BackOut; 12 | import com.book.manager.util.vo.BookOut; 13 | import io.swagger.annotations.Api; 14 | import io.swagger.annotations.ApiOperation; 15 | import org.springframework.beans.BeanUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.stereotype.Controller; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Date; 22 | import java.util.List; 23 | 24 | /** 25 | * @Description 用户管理 26 | * @Date 2020/7/14 16:35 27 | * @Author by 尘心 28 | */ 29 | @Api(tags = "借阅管理") 30 | @RestController 31 | @RequestMapping("/borrow") 32 | public class BorrowController { 33 | 34 | @Autowired 35 | private BorrowService borrowService; 36 | 37 | @Autowired 38 | private BookService bookService; 39 | 40 | @ApiOperation("借阅列表") 41 | @GetMapping("/list") 42 | public R getBorrowList(Integer userId) { 43 | return R.success(CodeEnum.SUCCESS,borrowService.findAllBorrowByUserId(userId)); 44 | } 45 | 46 | @ApiOperation("借阅图书") 47 | @PostMapping("/add") 48 | public R addBorrow(@RequestBody Borrow borrow) { 49 | Integer result = borrowService.addBorrow(borrow); 50 | if (result == Constants.BOOK_BORROWED) { 51 | return R.success(CodeEnum.BOOK_BORROWED); 52 | }else if (result == Constants.USER_SIZE_NOT_ENOUGH) { 53 | return R.success(CodeEnum.USER_NOT_ENOUGH); 54 | }else if (result == Constants.BOOK_SIZE_NOT_ENOUGH) { 55 | return R.success(CodeEnum.BOOK_NOT_ENOUGH); 56 | } 57 | return R.success(CodeEnum.SUCCESS,Constants.OK); 58 | } 59 | 60 | @ApiOperation("编辑借阅") 61 | @PostMapping("/update") 62 | public R modifyBorrow(@RequestBody Borrow borrow) { 63 | return R.success(CodeEnum.SUCCESS,borrowService.updateBorrow(borrow)); 64 | } 65 | 66 | 67 | @ApiOperation("借阅详情") 68 | @GetMapping("/detail") 69 | public R borrowDetail(Integer id) { 70 | return R.success(CodeEnum.SUCCESS,borrowService.findById(id)); 71 | } 72 | 73 | @ApiOperation("删除归还记录") 74 | @GetMapping("/delete") 75 | public R delBorrow(Integer id) { 76 | borrowService.deleteBorrow(id); 77 | return R.success(CodeEnum.SUCCESS); 78 | } 79 | 80 | 81 | @ApiOperation("已借阅列表") 82 | @GetMapping("/borrowed") 83 | public R borrowedList(Integer userId) { 84 | List outs = new ArrayList<>(); 85 | if (userId!=null&&userId>0) { 86 | // 获取所有 已借阅 未归还书籍 87 | List borrows = borrowService.findBorrowsByUserIdAndRet(userId, Constants.NO); 88 | for (Borrow borrow : borrows) { 89 | BackOut backOut = new BackOut(); 90 | BookOut out = bookService.findBookById(borrow.getBookId()); 91 | BeanUtils.copyProperties(out,backOut); 92 | 93 | backOut.setBorrowTime(DateUtil.format(borrow.getCreateTime(),Constants.DATE_FORMAT)); 94 | 95 | String endTimeStr = DateUtil.format(borrow.getEndTime(), Constants.DATE_FORMAT); 96 | backOut.setEndTime(endTimeStr); 97 | // 判断是否逾期 98 | String toDay = DateUtil.format(new Date(), Constants.DATE_FORMAT); 99 | int i = toDay.compareTo(endTimeStr); 100 | if (i>0) { 101 | backOut.setLate(Constants.YES_STR); 102 | }else { 103 | backOut.setLate(Constants.NO_STR); 104 | } 105 | 106 | outs.add(backOut); 107 | } 108 | } 109 | 110 | return R.success(CodeEnum.SUCCESS,outs); 111 | } 112 | 113 | @ApiOperation("归还书籍") 114 | @PostMapping("/ret") 115 | public R retBook(Integer userId, Integer bookId) { 116 | // 归还图书 117 | borrowService.retBook(userId,bookId); 118 | return R.success(CodeEnum.SUCCESS); 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.controller; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import com.book.manager.entity.Users; 5 | import com.book.manager.service.UserService; 6 | import com.book.manager.util.R; 7 | import com.book.manager.util.http.CodeEnum; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | 18 | /** 19 | * @Description 用户登录 20 | 21 | */ 22 | @Controller 23 | public class LoginController { 24 | 25 | @Autowired 26 | private UserService userService; 27 | 28 | /** 29 | * 登录, 使用SpringSecurity 无需自己编写登录接口 30 | */ 31 | // @ResponseBody 32 | // @RequestMapping(method = RequestMethod.POST,value = "/user/login") 33 | // public R login(HttpServletRequest request, HttpServletResponse response) throws IOException { 34 | // String username = request.getParameter("username"); 35 | // String password = request.getParameter("password"); 36 | // 37 | // if (StrUtil.isNotBlank(username)&&StrUtil.isNotBlank(password)) { 38 | // Users users = userService. login(username, password); 39 | // if (users!=null) { 40 | // request.getSession().setAttribute("username",username); 41 | // return R.success(CodeEnum.SUCCESS); 42 | // } 43 | // } 44 | // 45 | // return R.fail(CodeEnum.NAME_OR_PASS_ERROR); 46 | // } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/controller/RouteController.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.controller; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | 10 | /** 11 | * @Description 路由 12 | * @Date 2020/7/16 9:25 13 | * @Author by 尘心 14 | */ 15 | @Api(tags = "路由") 16 | @Controller 17 | public class RouteController { 18 | 19 | /** 20 | * 跳转登录 21 | */ 22 | @ApiOperation("跳转登录页") 23 | @GetMapping({"/login","/","logout"}) 24 | public String toLogin() { 25 | return "login"; 26 | } 27 | 28 | /** 29 | * 跳转首页 30 | */ 31 | @ApiOperation("跳转首页") 32 | @RequestMapping({"/index"}) 33 | public String toIndex() { 34 | return "index"; 35 | } 36 | 37 | /** 38 | * 跳转欢迎页面 39 | */ 40 | @ApiOperation("跳转欢迎页面") 41 | @RequestMapping({"/welcome"}) 42 | public String toWelcome() { 43 | return "welcome"; 44 | } 45 | 46 | /** 47 | * 二级路由跳转 48 | * @param name 映射名称 49 | */ 50 | @ApiOperation("二级路由跳转") 51 | @RequestMapping("/{filename}/{name}") 52 | public String change(@PathVariable String filename,@PathVariable String name) { 53 | return filename+"/"+name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/controller/UsersController.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.controller; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.core.date.DateUtil; 5 | import cn.hutool.core.util.StrUtil; 6 | import com.book.manager.entity.Users; 7 | import com.book.manager.service.UserService; 8 | import com.book.manager.util.R; 9 | import com.book.manager.util.consts.Constants; 10 | import com.book.manager.util.consts.ConvertUtil; 11 | import com.book.manager.util.http.CodeEnum; 12 | import com.book.manager.util.vo.PageOut; 13 | import com.book.manager.util.ro.PageIn; 14 | import com.book.manager.util.vo.UserOut; 15 | import com.github.pagehelper.PageInfo; 16 | import io.swagger.annotations.Api; 17 | import io.swagger.annotations.ApiOperation; 18 | import org.springframework.beans.BeanUtils; 19 | import org.springframework.beans.factory.annotation.Autowired; 20 | import org.springframework.security.core.context.SecurityContextHolder; 21 | import org.springframework.web.bind.annotation.*; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | import java.util.Map; 26 | 27 | /** 28 | * @Description 用户管理 29 | * @Date 2020/7/14 16:35 30 | * @Author by 尘心 31 | */ 32 | @Api(tags = "用户管理") 33 | @RestController 34 | @RequestMapping("/user") 35 | public class UsersController { 36 | 37 | @Autowired 38 | private UserService userService; 39 | 40 | @ApiOperation("用户列表") 41 | @PostMapping("/list") 42 | public R getUsers(@RequestBody PageIn pageIn) { 43 | if (pageIn == null) { 44 | return R.fail(CodeEnum.PARAM_ERROR); 45 | } 46 | // 封装分页出参对象 47 | PageInfo userList = userService.getUserList(pageIn); 48 | PageOut pageOut = new PageOut(); 49 | pageOut.setCurrPage(userList.getPageNum()); 50 | pageOut.setPageSize(userList.getPageSize()); 51 | pageOut.setTotal((int) userList.getTotal()); 52 | List outs = new ArrayList<>(); 53 | for (Users users : userList.getList()) { 54 | UserOut out = new UserOut(); 55 | BeanUtils.copyProperties(users,out); 56 | out.setIdent(ConvertUtil.identStr(users.getIdentity())); 57 | out.setBirth(DateUtil.format(users.getBirthday(),Constants.DATE_FORMAT)); 58 | outs.add(out); 59 | } 60 | 61 | pageOut.setList(outs); 62 | 63 | return R.success(CodeEnum.SUCCESS,pageOut); 64 | } 65 | 66 | // @ApiOperation("添加用户") 67 | // @PostMapping("/add") 68 | // public R addUsers(@RequestBody Users users) { 69 | // return R.success(CodeEnum.SUCCESS,userService.addUser(users)); 70 | // } 71 | 72 | @ApiOperation("添加读者") 73 | @PostMapping("/addReader") 74 | public R addReader(@RequestBody Users users) { 75 | if (users == null) { 76 | return R.fail(CodeEnum.PARAM_ERROR); 77 | } 78 | // 读者默认是普通用户 79 | users.setIsAdmin(1); 80 | return R.success(CodeEnum.SUCCESS,userService.addUser(users)); 81 | } 82 | 83 | @ApiOperation("添加管理员") 84 | @PostMapping("/addAdmin") 85 | public R addAdmin(@RequestBody Users users) { 86 | if (users == null) { 87 | return R.fail(CodeEnum.PARAM_ERROR); 88 | } 89 | // 设置管理员权限 90 | users.setIsAdmin(0); 91 | return R.success(CodeEnum.SUCCESS,userService.addUser(users)); 92 | } 93 | 94 | 95 | @ApiOperation("编辑用户") 96 | @PostMapping("/update") 97 | public R modifyUsers(@RequestBody Users users) { 98 | return R.success(CodeEnum.SUCCESS,userService.updateUser(users)); 99 | } 100 | 101 | 102 | @ApiOperation("用户详情") 103 | @GetMapping("/detail") 104 | public R userDetail(Integer id) { 105 | Users user = userService.findUserById(id); 106 | if (user!=null) { 107 | UserOut out = new UserOut(); 108 | BeanUtils.copyProperties(user,out); 109 | out.setBirth(DateUtil.format(user.getBirthday(),Constants.DATE_FORMAT)); 110 | out.setIdent(ConvertUtil.identStr(user.getIdentity())); 111 | return R.success(CodeEnum.SUCCESS,out); 112 | } 113 | 114 | return R.fail(CodeEnum.NOT_FOUND); 115 | } 116 | 117 | @ApiOperation("删除用户") 118 | @GetMapping("/delete") 119 | public R delUsers(Integer id) { 120 | userService.deleteUser(id); 121 | return R.success(CodeEnum.SUCCESS); 122 | } 123 | 124 | @ApiOperation("获取当前用户登陆信息") 125 | @GetMapping("/currUser") 126 | public R getCurrUser() { 127 | Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 128 | if (principal!=null) { 129 | Map map = BeanUtil.beanToMap(principal); 130 | String username = (String) map.get("username"); 131 | if (StrUtil.isNotBlank(username)) { 132 | Users users = userService.findByUsername(username); 133 | UserOut out = new UserOut(); 134 | BeanUtils.copyProperties(users,out); 135 | out.setBirth(DateUtil.format(users.getBirthday(),Constants.DATE_FORMAT)); 136 | Integer identity = users.getIdentity(); 137 | String ident = ""; 138 | if (identity == Constants.STUDENT) { 139 | ident = Constants.STU_STR; 140 | }else if (identity == Constants.TEACHER) { 141 | ident = Constants.TEA_STR; 142 | }else if (identity == Constants.OTHER) { 143 | ident = Constants.OTHER_STR; 144 | }else if (identity == Constants.ADMIN) { 145 | ident = Constants.ADMIN_STR; 146 | } 147 | out.setIdent(ident); 148 | return R.success(CodeEnum.SUCCESS,out); 149 | } 150 | } 151 | return R.fail(CodeEnum.USER_NOT_FOUND); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/dao/BookMapper.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.dao; 2 | 3 | import com.book.manager.entity.Book; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * @Description 图书 12 | * @Date 2020/7/14 19:57 13 | * @Author by 尘心 14 | */ 15 | @Mapper 16 | @Component 17 | public interface BookMapper { 18 | 19 | /** 20 | * 模糊分页查询用户 21 | * @param keyword 关键字 22 | * @return 23 | */ 24 | List findBookListByLike(String keyword); 25 | 26 | /** 27 | * 编辑用户 28 | * @param map 29 | * @return 30 | */ 31 | int updateBook(Map map); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/dao/BorrowMapper.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.dao; 2 | 3 | import com.book.manager.entity.Borrow; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | * @Description 借阅管理 14 | * @Date 2020/7/15 16:45 15 | * @Author by 尘心 16 | */ 17 | @Mapper 18 | @Component 19 | public interface BorrowMapper { 20 | 21 | @Update("update borrow set user_id = #{userId},book_id = #{bookId},update_time = #{updateTime} where id = #{id}") 22 | int updateBorrow(Borrow borrow); 23 | 24 | @Select("select * from borrow where user_id = #{userId} and book_id = #{bookId}") 25 | Borrow findBorrowByUserIdAndBookId(@Param("userId") Integer userId, @Param("bookId") Integer bookId); 26 | 27 | int updateBor(Map map); 28 | } -------------------------------------------------------------------------------- /src/main/java/com/book/manager/dao/UsersMapper.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.dao; 2 | 3 | import com.book.manager.entity.Users; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * @Description 12 | * @Date 2020/7/14 19:57 13 | * @Author by 尘心 14 | */ 15 | @Mapper 16 | @Component 17 | public interface UsersMapper { 18 | 19 | /** 20 | * 模糊分页查询用户 21 | * @param keyword 关键字 22 | * @return 23 | */ 24 | List findListByLike(String keyword); 25 | 26 | /** 27 | * 编辑用户 28 | * @param map 29 | * @return 30 | */ 31 | int updateUsers(Map map); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/entity/Book.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.DynamicInsert; 8 | import org.hibernate.annotations.DynamicUpdate; 9 | import org.springframework.format.annotation.DateTimeFormat; 10 | 11 | import javax.persistence.*; 12 | import java.util.Date; 13 | 14 | /** 15 | * @Description 图书实体类 16 | * @Date 2020/7/14 15:58 17 | * @Author by 尘心 18 | */ 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @DynamicUpdate 23 | @DynamicInsert 24 | @Entity 25 | @Table(name = "book") 26 | public class Book { 27 | 28 | @ApiModelProperty("主键") 29 | @Id 30 | @GeneratedValue(strategy = GenerationType.IDENTITY) 31 | private Integer id; 32 | 33 | @ApiModelProperty("图书ISBN编码") 34 | private String isbn; 35 | 36 | @ApiModelProperty("图书名称") 37 | private String name; 38 | 39 | @ApiModelProperty("图书作者") 40 | private String author; 41 | 42 | @ApiModelProperty("图书页数") 43 | private Integer pages; 44 | 45 | @ApiModelProperty("翻译") 46 | private String translate; 47 | 48 | @ApiModelProperty("出版社") 49 | private String publish; 50 | 51 | @ApiModelProperty("单价") 52 | private Double price; 53 | 54 | @ApiModelProperty("库存") 55 | private Integer size; 56 | 57 | @ApiModelProperty("分类") 58 | private String type; 59 | 60 | @ApiModelProperty("出版时间") 61 | private Date publishTime; 62 | 63 | // json字符串: {"isbn":"isbn","name":"name","author":"author","pages":"pages","translate":"translate","publish":"publish","price":"price","size":"size","type":"type","publishTime":"publishTime"} 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/entity/Borrow.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.DynamicInsert; 8 | import org.hibernate.annotations.DynamicUpdate; 9 | 10 | import javax.persistence.*; 11 | import java.util.Date; 12 | 13 | /** 14 | * @Description 借阅表 15 | * @Date 2020/7/14 16:01 16 | * @Author by 尘心 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @DynamicUpdate 22 | @DynamicInsert 23 | @Entity 24 | @Table(name = "borrow") 25 | public class Borrow { 26 | 27 | @ApiModelProperty("主键ID") 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) 30 | private Integer id; 31 | 32 | @ApiModelProperty("用户ID") 33 | private Integer userId; 34 | 35 | @ApiModelProperty("图书ID") 36 | private Integer bookId; 37 | 38 | @ApiModelProperty("借阅时间") 39 | private Date createTime; 40 | 41 | @ApiModelProperty("归还时间") 42 | private Date endTime; 43 | 44 | @ApiModelProperty("实际归还时间") 45 | private Date updateTime; 46 | 47 | @ApiModelProperty("是否归还? 0 已归还/1 未归还") 48 | private Integer ret; 49 | // json: {"userId":userId,"bookId":bookId,"createTime":createTime,"endTime":endTime,"updateTime":updateTime} 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/entity/Users.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.DynamicInsert; 8 | import org.hibernate.annotations.DynamicUpdate; 9 | 10 | import javax.persistence.*; 11 | import java.util.Date; 12 | 13 | /** 14 | * @Description 用户实体类 15 | * @Date 2020/7/14 15:39 16 | * @Author by 尘心 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @DynamicUpdate 22 | @DynamicInsert 23 | @Entity 24 | @Table(name = "users") 25 | public class Users { 26 | 27 | @ApiModelProperty("主键ID") 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) 30 | private Integer id; 31 | 32 | @ApiModelProperty("头像") 33 | private String avatar; 34 | 35 | @ApiModelProperty("昵称") 36 | private String nickname; 37 | 38 | @ApiModelProperty("用户名") 39 | private String username; 40 | 41 | @ApiModelProperty("密码") 42 | private String password; 43 | 44 | @ApiModelProperty("生日") 45 | private Date birthday; 46 | 47 | @ApiModelProperty("是否为管理员") 48 | private Integer isAdmin; 49 | 50 | @ApiModelProperty("电话") 51 | private String tel; 52 | 53 | @ApiModelProperty("邮箱") 54 | private String email; 55 | 56 | @ApiModelProperty("地址") 57 | private String address; 58 | 59 | @ApiModelProperty("可借数量") 60 | private Integer size; 61 | 62 | @ApiModelProperty("身份:0 学生,1 教师,2 校外人士,3 管理员") 63 | private Integer identity; 64 | 65 | // json: {"id":id,"avatar":avatar,"nickname":nickname,"username":username,"password":password,"birthday":birthday,"isAdmin":isAdmin,"tel":tel 66 | // ,"email":email,"address":address,"size":size,"identity":identity} 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.interceptor; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.stereotype.Component; 5 | import org.springframework.web.servlet.HandlerInterceptor; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import javax.servlet.http.HttpSession; 10 | 11 | /** 12 | * @Description 登录拦截器 13 | * @Date 2020/7/15 20:39 14 | * @Author by 尘心 15 | */ 16 | @Slf4j 17 | @Component 18 | public class LoginInterceptor implements HandlerInterceptor{ 19 | 20 | @Override 21 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 22 | HttpSession session = request.getSession(); 23 | // 查看用户session 是否已登录 24 | 25 | return true; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/repos/BookRepository.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.repos; 2 | 3 | import com.book.manager.entity.Book; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @Description 书籍 9 | * @Date 2020/7/14 16:12 10 | * @Author by 尘心 11 | */ 12 | @Repository 13 | public interface BookRepository extends JpaRepository { 14 | 15 | /** 16 | * ISBN编码查询 17 | * @param isbn 18 | * @return 19 | */ 20 | Book findByIsbn(String isbn); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/repos/BorrowRepository.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.repos; 2 | 3 | import com.book.manager.entity.Borrow; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.repository.query.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Description 借阅管理 jpa查询 12 | * @Date 2020/7/14 16:14 13 | * @Author by 尘心 14 | */ 15 | @Repository 16 | public interface BorrowRepository extends JpaRepository{ 17 | 18 | /** 19 | * 查询借阅信息 20 | * @param userId 用户id 21 | * @return 22 | */ 23 | List findBorrowByUserId(Integer userId); 24 | 25 | /** 26 | * 查询已借阅信息 27 | * @param userId 用户id 28 | * @param ret 是否归还, 0 已归还/ 1 未归还 29 | * @return 30 | */ 31 | List findBorrowsByUserIdAndRet(@Param("userId") Integer userId,@Param("ret")Integer ret); 32 | 33 | /** 34 | * 查询用户某一条借阅信息 35 | * @param userId 用户id 36 | * @param bookId 图书id 37 | */ 38 | Borrow findBorrowByUserIdAndBookId(@Param("userId") Integer userId, @Param("bookId") Integer bookId); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/repos/UsersRepository.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.repos; 2 | 3 | import com.book.manager.entity.Users; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.data.repository.query.Param; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @Description 用户jpa 查询 15 | * @Date 2020/7/14 16:06 16 | * @Author by 尘心 17 | */ 18 | @Repository 19 | public interface UsersRepository extends JpaRepository{ 20 | 21 | /** 22 | * 用户模糊查询 + 分页 用户信息 23 | * @param keyword 用户名 24 | * @param pageable 分页对象 25 | * @return Page 26 | */ 27 | @Query(value="select * from users where username like CONCAT('%',:keyword,'%') limit ",nativeQuery=true) 28 | Page findByUsernameLike(@Param(value = "keyword") String keyword,Pageable pageable); 29 | 30 | /** 31 | * 用户登录 32 | * @param username 用户名 33 | * @param password 密码 34 | */ 35 | Users findByUsernameAndPassword(@Param("username") String username,@Param("password") String password); 36 | 37 | /** 38 | * 用户名查询 39 | * @param username 40 | * @return 41 | */ 42 | Users findByUsername(@Param("username") String username); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/service/BookService.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.service; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.core.date.DateUtil; 5 | import com.book.manager.dao.BookMapper; 6 | import com.book.manager.entity.Book; 7 | import com.book.manager.repos.BookRepository; 8 | import com.book.manager.util.vo.BookOut; 9 | import com.book.manager.util.vo.PageOut; 10 | import com.book.manager.util.ro.PageIn; 11 | import com.github.pagehelper.PageHelper; 12 | import com.github.pagehelper.PageInfo; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.transaction.annotation.Transactional; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | import java.util.Optional; 20 | 21 | /** 22 | * @Description 图书业务类 23 | * @Date 2020/7/14 16:31 24 | * @Author by 尘心 25 | */ 26 | @Service 27 | public class BookService { 28 | 29 | @Autowired 30 | private BookRepository bookRepository; 31 | 32 | @Autowired 33 | private BookMapper bookMapper; 34 | 35 | 36 | /** 37 | * 添加用户 38 | * @param book 图书 39 | * @return 返回添加的图书 40 | */ 41 | public Book addBook(Book book) { 42 | return bookRepository.saveAndFlush(book); 43 | } 44 | 45 | /** 46 | * 编辑用户 47 | * @param book 图书对象 48 | * @return true or false 49 | */ 50 | public boolean updateBook(Book book) { 51 | return bookMapper.updateBook(BeanUtil.beanToMap(book))>0; 52 | } 53 | 54 | /** 55 | * 图书详情 56 | * @param id 主键 57 | * @return 图书详情 58 | */ 59 | public BookOut findBookById(Integer id) { 60 | Optional optional = bookRepository.findById(id); 61 | if (optional.isPresent()) { 62 | Book book = optional.get(); 63 | BookOut out = new BookOut(); 64 | BeanUtil.copyProperties(book,out); 65 | out.setPublishTime(DateUtil.format(book.getPublishTime(),"yyyy-MM-dd")); 66 | return out; 67 | } 68 | return null; 69 | } 70 | 71 | public Book findBook(Integer id) { 72 | Optional optional = bookRepository.findById(id); 73 | if (optional.isPresent()) { 74 | return optional.get(); 75 | } 76 | return null; 77 | } 78 | 79 | /** 80 | * ISBN查询 81 | * @param isbn 82 | * @return 83 | */ 84 | public BookOut findBookByIsbn(String isbn) { 85 | Book book = bookRepository.findByIsbn(isbn); 86 | BookOut out = new BookOut(); 87 | if (book == null) { 88 | return out; 89 | } 90 | BeanUtil.copyProperties(book,out); 91 | out.setPublishTime(DateUtil.format(book.getPublishTime(),"yyyy-MM-dd")); 92 | return out; 93 | } 94 | 95 | /** 96 | * 删除图书 97 | * @param id 主键 98 | * @return true or false 99 | */ 100 | public void deleteBook(Integer id) { 101 | bookRepository.deleteById(id); 102 | } 103 | 104 | 105 | /** 106 | * 图书搜索查询(mybatis 分页) 107 | * @param pageIn 108 | * @return 109 | */ 110 | public PageOut getBookList(PageIn pageIn) { 111 | 112 | PageHelper.startPage(pageIn.getCurrPage(),pageIn.getPageSize()); 113 | List list = bookMapper.findBookListByLike(pageIn.getKeyword()); 114 | PageInfo pageInfo = new PageInfo<>(list); 115 | 116 | List bookOuts = new ArrayList<>(); 117 | for (Book book : pageInfo.getList()) { 118 | BookOut out = new BookOut(); 119 | BeanUtil.copyProperties(book,out); 120 | out.setPublishTime(DateUtil.format(book.getPublishTime(),"yyyy-MM-dd")); 121 | bookOuts.add(out); 122 | } 123 | 124 | // 自定义分页返回对象 125 | PageOut pageOut = new PageOut(); 126 | pageOut.setList(bookOuts); 127 | pageOut.setTotal((int)pageInfo.getTotal()); 128 | pageOut.setCurrPage(pageInfo.getPageNum()); 129 | pageOut.setPageSize(pageInfo.getPageSize()); 130 | return pageOut; 131 | } 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/service/BorrowService.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.service; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.book.manager.dao.BookMapper; 5 | import com.book.manager.dao.BorrowMapper; 6 | import com.book.manager.dao.UsersMapper; 7 | import com.book.manager.entity.Book; 8 | import com.book.manager.entity.Borrow; 9 | import com.book.manager.entity.Users; 10 | import com.book.manager.repos.BookRepository; 11 | import com.book.manager.repos.BorrowRepository; 12 | import com.book.manager.util.consts.Constants; 13 | import com.book.manager.util.vo.BookOut; 14 | import org.springframework.beans.BeanUtils; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.transaction.annotation.Transactional; 18 | 19 | import java.util.Date; 20 | import java.util.List; 21 | import java.util.Optional; 22 | 23 | /** 24 | * @Description 借阅管理 25 | * @Date 2020/7/15 16:46 26 | * @Author by 尘心 27 | */ 28 | @Service 29 | public class BorrowService { 30 | 31 | @Autowired 32 | private BorrowRepository borrowRepository; 33 | 34 | @Autowired 35 | private BorrowMapper borrowMapper; 36 | 37 | @Autowired 38 | private BookService bookService; 39 | 40 | @Autowired 41 | private UserService userService; 42 | 43 | /** 44 | * 添加 45 | * (添加事物) 46 | */ 47 | @Transactional 48 | public Integer addBorrow(Borrow borrow) { 49 | Book book = bookService.findBook(borrow.getBookId()); 50 | Users users = userService.findUserById(borrow.getUserId()); 51 | 52 | // 查询是否已经借阅过该图书 53 | Borrow bor = findBorrowByUserIdAndBookId(users.getId(),book.getId()); 54 | if (bor!=null) { 55 | Integer ret = bor.getRet(); 56 | if (ret!=null) { 57 | // 已借阅, 未归还 不可再借 58 | if (ret == Constants.NO) { 59 | return Constants.BOOK_BORROWED; 60 | } 61 | } 62 | } 63 | 64 | // 库存数量减一 65 | int size = book.getSize(); 66 | if (size>0) { 67 | size--; 68 | book.setSize(size); 69 | bookService.updateBook(book); 70 | }else { 71 | return Constants.BOOK_SIZE_NOT_ENOUGH; 72 | } 73 | 74 | // 用户可借数量减一 75 | int userSize = users.getSize(); 76 | if (userSize>0) { 77 | userSize --; 78 | users.setSize(userSize); 79 | userService.updateUser(users); 80 | }else { 81 | return Constants.USER_SIZE_NOT_ENOUGH; 82 | } 83 | 84 | 85 | // 添加借阅信息, 借阅默认为未归还状态 86 | borrow.setRet(Constants.NO); 87 | borrowRepository.saveAndFlush(borrow); 88 | 89 | // 一切正常 90 | return Constants.OK; 91 | } 92 | 93 | /** 94 | * user id查询所有借阅信息 95 | */ 96 | public List findAllBorrowByUserId(Integer userId) { 97 | return borrowRepository.findBorrowByUserId(userId); 98 | } 99 | 100 | /** 101 | * user id查询所有 已借阅信息 102 | */ 103 | public List findBorrowsByUserIdAndRet(Integer userId, Integer ret) { 104 | return borrowRepository.findBorrowsByUserIdAndRet(userId,ret); 105 | } 106 | 107 | 108 | /** 109 | * 详情 110 | */ 111 | public Borrow findById(Integer id) { 112 | Optional optional = borrowRepository.findById(id); 113 | if (optional.isPresent()) { 114 | return optional.get(); 115 | } 116 | return null; 117 | } 118 | 119 | /** 120 | * 编辑 121 | */ 122 | public boolean updateBorrow(Borrow borrow) { 123 | return borrowMapper.updateBorrow(borrow)>0; 124 | } 125 | 126 | 127 | /** 128 | * 编辑 129 | */ 130 | public Borrow updateBorrowByRepo(Borrow borrow) { 131 | return borrowRepository.saveAndFlush(borrow); 132 | } 133 | 134 | /** 135 | * s删除 136 | */ 137 | public void deleteBorrow(Integer id) { 138 | borrowRepository.deleteById(id); 139 | } 140 | 141 | /** 142 | * 查询用户某一条借阅信息 143 | * @param userId 用户id 144 | * @param bookId 图书id 145 | */ 146 | public Borrow findBorrowByUserIdAndBookId(int userId,int bookId) { 147 | return borrowMapper.findBorrowByUserIdAndBookId(userId,bookId); 148 | } 149 | 150 | /** 151 | * 归还书籍, 使用事务保证 ACID 152 | * @param userId 用户Id 153 | * @param bookId 书籍id 154 | */ 155 | @Transactional(rollbackFor = Exception.class) 156 | public void retBook(int userId,int bookId) { 157 | // 用户可借数量加1 158 | Users user = userService.findUserById(userId); 159 | Integer size = user.getSize(); 160 | size++; 161 | user.setSize(size); 162 | userService.updateUser(user); 163 | 164 | 165 | // 书籍库存加1 166 | Book book = bookService.findBook(bookId); 167 | Integer bookSize = book.getSize(); 168 | bookSize++; 169 | book.setSize(bookSize); 170 | bookService.updateBook(book); 171 | // 借阅记录改为已归还,删除记录 172 | Borrow borrow = this.findBorrowByUserIdAndBookId(userId, bookId); 173 | // borrow.setRet(Constants.YES); 174 | // borrow.setUpdateTime(new Date()); 175 | // borrowMapper.updateBor(BeanUtil.beanToMap(borrow))>0; 176 | this.deleteBorrow(borrow.getId()); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.service; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.book.manager.dao.UsersMapper; 5 | import com.book.manager.entity.Users; 6 | import com.book.manager.repos.UsersRepository; 7 | import com.book.manager.util.ro.PageIn; 8 | import com.github.pagehelper.PageHelper; 9 | import com.github.pagehelper.PageInfo; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.data.domain.Page; 12 | import org.springframework.data.domain.Pageable; 13 | import org.springframework.security.core.GrantedAuthority; 14 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 15 | import org.springframework.security.core.userdetails.User; 16 | import org.springframework.security.core.userdetails.UserDetails; 17 | import org.springframework.security.core.userdetails.UserDetailsService; 18 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 19 | import org.springframework.security.crypto.password.PasswordEncoder; 20 | import org.springframework.stereotype.Service; 21 | import org.springframework.transaction.annotation.Transactional; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | import java.util.Optional; 26 | 27 | /** 28 | * @Description 用户业务类 29 | * @Date 2020/7/14 16:31 30 | * @Author by 尘心 31 | */ 32 | @Service 33 | public class UserService implements UserDetailsService{ 34 | 35 | @Autowired 36 | private UsersRepository usersRepository; 37 | 38 | @Autowired 39 | private UsersMapper usersMapper; 40 | 41 | @Autowired 42 | private PasswordEncoder passwordEncoder; 43 | 44 | /** 45 | * 获取所有用户, 分页(鉴于jpa分页过于繁琐, 已使用mybatis, page helper分页, 此方法弃用) 46 | * @param pageable 分页对象 47 | */ 48 | public Page getUsers(String keyword,Pageable pageable) { 49 | return usersRepository.findByUsernameLike(keyword,pageable); 50 | } 51 | 52 | /** 53 | * 登录 (使用SpringSecurity 此方法弃用) 54 | * @param username 用户名 55 | * @param password 密码 56 | */ 57 | public Users login(String username,String password) { 58 | return usersRepository.findByUsernameAndPassword(username,password); 59 | } 60 | 61 | 62 | /** 63 | * 添加用户 64 | * @param users 用户 65 | * @return 返回添加的用户 66 | */ 67 | public Users addUser(Users users) { 68 | return usersRepository.saveAndFlush(users); 69 | } 70 | 71 | /** 72 | * 编辑用户 73 | * @param users 用户对象 74 | * @return true or false 75 | */ 76 | // @Transactional(rollbackFor = Exception.class) 77 | public boolean updateUser(Users users) { 78 | return usersMapper.updateUsers(BeanUtil.beanToMap(users))>0; 79 | } 80 | 81 | /** 82 | * 用户详情 83 | * @param id 主键 84 | * @return 用户详情 85 | */ 86 | public Users findUserById(Integer id) { 87 | Optional optional = usersRepository.findById(id); 88 | if (optional.isPresent()) { 89 | return optional.get(); 90 | } 91 | return null; 92 | } 93 | 94 | /** 95 | * 删除用户 96 | * @param id 主键 97 | * @return true or false 98 | */ 99 | public void deleteUser(Integer id) { 100 | usersRepository.deleteById(id); 101 | } 102 | 103 | 104 | /** 105 | * 用户搜索查询(mybatis 分页) 106 | * @param pageIn 107 | * @return 108 | */ 109 | public PageInfo getUserList(PageIn pageIn) { 110 | 111 | PageHelper.startPage(pageIn.getCurrPage(),pageIn.getPageSize()); 112 | List listByLike = usersMapper.findListByLike(pageIn.getKeyword()); 113 | return new PageInfo<>(listByLike); 114 | } 115 | 116 | /** 117 | * 用户鉴权 118 | * @param username 用户名 119 | * @throws UsernameNotFoundException 120 | */ 121 | @Override 122 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 123 | // 查找用户 124 | Users user = usersRepository.findByUsername(username); 125 | // 获得角色 126 | String role = String.valueOf(user.getIsAdmin()); 127 | // 角色集合 128 | List authorities = new ArrayList<>(); 129 | // 角色必须以`ROLE_`开头,数据库中没有,则在这里加 130 | authorities.add(new SimpleGrantedAuthority("ROLE_" + role)); 131 | // 数据库密码是明文, 需要加密进行比对 132 | return new User(user.getUsername(), passwordEncoder.encode(user.getPassword()), authorities); 133 | } 134 | 135 | /** 136 | * 用户名查询用户信息 137 | * @param username 用户名 138 | */ 139 | public Users findByUsername(String username) { 140 | return usersRepository.findByUsername(username); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/R.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util; 2 | 3 | import com.book.manager.util.http.CodeEnum; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @Description 返回对象 10 | * @Date 2020/7/14 18:47 11 | * @Author by 尘心 12 | */ 13 | public class R implements Serializable{ 14 | 15 | @ApiModelProperty("响应码") 16 | private Integer code; 17 | 18 | @ApiModelProperty("响应信息") 19 | private String msg; 20 | 21 | @ApiModelProperty("响应数据") 22 | private Object data; 23 | 24 | public R() { 25 | } 26 | 27 | public R(String msg, String data) { 28 | this.msg = msg; 29 | this.data = data; 30 | } 31 | 32 | public R(Integer code, String msg, String data) { 33 | this.code = code; 34 | this.msg = msg; 35 | this.data = data; 36 | } 37 | 38 | 39 | public R(CodeEnum codeEnum,Object data) { 40 | this.code = codeEnum.getCode(); 41 | this.msg = codeEnum.getData(); 42 | this.data = data; 43 | } 44 | 45 | public R(CodeEnum codeEnum) { 46 | this.code = codeEnum.getCode(); 47 | this.msg = codeEnum.getData(); 48 | } 49 | 50 | 51 | public static R success(CodeEnum codeEnum,Object data) { 52 | return new R(codeEnum,data); 53 | } 54 | 55 | public static R success(CodeEnum codeEnum) { 56 | return new R(codeEnum); 57 | } 58 | 59 | public static R fail(CodeEnum codeEnum) { 60 | return new R(codeEnum); 61 | } 62 | 63 | 64 | public Integer getCode() { 65 | return code; 66 | } 67 | 68 | public void setCode(Integer code) { 69 | this.code = code; 70 | } 71 | 72 | public String getMsg() { 73 | return msg; 74 | } 75 | 76 | public void setMsg(String msg) { 77 | this.msg = msg; 78 | } 79 | 80 | public Object getData() { 81 | return data; 82 | } 83 | 84 | public void setData(Object data) { 85 | this.data = data; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/consts/Constants.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.consts; 2 | 3 | 4 | /** 5 | * 常量 6 | */ 7 | public final class Constants { 8 | 9 | /** 用户可解数量不足 */ 10 | public static final int USER_SIZE_NOT_ENOUGH = -101; 11 | /** 图书库存数量不足 */ 12 | public static final int BOOK_SIZE_NOT_ENOUGH = -102; 13 | /** 用户已借过该图书 */ 14 | public static final int BOOK_BORROWED = -201; 15 | /** 是 */ 16 | public static final int YES = 0; 17 | /** 否 */ 18 | public static final int NO = 1; 19 | /** 一切正常 */ 20 | public static final int OK = 1; 21 | /** 是 */ 22 | public static final String YES_STR = "是"; 23 | /** 否 */ 24 | public static final String NO_STR = "否"; 25 | /** 日期格式 */ 26 | public static final String DATE_FORMAT = "yyyy-MM-dd"; 27 | /** 学生 */ 28 | public static final int STUDENT = 0; 29 | /** 教师 */ 30 | public static final int TEACHER = 1; 31 | /** 其他 */ 32 | public static final int OTHER = 2; 33 | /** 管理员 */ 34 | public static final int ADMIN = 3; 35 | /** 身份 */ 36 | public static final String STU_STR = "学生"; 37 | public static final String TEA_STR = "教师"; 38 | public static final String OTHER_STR = "社会人士"; 39 | public static final String ADMIN_STR = "管理员"; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/consts/ConvertUtil.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.consts; 2 | 3 | /** 4 | * @Description 数字类型 和 中文名称互转 5 | * @Date 2020/7/28 13:48 6 | * @Author by 尘心 7 | */ 8 | public class ConvertUtil { 9 | 10 | /** 11 | * 获取身份信息 12 | * @param type 身份类型 13 | * @return 14 | */ 15 | public static String identStr(int type) { 16 | String result = null; 17 | if (type == Constants.STUDENT) { 18 | result = Constants.STU_STR; 19 | }else if (type == Constants.TEACHER) { 20 | result = Constants.TEA_STR; 21 | }else if (type == Constants.ADMIN) { 22 | result = Constants.ADMIN_STR; 23 | }else if (type == Constants.OTHER) { 24 | result = Constants.OTHER_STR; 25 | } 26 | 27 | return result; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/http/CodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.http; 2 | 3 | /** 4 | * @Description 响应状态码枚举类 5 | * @Date 2020/7/14 18:49 6 | * @Author by 尘心 7 | */ 8 | public enum CodeEnum { 9 | /** 请求成功 */ 10 | SUCCESS(200,"成功!"), 11 | /** 您已借阅过该图书, 且未归还 */ 12 | BOOK_BORROWED(300,"您已借阅过该图书, 且未归还!"), 13 | /** 图书库存不够,无法借阅! */ 14 | BOOK_NOT_ENOUGH(301,"图书库存不够,无法借阅!"), 15 | /** 用户可借数量不够,无法借阅! */ 16 | USER_NOT_ENOUGH(302,"用户可借数量不够,无法借阅!"), 17 | /** 找不到资源 */ 18 | NOT_FOUND(404,"找不到资源!"), 19 | /** 请求参数错误 */ 20 | PARAM_ERROR(444,"请求参数错误!"), 21 | /** 用户名或密码错误 */ 22 | NAME_OR_PASS_ERROR(445,"用户名或密码错误!"), 23 | /** 找不到用户 */ 24 | USER_NOT_FOUND(446,"找不到用户!"), 25 | /** 服务器发生异常 */ 26 | FAIL(500,"服务器发生异常!"); 27 | 28 | CodeEnum(int code, String data) { 29 | this.code = code; 30 | this.data = data; 31 | } 32 | 33 | private int code; 34 | private String data; 35 | 36 | public int getCode() { 37 | return code; 38 | } 39 | 40 | public void setCode(int code) { 41 | this.code = code; 42 | } 43 | 44 | public String getData() { 45 | return data; 46 | } 47 | 48 | public void setData(String data) { 49 | this.data = data; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/ro/PageIn.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.ro; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 分页对象 8 | * @Date 2020/7/14 16:51 9 | * @Author by 尘心 10 | */ 11 | @Data 12 | public class PageIn { 13 | 14 | /** 搜索关键字 */ 15 | @ApiModelProperty("搜索关键字") 16 | private String keyword; 17 | 18 | /** 当前页 */ 19 | @ApiModelProperty("当前页") 20 | private Integer currPage; 21 | 22 | /** 当前页条数 */ 23 | @ApiModelProperty("每页数量") 24 | private Integer pageSize; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/ro/RetBookIn.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.ro; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 图书归还 ro 对象 8 | * @Date 2020/7/24 15:09 9 | * @Author by 尘心 10 | */ 11 | @Data 12 | public class RetBookIn { 13 | 14 | @ApiModelProperty("用户ID") 15 | private Integer userId; 16 | 17 | @ApiModelProperty("图书ID") 18 | private Integer bookId; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/vo/BackOut.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 归还 vo对象 8 | * @Date 2020/7/24 11:24 9 | * @Author by 尘心 10 | */ 11 | @Data 12 | public class BackOut extends BookOut{ 13 | 14 | @ApiModelProperty("借阅时间") 15 | private String borrowTime; 16 | 17 | @ApiModelProperty("应还时间") 18 | private String endTime; 19 | 20 | @ApiModelProperty("是否逾期") 21 | private String late; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/vo/BookOut.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * 图书出参对象 8 | */ 9 | @Data 10 | public class BookOut { 11 | 12 | @ApiModelProperty("书籍ID") 13 | private Integer id; 14 | 15 | @ApiModelProperty("书籍ISBN编码") 16 | private String isbn; 17 | 18 | @ApiModelProperty("书名") 19 | private String name; 20 | 21 | @ApiModelProperty("作者") 22 | private String author; 23 | 24 | @ApiModelProperty("页数") 25 | private Integer pages; 26 | 27 | @ApiModelProperty("翻译") 28 | private String translate; 29 | 30 | @ApiModelProperty("出版社") 31 | private String publish; 32 | 33 | @ApiModelProperty("定价") 34 | private Double price; 35 | 36 | @ApiModelProperty("库存") 37 | private Integer size; 38 | 39 | @ApiModelProperty("分类") 40 | private String type; 41 | 42 | @ApiModelProperty("出版时间") 43 | private String publishTime; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/vo/PageOut.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 分页返回 8 | * @Date 2020/7/14 20:53 9 | * @Author by 尘心 10 | */ 11 | @Data 12 | public class PageOut { 13 | 14 | @ApiModelProperty("当前页") 15 | private Integer currPage; 16 | 17 | @ApiModelProperty("每页条数") 18 | private Integer pageSize; 19 | 20 | @ApiModelProperty("总数") 21 | private Integer total; 22 | 23 | @ApiModelProperty("数据") 24 | private Object list; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/book/manager/util/vo/UserOut.java: -------------------------------------------------------------------------------- 1 | package com.book.manager.util.vo; 2 | 3 | import com.book.manager.entity.Users; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * @Description 用户vo类 9 | * @Date 2020/7/24 14:29 10 | * @Author by 尘心 11 | */ 12 | @Data 13 | public class UserOut extends Users{ 14 | 15 | @ApiModelProperty("身份(中文:学生/教师/社会人士/管理员)") 16 | private String ident; 17 | 18 | @ApiModelProperty("生日:yyyy-MM-dd格式") 19 | private String birth; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # --------------------------------------------- 启动端口 ------------------------------------------------------- # 2 | server: 3 | port: 8080 4 | 5 | spring: 6 | # --------------------------------------------- 数据库配置(默认使用mysql:5.5+) -----------------------------------# 7 | datasource: 8 | driver-class-name: com.mysql.cj.jdbc.Driver 9 | url: jdbc:mysql://localhost:3306/graduation_book?characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai 10 | username: root 11 | password: 123456 12 | 13 | # --------------------------------------------- 配置 JPA ------------------------------------------------------- # 14 | jpa: 15 | hibernate: 16 | # --------------------------------------------- 更新策略 ------------------------------------------------------- # 17 | ddl-auto: update 18 | # --------------------------------------------- 打印SQL ------------------------------------------------------- # 19 | show-sql: true 20 | # --------------------------------------------- 自动生成表结构 ------------------------------------------------- # 21 | generate-ddl: true 22 | # --------------------------------------------- 配置mybatis ---------------------------------------------------- # 23 | mybatis: 24 | mapper-locations: classpath:mapper/*.xml 25 | configuration: 26 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 27 | -------------------------------------------------------------------------------- /src/main/resources/mapper/BookMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 29 | 30 | 31 | update book 32 | 33 | 34 | isbn = #{isbn}, 35 | 36 | 37 | `name` = #{name}, 38 | 39 | 40 | pages = #{pages}, 41 | 42 | 43 | `translate` = #{translate}, 44 | 45 | 46 | publish = #{publish}, 47 | 48 | 49 | price = #{price}, 50 | 51 | 52 | `size` = #{size}, 53 | 54 | 55 | `type` = #{type}, 56 | 57 | 58 | publish_time = #{publishTime}, 59 | 60 | 61 | where id = #{id} 62 | 63 | -------------------------------------------------------------------------------- /src/main/resources/mapper/BorrowMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | update borrow 16 | 17 | 18 | user_id = #{userId}, 19 | 20 | 21 | book_id = #{bookId}, 22 | 23 | 24 | create_time = #{createTime}, 25 | 26 | 27 | end_time = #{endTime}, 28 | 29 | 30 | update_time = #{updateTime}, 31 | 32 | 33 | ret = #{ret}, 34 | 35 | 36 | where id = #{id} 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UsersMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 29 | 30 | update users 31 | 32 | 33 | avatar = #{avatar}, 34 | 35 | 36 | nickname = #{nickname}, 37 | 38 | 39 | username = #{username}, 40 | 41 | 42 | password = #{password}, 43 | 44 | 45 | birthday = #{birthday}, 46 | 47 | 48 | is_admin = #{isAdmin}, 49 | 50 | 51 | tel = #{tel}, 52 | 53 | 54 | address = #{address}, 55 | 56 | 57 | `size` = #{size}, 58 | 59 | 60 | `identity` = #{identity}, 61 | 62 | 63 | where id = #{id} 64 | 65 | -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/2.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/3.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/4.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/5.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/6.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/7.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/8.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/img/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/img/9.jpg -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/mobile/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ 2 | ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'

'+(e?n.title[0]:n.title)+"

":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e=''+n.btn[0]+"",2===t&&(e=''+n.btn[1]+""+e),'
'+e+"
"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='

'+(n.content||"")+"

"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"
':"")+'
"+l+'
'+n.content+"
"+c+"
",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;odiv{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/theme/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/layer/theme/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/layer/theme/default/icon.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/theme/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/layer/theme/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/theme/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/layer/theme/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/resources/static/javaex/layer/theme/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/layer/theme/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/css/fonts/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/css/fonts/icomoon.eot -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/css/fonts/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/css/fonts/icomoon.ttf -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/css/fonts/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/css/fonts/icomoon.woff -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/css/skin/tina.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | /*皮肤:缇娜*/ 3 | /*弹出层*/ 4 | .dialog { 5 | background-color: #fff; 6 | } 7 | .dialog .dialog-content { 8 | color: #333; 9 | } 10 | .dialog .dialog-button-container { 11 | border-top: 1px solid #ebedf0; 12 | } 13 | .dialog .dialog-button { 14 | background: #F3F3F3; 15 | } 16 | .dialog .confirm { 17 | color: #444; 18 | } 19 | .tip-content { 20 | background-color: rgba(0,0,0,.8); 21 | border-radius: 8px; color: #fff; 22 | } 23 | .popup { 24 | color: #333; 25 | } 26 | .popup .dialog-title { 27 | color: #333; 28 | background: #F3F3F3; 29 | font-size: 0.44rem; 30 | } 31 | .popup .operation { 32 | background: #fff; 33 | } 34 | .popup .button-cancel { 35 | color: #666; 36 | background: #fff; 37 | border-top:1px solid #eee; 38 | } 39 | .loading { 40 | background: rgba(40,40,40,0.7); 41 | border-radius: 5px; 42 | color: #FFFFFF; 43 | } 44 | .vertical li { 45 | border-bottom: 1px solid #e5e5e5; 46 | } 47 | .vertical li:last-child { 48 | border-bottom: none; 49 | } 50 | 51 | /*主体内容结构*/ 52 | .block { 53 | background-color: #fff; 54 | } 55 | .block .divider { 56 | border-top: 1px solid #eee; 57 | } 58 | .banner { 59 | border-bottom: 1px solid #eee; 60 | } 61 | .banner .subtitle { 62 | color: #888; 63 | } 64 | .subtitle a { 65 | color: #999; 66 | } 67 | 68 | /*表单*/ 69 | .subtitle { 70 | color: #888; 71 | } 72 | .unit .right input { 73 | color: #666; 74 | text-align: right; 75 | } 76 | textarea.desc { 77 | color: #666; 78 | } 79 | 80 | /*单选框和复选框*/ 81 | /*普通填充样式*/ 82 | input[type="radio"].fill ~ .fill-css { 83 | border: 1px solid #c0c0c0; 84 | background-color: #c0c0c0; 85 | } 86 | input[type="checkbox"].fill ~ .fill-css { 87 | border: 1px solid #c0c0c0; 88 | } 89 | input[type="radio"].fill:disabled ~ .fill-css { 90 | border: 1px solid #ddd; 91 | background-color: #ddd; 92 | } 93 | input[type="checkbox"].fill:disabled ~ .fill-css { 94 | border: 1px solid #ccc; 95 | } 96 | input[type="radio"].fill:checked ~ .fill-css, input[type="checkbox"].fill:checked ~ .fill-css { 97 | border: 1px solid #2196f3; 98 | background-color: #2196f3; 99 | } 100 | 101 | input[type="radio"].fill:checked[disabled] ~ .fill-css, input[type="checkbox"].fill:checked[disabled] ~ .fill-css { 102 | border: 1px solid #c9e2f9; 103 | background-color: #c9e2f9; 104 | } 105 | /*开关样式复选框*/ 106 | .switch { 107 | background-color: #999; 108 | } 109 | .switch:checked { 110 | border-color: #3a9bd9; 111 | background-color: #3a9bd9; 112 | box-shadow: #3a9bd9 0 0 0 16px inset; 113 | } 114 | 115 | /*底部固定*/ 116 | .footer-ul { 117 | background-color: #fff; 118 | } 119 | .footer-ul .active { 120 | color: #12b7f5; 121 | } 122 | .footer-ul ul { 123 | color: #666; 124 | } 125 | .footer-div { 126 | background-color: #fff; 127 | } 128 | .footer-div ul { 129 | color: #666; 130 | } 131 | .footer-div > div > div { 132 | border-right: 1px solid #ebebeb; 133 | } 134 | 135 | /*底部弹出菜单*/ 136 | .javaex-menu .sub-menu { 137 | box-shadow: 0 6px 24px rgba(0, 0, 0, .24); 138 | } 139 | .javaex-menu .sub-menu li { 140 | background:#fff; 141 | border-top:1px solid #f2f2f2; 142 | } 143 | .javaex-menu .sub-menu li a { 144 | background:#fff; 145 | } 146 | .javaex-menu .menu-flag { 147 | border: 5px solid transparent; 148 | border-right: 5px solid #333; 149 | border-bottom: 5px solid #333; 150 | opacity: .5; 151 | } 152 | 153 | /*顶部*/ 154 | .header { 155 | background: #12b7f5 !important; 156 | color: #FFF; 157 | } 158 | .header > .left { 159 | left: 0px; 160 | color: #fff; 161 | width: 1.2rem; 162 | } 163 | .header > .right { 164 | right: 0px; 165 | color: #fff; 166 | width: 1.2rem; 167 | } 168 | 169 | 170 | /*侧栏*/ 171 | #slide-nav { 172 | background: #fff; 173 | } 174 | 175 | /*下拉导航菜单*/ 176 | #guide-nav ul { 177 | background: #fff; 178 | border-image: url(../../images/border.png) 2 2 repeat; 179 | -webkit-border-image: url(../../images/border.png) 2 2 repeat; 180 | } 181 | #guide-nav ul li.active { 182 | background-color: #ff851b; 183 | } 184 | #guide-nav ul li.active a { 185 | color: #fff; 186 | } 187 | #guide-nav ul.active .more span { 188 | color: #ff851b; 189 | } 190 | 191 | /*滚动公告*/ 192 | .big-title { 193 | background: #fa4e46; 194 | color: #fff; 195 | } 196 | 197 | /*屏幕预加载*/ 198 | .loading-screen { 199 | background: url(../../images/loading_screen.gif) no-repeat center; 200 | background-size: 80%; 201 | } 202 | 203 | /*上滑加载(分页)*/ 204 | .infinite-scroll-preloader .load-data { 205 | background: url(../../images/loading.gif); 206 | width: 2.5rem; 207 | height: .8rem; 208 | background-size: 2.5rem auto; 209 | } 210 | .infinite-scroll-preloader .no-data { 211 | color: #666; 212 | background-color: #fff; 213 | border-top: 1px solid #eee; 214 | } 215 | 216 | /*tab选项卡切换*/ 217 | .tab-title { 218 | background: #fff; 219 | } 220 | .tab-title li { 221 | color: #666666; 222 | } 223 | .tab-title li.current { 224 | color: #2fb3ff; 225 | } 226 | .tab-title .border { 227 | bottom: -1px; 228 | left: 0; 229 | height: 4px; 230 | background: #2fb3ff; 231 | } 232 | .tab-container{ 233 | background: #fff; 234 | min-height: 500px; 235 | } 236 | .tab-bar li.current { 237 | color: #2fb3ff; 238 | border-left-color: #2fb3ff; 239 | background: #fff; 240 | } 241 | 242 | /*超出屏幕的tab滑动*/ 243 | .tabbar { 244 | background-color: white; 245 | border-bottom: 1px solid #f3f3f3; 246 | } 247 | .tabbar>a.activate::after { 248 | background-color: #61A8FF; 249 | } 250 | 251 | /*下拉选择框*/ 252 | .search-input { 253 | background-color: #f7f7f8; 254 | } 255 | .search-input input { 256 | color: #3d4145; 257 | background-color: #fff; 258 | border: 1px solid #b4b4b4; 259 | } 260 | .search-input .icon { 261 | color: #b4b4b4; 262 | } 263 | -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/border.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/link-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/link-arrow.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/loading.gif -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/loading.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/loading_screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/loading_screen.gif -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/logo.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/images/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaGraduationProject/LibraryBackgroundManagementSystem/5c03a100b6505d684ccad9bc0d2545a49931796e/src/main/resources/static/javaex/m/images/more.png -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/js/common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 作者:陈霓清 3 | * 官网:http://www.javaex.cn 4 | */ 5 | $(function() { 6 | // 栅格系统 7 | $('[class^="grid-"]').each(function() { 8 | // 判断含有多少个属性 9 | var classArr = $(this).attr("class").split(" "); 10 | for (var i=0; i=0) { 12 | // 获取栅格布局 13 | var arr = classArr[i].split("-"); 14 | // 计算一共需要分成多少份 15 | var sum = 0; 16 | for (var j in arr) { 17 | if (j>0) { 18 | sum = parseInt(sum) + parseInt(arr[j]); 19 | } 20 | } 21 | // 为子级div设置宽度 22 | $(this).children("div").each(function(k) { 23 | $(this).css("width", (100/sum) * arr[k+1] + "%"); 24 | }); 25 | } else if (classArr[i].indexOf("spacing-")>=0) { 26 | // 获取栅格间距 27 | var spacing = classArr[i].split("-")[1]; 28 | 29 | // 为子级div设置间距 30 | var width = "calc(100% + "+parseInt(spacing)+"px)"; 31 | $(this).css("width", width); 32 | $(this).children("div").each(function(k) { 33 | $(this).css("margin-right", parseInt(spacing) + "px"); 34 | }); 35 | } 36 | } 37 | }); 38 | 39 | // 等分系统 40 | $('[class^="equal-"]').each(function() { 41 | // 判断含有多少个属性 42 | var classArr = $(this).attr("class").split(" "); 43 | for (var i=0; i=0) { 45 | // 获取等分布局的等分数 46 | var num = classArr[i].split("-")[1]; 47 | // 为子级li设置宽度 48 | $(this).children("li").css("width", (100/num) + "%"); 49 | break; 50 | } 51 | } 52 | }); 53 | 54 | // 遍历含有指定类的单选框和复选框 55 | $(":radio, :checkbox").each(function() { 56 | // 填充样式 57 | if ($(this).hasClass("fill")) { 58 | // 判断用户是否自己包裹了一层LABEL 59 | if ($(this).parent()[0].tagName=="LABEL") { 60 | $(this).parent().addClass("fill-label"); 61 | // 先获取input之后的文本,保存起来 62 | var text = $(this)[0].nextSibling.nodeValue; 63 | // 清空input之后的文本 64 | $(this)[0].nextSibling.nodeValue = ""; 65 | } else { 66 | // 先获取input之后的文本,保存起来 67 | var text = $(this)[0].nextSibling.nodeValue; 68 | // 清空input之后的文本 69 | $(this)[0].nextSibling.nodeValue = ""; 70 | // 为input创建父节点 71 | $(this).wrap(''); 72 | } 73 | 74 | if (!!text) { 75 | // 重新追加之前保存的input之后的文本 76 | text = text.replace(/(\s*$)/g, ""); 77 | if (text.length==0) { 78 | $(this).parent().append(''); 79 | } else { 80 | $(this).parent().append('' + text + ''); 81 | } 82 | } 83 | // 判断是否已存在span标签 84 | if ($(this).siblings().length==1) { 85 | $(this).after(''); 86 | } 87 | } else if ($(this).hasClass("svg")) { 88 | // svg动画样式 89 | var oSvg = document.getElementById("boxGradient"); 90 | if (oSvg==null) { 91 | var svgHtml = ''; 92 | svgHtml += ''; 93 | svgHtml += ''; 94 | svgHtml += ''; 95 | svgHtml += ''; 96 | svgHtml += ''; 97 | svgHtml += ''; 98 | svgHtml += ''; 99 | svgHtml += ''; 100 | svgHtml += ''; 101 | svgHtml += ''; 102 | svgHtml += ''; 103 | svgHtml += ''; 104 | svgHtml += ''; 105 | svgHtml += ''; 106 | svgHtml += ''; 107 | $(document.body).append(svgHtml); 108 | } 109 | var text = ""; 110 | if ($(this).parent()[0].tagName=="LABEL") { 111 | $(this).parent().addClass("todo"); 112 | text = $(this)[0].nextSibling.nodeValue; 113 | $(this)[0].nextSibling.nodeValue = ""; 114 | } else { 115 | text = $(this)[0].nextSibling.nodeValue; 116 | $(this)[0].nextSibling.nodeValue = ""; 117 | $(this).wrap(''); 118 | } 119 | var html = ''; 120 | html += ''; 121 | if (this.type=="radio") { 122 | html += ''; 123 | html += ''; 124 | html += ''; 125 | } else { 126 | html += ''; 127 | html += ''; 128 | html += ''; 129 | } 130 | html += ''; 131 | $(this).after(html); 132 | if (text!="" && text!=null) { 133 | // 判断是否已存在div 134 | if ($(this).next().next().length==0) { 135 | $(this).parent().append('
'+text.replace(/(\s*$)/g, "")+'
'); 136 | } 137 | } 138 | } 139 | }); 140 | 141 | // 弹出底部菜单 142 | $(".javaex-menu").click(function() { 143 | // 如果当前菜单为激活状态 144 | if ($(this).hasClass("activate")) { 145 | // 则隐藏其子菜单 146 | $(this).children(".sub-menu").hide(); 147 | $(".javaex-menu").removeClass("activate"); 148 | } else { 149 | // 否则的话,先关闭其他兄弟菜单的子菜单 150 | $(".javaex-menu").removeClass("activate"); 151 | $(".javaex-menu").children(".sub-menu").slideUp("fast"); 152 | // 再激活当前菜单 153 | $(this).addClass("activate"); 154 | $(this).children(".sub-menu").slideDown("fast"); 155 | } 156 | }); 157 | }); 158 | -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/js/flexible.js: -------------------------------------------------------------------------------- 1 | ;(function(win) { 2 | var remCalc = {}; 3 | var docEl = win.document.documentElement, 4 | tid; 5 | 6 | function refreshRem() { 7 | // 获取当前窗口的宽度 8 | var width = docEl.getBoundingClientRect().width; 9 | // 大于640px 按640算 10 | if (width>640) { 11 | width = 640; 12 | } 13 | // 把窗口的宽度固定分为10份 也就是10rem 14 | // 按视觉稿640算 640/10=64px 那么1rem = 64px 15 | // 640视觉中 80px*80px的按钮 转换为rem 80/64 = 1.25rem 16 | // 按钮的宽高固定为 1.25rem * 1.25rem 17 | // 当窗口宽度缩放为 320px的时候 18 | // 那么 1rem = 32px 19 | // 原来 80px*80px的按钮现在变为 1.25rem * 32px = 40px 20 | // 按钮变为 40px * 40px 21 | // 其他宽度也类似 22 | // 23 | // cms做法也类似 24 | // 只是我们把窗口宽度固定分为 6.4份,即6.4rem 25 | // 所以 1rem = 100px 26 | // 640视觉中 80px*80px的按钮 转换为rem 80/100 = 0.8rem 27 | // ....其他也差不多 28 | // 29 | // 30 | // 对比 31 | // 其实也就是计算rem的问题 视觉稿量出来的值 除64 或 100的问题 32 | // 除100 总比 除64 好口算 33 | // 就算用sass写个 @function px2rem代替口算 34 | // .8rem 总比输入 px2rem(80)少几个字符 35 | var rem = width / 10; // cms 只要把这行改成 var rem = width / 640 * 100 36 | docEl.style.fontSize = rem + "px"; 37 | remCalc.rem = rem; 38 | // 误差、兼容性处理 39 | var actualSize = parseFloat(window.getComputedStyle(document.documentElement)["font-size"]); 40 | if (actualSize !== rem && actualSize > 0 && Math.abs(actualSize - rem) > 1) { 41 | var remScaled = rem * rem / actualSize; 42 | docEl.style.fontSize = remScaled + "px"; 43 | } 44 | } 45 | 46 | // 函数节流,避免频繁更新 47 | function dbcRefresh() { 48 | clearTimeout(tid); 49 | tid = setTimeout(refreshRem, 100); 50 | } 51 | 52 | // 窗口更新动态改变font-size 53 | win.addEventListener("resize", function() { 54 | dbcRefresh(); 55 | }, false); 56 | 57 | // 页面显示的时候再计算一次,难道切换窗口之后再切换来窗口大小会变? 58 | win.addEventListener("pageshow", function(e) { 59 | if (e.persisted) { 60 | dbcRefresh(); 61 | } 62 | }, false); 63 | refreshRem(); 64 | remCalc.refreshRem = refreshRem; 65 | remCalc.rem2px = function(d) { 66 | var val = parseFloat(d) * this.rem; 67 | if (typeof d=="string" && d.match(/rem$/)) { 68 | val += "px"; 69 | } 70 | return val; 71 | }; 72 | remCalc.px2rem = function(d) { 73 | var val = parseFloat(d) / this.rem; 74 | if (typeof d=="string" && d.match(/px$/)) { 75 | val += "rem"; 76 | } 77 | return val; 78 | }; 79 | win.remCalc = remCalc; 80 | })(window); -------------------------------------------------------------------------------- /src/main/resources/static/javaex/m/js/javaex-formVerify.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 作者:陈霓清 3 | * 官网:http://www.javaex.cn 4 | */ 5 | // 自定义验证类型 必填项:页面中直接写 data-type="必填" 即可,不需要为其定义正则表达式 6 | var regJson = { 7 | "金额" : "/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/", // 0 + 正整数 + 最多2位小数(正数) 8 | "整数" : "/^-?\\d+$/", 9 | "正整数" : "/^[0-9]*[1-9][0-9]*$/", 10 | "负整数" : "/^-[0-9]*[1-9][0-9]*$/", 11 | "非负整数" : "/^\\d+$/", // 正整数 + 0 12 | "非正整数" : "/^((-\\d+)|(0+))$/", // 负整数 + 0 13 | "正小数" : "/^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$/", 14 | "负小数" : "/^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/", 15 | "非负小数" : "/^\\d+(\\.\\d+)?$/", // 0 + 正小数 16 | "非正小数" : "/^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$/", // 0 + 负小数 17 | "邮箱" : "/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/", 18 | "手机号" : "/^(1)\\d{10}$/", 19 | "身份证号" : "/(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)/", 20 | "中文" : "/^[\u4e00-\u9fa5]+$/", 21 | "英文字母" : "/^[a-zA-Z]+$/", 22 | "英文字母或数字" : "/^[0-9a-zA-Z]+$/", 23 | "QQ" : "/^[1-9][0-9]{4,9}$/", 24 | "车牌号" : "/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/", 25 | "登录名" : "/^[a-zA-Z]{1}([a-zA-Z0-9]){4,9}$/", // 只能输入5-10个以字母开头,可带数字的字符串 26 | "密码" : "/^[a-zA-Z0-9]{6,16}$/", // 6到16位字母或数字或它们的组合 27 | "密码强" : "/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[!@#$%^~&*]).*$/" // 字符+数字+特殊字符组合,长度需要自己判断 28 | }; 29 | 30 | /** 31 | * javaex表单验证插件入口 32 | */ 33 | function javaexVerify() { 34 | var result = false; 35 | // 遍历当前页面所有input元素 36 | $("input, textarea, select").each(function() { 37 | var dataTypeAll = $(this).attr("data-type"); 38 | // 判断该输入框是否需要进行验证 39 | if (!!dataTypeAll) { 40 | result = formVerify($(this), dataTypeAll); 41 | if (!result) { 42 | return result; 43 | } 44 | } 45 | }); 46 | 47 | return result; 48 | } 49 | 50 | /** 51 | * 正则表达式验证函数 52 | * obj : jquery对象 53 | * dataTypeAll : 需要验证哪些类型(集合) 54 | */ 55 | function formVerify(obj, dataTypeAll) { 56 | // 判断内容去除左右两边空格后是否为空 57 | if ($.trim(obj.val()).length==0) { 58 | var errorMsg = "不能为空"; 59 | // 获取标签内容 60 | var label = obj.attr("error-label"); 61 | if (!!label) { 62 | errorMsg = label + ":" + errorMsg; 63 | } 64 | // 添加错误状态 65 | addErrorMsg(errorMsg); 66 | return false; 67 | } 68 | 69 | // 判断验证类型是否是 必填 70 | if (dataTypeAll.indexOf("必填")>=0) { 71 | return true; 72 | } 73 | 74 | // 遍历这些验证类型并验证 75 | var dataTypeArr = dataTypeAll.split("|"); 76 | var regArr = new Array(); 77 | for (var i=0; i0) { 84 | // 定义一个标识,默认验证失败 85 | var flag = false; 86 | for (var i=0; i=0) { 12 | // 获取栅格布局 13 | var arr = classArr[i].split("-"); 14 | // 计算一共需要分成多少份 15 | var sum = 0; 16 | for (var j=1; j=0) { 24 | // 获取栅格间距 25 | var spacing = classArr[i].split("-")[1]; 26 | 27 | // 为子级div设置间距 28 | var width = "calc(100% + "+parseInt(spacing)+"px)"; 29 | $(this).css("width", width); 30 | $(this).children("div").each(function(k) { 31 | $(this).css("margin-right", parseInt(spacing) + "px"); 32 | }); 33 | } 34 | } 35 | }); 36 | 37 | // 等分系统 38 | $('[class^="equal-"]').each(function() { 39 | // 判断含有多少个属性 40 | var classArr = $(this).attr("class").split(" "); 41 | for (var i=0; i=0) { 43 | // 获取等分布局的等分数 44 | var num = classArr[i].split("-")[1]; 45 | // 为子级div设置宽度 46 | $(this).children("li").css("width", (100/num) + "%"); 47 | break; 48 | } 49 | } 50 | }); 51 | 52 | // 遍历含有指定类的单选框和复选框 53 | $(":radio, :checkbox").each(function() { 54 | if ($(this).hasClass("fill")) { 55 | // 判断用户是否自己包裹了一层LABEL 56 | if ($(this).parent()[0].tagName=="LABEL") { 57 | $(this).parent().addClass("fill-label"); 58 | // 先获取input之后的文本,保存起来 59 | var text = $(this)[0].nextSibling.nodeValue; 60 | // 清空input之后的文本 61 | $(this)[0].nextSibling.nodeValue = ""; 62 | } else { 63 | // 先获取input之后的文本,保存起来 64 | var text = $(this)[0].nextSibling.nodeValue; 65 | // 清空input之后的文本 66 | $(this)[0].nextSibling.nodeValue = ""; 67 | // 为input创建父节点 68 | $(this).wrap(''); 69 | } 70 | 71 | if (!!text) { 72 | // 重新追加之前保存的input之后的文本 73 | text = text.replace(/(\s*$)/g, ""); 74 | if (text.length==0) { 75 | $(this).parent().append(''); 76 | } else { 77 | $(this).parent().append('' + text + ''); 78 | } 79 | } 80 | // 判断是否已存在span标签 81 | if ($(this).siblings().length==1) { 82 | $(this).after(''); 83 | } 84 | } 85 | }); 86 | 87 | // 监听复选框的点击事件 88 | $(":checkbox").click(function() { 89 | // 如果是原生的复选框,则直接返回 90 | if (!$(this).attr("class")) { 91 | return; 92 | } 93 | 94 | // 判断含有多少个属性 95 | var classArr = $(this).attr("class").split(" "); 96 | 97 | for (var i=0; i=0) { 101 | // 提取key 102 | var listenKey = listen.replace(listen.split("-")[0]+"-", ""); 103 | var keyArr = listenKey.split("-"); 104 | 105 | // 判断当前点击的复选框的选中状态 106 | if ($(this).is(":checked")) { 107 | // 当前级别的复选框的选中个数 108 | var num = 0; 109 | // 选中时 110 | $(":checkbox").each(function() { 111 | var classArr = $(this).attr("class").split(" "); 112 | for (var j=0; j=0 && classArr[j]!=listen) { 115 | // 跳过禁用的 116 | if (!$(this).attr("disabled")) { 117 | $(this).attr("checked", true); 118 | // 设置选择图标为对勾(树形菜单专用) 119 | $(this).next("span.icon-stop").removeClass("icon-stop").addClass("icon-check"); 120 | } 121 | } 122 | if (classArr[j]==listen) { 123 | if ($(this).is(":checked") || $(this).attr("disabled")) { 124 | num++; 125 | } 126 | } 127 | } 128 | }); 129 | 130 | // 判断当前级别的复选框是否已全部选中 131 | if (num==($("."+listen).length)) { 132 | // 自动选中父级 133 | var parentClass = listen.replace("-"+keyArr[keyArr.length-1], ""); 134 | if (((parentClass.split("-")).length-1)==1) { 135 | // 遍历listen-X-? 136 | var flag = true; 137 | for (var i=1; i<=10; i++) { 138 | if ($("."+parentClass+"-"+i).length>0 && !$("."+parentClass+"-"+i).is(":checked")) { 139 | flag = false; 140 | } 141 | } 142 | if (flag) { 143 | $(":checkbox").each(function() { 144 | if ($(this).hasClass(parentClass)) { 145 | $(this).attr("checked", true); 146 | } 147 | }); 148 | } 149 | } else { 150 | $(":checkbox").each(function() { 151 | if ($(this).hasClass(parentClass)) { 152 | $(this).attr("checked", true); 153 | } 154 | }); 155 | 156 | parentClass = parentClass.substring(0, parentClass.length-2); 157 | var flag = true; 158 | for (var i=1; i<=10; i++) { 159 | if ($("."+parentClass+"-"+i).length>0 && !$("."+parentClass+"-"+i).is(":checked")) { 160 | flag = false; 161 | } 162 | } 163 | if (flag) { 164 | $(":checkbox").each(function() { 165 | if ($(this).hasClass(parentClass)) { 166 | $(this).attr("checked", true); 167 | } 168 | }); 169 | } 170 | } 171 | } 172 | } else { 173 | // 未选中时 174 | $(":checkbox").each(function() { 175 | var classArr = $(this).attr("class").split(" "); 176 | for (var j=0; j=0 && classArr[j]!=listen) { 179 | $(this).attr("checked", false); 180 | } 181 | // 让父级复选框全部取消选中 182 | var parentClass = "listen"; 183 | for (var k=0; k=0) { 99 | return true; 100 | } 101 | 102 | // 遍历这些验证类型并验证 103 | var dataTypeArr = dataTypeAll.split("|"); 104 | var regArr = new Array(); 105 | for (var i=0; i0) { 112 | // 解除错误状态 113 | deleteErrorState(obj); 114 | 115 | // 定义一个标识,默认验证失败 116 | var flag = false; 117 | for (var i=0; i'; 180 | html += '
' + errorMsg + '
'; 181 | html += '
'; 182 | html += ''; 183 | obj.after(html); 184 | } else { 185 | $("#"+errorTipId).text(errorMsg); 186 | $("#"+errorTipId).removeClass("vh"); 187 | } 188 | } 189 | 190 | /** 191 | * 实时监听 192 | */ 193 | $(function() { 194 | // 监听元素获得焦点事件 195 | $('input[type="text"], input[type="password"], textarea').focus(function() { 196 | var dataTypeAll = $(this).attr("data-type"); 197 | // 判断该输入框是否需要进行验证 198 | if (!!dataTypeAll) { 199 | // 解除错误状态 200 | deleteErrorState($(this)); 201 | } 202 | 203 | if ($(this).hasClass("original") || $(this).hasClass("readonly")) { 204 | // 使用原生样式,不添加边框颜色 205 | } else { 206 | // 添加蓝色边框 207 | $(this).addClass("ex-input-border"); 208 | } 209 | }); 210 | 211 | // 监听元素失去焦点事件 212 | $('input[type="text"], input[type="password"], textarea').blur(function() { 213 | // 清除颜色边框 214 | $(this).removeClass("ex-input-border"); 215 | // 判断该输入框是否需要进行验证 216 | var dataTypeAll = $(this).attr("data-type"); 217 | if (!!dataTypeAll) { 218 | // 如果未输入内容,则不验证 219 | if ($.trim($(this).val()).length==0) { 220 | // 解除错误状态 221 | deleteErrorState($(this)); 222 | } else { 223 | // 验证 224 | formVerify($(this), dataTypeAll); 225 | } 226 | } 227 | }); 228 | }); -------------------------------------------------------------------------------- /src/main/resources/static/javaex/pc/lib/highlight/highlight.css: -------------------------------------------------------------------------------- 1 | pre {margin: 5px 0;padding: 15px;overflow: auto;line-height: 1.45;background-color: #f6f8fa;border-radius: 3px;} 2 | /*修改代码高亮*/ 3 | .hljs { 4 | display: block; 5 | overflow-x: auto; 6 | color: #525252; 7 | -webkit-text-size-adjust: none 8 | } 9 | .hljs-doctype { 10 | color: #999 11 | } 12 | .hljs-tag { 13 | color: #3e76f6 14 | } 15 | .hljs-attribute { 16 | color: #e96900 17 | } 18 | .hljs-value { 19 | color: #42b983 20 | } 21 | .hljs-keyword { 22 | color: #e96900 23 | } 24 | .hljs-string { 25 | color: #42b983 26 | } 27 | .hljs-comment { 28 | color: #b3b3b3 29 | } 30 | .hljs-operator .hljs-comment { 31 | color: #525252 32 | } 33 | .hljs-regexp { 34 | color: #af7dff 35 | } 36 | .hljs-built_in { 37 | color: #2db7f5 38 | } 39 | .css .hljs-class { 40 | color: #e96900 41 | } 42 | .css .hljs-number, 43 | .javascript .hljs-number { 44 | color: #fc1e70 45 | } 46 | .css .hljs-attribute { 47 | color: #af7dff 48 | } 49 | .css .hljs-important { 50 | color: red 51 | } 52 | .actionscript .hljs-literal, 53 | .javascript .hljs-literal { 54 | color: #fc1e70 55 | } 56 | code { 57 | display: inline-block; 58 | background: #f7f7f7; 59 | font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace; 60 | margin: 0 3px; 61 | padding: 1px 5px; 62 | border-radius: 3px; 63 | color: #666; 64 | border: 1px solid #eee 65 | } 66 | pre code { 67 | display: inline; 68 | margin: 0; 69 | padding: 0; 70 | border: none; 71 | background: transparent; 72 | } 73 | pre.bg code { 74 | background: #f7f7f7 75 | } 76 | -------------------------------------------------------------------------------- /src/main/resources/templates/book/book-add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
30 | 31 |
32 | 33 | 36 | 37 | 38 |
39 |
40 | 41 |
42 |
*

书名

43 |
44 | 45 |
46 |
47 | 48 |
49 |
*

ISBN编号

50 |
51 | 52 |
53 |
54 | 55 |
56 |
*

作者

57 |
58 | 59 |
60 |
61 | 62 | 63 |
64 |

图书分类

65 |
66 | 74 |
75 |
76 | 77 |
78 |

页数

79 |
80 | 81 |
82 |
83 | 84 |
85 |

定价

86 |
87 | 88 |
89 |
90 | 91 |
92 |

出版时间

93 |
94 | 95 |
96 |
97 | 98 |
99 |

出版社

100 |
101 | 102 |
103 |
104 | 105 | 106 | 107 |
108 |

库存数量

109 |
110 | 111 |
112 |
113 | 114 |
115 |

翻译

116 |
117 | 118 |
119 |
120 | 121 | 122 | 123 |
124 |
125 | 126 | 127 | 128 |
129 |
130 |
131 | 132 |
133 |
134 |
135 | 136 | 249 | 250 | -------------------------------------------------------------------------------- /src/main/resources/templates/book/book-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 24 | 25 | 26 |
27 | 28 |
29 | 30 |

图书列表

31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | 45 | 46 | 47 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
序号书名作者ISBN页数定价出版社出版时间库存数量翻译分类操作
80 | 81 |
82 |
    83 |
    84 |
    85 |
    86 |
    87 | 88 | 89 | 203 | 204 | -------------------------------------------------------------------------------- /src/main/resources/templates/book/book-update.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
    30 | 31 |
    32 | 33 | 36 | 37 | 38 |
    39 |
    40 | 41 |
    42 |
    *

    书名

    43 |
    44 | 45 |
    46 |
    47 | 48 |
    49 |
    *

    ISBN编号

    50 |
    51 | 52 |
    53 |
    54 | 55 |
    56 |
    *

    作者

    57 |
    58 | 59 |
    60 |
    61 | 62 | 63 |
    64 |

    图书分类

    65 |
    66 | 67 | 75 |
    76 |
    77 | 78 |
    79 |

    页数

    80 |
    81 | 82 |
    83 |
    84 | 85 |
    86 |

    定价

    87 |
    88 | 89 |
    90 |
    91 | 92 |
    93 |

    出版时间

    94 |
    95 | 96 |
    97 |
    98 | 99 |
    100 |

    出版社

    101 |
    102 | 103 |
    104 |
    105 | 106 | 107 | 108 |
    109 |

    库存数量

    110 |
    111 | 112 |
    113 |
    114 | 115 |
    116 |

    翻译

    117 |
    118 | 119 |
    120 |
    121 | 122 | 123 | 124 |
    125 |
    126 | 127 | 128 | 129 |
    130 |
    131 |
    132 | 133 |
    134 |
    135 |
    136 | 137 | 305 | 306 | -------------------------------------------------------------------------------- /src/main/resources/templates/borrow/back.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 图书归还 24 | 25 | 28 | 29 | 30 | 31 |
    32 | 33 |
    34 | 35 | 38 | 39 | 40 |
    41 |
    42 | 43 |
    44 |
    *

    用户名

    45 |
    46 | 47 |
    48 |
    49 | 50 |
    51 |
    *

    昵称

    52 |
    53 | 54 |
    55 |
    56 | 57 |
    58 |
    *

    身份

    59 |
    60 | 61 |
    62 |
    63 | 64 |
    65 |
    *

    可借数量

    66 |
    67 | 68 |
    69 |
    70 | 71 |
    *

    已借阅列表

    72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
    序号书名作者ISBN页数定价出版社分类借阅时间应还时间是否逾期操作
    93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
    103 |
    104 |
    105 |
    106 | 107 | 154 | 155 | -------------------------------------------------------------------------------- /src/main/resources/templates/borrow/book-search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 24 | 25 | 26 |
    27 | 28 |
    29 | 30 |

    图书搜索

    31 | 32 | 33 | 34 | 35 | 36 | 37 |
    38 | 39 |
    40 |
    41 | 42 | 43 |
    44 |
    45 | 46 | 47 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
    序号书名作者ISBN页数定价出版社出版时间库存数量翻译分类操作
    80 | 81 |
    82 |
      83 |
      84 |
      85 |
      86 |
      87 | 88 | 89 | 186 | 187 | -------------------------------------------------------------------------------- /src/main/resources/templates/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 24 | 25 | 26 | 27 |
      28 |
      29 | 30 | 31 | 32 | 33 | 41 |
      42 |
      43 | 44 | 45 |
      46 | 47 |
      48 | 49 |
      50 | 93 |
      94 |
      95 | 96 | 97 |
      98 | 99 |
      100 |
      101 | 102 | 135 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 38 | 39 | 40 |
      41 | 62 |
      63 | 88 | 89 | -------------------------------------------------------------------------------- /src/main/resources/templates/reader/reader-add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
      30 | 31 |
      32 | 33 | 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 | 62 |
      63 |

      生日

      64 |
      65 | 66 |
      67 |
      68 | 69 |
      70 |

      电话

      71 |
      72 | 73 |
      74 |
      75 | 76 | 77 |
      78 |

      身份

      79 |
      80 | 87 |
      88 |
      89 | 90 |
      91 |

      邮箱

      92 |
      93 | 94 |
      95 |
      96 | 97 |
      98 |

      地址

      99 |
      100 | 101 |
      102 |
      103 | 104 |
      105 |

      可借数量

      106 |
      107 | 108 |
      109 |
      110 |
      111 |
      112 | 113 | 114 | 115 |
      116 |
      117 | 118 | 119 | 120 |
      121 |
      122 |
      123 |
      124 |
      125 |
      126 | 127 | 222 | 223 | -------------------------------------------------------------------------------- /src/main/resources/templates/reader/reader-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 24 | 25 | 26 |
      27 | 28 |
      29 | 30 |

      读者列表

      31 | 32 | 33 | 34 | 35 | 36 | 37 |
      38 | 39 | 45 | 46 | 47 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
      序号昵称用户名生日电话邮箱地址可借数量身份操作
      78 | 79 |
      80 |
        81 |
        82 |
        83 |
        84 |
        85 | 86 | 87 | 201 | 202 | -------------------------------------------------------------------------------- /src/main/resources/templates/reader/reader-update.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
        30 | 31 |
        32 | 33 | 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 | 62 |
        63 |

        生日

        64 |
        65 | 66 |
        67 |
        68 | 69 |
        70 |

        电话

        71 |
        72 | 73 |
        74 |
        75 | 76 | 77 |
        78 |

        身份

        79 |
        80 | 87 |
        88 |
        89 | 90 |
        91 |

        邮箱

        92 |
        93 | 94 |
        95 |
        96 | 97 |
        98 |

        地址

        99 |
        100 | 101 |
        102 |
        103 | 104 |
        105 |

        可借数量

        106 |
        107 | 108 |
        109 |
        110 |
        111 |
        112 | 113 | 114 | 115 |
        116 |
        117 | 118 | 119 | 120 |
        121 |
        122 |
        123 |
        124 |
        125 |
        126 | 127 | 245 | 246 | -------------------------------------------------------------------------------- /src/main/resources/templates/user/user-add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
        30 | 31 |
        32 | 33 | 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 | 62 |
        63 |

        生日

        64 |
        65 | 66 |
        67 |
        68 | 69 |
        70 |

        电话

        71 |
        72 | 73 |
        74 |
        75 | 76 | 77 |
        78 |

        身份

        79 |
        80 | 87 |
        88 |
        89 | 90 |
        91 |

        邮箱

        92 |
        93 | 94 |
        95 |
        96 | 97 |
        98 |

        地址

        99 |
        100 | 101 |
        102 |
        103 | 104 |
        105 |

        可借数量

        106 |
        107 | 108 |
        109 |
        110 |
        111 |
        112 | 113 | 114 | 115 |
        116 |
        117 | 118 | 119 | 120 |
        121 |
        122 |
        123 |
        124 |
        125 |
        126 | 127 | 212 | 213 | -------------------------------------------------------------------------------- /src/main/resources/templates/user/user-info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 26 | 27 | 28 | 29 |
        30 | 31 |
        32 | 33 | 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 | 62 |
        63 |

        生日

        64 |
        65 | 66 |
        67 |
        68 | 69 |
        70 |

        电话

        71 |
        72 | 73 |
        74 |
        75 | 76 | 77 |
        78 |

        身份

        79 |
        80 | 81 |
        82 |
        83 | 84 |
        85 |

        邮箱

        86 |
        87 | 88 |
        89 |
        90 | 91 |
        92 |

        地址

        93 |
        94 | 95 |
        96 |
        97 | 98 |
        99 |

        可借数量

        100 |
        101 | 102 |
        103 |
        104 |
        105 |
        106 | 107 |
        108 |
        109 |
        110 |
        111 | 112 | 139 | 140 | -------------------------------------------------------------------------------- /src/main/resources/templates/user/user-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 23 | 24 | 25 | 26 |
        27 | 28 |
        29 | 30 |

        用户列表

        31 | 32 | 33 | 34 | 35 | 36 | 37 |
        38 | 39 | 45 | 46 | 47 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
        序号昵称用户名生日电话邮箱地址可借数量身份操作
        78 | 79 |
        80 |
          81 |
          82 |
          83 |
          84 |
          85 | 86 | 87 | 237 | 238 | -------------------------------------------------------------------------------- /src/main/resources/templates/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 后台管理 22 | 34 | 35 | 36 | 37 | 42 | 43 |
          44 | 45 |
          46 | 47 | 85 | 86 |
          87 | 88 |
          89 |
            90 |
          • 91 | 92 |
          • 93 |
          • 94 | 95 |
          • 96 |
          • 97 | 98 |
          • 99 |
          • 100 | 101 |
          • 102 |
          • 103 | 104 |
          • 105 |
          • 106 | 107 |
          • 108 |
          • 109 | 110 |
          • 111 |
          • 112 | 113 |
          • 114 |
          • 115 | 116 |
          • 117 |
          118 |
          119 |
          120 |
          121 |
          122 | 123 | 129 | 130 | --------------------------------------------------------------------------------