├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── doc ├── mysql.sql ├── oracle.sql └── sqlServer.sql ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── company │ │ └── project │ │ ├── CompanyProjectApplication.java │ │ ├── common │ │ ├── aop │ │ │ ├── annotation │ │ │ │ └── LogAnnotation.java │ │ │ └── aspect │ │ │ │ └── SysLogAspect.java │ │ ├── config │ │ │ ├── MetaObjectHandlerConfig.java │ │ │ ├── MyBatisPlusConfig.java │ │ │ ├── ResponseControllerAdvice.java │ │ │ ├── SaTokenConfigure.java │ │ │ ├── StpInterfaceImpl.java │ │ │ ├── SwaggerConfiguration.java │ │ │ └── WebMvcConfigurer.java │ │ ├── exception │ │ │ ├── BusinessException.java │ │ │ ├── code │ │ │ │ ├── BaseResponseCode.java │ │ │ │ └── ResponseCodeInterface.java │ │ │ └── handler │ │ │ │ └── RestExceptionHandler.java │ │ ├── filter │ │ │ └── AuthFilter.java │ │ └── utils │ │ │ ├── Constant.java │ │ │ ├── DataResult.java │ │ │ ├── DateUtils.java │ │ │ ├── GenUtils.java │ │ │ ├── HttpContextUtils.java │ │ │ ├── IPUtils.java │ │ │ ├── PasswordEncoder.java │ │ │ ├── PasswordUtils.java │ │ │ ├── SpringContextUtils.java │ │ │ └── ValidatorUtils.java │ │ ├── controller │ │ ├── DeptController.java │ │ ├── IndexController.java │ │ ├── PermissionController.java │ │ ├── RoleController.java │ │ ├── SysContentController.java │ │ ├── SysDictController.java │ │ ├── SysDictDetailController.java │ │ ├── SysFilesController.java │ │ ├── SysGeneratorController.java │ │ ├── SysLogController.java │ │ ├── UserController.java │ │ ├── UserRoleController.java │ │ └── api │ │ │ └── TestController.java │ │ ├── entity │ │ ├── BaseEntity.java │ │ ├── ColumnEntity.java │ │ ├── SysContentEntity.java │ │ ├── SysDept.java │ │ ├── SysDictDetailEntity.java │ │ ├── SysDictEntity.java │ │ ├── SysFilesEntity.java │ │ ├── SysGenerator.java │ │ ├── SysLog.java │ │ ├── SysPermission.java │ │ ├── SysRole.java │ │ ├── SysRoleDeptEntity.java │ │ ├── SysRolePermission.java │ │ ├── SysUser.java │ │ ├── SysUserRole.java │ │ └── TableEntity.java │ │ ├── mapper │ │ ├── GeneratorMapper.java │ │ ├── SysContentMapper.java │ │ ├── SysDeptMapper.java │ │ ├── SysDictDetailMapper.java │ │ ├── SysDictMapper.java │ │ ├── SysFilesMapper.java │ │ ├── SysLogMapper.java │ │ ├── SysPermissionMapper.java │ │ ├── SysRoleDeptMapper.java │ │ ├── SysRoleMapper.java │ │ ├── SysRolePermissionMapper.java │ │ ├── SysUserMapper.java │ │ └── SysUserRoleMapper.java │ │ ├── service │ │ ├── DeptService.java │ │ ├── HomeService.java │ │ ├── ISysGeneratorService.java │ │ ├── LogService.java │ │ ├── PermissionService.java │ │ ├── RolePermissionService.java │ │ ├── RoleService.java │ │ ├── SysContentService.java │ │ ├── SysDictDetailService.java │ │ ├── SysDictService.java │ │ ├── SysFilesService.java │ │ ├── SysRoleDeptService.java │ │ ├── UserRoleService.java │ │ ├── UserService.java │ │ └── impl │ │ │ ├── DeptServiceImpl.java │ │ │ ├── HomeServiceImpl.java │ │ │ ├── LogServiceImpl.java │ │ │ ├── PermissionServiceImpl.java │ │ │ ├── RolePermissionServiceImpl.java │ │ │ ├── RoleServiceImpl.java │ │ │ ├── SysContentServiceImpl.java │ │ │ ├── SysDictDetailServiceImpl.java │ │ │ ├── SysDictServiceImpl.java │ │ │ ├── SysFilesServiceImpl.java │ │ │ ├── SysGeneratorServiceImpl.java │ │ │ ├── SysRoleDeptServiceImpl.java │ │ │ ├── UserRoleServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ └── vo │ │ ├── req │ │ ├── RolePermissionOperationReqVO.java │ │ └── UserRoleOperationReqVO.java │ │ └── resp │ │ ├── DeptRespNodeVO.java │ │ ├── HomeRespVO.java │ │ ├── LoginRespVO.java │ │ ├── PermissionRespNode.java │ │ ├── UserInfoRespVO.java │ │ └── UserOwnRoleRespVO.java └── resources │ ├── application-dev.yml │ ├── application-prod.yml │ ├── application-test.yml │ ├── application.yml │ ├── generator.properties │ ├── logback-spring.xml │ ├── mapper │ ├── mysql │ │ └── SysGeneratorMapper.xml │ ├── oracle │ │ └── SysGeneratorMapper.xml │ └── sqlServer │ │ └── SysGeneratorMapper.xml │ ├── static │ ├── css │ │ ├── 403.css │ │ ├── 404.css │ │ ├── 500.css │ │ ├── build.css │ │ ├── custom.form.css │ │ ├── home.css │ │ ├── images │ │ │ ├── 403.png │ │ │ ├── 404.png │ │ │ ├── 500.png │ │ │ └── bg.jpg │ │ ├── login.css │ │ └── login2.css │ ├── js │ │ ├── build.js │ │ ├── core.util.js │ │ ├── home.js │ │ ├── jq-module │ │ │ ├── jquery.particleground.min.js │ │ │ ├── paigusu.min.js │ │ │ └── zyupload │ │ │ │ ├── zyupload-1.0.0.min.css │ │ │ │ └── zyupload-1.0.0.min.js │ │ └── jquery.js │ ├── layui-ext │ │ ├── cron │ │ │ ├── cron.css │ │ │ └── cron.js │ │ ├── eleTree │ │ │ └── eleTree.js │ │ ├── icon │ │ │ └── iconPicker.js │ │ ├── tinymce │ │ │ ├── tinymce.js │ │ │ └── tinymce │ │ │ │ ├── icons │ │ │ │ └── default │ │ │ │ │ └── icons.min.js │ │ │ │ ├── jquery.tinymce.min.js │ │ │ │ ├── langs │ │ │ │ ├── readme.md │ │ │ │ └── zh_CN.js │ │ │ │ ├── license.txt │ │ │ │ ├── plugins │ │ │ │ ├── advlist │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── anchor │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autolink │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autoresize │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autosave │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── bbcode │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── charmap │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── code │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── codesample │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── colorpicker │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── contextmenu │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── directionality │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── emoticons │ │ │ │ │ ├── js │ │ │ │ │ │ ├── emojis.js │ │ │ │ │ │ └── emojis.min.js │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── fullpage │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── fullscreen │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── help │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── hr │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── image │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── imagetools │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── importcss │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── indent2em │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── insertdatetime │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── legacyoutput │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── link │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── lists │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── media │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── nonbreaking │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── noneditable │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── pagebreak │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── paste │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── preview │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── print │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── quickbars │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── save │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── searchreplace │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── spellchecker │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── tabfocus │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── table │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── template │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── textcolor │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── textpattern │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── toc │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── visualblocks │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── visualchars │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ └── wordcount │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── skins │ │ │ │ ├── content │ │ │ │ │ ├── dark │ │ │ │ │ │ └── content.min.css │ │ │ │ │ ├── default │ │ │ │ │ │ └── content.min.css │ │ │ │ │ ├── document │ │ │ │ │ │ └── content.min.css │ │ │ │ │ └── writer │ │ │ │ │ │ └── content.min.css │ │ │ │ └── ui │ │ │ │ │ ├── oxide-dark │ │ │ │ │ ├── content.inline.min.css │ │ │ │ │ ├── content.min.css │ │ │ │ │ ├── content.mobile.min.css │ │ │ │ │ ├── fonts │ │ │ │ │ │ └── tinymce-mobile.woff │ │ │ │ │ ├── skin.min.css │ │ │ │ │ └── skin.mobile.min.css │ │ │ │ │ └── oxide │ │ │ │ │ ├── content.inline.min.css │ │ │ │ │ ├── content.min.css │ │ │ │ │ ├── content.mobile.min.css │ │ │ │ │ ├── fonts │ │ │ │ │ └── tinymce-mobile.woff │ │ │ │ │ ├── skin.min.css │ │ │ │ │ └── skin.mobile.min.css │ │ │ │ ├── themes │ │ │ │ ├── mobile │ │ │ │ │ └── theme.min.js │ │ │ │ └── silver │ │ │ │ │ └── theme.min.js │ │ │ │ └── tinymce.min.js │ │ └── treetable-lay │ │ │ ├── treetable.css │ │ │ └── treetable.js │ └── layui │ │ ├── css │ │ ├── layui.css │ │ ├── layui.mobile.css │ │ └── modules │ │ │ ├── code.css │ │ │ ├── laydate │ │ │ └── default │ │ │ │ └── laydate.css │ │ │ └── layer │ │ │ └── default │ │ │ ├── icon-ext.png │ │ │ ├── icon.png │ │ │ ├── layer.css │ │ │ ├── loading-0.gif │ │ │ ├── loading-1.gif │ │ │ └── loading-2.gif │ │ ├── font │ │ ├── iconfont.eot │ │ ├── iconfont.svg │ │ ├── iconfont.ttf │ │ ├── iconfont.woff │ │ └── iconfont.woff2 │ │ ├── images │ │ └── face │ │ │ ├── 0.gif │ │ │ ├── 1.gif │ │ │ ├── 10.gif │ │ │ ├── 11.gif │ │ │ ├── 12.gif │ │ │ ├── 13.gif │ │ │ ├── 14.gif │ │ │ ├── 15.gif │ │ │ ├── 16.gif │ │ │ ├── 17.gif │ │ │ ├── 18.gif │ │ │ ├── 19.gif │ │ │ ├── 2.gif │ │ │ ├── 20.gif │ │ │ ├── 21.gif │ │ │ ├── 22.gif │ │ │ ├── 23.gif │ │ │ ├── 24.gif │ │ │ ├── 25.gif │ │ │ ├── 26.gif │ │ │ ├── 27.gif │ │ │ ├── 28.gif │ │ │ ├── 29.gif │ │ │ ├── 3.gif │ │ │ ├── 30.gif │ │ │ ├── 31.gif │ │ │ ├── 32.gif │ │ │ ├── 33.gif │ │ │ ├── 34.gif │ │ │ ├── 35.gif │ │ │ ├── 36.gif │ │ │ ├── 37.gif │ │ │ ├── 38.gif │ │ │ ├── 39.gif │ │ │ ├── 4.gif │ │ │ ├── 40.gif │ │ │ ├── 41.gif │ │ │ ├── 42.gif │ │ │ ├── 43.gif │ │ │ ├── 44.gif │ │ │ ├── 45.gif │ │ │ ├── 46.gif │ │ │ ├── 47.gif │ │ │ ├── 48.gif │ │ │ ├── 49.gif │ │ │ ├── 5.gif │ │ │ ├── 50.gif │ │ │ ├── 51.gif │ │ │ ├── 52.gif │ │ │ ├── 53.gif │ │ │ ├── 54.gif │ │ │ ├── 55.gif │ │ │ ├── 56.gif │ │ │ ├── 57.gif │ │ │ ├── 58.gif │ │ │ ├── 59.gif │ │ │ ├── 6.gif │ │ │ ├── 60.gif │ │ │ ├── 61.gif │ │ │ ├── 62.gif │ │ │ ├── 63.gif │ │ │ ├── 64.gif │ │ │ ├── 65.gif │ │ │ ├── 66.gif │ │ │ ├── 67.gif │ │ │ ├── 68.gif │ │ │ ├── 69.gif │ │ │ ├── 7.gif │ │ │ ├── 70.gif │ │ │ ├── 71.gif │ │ │ ├── 8.gif │ │ │ └── 9.gif │ │ ├── lay │ │ └── modules │ │ │ ├── carousel.js │ │ │ ├── code.js │ │ │ ├── colorpicker.js │ │ │ ├── element.js │ │ │ ├── flow.js │ │ │ ├── form.js │ │ │ ├── jquery.js │ │ │ ├── laydate.js │ │ │ ├── layedit.js │ │ │ ├── layer.js │ │ │ ├── laypage.js │ │ │ ├── laytpl.js │ │ │ ├── mobile.js │ │ │ ├── rate.js │ │ │ ├── slider.js │ │ │ ├── table.js │ │ │ ├── transfer.js │ │ │ ├── tree.js │ │ │ ├── upload.js │ │ │ └── util.js │ │ └── layui.js │ ├── template │ ├── Controller.java.vm │ ├── Dao.java.vm │ ├── Dao.xml.vm │ ├── Entity.java.vm │ ├── Service.java.vm │ ├── ServiceImpl.java.vm │ ├── list.html.vm │ └── menu.sql.vm │ └── templates │ ├── about.html │ ├── build.html │ ├── depts │ └── dept_list.html │ ├── error │ ├── 403.html │ ├── 404.html │ └── 500.html │ ├── generator │ └── list.html │ ├── home.html │ ├── layout.html │ ├── login.html │ ├── login2.html │ ├── logs │ └── log_list.html │ ├── main.html │ ├── menus │ └── menu_list.html │ ├── roles │ └── role_list.html │ ├── syscontent │ └── list.html │ ├── sysdict │ └── list.html │ ├── sysfiles │ └── list.html │ └── users │ ├── update_password.html │ ├── user_edit.html │ └── user_list.html └── test └── java └── com └── company └── project └── CompanyFrameApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | .DS_Store 3 | .gitignore 4 | .idea/* 5 | .mvn/ 6 | aitangbao.iml 7 | log/ 8 | target/ 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 基础镜像 2 | FROM registry.cn-hangzhou.aliyuncs.com/wb_public/openjdk:8-jre 3 | # author 4 | MAINTAINER manager 5 | # 复制jar文件到路径 6 | ADD ./target/manager.jar ./ 7 | # 时间 8 | RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 9 | RUN echo 'Asia/Shanghai' >/etc/timezone 10 | # 启动服务 11 | ENTRYPOINT ["java","-jar","/manager.jar"] 12 | # 暴露端口 13 | EXPOSE 8080 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 wenbin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/CompanyProjectApplication.java: -------------------------------------------------------------------------------- 1 | package com.company.project; 2 | 3 | import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.boot.web.servlet.ServletComponentScan; 9 | import org.springframework.context.ConfigurableApplicationContext; 10 | import org.springframework.core.env.Environment; 11 | 12 | import java.net.InetAddress; 13 | 14 | /** 15 | * 启动类 16 | * 17 | * @author wenbin 18 | */ 19 | @SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class) 20 | @MapperScan("com.company.project.mapper") 21 | @Slf4j 22 | @ServletComponentScan(basePackages = {"com.company.project.common.filter"}) //这一句完成了配置,Springboot的”懒理念“真的厉害。 23 | public class CompanyProjectApplication { 24 | 25 | public static void main(String[] args) throws Exception { 26 | ConfigurableApplicationContext application = SpringApplication.run(CompanyProjectApplication.class, args); 27 | 28 | Environment env = application.getEnvironment(); 29 | log.info("\n----------------------------------------------------------\n\t" + 30 | "Application '{}' is running! Access URLs:\n\t" + 31 | "Login: \thttp://{}:{}/manager\n\t" + 32 | "Doc: \thttp://{}:{}/manager/doc.html\n" + 33 | "----------------------------------------------------------", 34 | env.getProperty("spring.application.name"), 35 | InetAddress.getLocalHost().getHostAddress(), 36 | env.getProperty("server.port"), 37 | InetAddress.getLocalHost().getHostAddress(), 38 | env.getProperty("server.port")); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/aop/annotation/LogAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.aop.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * LogAnnotation 7 | * 8 | * @author wenbin 9 | * @version V1.0 10 | * @date 2020年3月18日 11 | */ 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | public @interface LogAnnotation { 16 | /** 17 | * 模块 18 | */ 19 | String title() default ""; 20 | 21 | /** 22 | * 功能 23 | */ 24 | String action() default ""; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/config/MyBatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * mybatis plus config 9 | * 10 | * @author wenbin 11 | * @version V1.0 12 | * @date 2020年3月18日 13 | */ 14 | @Configuration 15 | public class MyBatisPlusConfig { 16 | /** 17 | * 配置mybatis-plus 分页查件 18 | */ 19 | @Bean 20 | public PaginationInterceptor paginationInterceptor() { 21 | return new PaginationInterceptor(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/config/SaTokenConfigure.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.config; 2 | 3 | import cn.dev33.satoken.thymeleaf.dialect.SaTokenDialect; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * Thymeleaf中使用saToken需要此配置 9 | * 10 | * @author wenbin 11 | */ 12 | @Configuration 13 | public class SaTokenConfigure { 14 | // Sa-Token 标签方言 (Thymeleaf版) 15 | @Bean 16 | public SaTokenDialect getSaTokenDialect() { 17 | return new SaTokenDialect(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/config/StpInterfaceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.config; 2 | 3 | import cn.dev33.satoken.stp.StpInterface; 4 | import cn.dev33.satoken.stp.StpUtil; 5 | import com.company.project.service.PermissionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * SaToken自定义权限加载接口实现类 13 | * 14 | * @author wenbin 15 | */ 16 | @Component // 保证此类被 SpringBoot 扫描,完成 Sa-Token 的自定义权限验证扩展 17 | public class StpInterfaceImpl implements StpInterface { 18 | 19 | @Autowired 20 | PermissionService permissionService; 21 | 22 | /** 23 | * 返回一个账号所拥有的权限码集合 24 | */ 25 | @Override 26 | public List getPermissionList(Object loginId, String loginType) { 27 | if (loginType.equals(StpUtil.TYPE)) { 28 | return permissionService.getPermissionsByUserId(String.valueOf(loginId)); 29 | } 30 | return null; 31 | } 32 | 33 | /** 34 | * 返回一个账号所拥有的角色标识集合 35 | */ 36 | @Override 37 | public List getRoleList(Object loginId, String loginType) { 38 | return null; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/config/SwaggerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.config; 2 | 3 | import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.Import; 7 | import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; 8 | import springfox.documentation.builders.ApiInfoBuilder; 9 | import springfox.documentation.builders.PathSelectors; 10 | import springfox.documentation.builders.RequestHandlerSelectors; 11 | import springfox.documentation.service.ApiInfo; 12 | import springfox.documentation.spi.DocumentationType; 13 | import springfox.documentation.spring.web.plugins.Docket; 14 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 15 | 16 | 17 | /** 18 | * SwaggerConfiguration 19 | * 20 | * @author wenbin 21 | * @version V1.0 22 | * @date 2020年3月18日 23 | */ 24 | @Configuration 25 | @EnableSwagger2 26 | @EnableKnife4j 27 | @Import(BeanValidatorPluginsConfiguration.class) 28 | public class SwaggerConfiguration { 29 | 30 | @Bean 31 | public Docket createRestApi() { 32 | return new Docket(DocumentationType.SWAGGER_2) 33 | .apiInfo(apiInfo()) 34 | .select() 35 | .apis(RequestHandlerSelectors.basePackage("com.company.project.controller")) 36 | .paths(PathSelectors.any()) 37 | .build(); 38 | } 39 | 40 | private ApiInfo apiInfo() { 41 | return new ApiInfoBuilder() 42 | .title("Springboot-api APIs") 43 | .description("Springboot-api APIs") 44 | .termsOfServiceUrl("http://localhost:8080/") 45 | .version("1.0") 46 | .build(); 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.exception; 2 | 3 | import com.company.project.common.exception.code.BaseResponseCode; 4 | import com.company.project.common.exception.code.ResponseCodeInterface; 5 | 6 | /** 7 | * BusinessException 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public class BusinessException extends RuntimeException { 14 | /** 15 | * 异常编号 16 | */ 17 | private final int messageCode; 18 | 19 | /** 20 | * 对messageCode 异常信息进行补充说明 21 | */ 22 | private final String detailMessage; 23 | 24 | public BusinessException(int messageCode, String message) { 25 | super(message); 26 | this.messageCode = messageCode; 27 | this.detailMessage = message; 28 | } 29 | 30 | public BusinessException(String message) { 31 | super(message); 32 | this.messageCode = BaseResponseCode.OPERATION_ERRO.getCode(); 33 | this.detailMessage = message; 34 | } 35 | 36 | /** 37 | * 构造函数 38 | * 39 | * @param code 异常码 40 | */ 41 | public BusinessException(ResponseCodeInterface code) { 42 | this(code.getCode(), code.getMsg()); 43 | } 44 | 45 | public int getMessageCode() { 46 | return messageCode; 47 | } 48 | 49 | public String getDetailMessage() { 50 | return detailMessage; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/exception/code/BaseResponseCode.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.exception.code; 2 | 3 | 4 | /** 5 | * 错误码 6 | * 7 | * @author wenbin 8 | * @version V1.0 9 | * @date 2020年3月18日 10 | */ 11 | public enum BaseResponseCode implements ResponseCodeInterface { 12 | /** 13 | * 错误码 14 | */ 15 | SUCCESS(0, "操作成功"), 16 | SYSTEM_BUSY(500001, "系统繁忙,请稍候再试"), 17 | OPERATION_ERRO(500002, "操作失败"), 18 | ILLEGAL_DATA(500003, "非法的数据格式"), 19 | TOKEN_ERROR(401001, "登录凭证已过期,请重新登录"), 20 | DATA_ERROR(401003, "传入数据异常"), 21 | NOT_ACCOUNT(401004, "该用户不存在,请先注册"), 22 | USER_LOCK(401005, "该用户已被锁定,请联系运营人员"), 23 | PASSWORD_ERROR(401006, "用户名或密码错误"), 24 | METHODARGUMENTNOTVALIDEXCEPTION(401007, "方法参数校验异常"), 25 | UNAUTHORIZED_ERROR(401008, "权鉴校验不通过"), 26 | ROLE_PERMISSION_RELATION(401009, "该菜单权限存在子集关联,不允许删除"), 27 | OLD_PASSWORD_ERROR(401010, "旧密码不正确"), 28 | NOT_PERMISSION_DELETED_DEPT(401011, "该组织机构下还关联着用户,不允许删除"), 29 | OPERATION_MENU_PERMISSION_CATALOG_ERROR(401012, "操作后的菜单类型是目录,所属菜单必须为默认顶级菜单或者目录"), 30 | OPERATION_MENU_PERMISSION_MENU_ERROR(401013, "操作后的菜单类型是菜单,所属菜单必须为目录类型"), 31 | OPERATION_MENU_PERMISSION_BTN_ERROR(401013, "操作后的菜单类型是按钮,所属菜单必须为菜单类型"), 32 | OPERATION_MENU_PERMISSION_URL_NOT_NULL(401015, "菜单权限的url不能为空"), 33 | OPERATION_MENU_PERMISSION_URL_PERMS_NULL(401016, "菜单权限的标识符不能为空"), 34 | ; 35 | 36 | /** 37 | * 错误码 38 | */ 39 | private final int code; 40 | /** 41 | * 错误消息 42 | */ 43 | private final String msg; 44 | 45 | BaseResponseCode(int code, String msg) { 46 | this.code = code; 47 | this.msg = msg; 48 | } 49 | 50 | @Override 51 | public int getCode() { 52 | return code; 53 | } 54 | 55 | @Override 56 | public String getMsg() { 57 | return msg; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/exception/code/ResponseCodeInterface.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.exception.code; 2 | 3 | /** 4 | * ResponseCodeInterface 5 | * 6 | * @author wenbin 7 | * @version V1.0 8 | * @date 2020年3月18日 9 | */ 10 | public interface ResponseCodeInterface { 11 | /** 12 | * 获取code 13 | * 14 | * @return code 15 | */ 16 | int getCode(); 17 | 18 | /** 19 | * 获取信息 20 | * 21 | * @return msg 22 | */ 23 | String getMsg(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/filter/AuthFilter.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.filter; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.company.project.common.utils.DataResult; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.apache.commons.lang.StringUtils; 7 | import org.springframework.core.annotation.Order; 8 | 9 | import javax.servlet.*; 10 | import javax.servlet.annotation.WebFilter; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.IOException; 14 | import java.util.Arrays; 15 | 16 | 17 | @Slf4j 18 | @WebFilter(filterName = "authFilter", urlPatterns = "/app/api/*") 19 | @Order(1) 20 | public class AuthFilter implements Filter { 21 | /** 22 | * 白名单 23 | */ 24 | private static final String[] whiteList = {"/app/api/login", "/app/api/open/test"}; 25 | 26 | //需要拦截的地址 27 | @Override 28 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 29 | HttpServletRequest req = (HttpServletRequest) request; 30 | HttpServletResponse resp = (HttpServletResponse) response; 31 | resp.setHeader("Access-Control-Allow-Origin", "*"); 32 | resp.setHeader("Access-Control-Allow-Credentials", "true"); 33 | resp.setHeader("Access-Control-Allow-Methods", "POST, GET, PATCH, DELETE, PUT"); 34 | resp.setHeader("Access-Control-Allow-Headers", "*"); 35 | String url = req.getRequestURI(); 36 | log.info("url:{}", url); 37 | if (Arrays.asList(whiteList).contains(url)) { 38 | chain.doFilter(request, response); 39 | } else { 40 | //拦截接口 41 | //从header中获取token 42 | String token = req.getHeader("satoken"); 43 | //如果header中不存在token,则从参数中获取token 44 | if (StringUtils.isBlank(token)) { 45 | token = request.getParameter("satoken"); 46 | } 47 | //token为空返回 48 | if (StringUtils.isBlank(token)) { 49 | responseResult(resp, DataResult.fail("token不能为空")); 50 | } 51 | } 52 | 53 | } 54 | 55 | /** 56 | * responseResult 57 | * 58 | * @param response 59 | * @param result 60 | */ 61 | private void responseResult(HttpServletResponse response, DataResult result) { 62 | response.setCharacterEncoding("UTF-8"); 63 | response.setHeader("Content-type", "application/json;charset=UTF-8"); 64 | response.setStatus(200); 65 | try { 66 | response.getWriter().write(JSON.toJSONString(result)); 67 | } catch (IOException ex) { 68 | log.error(ex.getMessage()); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/Constant.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | /** 4 | * Constant 5 | * 6 | * @author wenbin 7 | * @version V1.0 8 | * @date 2020年3月18日 9 | */ 10 | public class Constant { 11 | 12 | /** 13 | * 未删除值 14 | */ 15 | public static final Integer DATA_NOT_DELETED = 1; 16 | 17 | /** 18 | * 数据库类型 19 | */ 20 | public static final String DB_TYPE_MYSQL = "mysql"; 21 | public static final String DB_TYPE_ORACLE = "oracle"; 22 | public static final String DB_TYPE_SQL_SERVER = "sqlServer"; 23 | 24 | /** 25 | * 定时任务状态 26 | */ 27 | public static final Integer SCHEDULER_STATUS_NORMAL = 0; 28 | public static final Integer SCHEDULER_STATUS_PAUSE = 1; 29 | 30 | /** 31 | * 数据范围类型 1:所有/2:自定义/3:本部门及一下/4:仅本部门/5:自己 32 | */ 33 | public static final Integer DATA_SCOPE_ALL = 1; 34 | public static final Integer DATA_SCOPE_CUSTOM = 2; 35 | public static final Integer DATA_SCOPE_DEPT_AND_CHILD = 3; 36 | public static final Integer DATA_SCOPE_DEPT = 4; 37 | public static final Integer DATA_SCOPE_DEPT_SELF = 5; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * 日期处理 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public class DateUtils { 14 | /** 15 | * 时间格式(yyyy-MM-dd HH:mm:ss) 16 | */ 17 | public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; 18 | /** 19 | * 时间格式(yyyyMMdd) 20 | */ 21 | public final static String DATEPATTERN = "yyyyMMdd"; 22 | 23 | public static String format(Date date, String pattern) { 24 | if (date != null) { 25 | SimpleDateFormat df = new SimpleDateFormat(pattern); 26 | return df.format(date); 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/HttpContextUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | import org.springframework.web.context.request.RequestContextHolder; 4 | import org.springframework.web.context.request.ServletRequestAttributes; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import java.util.Objects; 8 | 9 | /** 10 | * HttpContextUtils 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | public class HttpContextUtils { 17 | 18 | public static HttpServletRequest getHttpServletRequest() { 19 | return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/IPUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import java.net.InetAddress; 9 | import java.net.UnknownHostException; 10 | 11 | /** 12 | * IPUtils 13 | * 14 | * @author wenbin 15 | * @version V1.0 16 | * @date 2020年3月18日 17 | */ 18 | public class IPUtils { 19 | 20 | private static Logger logger = LoggerFactory.getLogger(IPUtils.class); 21 | 22 | /** 23 | * 获取IP地址 24 | *

25 | * 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址 26 | * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址 27 | */ 28 | public static String getIpAddr(HttpServletRequest request) { 29 | String ip = null; 30 | try { 31 | ip = request.getHeader("x-forwarded-for"); 32 | if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { 33 | ip = request.getHeader("Proxy-Client-IP"); 34 | } 35 | if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 36 | ip = request.getHeader("WL-Proxy-Client-IP"); 37 | } 38 | if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { 39 | ip = request.getHeader("HTTP_CLIENT_IP"); 40 | } 41 | if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { 42 | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); 43 | } 44 | if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { 45 | ip = request.getRemoteAddr(); 46 | } 47 | } catch (Exception e) { 48 | logger.error("IPUtils ERROR ", e); 49 | } 50 | 51 | // 使用代理,则获取第一个IP地址 52 | if (!StringUtils.isEmpty(ip) && ip.length() > 15) { 53 | if (ip.indexOf(",") > 0) { 54 | ip = ip.substring(0, ip.indexOf(",")); 55 | } 56 | } 57 | 58 | return ip; 59 | } 60 | 61 | /** 62 | * 获取客户端主机名称 63 | */ 64 | public static String getHostName() { 65 | try { 66 | return InetAddress.getLocalHost().getHostName(); 67 | } catch (UnknownHostException e) { 68 | logger.error(e.getMessage(), e); 69 | } 70 | return "未知"; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | import java.util.UUID; 4 | 5 | 6 | /** 7 | * 密码工具类 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public class PasswordUtils { 14 | 15 | /** 16 | * 匹配密码 17 | * 18 | * @param salt 盐 19 | * @param rawPass 明文 20 | * @param encPass 密文 21 | * @return 是否匹配 22 | */ 23 | public static boolean matches(String salt, String rawPass, String encPass) { 24 | return new PasswordEncoder(salt).matches(encPass, rawPass); 25 | } 26 | 27 | /** 28 | * 明文密码加密 29 | * 30 | * @param rawPass 明文 31 | * @param salt 盐 32 | * @reture 加密后 33 | */ 34 | public static String encode(String rawPass, String salt) { 35 | return new PasswordEncoder(salt).encode(rawPass); 36 | } 37 | 38 | /** 39 | * 获取加密盐 40 | * 41 | * @return 盐值 42 | */ 43 | public static String getSalt() { 44 | return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 20); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/SpringContextUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * SpringContextUtils 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | @Component 16 | public class SpringContextUtils implements ApplicationContextAware { 17 | private static ApplicationContext applicationContext; 18 | 19 | @Override 20 | public void setApplicationContext(ApplicationContext applicationContext) 21 | throws BeansException { 22 | SpringContextUtils.applicationContext = applicationContext; 23 | } 24 | 25 | public static Object getBean(String name) { 26 | try { 27 | return applicationContext.getBean(name); 28 | } catch (Exception e) { 29 | return null; 30 | } 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/common/utils/ValidatorUtils.java: -------------------------------------------------------------------------------- 1 | package com.company.project.common.utils; 2 | 3 | 4 | import com.company.project.common.exception.BusinessException; 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import javax.validation.ConstraintViolation; 8 | import javax.validation.Validation; 9 | import javax.validation.Validator; 10 | import java.util.Set; 11 | 12 | /** 13 | * hibernate-validator校验工具类 14 | */ 15 | public class ValidatorUtils { 16 | private static Validator validator; 17 | 18 | static { 19 | validator = Validation.buildDefaultValidatorFactory().getValidator(); 20 | } 21 | 22 | /** 23 | * 校验对象 24 | * 25 | * @param object 待校验对象 26 | * @param groups 待校验的组 27 | * @throws BusinessException 校验不通过,则报RRException异常 28 | */ 29 | public static void validateEntity(Object object, Class... groups) 30 | throws BusinessException { 31 | Set> constraintViolations = validator.validate(object, groups); 32 | if (!constraintViolations.isEmpty()) { 33 | ConstraintViolation constraint = (ConstraintViolation) constraintViolations.iterator().next(); 34 | throw new BusinessException(constraint.getMessage()); 35 | } 36 | } 37 | 38 | /** 39 | * 空判断处理 40 | * 41 | * @param str 42 | * @param message 43 | */ 44 | public static void isBlank(Object str, String message) { 45 | if (str == null) { 46 | throw new BusinessException(message); 47 | } 48 | if (str instanceof String) { 49 | if (StringUtils.isBlank(String.valueOf(str))) { 50 | throw new BusinessException(message); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/SysContentController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller; 2 | 3 | import cn.dev33.satoken.annotation.SaCheckPermission; 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 7 | import com.company.project.entity.SysContentEntity; 8 | import com.company.project.service.SysContentService; 9 | import io.swagger.annotations.Api; 10 | import io.swagger.annotations.ApiOperation; 11 | import io.swagger.annotations.ApiParam; 12 | import org.springframework.util.CollectionUtils; 13 | import org.springframework.util.StringUtils; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | 20 | /** 21 | * 文章管理 22 | * 23 | * @author wenbin 24 | * @version V1.0 25 | * @date 2020年3月18日 26 | */ 27 | @Api(tags = "文章管理") 28 | @RestController 29 | @RequestMapping("/sysContent") 30 | public class SysContentController { 31 | @Resource 32 | private SysContentService sysContentService; 33 | 34 | 35 | @ApiOperation(value = "新增") 36 | @PostMapping("/add") 37 | @SaCheckPermission("sysContent:add") 38 | public void add(@RequestBody SysContentEntity sysContent) { 39 | sysContentService.save(sysContent); 40 | } 41 | 42 | @ApiOperation(value = "删除") 43 | @DeleteMapping("/delete") 44 | @SaCheckPermission("sysContent:delete") 45 | public void delete(@RequestBody @ApiParam(value = "id集合") List ids) { 46 | sysContentService.removeByIds(ids); 47 | } 48 | 49 | @ApiOperation(value = "更新") 50 | @PutMapping("/update") 51 | @SaCheckPermission("sysContent:update") 52 | public void update(@RequestBody SysContentEntity sysContent) { 53 | sysContentService.updateById(sysContent); 54 | } 55 | 56 | @ApiOperation(value = "查询分页数据") 57 | @PostMapping("/listByPage") 58 | @SaCheckPermission("sysContent:list") 59 | public IPage findListByPage(@RequestBody SysContentEntity sysContent) { 60 | LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); 61 | //查询条件示例 62 | if (!StringUtils.isEmpty(sysContent.getTitle())) { 63 | queryWrapper.like(SysContentEntity::getTitle, sysContent.getTitle()); 64 | } 65 | //数据权限示例, 需手动添加此条件 begin 66 | if (!CollectionUtils.isEmpty(sysContent.getCreateIds())) { 67 | queryWrapper.in(SysContentEntity::getCreateId, sysContent.getCreateIds()); 68 | } 69 | //数据权限示例, 需手动添加此条件 end 70 | return sysContentService.page(sysContent.getQueryPage(), queryWrapper); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/SysFilesController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller; 2 | 3 | import cn.dev33.satoken.annotation.SaCheckPermission; 4 | import cn.dev33.satoken.annotation.SaMode; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 7 | import com.company.project.common.exception.BusinessException; 8 | import com.company.project.entity.SysFilesEntity; 9 | import com.company.project.service.SysFilesService; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import io.swagger.annotations.ApiParam; 13 | import org.springframework.web.bind.annotation.*; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | import javax.annotation.Resource; 17 | import javax.servlet.http.HttpServletRequest; 18 | import java.util.List; 19 | 20 | 21 | /** 22 | * 文件上传 23 | * 24 | * @author wenbin 25 | * @version V1.0 26 | * @date 2020年3月18日 27 | */ 28 | @RestController 29 | @RequestMapping("/sysFiles") 30 | @Api(tags = "文件管理") 31 | public class SysFilesController { 32 | @Resource 33 | private SysFilesService sysFilesService; 34 | 35 | @ApiOperation(value = "新增") 36 | @PostMapping("/upload") 37 | @SaCheckPermission(value = {"sysFiles:add", "sysContent:update", "sysContent:add"}, mode = SaMode.OR) 38 | public String add(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request) { 39 | //判断文件是否空 40 | if (file == null || file.getOriginalFilename() == null || "".equalsIgnoreCase(file.getOriginalFilename().trim())) { 41 | throw new BusinessException("文件为空"); 42 | } 43 | return sysFilesService.saveFile(file, request); 44 | } 45 | 46 | @ApiOperation(value = "删除") 47 | @DeleteMapping("/delete") 48 | @SaCheckPermission("sysFiles:delete") 49 | public void delete(@RequestBody @ApiParam(value = "id集合") List ids) { 50 | sysFilesService.removeByIdsAndFiles(ids); 51 | } 52 | 53 | @ApiOperation(value = "查询分页数据") 54 | @PostMapping("/listByPage") 55 | @SaCheckPermission("sysFiles:list") 56 | public IPage findListByPage(@RequestBody SysFilesEntity sysFiles) { 57 | return sysFilesService.page(sysFiles.getQueryPage(), Wrappers.lambdaQuery().orderByDesc(SysFilesEntity::getCreateDate)); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/SysGeneratorController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller; 2 | 3 | import cn.dev33.satoken.annotation.SaCheckPermission; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.company.project.entity.SysGenerator; 6 | import com.company.project.service.ISysGeneratorService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiOperation; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.apache.commons.io.IOUtils; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.annotation.Resource; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.IOException; 16 | 17 | /** 18 | * 代码生成 19 | * 20 | * @author wenbin 21 | * @version V1.0 22 | * @date 2020年3月18日 23 | */ 24 | @Api(tags = "系统模块-代码生成") 25 | @Slf4j 26 | @RestController 27 | @RequestMapping("/sysGenerator") 28 | public class SysGeneratorController { 29 | @Resource 30 | private ISysGeneratorService sysGeneratorService; 31 | 32 | /** 33 | * 生成代码 34 | */ 35 | @ApiOperation(value = "生成") 36 | @GetMapping("/gen") 37 | @SaCheckPermission("sysGenerator:add") 38 | public void code(String tables, HttpServletResponse response) throws IOException { 39 | byte[] data = sysGeneratorService.generatorCode(tables.split(",")); 40 | 41 | response.reset(); 42 | response.setHeader("Content-Disposition", "attachment; filename=\"manager.zip\""); 43 | response.addHeader("Content-Length", "" + data.length); 44 | response.setContentType("application/octet-stream; charset=UTF-8"); 45 | 46 | IOUtils.write(data, response.getOutputStream()); 47 | } 48 | 49 | @ApiOperation(value = "查询分页数据") 50 | @PostMapping("/listByPage") 51 | @SaCheckPermission("sysGenerator:list") 52 | public IPage findListByPage(@RequestBody SysGenerator vo) { 53 | return sysGeneratorService.selectAllTables(vo.getQueryPage(), vo); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/SysLogController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller; 2 | 3 | import cn.dev33.satoken.annotation.SaCheckPermission; 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.company.project.common.aop.annotation.LogAnnotation; 8 | import com.company.project.entity.SysLog; 9 | import com.company.project.service.LogService; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import org.springframework.util.StringUtils; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.annotation.Resource; 16 | import java.util.List; 17 | 18 | /** 19 | * 系统操作日志 20 | * 21 | * @author wenbin 22 | * @version V1.0 23 | * @date 2020年3月18日 24 | */ 25 | @RequestMapping("/sys") 26 | @Api(tags = "系统模块-系统操作日志管理") 27 | @RestController 28 | public class SysLogController { 29 | @Resource 30 | private LogService logService; 31 | 32 | @PostMapping("/logs") 33 | @ApiOperation(value = "分页查询系统操作日志接口") 34 | @LogAnnotation(title = "系统操作日志管理", action = "分页查询系统操作日志") 35 | @SaCheckPermission("sys:log:list") 36 | public Page pageInfo(@RequestBody SysLog vo) { 37 | LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); 38 | if (!StringUtils.isEmpty(vo.getUsername())) { 39 | queryWrapper.like(SysLog::getUsername, vo.getUsername()); 40 | } 41 | if (!StringUtils.isEmpty(vo.getOperation())) { 42 | queryWrapper.like(SysLog::getOperation, vo.getOperation()); 43 | } 44 | if (!StringUtils.isEmpty(vo.getStartTime())) { 45 | queryWrapper.gt(SysLog::getCreateTime, vo.getStartTime()); 46 | } 47 | if (!StringUtils.isEmpty(vo.getEndTime())) { 48 | queryWrapper.lt(SysLog::getCreateTime, vo.getEndTime()); 49 | } 50 | queryWrapper.orderByDesc(SysLog::getCreateTime); 51 | return logService.page(vo.getQueryPage(), queryWrapper); 52 | } 53 | 54 | @DeleteMapping("/logs") 55 | @ApiOperation(value = "删除日志接口") 56 | @LogAnnotation(title = "系统操作日志管理", action = "删除系统操作日志") 57 | @SaCheckPermission("sys:log:deleted") 58 | public void deleted(@RequestBody List logIds) { 59 | logService.removeByIds(logIds); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/UserRoleController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller; 2 | 3 | import com.company.project.common.aop.annotation.LogAnnotation; 4 | import com.company.project.service.UserRoleService; 5 | import com.company.project.vo.req.UserRoleOperationReqVO; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import javax.annotation.Resource; 14 | import javax.validation.Valid; 15 | 16 | /** 17 | * 用户和角色关联 18 | * 19 | * @author wenbin 20 | * @version V1.0 21 | * @date 2020年3月18日 22 | */ 23 | @RequestMapping("/sys") 24 | @RestController 25 | @Api(tags = "组织管理-用户和角色关联接口") 26 | public class UserRoleController { 27 | @Resource 28 | private UserRoleService userRoleService; 29 | 30 | @PostMapping("/user/role") 31 | @ApiOperation(value = "修改或者新增用户角色接口") 32 | @LogAnnotation(title = "用户和角色关联接口", action = "修改或者新增用户角色") 33 | public void operationUserRole(@RequestBody @Valid UserRoleOperationReqVO vo) { 34 | userRoleService.addUserRoleInfo(vo); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/controller/api/TestController.java: -------------------------------------------------------------------------------- 1 | package com.company.project.controller.api; 2 | 3 | import cn.dev33.satoken.stp.SaTokenInfo; 4 | import cn.dev33.satoken.stp.StpUtil; 5 | import cn.dev33.satoken.util.SaResult; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | 14 | /** 15 | * api test示例 16 | * 17 | * @author wenbin 18 | * @version V1.0 19 | * @date 2020年5月11日 20 | */ 21 | @RestController 22 | @RequestMapping("/app/api") 23 | @Api(tags = "test") 24 | public class TestController { 25 | 26 | 27 | @PostMapping("/login") 28 | @ApiOperation(value = "登录接口") 29 | public SaResult login() { 30 | // 第1步,先登录上 31 | StpUtil.login(10001); 32 | // 第2步,获取 Token 相关参数 33 | SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); 34 | // 第3步,返回给前端 35 | return SaResult.data(tokenInfo); 36 | } 37 | 38 | 39 | @GetMapping("/getCurUserInfo") 40 | @ApiOperation(value = "获取当前登录人信息示例") 41 | public void getAppUserInfo() { 42 | //拿userId与userName 43 | String userId = StpUtil.getLoginIdAsString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import lombok.Data; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * BaseEntity 13 | * 14 | * @author wenbin 15 | * @version V1.0 16 | * @date 2020年3月18日 17 | */ 18 | @Data 19 | @JsonIgnoreProperties(value = {"page", "limit", "getQueryPage"}) 20 | public class BaseEntity { 21 | @JSONField(serialize = false) 22 | @TableField(exist = false) 23 | private Integer page = 1; 24 | 25 | @JSONField(serialize = false) 26 | @TableField(exist = false) 27 | private Integer limit = 10; 28 | 29 | /** 30 | * 数据权限:用户id 31 | */ 32 | @TableField(exist = false) 33 | private List createIds; 34 | 35 | /** 36 | * page条件 37 | * 38 | * @param 39 | * @return 40 | */ 41 | @JSONField(serialize = false) 42 | public Page getQueryPage() { 43 | return new Page(page, limit); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/ColumnEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 代码生成 列属性 7 | * 8 | * @author wenbin 9 | * @version V1.0 10 | * @date 2020年3月18日 11 | */ 12 | @Data 13 | public class ColumnEntity { 14 | /** 15 | * 列名 16 | */ 17 | private String columnName; 18 | 19 | /** 20 | * 列名类型 21 | */ 22 | private String dataType; 23 | 24 | /** 25 | * 列名备注 26 | */ 27 | private String comments; 28 | 29 | /** 30 | * 属性名称(第一个字母大写),如:user_name => UserName 31 | */ 32 | private String attrName; 33 | 34 | /** 35 | * 属性名称(第一个字母小写),如:user_name => userName 36 | */ 37 | private String attrname; 38 | 39 | /** 40 | * 属性类型 41 | */ 42 | private String attrType; 43 | 44 | /** 45 | * auto_increment 46 | */ 47 | private String extra; 48 | 49 | public String getColumnName() { 50 | return columnName; 51 | } 52 | 53 | public void setColumnName(String columnName) { 54 | this.columnName = columnName; 55 | } 56 | 57 | public String getDataType() { 58 | return dataType; 59 | } 60 | 61 | public void setDataType(String dataType) { 62 | this.dataType = dataType; 63 | } 64 | 65 | public String getComments() { 66 | return comments; 67 | } 68 | 69 | public void setComments(String comments) { 70 | this.comments = comments; 71 | } 72 | 73 | public String getAttrname() { 74 | return attrname; 75 | } 76 | 77 | public void setAttrname(String attrname) { 78 | this.attrname = attrname; 79 | } 80 | 81 | public String getAttrName() { 82 | return attrName; 83 | } 84 | 85 | public void setAttrName(String attrName) { 86 | this.attrName = attrName; 87 | } 88 | 89 | public String getAttrType() { 90 | return attrType; 91 | } 92 | 93 | public void setAttrType(String attrType) { 94 | this.attrType = attrType; 95 | } 96 | 97 | public String getExtra() { 98 | return extra; 99 | } 100 | 101 | public void setExtra(String extra) { 102 | this.extra = extra; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysContentEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 内容管理 15 | * 16 | * @author wenbin 17 | * @version V1.0 18 | * @date 2020年3月18日 19 | */ 20 | @EqualsAndHashCode(callSuper = true) 21 | @Data 22 | @TableName("sys_content") 23 | public class SysContentEntity extends BaseEntity implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 主键id 28 | */ 29 | @TableId("id") 30 | private String id; 31 | 32 | /** 33 | * 主题 34 | */ 35 | @TableField("title") 36 | private String title; 37 | 38 | /** 39 | * 内容 40 | */ 41 | @TableField("content") 42 | private String content; 43 | 44 | /** 45 | * 单个图片url 46 | */ 47 | private String oneImg; 48 | 49 | /** 50 | * 多个图片url 51 | */ 52 | private String multipleImg; 53 | 54 | /** 55 | * 关键字 56 | */ 57 | private String keywords; 58 | 59 | /** 60 | * 类型(数据字典) 61 | */ 62 | @TableField("type") 63 | private String type; 64 | 65 | /** 66 | * 创建人 67 | */ 68 | @TableField(value = "create_id", fill = FieldFill.INSERT) 69 | private String createId; 70 | 71 | /** 72 | * 创建时间 73 | */ 74 | @TableField(value = "create_time", fill = FieldFill.INSERT) 75 | private Date createTime; 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysDept.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.NotBlank; 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 部门 14 | * 15 | * @author wenbin 16 | * @version V1.0 17 | * @date 2020年3月18日 18 | */ 19 | @Data 20 | public class SysDept implements Serializable { 21 | @TableId 22 | private String id; 23 | 24 | private String deptNo; 25 | 26 | @NotBlank(message = "机构名称不能为空") 27 | private String name; 28 | 29 | @NotBlank(message = "父级不能为空") 30 | private String pid; 31 | 32 | @TableField(exist = false) 33 | private String pidName; 34 | 35 | private Integer status; 36 | 37 | private String relationCode; 38 | 39 | private String deptManagerId; 40 | 41 | private String managerName; 42 | 43 | private String phone; 44 | 45 | @TableField(fill = FieldFill.INSERT) 46 | private Date createTime; 47 | 48 | @TableField(fill = FieldFill.INSERT_UPDATE) 49 | private Date updateTime; 50 | 51 | @TableField(fill = FieldFill.INSERT) 52 | private Integer deleted; 53 | 54 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysDictDetailEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 字典明细 15 | * 16 | * @author wenbin 17 | * @version V1.0 18 | * @date 2020年3月18日 19 | */ 20 | @EqualsAndHashCode(callSuper = true) 21 | @Data 22 | @TableName("sys_dict_detail") 23 | public class SysDictDetailEntity extends BaseEntity implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 主键 28 | */ 29 | @TableId("id") 30 | private String id; 31 | 32 | /** 33 | * 字典标签 34 | */ 35 | @TableField("label") 36 | private String label; 37 | 38 | /** 39 | * 字典值 40 | */ 41 | @TableField("value") 42 | private String value; 43 | 44 | /** 45 | * 排序 46 | */ 47 | @TableField("sort") 48 | private Integer sort; 49 | 50 | /** 51 | * 字典id 52 | */ 53 | @TableField("dict_id") 54 | private String dictId; 55 | 56 | /** 57 | * 创建日期 58 | */ 59 | @TableField(value = "create_time", fill = FieldFill.INSERT) 60 | private Date createTime; 61 | 62 | /** 63 | * 字典name 64 | */ 65 | @TableField(exist = false) 66 | private String dictName; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysDictEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 字典管理 15 | * 16 | * @author wenbin 17 | * @version V1.0 18 | * @date 2020年3月18日 19 | */ 20 | @EqualsAndHashCode(callSuper = true) 21 | @Data 22 | @TableName("sys_dict") 23 | public class SysDictEntity extends BaseEntity implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 主键 28 | */ 29 | @TableId("id") 30 | private String id; 31 | 32 | /** 33 | * 字典名称 34 | */ 35 | @TableField("name") 36 | private String name; 37 | 38 | /** 39 | * 备注 40 | */ 41 | @TableField("remark") 42 | private String remark; 43 | 44 | /** 45 | * 创建时间 46 | */ 47 | @TableField(value = "create_time", fill = FieldFill.INSERT) 48 | private Date createTime; 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysFilesEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 文件上传 15 | * 16 | * @author wenbin 17 | * @version V1.0 18 | * @date 2020年3月18日 19 | */ 20 | @EqualsAndHashCode(callSuper = true) 21 | @Data 22 | @TableName("sys_files") 23 | public class SysFilesEntity extends BaseEntity implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 主键 28 | */ 29 | @TableId("id") 30 | private String id; 31 | 32 | /** 33 | * URL地址 34 | */ 35 | @TableField("url") 36 | private String url; 37 | 38 | /** 39 | * 创建时间 40 | */ 41 | @TableField(value = "create_date", fill = FieldFill.INSERT) 42 | private Date createDate; 43 | 44 | @TableField("file_name") 45 | private String fileName; 46 | 47 | @TableField("file_path") 48 | private String filePath; 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysGenerator.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * 代码生成 12 | * 13 | * @author wenbin 14 | * @version V1.0 15 | * @date 2020年3月18日 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | public class SysGenerator extends BaseEntity implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private String tableName; 25 | 26 | private Date createTime; 27 | 28 | private String tableComment; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysLog.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 操作日志 14 | * 15 | * @author wenbin 16 | * @version V1.0 17 | * @date 2020年3月18日 18 | */ 19 | @EqualsAndHashCode(callSuper = true) 20 | @Data 21 | public class SysLog extends BaseEntity implements Serializable { 22 | @TableId 23 | private String id; 24 | 25 | private String userId; 26 | 27 | private String username; 28 | 29 | private String operation; 30 | 31 | private Integer time; 32 | 33 | private String method; 34 | 35 | private String params; 36 | 37 | private String ip; 38 | 39 | @TableField(fill = FieldFill.INSERT) 40 | private Date createTime; 41 | 42 | @TableField(exist = false) 43 | private String startTime; 44 | 45 | @TableField(exist = false) 46 | private String endTime; 47 | 48 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysPermission.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.NotBlank; 9 | import javax.validation.constraints.NotNull; 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 权限菜单 15 | * 16 | * @author wenbin 17 | * @version V1.0 18 | * @date 2020年3月18日 19 | */ 20 | @Data 21 | public class SysPermission implements Serializable { 22 | 23 | 24 | @TableId 25 | private String id; 26 | 27 | @NotBlank(message = "菜单权限名称不能为空") 28 | private String name; 29 | 30 | private String perms; 31 | 32 | private String url; 33 | 34 | private String icon; 35 | 36 | private String target; 37 | 38 | @NotNull(message = "所属菜单不能为空") 39 | private String pid; 40 | 41 | private Integer orderNum; 42 | 43 | @NotNull(message = "菜单权限类型不能为空") 44 | private Integer type; 45 | 46 | /** 47 | * 1正常 2禁用 48 | */ 49 | private Integer status; 50 | 51 | @TableField(fill = FieldFill.INSERT) 52 | private Date createTime; 53 | 54 | @TableField(fill = FieldFill.INSERT_UPDATE) 55 | private Date updateTime; 56 | 57 | @TableField(fill = FieldFill.INSERT) 58 | private Integer deleted; 59 | 60 | @TableField(exist = false) 61 | private String pidName; 62 | 63 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysRole.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.company.project.vo.resp.DeptRespNodeVO; 7 | import com.company.project.vo.resp.PermissionRespNode; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | import javax.validation.constraints.NotBlank; 13 | import java.io.Serializable; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | /** 18 | * 角色 19 | * 20 | * @author wenbin 21 | * @version V1.0 22 | * @date 2020年3月18日 23 | */ 24 | @EqualsAndHashCode(callSuper = true) 25 | @Data 26 | @Accessors(chain = true) 27 | public class SysRole extends BaseEntity implements Serializable { 28 | @TableId 29 | private String id; 30 | 31 | @NotBlank(message = "名称不能为空") 32 | private String name; 33 | 34 | private String description; 35 | 36 | private Integer status; 37 | 38 | private Integer dataScope; 39 | 40 | @TableField(fill = FieldFill.INSERT) 41 | private Date createTime; 42 | 43 | @TableField(fill = FieldFill.INSERT_UPDATE) 44 | private Date updateTime; 45 | 46 | @TableField(fill = FieldFill.INSERT) 47 | private Integer deleted; 48 | 49 | @TableField(exist = false) 50 | private List permissionRespNodes; 51 | @TableField(exist = false) 52 | private List deptRespNodes; 53 | 54 | @TableField(exist = false) 55 | private String startTime; 56 | 57 | @TableField(exist = false) 58 | private String endTime; 59 | 60 | @TableField(exist = false) 61 | private List permissions; 62 | 63 | @TableField(exist = false) 64 | private List depts; 65 | 66 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysRoleDeptEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 角色部门 14 | * 15 | * @author wenbin 16 | * @email *****@mail.com 17 | * @date 2020-09-27 17:30:15 18 | */ 19 | @Data 20 | @TableName("sys_role_dept") 21 | public class SysRoleDeptEntity extends BaseEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * 主键 26 | */ 27 | @TableId("id") 28 | private String id; 29 | 30 | /** 31 | * 角色id 32 | */ 33 | @TableField("role_id") 34 | private String roleId; 35 | 36 | /** 37 | * 菜单权限id 38 | */ 39 | @TableField("dept_id") 40 | private String deptId; 41 | 42 | /** 43 | * 创建时间 44 | */ 45 | @TableField(value = "create_time", fill = FieldFill.INSERT) 46 | private Date createTime; 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysRolePermission.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | /** 12 | * 角色权限 13 | * 14 | * @author wenbin 15 | * @version V1.0 16 | * @date 2020年3月18日 17 | */ 18 | @Data 19 | public class SysRolePermission implements Serializable { 20 | @TableId 21 | private String id; 22 | 23 | private String roleId; 24 | 25 | private String permissionId; 26 | 27 | @TableField(fill = FieldFill.INSERT) 28 | private Date createTime; 29 | 30 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysUser.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | import javax.validation.constraints.NotBlank; 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author wenbin 18 | * @version V1.0 19 | * @date 2020年3月18日 20 | */ 21 | @EqualsAndHashCode(callSuper = true) 22 | @Data 23 | public class SysUser extends BaseEntity implements Serializable { 24 | @TableId 25 | private String id; 26 | 27 | @NotBlank(message = "账号不能为空") 28 | private String username; 29 | 30 | private String salt; 31 | 32 | @NotBlank(message = "密码不能为空") 33 | private String password; 34 | 35 | @TableField(exist = false) 36 | private String oldPwd; 37 | 38 | @TableField(exist = false) 39 | private String newPwd; 40 | 41 | private String phone; 42 | 43 | private String deptId; 44 | 45 | @TableField(exist = false) 46 | private String deptName; 47 | 48 | @TableField(exist = false) 49 | private String deptNo; 50 | 51 | 52 | private String realName; 53 | 54 | private String nickName; 55 | 56 | private String email; 57 | 58 | private Integer status; 59 | 60 | private Integer sex; 61 | 62 | @TableField(fill = FieldFill.INSERT) 63 | private Integer deleted; 64 | 65 | private String createId; 66 | 67 | private String updateId; 68 | 69 | private Integer createWhere; 70 | 71 | @TableField(fill = FieldFill.INSERT) 72 | private Date createTime; 73 | 74 | @TableField(fill = FieldFill.INSERT_UPDATE) 75 | private Date updateTime; 76 | 77 | @TableField(exist = false) 78 | private String startTime; 79 | 80 | @TableField(exist = false) 81 | private String endTime; 82 | 83 | @TableField(exist = false) 84 | private List roleIds; 85 | 86 | @TableField(exist = false) 87 | private String captcha; 88 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | /** 12 | * 用户角色 13 | * 14 | * @author wenbin 15 | * @version V1.0 16 | * @date 2020年3月18日 17 | */ 18 | @Data 19 | public class SysUserRole implements Serializable { 20 | @TableId 21 | private String id; 22 | 23 | private String userId; 24 | 25 | private String roleId; 26 | 27 | @TableField(fill = FieldFill.INSERT) 28 | private Date createTime; 29 | 30 | 31 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/entity/TableEntity.java: -------------------------------------------------------------------------------- 1 | package com.company.project.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 代码生成 表数据 7 | * 8 | * @author wenbin 9 | * @version V1.0 10 | * @date 2020年3月18日 11 | */ 12 | public class TableEntity { 13 | //表的名称 14 | private String tableName; 15 | //表的备注 16 | private String comments; 17 | //表的主键 18 | private ColumnEntity pk; 19 | //表的列名(不包含主键) 20 | private List columns; 21 | private List htmlColumns; 22 | 23 | //类名(第一个字母大写),如:sys_user => SysUser 24 | private String className; 25 | //类名(第一个字母小写),如:sys_user => sysUser 26 | private String classname; 27 | //类名(都小写),如:sys_user => sysuser 28 | private String classNameLower; 29 | 30 | public List getHtmlColumns() { 31 | return htmlColumns; 32 | } 33 | 34 | public void setHtmlColumns(List htmlColumns) { 35 | this.htmlColumns = htmlColumns; 36 | } 37 | 38 | public String getTableName() { 39 | return tableName; 40 | } 41 | 42 | public void setTableName(String tableName) { 43 | this.tableName = tableName; 44 | } 45 | 46 | public String getComments() { 47 | return comments; 48 | } 49 | 50 | public void setComments(String comments) { 51 | this.comments = comments; 52 | } 53 | 54 | public ColumnEntity getPk() { 55 | return pk; 56 | } 57 | 58 | public void setPk(ColumnEntity pk) { 59 | this.pk = pk; 60 | } 61 | 62 | public List getColumns() { 63 | return columns; 64 | } 65 | 66 | public void setColumns(List columns) { 67 | this.columns = columns; 68 | } 69 | 70 | public String getClassName() { 71 | return className; 72 | } 73 | 74 | public void setClassName(String className) { 75 | this.className = className; 76 | } 77 | 78 | public String getClassname() { 79 | return classname; 80 | } 81 | 82 | public void setClassname(String classname) { 83 | this.classname = classname; 84 | } 85 | 86 | public String getClassNameLower() { 87 | return classNameLower; 88 | } 89 | 90 | public void setClassNameLower(String classNameLower) { 91 | this.classNameLower = classNameLower; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/GeneratorMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.company.project.entity.SysGenerator; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 代码生成 Mapper 14 | * 15 | * @author wenbin 16 | * @version V1.0 17 | * @date 2020年3月18日 18 | */ 19 | public interface GeneratorMapper extends BaseMapper { 20 | 21 | IPage selectAllTables(Page page, @Param(value = "vo") SysGenerator vo); 22 | 23 | Map queryTable(String tableName); 24 | 25 | List> queryColumns(String tableName); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysContentMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysContentEntity; 5 | 6 | /** 7 | * 内容管理 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysContentMapper extends BaseMapper { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysDeptMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysDept; 5 | 6 | /** 7 | * 部门 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysDeptMapper extends BaseMapper { 14 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysDictDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysDictDetailEntity; 5 | 6 | /** 7 | * 字典详情 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysDictDetailMapper extends BaseMapper { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysDictMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysDictEntity; 5 | 6 | /** 7 | * 字典 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysDictMapper extends BaseMapper { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysFilesMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysFilesEntity; 5 | 6 | /** 7 | * 文件上传 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysFilesMapper extends BaseMapper { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysLog; 5 | 6 | /** 7 | * 操作日志 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysLogMapper extends BaseMapper { 14 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysPermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysPermission; 5 | 6 | /** 7 | * 菜单权限 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysPermissionMapper extends BaseMapper { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysRoleDeptEntity; 5 | 6 | /** 7 | * 角色部门 8 | * 9 | * @author wenbin 10 | * @email *****@mail.com 11 | * @date 2020-09-27 17:30:15 12 | */ 13 | public interface SysRoleDeptMapper extends BaseMapper { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysRole; 5 | 6 | /** 7 | * 角色 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysRoleMapper extends BaseMapper { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysRolePermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysRolePermission; 5 | 6 | /** 7 | * 角色权限 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysRolePermissionMapper extends BaseMapper { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysUserMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysUser; 5 | 6 | /** 7 | * 用户 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysUserMapper extends BaseMapper { 14 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/mapper/SysUserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.company.project.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.company.project.entity.SysUserRole; 5 | 6 | /** 7 | * 用户角色 Mapper 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysUserRoleMapper extends BaseMapper { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/DeptService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysDept; 5 | import com.company.project.vo.resp.DeptRespNodeVO; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 部门 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | public interface DeptService extends IService { 17 | 18 | /** 19 | * 添加部门 20 | * 21 | * @param vo vo 22 | */ 23 | void addDept(SysDept vo); 24 | 25 | /** 26 | * 更新部门 27 | * 28 | * @param vo vo 29 | */ 30 | void updateDept(SysDept vo); 31 | 32 | /** 33 | * 删除部门 34 | * 35 | * @param id id 36 | */ 37 | void deleted(String id); 38 | 39 | /** 40 | * 部门树形列表 41 | * 42 | * @param deptId deptId 43 | * @param disabled 最顶级是否可用 44 | * @return 树形列表 45 | */ 46 | List deptTreeList(String deptId, Boolean disabled); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/HomeService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.company.project.vo.resp.HomeRespVO; 4 | 5 | /** 6 | * 首页 7 | * 8 | * @author wenbin 9 | * @version V1.0 10 | * @date 2020年3月18日 11 | */ 12 | public interface HomeService { 13 | 14 | /** 15 | * 获取首页信息 16 | * 17 | * @param userId userId 18 | * @return HomeRespVO 19 | */ 20 | HomeRespVO getHomeInfo(String userId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/ISysGeneratorService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.company.project.entity.SysGenerator; 6 | 7 | /** 8 | * 代码生成 9 | * 10 | * @author wenbin 11 | * @version V1.0 12 | * @date 2020年3月18日 13 | */ 14 | public interface ISysGeneratorService { 15 | 16 | /** 17 | * 获取所有表 18 | * 19 | * @param page page 20 | * @param vo vo 21 | * @return IPage 22 | */ 23 | IPage selectAllTables(Page page, SysGenerator vo); 24 | 25 | /** 26 | * 生成代码 27 | * 28 | * @param tables tables 29 | * @return byte[] 30 | */ 31 | byte[] generatorCode(String[] tables); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/LogService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysLog; 5 | 6 | /** 7 | * 系统日志 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface LogService extends IService { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysPermission; 5 | import com.company.project.vo.resp.PermissionRespNode; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 菜单权限 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | public interface PermissionService extends IService { 17 | 18 | /** 19 | * 根据userId获取权限 20 | * 21 | * @param userId userId 22 | * @return 权限 23 | */ 24 | List getPermission(String userId); 25 | 26 | /** 27 | * 删除权限 28 | * 29 | * @param permissionId 权限id 30 | */ 31 | void deleted(String permissionId); 32 | 33 | /** 34 | * 获取所有 35 | * 36 | * @return List 37 | */ 38 | List selectAll(Integer status); 39 | 40 | /** 41 | * 根据userId获取权限标志 42 | * 43 | * @param userId userId 44 | * @return Set 45 | */ 46 | List getPermissionsByUserId(String userId); 47 | 48 | /** 49 | * 根据userId获取权限树 50 | * 51 | * @param userId 52 | * @return List 53 | */ 54 | List permissionTreeList(String userId); 55 | 56 | /** 57 | * 根据权限树 58 | * 59 | * @return List 60 | */ 61 | List selectAllByTree(Integer status); 62 | 63 | /** 64 | * 根据目录树 65 | * 66 | * @param permissionId permissionId 67 | * @return List 68 | */ 69 | List selectAllMenuByTree(String permissionId); 70 | 71 | 72 | /** 73 | * 根据权限id获取绑定的userId 74 | * 75 | * @param permissionId permissionId 76 | * @return List 77 | */ 78 | List getUserIdsById(String permissionId); 79 | 80 | /** 81 | * 更新 82 | * 83 | * @param vo vo 84 | */ 85 | void updatePermission(SysPermission vo); 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/RolePermissionService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysRolePermission; 5 | import com.company.project.vo.req.RolePermissionOperationReqVO; 6 | 7 | /** 8 | * 角色权限关联 9 | * 10 | * @author wenbin 11 | * @version V1.0 12 | * @date 2020年3月18日 13 | */ 14 | public interface RolePermissionService extends IService { 15 | 16 | /** 17 | * 角色绑定权限 18 | * 19 | * @param vo vo 20 | */ 21 | void addRolePermission(RolePermissionOperationReqVO vo); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysRole; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 角色 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | public interface RoleService extends IService { 16 | 17 | /** 18 | * 添加角色 19 | * 20 | * @param vo SysRole 21 | */ 22 | void addRole(SysRole vo); 23 | 24 | /** 25 | * 更新角色 26 | * 27 | * @param vo SysRole 28 | */ 29 | void updateRole(SysRole vo); 30 | 31 | /** 32 | * 根据id获取角色详情 33 | * 34 | * @param id id 35 | * @return SysRole 36 | */ 37 | SysRole detailInfo(String id); 38 | 39 | /** 40 | * 根据id删除 41 | * 42 | * @param id id 43 | */ 44 | void deletedRole(String id); 45 | 46 | /** 47 | * 根据userId获取绑定的角色 48 | * 49 | * @param userId userId 50 | * @return List 51 | */ 52 | List getRoleInfoByUserId(String userId); 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/SysContentService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysContentEntity; 5 | 6 | /** 7 | * 内容 服务类 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysContentService extends IService { 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/SysDictDetailService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import com.company.project.entity.SysDictDetailEntity; 7 | 8 | /** 9 | * 数据字典 服务类 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | public interface SysDictDetailService extends IService { 16 | 17 | /** 18 | * 分页 19 | * 20 | * @param page page 21 | * @param dictId dictId 22 | * @return IPage 23 | */ 24 | IPage listByPage(Page page, String dictId); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/SysDictService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysDictEntity; 5 | 6 | /** 7 | * 数据字典 服务类 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | public interface SysDictService extends IService { 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/SysFilesService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysFilesEntity; 5 | import org.springframework.web.multipart.MultipartFile; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import java.util.List; 9 | 10 | /** 11 | * 文件上传 服务类 12 | * 13 | * @author wenbin 14 | * @version V1.0 15 | * @date 2020年3月18日 16 | */ 17 | public interface SysFilesService extends IService { 18 | 19 | /** 20 | * 保存图片返回url 21 | * 22 | * @param file 23 | * @param request 24 | * @return 25 | */ 26 | String saveFile(MultipartFile file, HttpServletRequest request); 27 | 28 | /** 29 | * 删除图片 30 | * 31 | * @param ids 32 | */ 33 | void removeByIdsAndFiles(List ids); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/SysRoleDeptService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysRoleDeptEntity; 5 | 6 | /** 7 | * 角色部门 8 | * 9 | * @author wenbin 10 | * @email *****@mail.com 11 | * @date 2020-09-27 17:30:15 12 | */ 13 | public interface SysRoleDeptService extends IService { 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/UserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.company.project.entity.SysUserRole; 5 | import com.company.project.vo.req.UserRoleOperationReqVO; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 用户角色 服务类 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | public interface UserRoleService extends IService { 17 | 18 | /** 19 | * 根据userId获取绑定的角色id 20 | * 21 | * @param userId userId 22 | * @return List 23 | */ 24 | List getRoleIdsByUserId(String userId); 25 | 26 | /** 27 | * 用户绑定角色 28 | * 29 | * @param vo vo 30 | */ 31 | void addUserRoleInfo(UserRoleOperationReqVO vo); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.company.project.entity.SysUser; 6 | import com.company.project.vo.resp.LoginRespVO; 7 | import com.company.project.vo.resp.UserOwnRoleRespVO; 8 | 9 | /** 10 | * 用户 服务类 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | public interface UserService extends IService { 17 | 18 | /** 19 | * 注册 20 | * 21 | * @param vo vo 22 | */ 23 | void register(SysUser vo); 24 | 25 | /** 26 | * 登陆 27 | * 28 | * @param vo vo 29 | * @return LoginRespVO 30 | */ 31 | LoginRespVO login(SysUser vo); 32 | 33 | /** 34 | * 更新用户信息 35 | * 36 | * @param vo vo 37 | */ 38 | void updateUserInfo(SysUser vo); 39 | 40 | /** 41 | * 分页 42 | * 43 | * @param vo vo 44 | * @return IPage 45 | */ 46 | IPage pageInfo(SysUser vo); 47 | 48 | /** 49 | * 添加用户 50 | * 51 | * @param vo vo 52 | */ 53 | void addUser(SysUser vo); 54 | 55 | /** 56 | * 修改密码 57 | * 58 | * @param vo vo 59 | */ 60 | void updatePwd(SysUser vo); 61 | 62 | /** 63 | * 根据userid获取绑定角色 64 | * 65 | * @param userId userId 66 | * @return UserOwnRoleRespVO 67 | */ 68 | UserOwnRoleRespVO getUserOwnRole(String userId); 69 | 70 | /** 71 | * 修改自己信息 72 | * 73 | * @param vo vo 74 | */ 75 | void updateUserInfoMy(SysUser vo); 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/HomeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.company.project.entity.SysDept; 4 | import com.company.project.entity.SysUser; 5 | import com.company.project.service.DeptService; 6 | import com.company.project.service.HomeService; 7 | import com.company.project.service.PermissionService; 8 | import com.company.project.service.UserService; 9 | import com.company.project.vo.resp.HomeRespVO; 10 | import com.company.project.vo.resp.PermissionRespNode; 11 | import com.company.project.vo.resp.UserInfoRespVO; 12 | import org.springframework.beans.BeanUtils; 13 | import org.springframework.stereotype.Service; 14 | 15 | import javax.annotation.Resource; 16 | import java.util.List; 17 | 18 | /** 19 | * 首页 20 | * 21 | * @author wenbin 22 | * @version V1.0 23 | * @date 2020年3月18日 24 | */ 25 | @Service 26 | public class HomeServiceImpl implements HomeService { 27 | @Resource 28 | private UserService userService; 29 | @Resource 30 | private DeptService deptService; 31 | @Resource 32 | private PermissionService permissionService; 33 | 34 | @Override 35 | public HomeRespVO getHomeInfo(String userId) { 36 | 37 | 38 | SysUser sysUser = userService.getById(userId); 39 | UserInfoRespVO vo = new UserInfoRespVO(); 40 | 41 | if (sysUser != null) { 42 | BeanUtils.copyProperties(sysUser, vo); 43 | SysDept sysDept = deptService.getById(sysUser.getDeptId()); 44 | if (sysDept != null) { 45 | vo.setDeptId(sysDept.getId()); 46 | vo.setDeptName(sysDept.getName()); 47 | } 48 | } 49 | 50 | List menus = permissionService.permissionTreeList(userId); 51 | 52 | HomeRespVO respVO = new HomeRespVO(); 53 | respVO.setMenus(menus); 54 | respVO.setUserInfo(vo); 55 | 56 | return respVO; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.company.project.entity.SysLog; 5 | import com.company.project.mapper.SysLogMapper; 6 | import com.company.project.service.LogService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * 系统日志 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | @Service 17 | public class LogServiceImpl extends ServiceImpl implements LogService { 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/RolePermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.company.project.entity.SysRolePermission; 6 | import com.company.project.mapper.SysRolePermissionMapper; 7 | import com.company.project.service.RolePermissionService; 8 | import com.company.project.vo.req.RolePermissionOperationReqVO; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * 角色权限关联 16 | * 17 | * @author wenbin 18 | * @version V1.0 19 | * @date 2020年3月18日 20 | */ 21 | @Service 22 | public class RolePermissionServiceImpl extends ServiceImpl implements RolePermissionService { 23 | @Override 24 | public void addRolePermission(RolePermissionOperationReqVO vo) { 25 | List list = new ArrayList<>(); 26 | for (String permissionId : vo.getPermissionIds()) { 27 | SysRolePermission sysRolePermission = new SysRolePermission(); 28 | sysRolePermission.setPermissionId(permissionId); 29 | sysRolePermission.setRoleId(vo.getRoleId()); 30 | list.add(sysRolePermission); 31 | } 32 | this.remove(Wrappers.lambdaQuery().eq(SysRolePermission::getRoleId, vo.getRoleId())); 33 | this.saveBatch(list); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/SysContentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.company.project.entity.SysContentEntity; 5 | import com.company.project.mapper.SysContentMapper; 6 | import com.company.project.service.SysContentService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * 内容 服务类 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | @Service("sysContentService") 17 | public class SysContentServiceImpl extends ServiceImpl implements SysContentService { 18 | 19 | 20 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/SysDictDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import com.company.project.common.exception.BusinessException; 9 | import com.company.project.entity.SysDictDetailEntity; 10 | import com.company.project.entity.SysDictEntity; 11 | import com.company.project.mapper.SysDictDetailMapper; 12 | import com.company.project.mapper.SysDictMapper; 13 | import com.company.project.service.SysDictDetailService; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.util.CollectionUtils; 16 | 17 | import javax.annotation.Resource; 18 | 19 | /** 20 | * 数据字典 服务类 21 | * 22 | * @author wenbin 23 | * @version V1.0 24 | * @date 2020年3月18日 25 | */ 26 | @Service("sysDictDetailService") 27 | public class SysDictDetailServiceImpl extends ServiceImpl implements SysDictDetailService { 28 | @Resource 29 | private SysDictDetailMapper sysDictDetailMapper; 30 | @Resource 31 | private SysDictMapper sysDictMapper; 32 | 33 | 34 | @Override 35 | public IPage listByPage(Page page, String dictId) { 36 | 37 | SysDictEntity sysDictEntity = sysDictMapper.selectById(dictId); 38 | if (sysDictEntity == null) { 39 | throw new BusinessException("获取字典数据失败!"); 40 | } 41 | 42 | LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); 43 | wrapper.eq(SysDictDetailEntity::getDictId, dictId); 44 | wrapper.orderByAsc(SysDictDetailEntity::getSort); 45 | IPage result = sysDictDetailMapper.selectPage(page, wrapper); 46 | if (!CollectionUtils.isEmpty(result.getRecords())) { 47 | result.getRecords().stream().forEach(entity -> entity.setDictName(sysDictEntity.getName())); 48 | } 49 | return result; 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/SysDictServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONArray; 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.company.project.entity.SysDictDetailEntity; 8 | import com.company.project.entity.SysDictEntity; 9 | import com.company.project.mapper.SysDictDetailMapper; 10 | import com.company.project.mapper.SysDictMapper; 11 | import com.company.project.service.SysDictService; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.util.StringUtils; 14 | 15 | import javax.annotation.Resource; 16 | import java.util.List; 17 | 18 | /** 19 | * 数据字典 服务类 20 | * 21 | * @author wenbin 22 | * @version V1.0 23 | * @date 2020年3月18日 24 | */ 25 | @Service("sysDictService") 26 | public class SysDictServiceImpl extends ServiceImpl implements SysDictService { 27 | 28 | @Resource 29 | private SysDictDetailMapper sysDictDetailMapper; 30 | 31 | /** 32 | * 根据字典类型查询字典数据信息 33 | * 34 | * @param name 字典名称 35 | * @return 参数键值 36 | **/ 37 | public JSONArray getType(String name) { 38 | if (StringUtils.isEmpty(name)) { 39 | return new JSONArray(); 40 | } 41 | //根据名称获取字典 42 | SysDictEntity dict = this.getOne(Wrappers.lambdaQuery().eq(SysDictEntity::getName, name)); 43 | if (dict == null || dict.getId() == null) { 44 | return new JSONArray(); 45 | } 46 | //获取明细 47 | List list = sysDictDetailMapper.selectList(Wrappers.lambdaQuery().eq(SysDictDetailEntity::getDictId, dict.getId())); 48 | return JSONArray.parseArray(JSON.toJSONString(list)); 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/SysGeneratorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.company.project.common.utils.GenUtils; 6 | import com.company.project.entity.SysGenerator; 7 | import com.company.project.mapper.GeneratorMapper; 8 | import com.company.project.service.ISysGeneratorService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.apache.commons.io.IOUtils; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.io.ByteArrayOutputStream; 14 | import java.util.List; 15 | import java.util.Map; 16 | import java.util.zip.ZipOutputStream; 17 | 18 | /** 19 | * 代码生成 20 | * 21 | * @author wenbin 22 | * @version V1.0 23 | * @date 2020年3月18日 24 | */ 25 | @Service 26 | @Slf4j 27 | public class SysGeneratorServiceImpl implements ISysGeneratorService { 28 | private final GeneratorMapper generatorMapper; 29 | 30 | public SysGeneratorServiceImpl(GeneratorMapper generatorMapper) { 31 | this.generatorMapper = generatorMapper; 32 | } 33 | 34 | @Override 35 | public IPage selectAllTables(Page page, SysGenerator vo) { 36 | return generatorMapper.selectAllTables(page, vo); 37 | } 38 | 39 | @Override 40 | public byte[] generatorCode(String[] tableNames) { 41 | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); 42 | ZipOutputStream zip = new ZipOutputStream(outputStream); 43 | 44 | for (String tableName : tableNames) { 45 | //查询表信息 46 | Map table = queryTable(tableName); 47 | //查询列信息 48 | List> columns = queryColumns(tableName); 49 | //生成代码 50 | GenUtils.generatorCode(table, columns, zip); 51 | } 52 | IOUtils.closeQuietly(zip); 53 | return outputStream.toByteArray(); 54 | } 55 | 56 | public Map queryTable(String tableName) { 57 | return generatorMapper.queryTable(tableName); 58 | } 59 | 60 | public List> queryColumns(String tableName) { 61 | return generatorMapper.queryColumns(tableName); 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/SysRoleDeptServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.company.project.entity.SysRoleDeptEntity; 5 | import com.company.project.mapper.SysRoleDeptMapper; 6 | import com.company.project.service.SysRoleDeptService; 7 | import org.springframework.stereotype.Service; 8 | 9 | 10 | @Service("sysRoleDeptService") 11 | public class SysRoleDeptServiceImpl extends ServiceImpl implements SysRoleDeptService { 12 | 13 | 14 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/service/impl/UserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.company.project.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.company.project.entity.SysUserRole; 8 | import com.company.project.mapper.SysUserRoleMapper; 9 | import com.company.project.service.UserRoleService; 10 | import com.company.project.vo.req.UserRoleOperationReqVO; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import javax.annotation.Resource; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 用户角色 服务类 20 | * 21 | * @author wenbin 22 | * @version V1.0 23 | * @date 2020年3月18日 24 | */ 25 | @Service 26 | public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { 27 | @Resource 28 | private SysUserRoleMapper sysUserRoleMapper; 29 | 30 | @Override 31 | public List getRoleIdsByUserId(String userId) { 32 | LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery().select(SysUserRole::getRoleId).eq(SysUserRole::getUserId, userId); 33 | return sysUserRoleMapper.selectObjs(queryWrapper); 34 | } 35 | 36 | @Transactional(rollbackFor = Exception.class) 37 | @Override 38 | public void addUserRoleInfo(UserRoleOperationReqVO vo) { 39 | if (CollectionUtils.isEmpty(vo.getRoleIds())) { 40 | return; 41 | } 42 | List list = new ArrayList<>(); 43 | for (String roleId : vo.getRoleIds()) { 44 | SysUserRole sysUserRole = new SysUserRole(); 45 | sysUserRole.setUserId(vo.getUserId()); 46 | sysUserRole.setRoleId(roleId); 47 | list.add(sysUserRole); 48 | } 49 | sysUserRoleMapper.delete(Wrappers.lambdaQuery().eq(SysUserRole::getUserId, vo.getUserId())); 50 | //批量插入 51 | this.saveBatch(list); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/req/RolePermissionOperationReqVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotEmpty; 8 | import java.util.List; 9 | 10 | /** 11 | * RolePermissionOperationReqVO 12 | * 13 | * @author wenbin 14 | * @version V1.0 15 | * @date 2020年3月18日 16 | */ 17 | @Data 18 | public class RolePermissionOperationReqVO { 19 | @ApiModelProperty(value = "角色id") 20 | @NotBlank(message = "角色id不能为空") 21 | private String roleId; 22 | @ApiModelProperty(value = "菜单权限集合") 23 | @NotEmpty(message = "菜单权限集合不能为空") 24 | private List permissionIds; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/req/UserRoleOperationReqVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotEmpty; 8 | import java.util.List; 9 | 10 | /** 11 | * UserRoleOperationReqVO 12 | * 13 | * @author wenbin 14 | * @version V1.0 15 | * @date 2020年3月18日 16 | */ 17 | @Data 18 | public class UserRoleOperationReqVO { 19 | @ApiModelProperty(value = "用户id") 20 | @NotBlank(message = "用户id不能为空") 21 | private String userId; 22 | @ApiModelProperty(value = "角色id集合") 23 | @NotEmpty(message = "角色id集合不能为空") 24 | private List roleIds; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/DeptRespNodeVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * DeptRespNodeVO 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | @Data 16 | public class DeptRespNodeVO { 17 | @ApiModelProperty(value = "组织id") 18 | private String id; 19 | 20 | @ApiModelProperty(value = "组织编码") 21 | private String deptNo; 22 | 23 | @ApiModelProperty(value = "组织名称") 24 | private String title; 25 | 26 | @ApiModelProperty(value = "组织名称") 27 | private String label; 28 | 29 | @ApiModelProperty(value = "组织父级id") 30 | private String pid; 31 | 32 | @ApiModelProperty(value = "组织状态") 33 | private Integer status; 34 | 35 | @ApiModelProperty(value = "组织关系id") 36 | private String relationCode; 37 | 38 | @ApiModelProperty(value = "是否展开 默认不展开(false)") 39 | private boolean spread = true; 40 | 41 | @ApiModelProperty(value = "是否选中") 42 | private boolean checked = false; 43 | 44 | private boolean disabled = false; 45 | 46 | @ApiModelProperty(value = "子集") 47 | private List children; 48 | 49 | public String getLabel() { 50 | return title; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/HomeRespVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * HomeRespVO 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | @Data 16 | public class HomeRespVO { 17 | @ApiModelProperty(value = "用户信息") 18 | private UserInfoRespVO userInfo; 19 | @ApiModelProperty(value = "目录菜单") 20 | private List menus; 21 | 22 | } -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/LoginRespVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * LoginRespVO 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | @Data 16 | public class LoginRespVO { 17 | @ApiModelProperty(value = "token") 18 | private String accessToken; 19 | @ApiModelProperty(value = "用户名") 20 | private String username; 21 | @ApiModelProperty(value = "用户id") 22 | private String id; 23 | @ApiModelProperty(value = "电话") 24 | private String phone; 25 | @ApiModelProperty(value = "用户所拥有的菜单权限(前后端分离返回给前端控制菜单和按钮的显示和隐藏)") 26 | private List list; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/PermissionRespNode.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * PermissionRespNode 10 | * 11 | * @author wenbin 12 | * @version V1.0 13 | * @date 2020年3月18日 14 | */ 15 | @Data 16 | public class PermissionRespNode { 17 | @ApiModelProperty(value = "id") 18 | private String id; 19 | @ApiModelProperty(value = "菜单权限名称") 20 | private String title; 21 | 22 | @ApiModelProperty(value = "菜单权限标识,shiro 适配restful") 23 | private String perms; 24 | 25 | @ApiModelProperty(value = "接口地址") 26 | private String url; 27 | 28 | @ApiModelProperty(value = "icon") 29 | private String icon; 30 | 31 | private String target; 32 | 33 | @ApiModelProperty(value = "父级id") 34 | private String pid; 35 | 36 | @ApiModelProperty(value = "父级名称") 37 | private String pidName; 38 | 39 | @ApiModelProperty(value = "菜单权限类型(1:目录;2:菜单;3:按钮)") 40 | private Integer type; 41 | 42 | @ApiModelProperty(value = "排序码") 43 | private Integer orderNum; 44 | 45 | @ApiModelProperty(value = "是否展开 默认不展开(false)") 46 | private boolean spread = true; 47 | 48 | @ApiModelProperty(value = "是否选中 默认false") 49 | private boolean checked; 50 | private List children; 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/UserInfoRespVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * UserInfoRespVO 8 | * 9 | * @author wenbin 10 | * @version V1.0 11 | * @date 2020年3月18日 12 | */ 13 | @Data 14 | public class UserInfoRespVO { 15 | @ApiModelProperty(value = "用户id") 16 | private String id; 17 | @ApiModelProperty(value = "账号") 18 | private String username; 19 | @ApiModelProperty(value = "手机号") 20 | private String phone; 21 | @ApiModelProperty(value = "昵称") 22 | private String nickName; 23 | @ApiModelProperty(value = "真实姓名") 24 | private String realName; 25 | @ApiModelProperty(value = "所属机构id") 26 | private String deptId; 27 | @ApiModelProperty(value = "所属机构名称") 28 | private String deptName; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/company/project/vo/resp/UserOwnRoleRespVO.java: -------------------------------------------------------------------------------- 1 | package com.company.project.vo.resp; 2 | 3 | import com.company.project.entity.SysRole; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * UserOwnRoleRespVO 11 | * 12 | * @author wenbin 13 | * @version V1.0 14 | * @date 2020年3月18日 15 | */ 16 | @Data 17 | public class UserOwnRoleRespVO { 18 | @ApiModelProperty("所有角色集合") 19 | private List allRole; 20 | @ApiModelProperty(value = "用户所拥有角色集合") 21 | private List ownRoles; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | # 开发环境配置 2 | spring: 3 | thymeleaf: 4 | cache: false 5 | datasource: 6 | dynamic: 7 | primary: master #设置默认的数据源或者数据源组,默认值即为master 8 | datasource: 9 | master: 10 | username: root 11 | password: Lwb123456 12 | driver-class-name: com.mysql.cj.jdbc.Driver 13 | url: jdbc:mysql://1.94.23.145:3306/company_project?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 14 | oracle: 15 | username: root 16 | password: 123456 17 | driver-class-name: oracle.jdbc.driver.OracleDriver 18 | url: jdbc:oracle:thin:@localhost:1521/company_project 19 | sqlServer: 20 | username: sa 21 | password: 123456 22 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 23 | url: jdbc:sqlserver://localhost:1433;databaseName=company_project 24 | 25 | file: 26 | #文件上传目录 绝对路径 末尾不需要加 / 27 | path: D:/files #windows 28 | #path: /data/files #linux 29 | -------------------------------------------------------------------------------- /src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | # 生产环境配置 2 | spring: 3 | thymeleaf: 4 | cache: false 5 | datasource: 6 | dynamic: 7 | primary: master #设置默认的数据源或者数据源组,默认值即为master 8 | datasource: 9 | master: 10 | username: root 11 | password: 123456 12 | driver-class-name: com.mysql.cj.jdbc.Driver 13 | url: jdbc:mysql://localhost:3306/company_project?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 14 | oracle: 15 | username: root 16 | password: 123456 17 | driver-class-name: oracle.jdbc.driver.OracleDriver 18 | url: jdbc:oracle:thin:@localhost:1521/company_project 19 | sqlServer: 20 | username: sa 21 | password: 123456 22 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 23 | url: jdbc:sqlserver://localhost:1433;databaseName=company_project 24 | 25 | file: 26 | #文件上传目录 绝对路径 末尾请加 / 27 | path: F:/files/ #windows 28 | #path: /data/files/ #linux 29 | knife4j: 30 | production: true #生成环境禁用查看文档 -------------------------------------------------------------------------------- /src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | # 开发环境配置 2 | spring: 3 | thymeleaf: 4 | cache: false 5 | datasource: 6 | dynamic: 7 | primary: master #设置默认的数据源或者数据源组,默认值即为master 8 | datasource: 9 | master: 10 | username: root 11 | password: 123456 12 | driver-class-name: com.mysql.cj.jdbc.Driver 13 | url: jdbc:mysql://localhost:3306/company_project?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 14 | oracle: 15 | username: root 16 | password: 123456 17 | driver-class-name: oracle.jdbc.driver.OracleDriver 18 | url: jdbc:oracle:thin:@localhost:1521/company_project 19 | sqlServer: 20 | username: sa 21 | password: 123456 22 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 23 | url: jdbc:sqlserver://localhost:1433;databaseName=company_project 24 | 25 | file: 26 | #文件上传目录 绝对路径 末尾请加 / 27 | path: F:/files/ #windows 28 | #path: /data/files/ #linux 29 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 端口 2 | server: 3 | port: 8080 4 | servlet: 5 | context-path: /manager 6 | 7 | spring: 8 | profiles: 9 | active: dev 10 | mvc: 11 | throw-exception-if-no-handler-found: true 12 | resources: 13 | add-mappings: false 14 | application: 15 | name: springboot-manager 16 | jackson: 17 | date-format: yyyy-MM-dd HH:mm:ss 18 | time-zone: GMT+8 19 | # 文件大小限制 20 | servlet: 21 | multipart: 22 | max-file-size: 10MB 23 | max-request-size: 100MB 24 | 25 | mybatis-plus: 26 | configuration: 27 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 28 | mapper-locations: classpath:mapper/${project.database}/**/*.xml,classpath:mapper/*.xml 29 | global-config: 30 | db-config: 31 | logic-delete-value: 0 32 | logic-not-delete-value: 1 33 | logic-delete-field: deleted 34 | 35 | ############## Sa-Token 配置 (文档: https://sa-token.cc) ############## 36 | sa-token: 37 | # token 名称(同时也是 cookie 名称) 38 | token-name: satoken 39 | # token 有效期(单位:秒) 默认30天,-1 代表永久有效 40 | timeout: 2592000 41 | # token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 42 | active-timeout: -1 43 | # 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) 44 | is-concurrent: true 45 | # 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token) 46 | is-share: true 47 | # token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) 48 | token-style: uuid 49 | # 是否输出操作日志 50 | is-log: true 51 | 52 | #使用代码生成模块时 指定要生成的表存在于哪种数据库,可选值有【mysql、oracle、sqlServer】 53 | project: 54 | database: mysql 55 | 56 | -------------------------------------------------------------------------------- /src/main/resources/generator.properties: -------------------------------------------------------------------------------- 1 | #\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F 2 | 3 | mainPath=com.company 4 | #\u5305\u540D 5 | package=com.company.project 6 | #\u4F5C\u8005 7 | author=wenbin 8 | #Email 9 | email=*****@mail.com 10 | #表前缀 11 | tablePrefix= 12 | 13 | #\u7C7B\u578B\u8F6C\u6362\uFF0C\u914D\u7F6E\u4FE1\u606F 14 | tinyint=Integer 15 | smallint=Integer 16 | mediumint=Integer 17 | int=Integer 18 | integer=Integer 19 | bigint=Long 20 | float=Float 21 | double=Double 22 | decimal=BigDecimal 23 | bit=Boolean 24 | 25 | char=String 26 | varchar=String 27 | tinytext=String 28 | text=String 29 | mediumtext=String 30 | longtext=String 31 | 32 | date=Date 33 | datetime=Date 34 | timestamp=Date 35 | 36 | NUMBER=Integer 37 | INT=Integer 38 | INTEGER=Integer 39 | BINARY_INTEGER=Integer 40 | LONG=String 41 | FLOAT=Float 42 | BINARY_FLOAT=Float 43 | DOUBLE=Double 44 | BINARY_DOUBLE=Double 45 | DECIMAL=BigDecimal 46 | CHAR=String 47 | VARCHAR=String 48 | VARCHAR2=String 49 | NVARCHAR=String 50 | NVARCHAR2=String 51 | CLOB=String 52 | BLOB=String 53 | DATE=Date 54 | DATETIME=Date 55 | TIMESTAMP=Date 56 | TIMESTAMP(6)=Date 57 | 58 | int8=Long 59 | int4=Integer 60 | int2=Integer 61 | numeric=BigDecimal -------------------------------------------------------------------------------- /src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ${CONSOLE_LOG_PATTERN} 15 | 16 | 17 | 18 | 19 | 20 | 21 | ${LOG_PATH}/${LOG_FILE} 22 | 23 | ${FILE_LOG_PATTERN} 24 | 25 | 26 | ${LOG_PATH}/${LOG_HISTORY} 27 | 30 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 500 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/SysGeneratorMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | id, table_name, menu_name, pid, gen_time 8 | 9 | 10 | 28 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/static/css/403.css: -------------------------------------------------------------------------------- 1 | #banner { 2 | background: url("images/403.png") no-repeat; 3 | background-size: 100%; 4 | overflow: hidden; 5 | } 6 | 7 | h1 { 8 | font-size: 40px; 9 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/404.css: -------------------------------------------------------------------------------- 1 | #banner { 2 | background: url("images/404.png") no-repeat; 3 | background-size: 100%; 4 | overflow: hidden; 5 | } 6 | 7 | h1 { 8 | font-size: 40px; 9 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/500.css: -------------------------------------------------------------------------------- 1 | #banner { 2 | background: url("images/500.png") no-repeat; 3 | background-size: 100%; 4 | overflow: hidden; 5 | } 6 | 7 | h1 { 8 | font-size: 40px; 9 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/custom.form.css: -------------------------------------------------------------------------------- 1 | .panel-heading{ 2 | padding:10px 10px; 3 | border-bottom:1px solid transparent; 4 | border-radius:2px 2px 0 0; 5 | font-size:14px; 6 | background: #eeeeee 7 | } 8 | .panel{ 9 | margin-bottom:20px; 10 | background-color:#fff; 11 | border:1px solid transparent; 12 | border-radius:4px; 13 | -webkit-box-shadow:0 1px 1px rgba(0,0,0,.05); 14 | box-shadow:0 1px 1px rgba(0,0,0,.05) 15 | } 16 | .panel-default{ 17 | border-color:#ddd; 18 | } 19 | 20 | .layui-input, .layui-textarea { 21 | display: block; 22 | width: 96%; 23 | padding-left: 10px; 24 | } 25 | 26 | .layui-form-pane .layui-form-label { 27 | width: 125px; 28 | padding: 8px 15px; 29 | height: 38px; 30 | line-height: 20px; 31 | border-width: 1px; 32 | border-style: solid; 33 | border-radius: 2px 0 0 2px; 34 | text-align: center; 35 | background-color: #FBFBFB; 36 | overflow: hidden; 37 | box-sizing: border-box; 38 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/home.css: -------------------------------------------------------------------------------- 1 | .layui-tab-title .layui-this { 2 | background-color: #009688; 3 | color: #eee; 4 | } 5 | 6 | .first-tab i.layui-tab-close { 7 | display: none !important; 8 | } 9 | 10 | .layui-layout-admin .layui-header { 11 | background-color: #1aa094 !important; 12 | } 13 | 14 | .layui-layout-admin .layui-logo { 15 | background-color: #0c0c0c !important; 16 | } 17 | 18 | .layuimini-color .color-title { 19 | padding: 10px 0 10px 20px; 20 | border-bottom: 1px solid #d9dada; 21 | margin-bottom: 8px; 22 | } 23 | 24 | .layuimini-color .color-content { 25 | padding: 0 5px 0 5px; 26 | } 27 | 28 | .layuimini-color .color-content ul { 29 | list-style: none; 30 | text-align: center; 31 | } 32 | 33 | .layuimini-color .color-content ul li { 34 | position: relative; 35 | display: inline-block; 36 | vertical-align: top; 37 | width: 80px; 38 | height: 50px; 39 | margin: 0 15px 15px 0; 40 | padding: 2px 2px 4px 2px; 41 | background-color: #f2f2f2; 42 | cursor: pointer; 43 | font-size: 12px; 44 | color: #666; 45 | } 46 | 47 | .layuimini-color .color-content li.layui-this:after, .layuimini-color .color-content li:hover:after { 48 | width: 100%; 49 | height: 100%; 50 | padding: 4px; 51 | top: -5px; 52 | left: -5px; 53 | border-color: #d8d8d8; 54 | opacity: 1; 55 | } 56 | 57 | .layuimini-color .color-content li:after { 58 | content: ''; 59 | position: absolute; 60 | z-index: 20; 61 | top: 50%; 62 | left: 50%; 63 | width: 1px; 64 | height: 0; 65 | border: 1px solid #f2f2f2; 66 | transition: all .3s; 67 | -webkit-transition: all .3s; 68 | opacity: 0; 69 | } 70 | 71 | .layuimini-tool-left { 72 | position: absolute !important; 73 | top: 0; 74 | left: 200px; 75 | width: 60px; 76 | height: 100%; 77 | line-height: 60px; 78 | text-align: center; 79 | color: #ffffff !important; 80 | } 81 | 82 | .closeBox { 83 | height: 35px !important; 84 | } 85 | 86 | .closeBox > li { 87 | line-height: 35px !important; 88 | } 89 | 90 | .closeBox { 91 | position: absolute; 92 | right: -10px; 93 | top: 16px; 94 | background-color: #fff !important; 95 | color: #000; 96 | border-bottom: 1px solid #e2e2e2; 97 | padding: 0 10px !important; 98 | } 99 | 100 | .closeBox .layui-nav-item { 101 | line-height: 40px; 102 | } 103 | 104 | .closeBox .layui-nav-item > a, .closeBox .layui-nav-item > a:hover { 105 | color: #000; 106 | } 107 | 108 | .closeBox .layui-nav-child { 109 | top: 40px; 110 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/images/403.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aitangbao/springboot-manager/afac0f99d9f17f58ae7c2ccafb2fa98fa3302f59/src/main/resources/static/css/images/403.png -------------------------------------------------------------------------------- /src/main/resources/static/css/images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aitangbao/springboot-manager/afac0f99d9f17f58ae7c2ccafb2fa98fa3302f59/src/main/resources/static/css/images/404.png -------------------------------------------------------------------------------- /src/main/resources/static/css/images/500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aitangbao/springboot-manager/afac0f99d9f17f58ae7c2ccafb2fa98fa3302f59/src/main/resources/static/css/images/500.png -------------------------------------------------------------------------------- /src/main/resources/static/css/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aitangbao/springboot-manager/afac0f99d9f17f58ae7c2ccafb2fa98fa3302f59/src/main/resources/static/css/images/bg.jpg -------------------------------------------------------------------------------- /src/main/resources/static/css/login.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | width: 100%; 3 | height: 100%; 4 | overflow: hidden 5 | } 6 | 7 | body { 8 | background: #1E9FFF; 9 | } 10 | 11 | body:after { 12 | content: ''; 13 | background-repeat: no-repeat; 14 | background-size: cover; 15 | -webkit-filter: blur(3px); 16 | -moz-filter: blur(3px); 17 | -o-filter: blur(3px); 18 | -ms-filter: blur(3px); 19 | filter: blur(3px); 20 | position: absolute; 21 | top: 0; 22 | left: 0; 23 | right: 0; 24 | bottom: 0; 25 | z-index: -1; 26 | } 27 | 28 | .layui-container { 29 | width: 100%; 30 | height: 100%; 31 | overflow: hidden 32 | } 33 | 34 | .admin-login-background { 35 | width: 360px; 36 | height: 300px; 37 | position: absolute; 38 | left: 50%; 39 | top: 40%; 40 | margin-left: -180px; 41 | margin-top: -100px; 42 | } 43 | 44 | .logo-title { 45 | text-align: center; 46 | letter-spacing: 2px; 47 | padding: 14px 0; 48 | } 49 | 50 | .logo-title h1 { 51 | color: #1E9FFF; 52 | font-size: 25px; 53 | font-weight: bold; 54 | } 55 | 56 | .login-form { 57 | background-color: #fff; 58 | border: 1px solid #fff; 59 | border-radius: 3px; 60 | padding: 14px 20px; 61 | box-shadow: 0 0 8px #eeeeee; 62 | } 63 | 64 | .login-form .layui-form-item { 65 | position: relative; 66 | } 67 | 68 | .login-form .layui-form-item label { 69 | position: absolute; 70 | left: 1px; 71 | top: 1px; 72 | width: 38px; 73 | line-height: 36px; 74 | text-align: center; 75 | color: #d2d2d2; 76 | } 77 | 78 | .login-form .layui-form-item input { 79 | padding-left: 36px; 80 | } 81 | 82 | .captcha { 83 | width: 60%; 84 | display: inline-block; 85 | } 86 | 87 | .captcha-img { 88 | display: inline-block; 89 | width: 34%; 90 | float: right; 91 | } 92 | 93 | .captcha-img img { 94 | height: 34px; 95 | border: 1px solid #e6e6e6; 96 | height: 36px; 97 | width: 100%; 98 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/login2.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url("images/bg.jpg"); 3 | height: 100%; 4 | width: 100% 5 | } 6 | 7 | #container { 8 | height: 100%; 9 | width: 100% 10 | } 11 | 12 | input:-webkit-autofill { 13 | -webkit-box-shadow: inset 0 0 0 1000px #fff; 14 | background-color: transparent 15 | } 16 | 17 | .admin-login-background { 18 | width: 300px; 19 | height: 300px; 20 | position: absolute; 21 | left: 50%; 22 | top: 40%; 23 | margin-left: -150px; 24 | margin-top: -100px 25 | } 26 | 27 | .admin-header { 28 | text-align: center; 29 | margin-bottom: 20px; 30 | color: #ffffff; 31 | font-weight: bold; 32 | font-size: 40px 33 | } 34 | 35 | .admin-input { 36 | border-top-style: none; 37 | border-right-style: solid; 38 | border-bottom-style: solid; 39 | border-left-style: solid; 40 | height: 50px; 41 | width: 300px; 42 | padding-bottom: 0px 43 | } 44 | 45 | .admin-input::-webkit-input-placeholder { 46 | color: #a78369 47 | } 48 | 49 | .layui-icon-username { 50 | color: #a78369 !important 51 | } 52 | 53 | .layui-icon-username:hover { 54 | color: #9dadce !important 55 | } 56 | 57 | .layui-icon-password { 58 | color: #a78369 !important 59 | } 60 | 61 | .layui-icon-password:hover { 62 | color: #9dadce !important 63 | } 64 | 65 | .admin-input-username { 66 | border-top-style: solid; 67 | border-radius: 10px 10px 0 0 68 | } 69 | 70 | .admin-input-verify { 71 | border-radius: 0 0 10px 10px 72 | } 73 | 74 | .admin-button { 75 | margin-top: 20px; 76 | font-weight: bold; 77 | font-size: 18px; 78 | width: 300px; 79 | height: 50px; 80 | border-radius: 5px; 81 | background-color: #a78369; 82 | border: 1px solid #d8b29f 83 | } 84 | 85 | .admin-icon { 86 | margin-left: 260px; 87 | margin-top: 10px; 88 | font-size: 30px 89 | } 90 | 91 | i { 92 | position: absolute 93 | } 94 | 95 | .admin-captcha { 96 | position: absolute; 97 | margin-left: 205px; 98 | margin-top: -45px 99 | } -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/langs/readme.md: -------------------------------------------------------------------------------- 1 | This is where language files should be placed. 2 | 3 | Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ 4 | -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/autolink/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.4.2 (2020-08-17) 8 | */ 9 | !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=tinymce.util.Tools.resolve("tinymce.Env"),o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;nv(e)&&(s=l+f);var c=e.getParam("max_height",0,"number");if(c&&c'); 17 | }); 18 | }; 19 | 20 | var register$1 = function (editor) { 21 | editor.ui.registry.addButton('hr', { 22 | icon: 'horizontal-rule', 23 | tooltip: 'Horizontal line', 24 | onAction: function () { 25 | return editor.execCommand('InsertHorizontalRule'); 26 | } 27 | }); 28 | editor.ui.registry.addMenuItem('hr', { 29 | icon: 'horizontal-rule', 30 | text: 'Horizontal line', 31 | onAction: function () { 32 | return editor.execCommand('InsertHorizontalRule'); 33 | } 34 | }); 35 | }; 36 | 37 | function Plugin () { 38 | global.add('hr', function (editor) { 39 | register(editor); 40 | register$1(editor); 41 | }); 42 | } 43 | 44 | Plugin(); 45 | 46 | }()); 47 | -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/hr/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.4.2 (2020-08-17) 8 | */ 9 | !function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager");!function o(){n.add("hr",function(n){var o,t;(o=n).addCommand("InsertHorizontalRule",function(){o.execCommand("mceInsertContent",!1,"
")}),(t=n).ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:function(){return t.execCommand("InsertHorizontalRule")}}),t.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:function(){return t.execCommand("InsertHorizontalRule")}})})}()}(); -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/indent2em/plugin.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add('indent2em', function(editor, url) { 2 | var pluginName='首行缩进'; 3 | var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); 4 | var indent2em_val = editor.getParam('indent2em_val', '2em'); 5 | var doAct = function () { 6 | var dom = editor.dom; 7 | var blocks = editor.selection.getSelectedBlocks(); 8 | var act = ''; 9 | global$1.each(blocks, function (block) { 10 | if(act==''){ 11 | act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add'; 12 | } 13 | if( act=='add' ){ 14 | dom.setStyle(block, 'text-indent', indent2em_val); 15 | }else{ 16 | var style=dom.getAttrib(block,'style'); 17 | var reg = new RegExp('text-indent:[\\s]*' + indent2em_val + ';', 'ig'); 18 | style = style.replace(reg, ''); 19 | dom.setAttrib(block,'style',style); 20 | } 21 | 22 | }); 23 | }; 24 | 25 | editor.ui.registry.getAll().icons.indent2em || editor.ui.registry.addIcon('indent2em',''); 26 | 27 | var stateSelectorAdapter = function (editor, selector) { 28 | return function (buttonApi) { 29 | return editor.selection.selectorChangedWithUnbind(selector.join(','), buttonApi.setActive).unbind; 30 | }; 31 | }; 32 | 33 | editor.ui.registry.addToggleButton('indent2em', { 34 | icon: 'indent2em', 35 | tooltip: pluginName, 36 | onAction: function () { 37 | doAct(); 38 | }, 39 | onSetup: stateSelectorAdapter(editor, [ 40 | '*[style*="text-indent"]', 41 | '*[data-mce-style*="text-indent"]', 42 | ]) 43 | }); 44 | 45 | editor.ui.registry.addMenuItem('indent2em', { 46 | text: pluginName, 47 | onAction: function() { 48 | doAct(); 49 | } 50 | }); 51 | 52 | editor.addCommand('indent2em', doAct ); 53 | 54 | return { 55 | getMetadata: function () { 56 | return { 57 | name: pluginName, 58 | url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php", 59 | }; 60 | } 61 | }; 62 | }); 63 | -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/indent2em/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add('indent2em', function(editor, url) { 2 | var pluginName='首行缩进'; 3 | var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); 4 | var indent2em_val = editor.getParam('indent2em_val', '2em'); 5 | var doAct = function () { 6 | var dom = editor.dom; 7 | var blocks = editor.selection.getSelectedBlocks(); 8 | var act = ''; 9 | global$1.each(blocks, function (block) { 10 | if(act==''){ 11 | act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add'; 12 | } 13 | if( act=='add' ){ 14 | dom.setStyle(block, 'text-indent', indent2em_val); 15 | }else{ 16 | var style=dom.getAttrib(block,'style'); 17 | var reg = new RegExp('text-indent:[\\s]*' + indent2em_val + ';', 'ig'); 18 | style = style.replace(reg, ''); 19 | dom.setAttrib(block,'style',style); 20 | } 21 | 22 | }); 23 | }; 24 | 25 | editor.ui.registry.getAll().icons.indent2em || editor.ui.registry.addIcon('indent2em',''); 26 | 27 | var stateSelectorAdapter = function (editor, selector) { 28 | return function (buttonApi) { 29 | return editor.selection.selectorChangedWithUnbind(selector.join(','), buttonApi.setActive).unbind; 30 | }; 31 | }; 32 | 33 | editor.ui.registry.addToggleButton('indent2em', { 34 | icon: 'indent2em', 35 | tooltip: pluginName, 36 | onAction: function () { 37 | doAct(); 38 | }, 39 | onSetup: stateSelectorAdapter(editor, [ 40 | '*[style*="text-indent"]', 41 | '*[data-mce-style*="text-indent"]', 42 | ]) 43 | }); 44 | 45 | editor.ui.registry.addMenuItem('indent2em', { 46 | text: pluginName, 47 | onAction: function() { 48 | doAct(); 49 | } 50 | }); 51 | 52 | editor.addCommand('indent2em', doAct ); 53 | 54 | return { 55 | getMetadata: function () { 56 | return { 57 | name: pluginName, 58 | url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php", 59 | }; 60 | } 61 | }; 62 | }); 63 | -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/nonbreaking/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.4.2 (2020-08-17) 8 | */ 9 | !function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){for(var a="",o=0;o'+i(" ",e)+"":i(" ",e);n.undoManager.transact(function(){return n.insertContent(o)})},c=tinymce.util.Tools.resolve("tinymce.util.VK");!function e(){n.add("nonbreaking",function(n){var e,a,o,i,t;(e=n).addCommand("mceNonBreaking",function(){r(e,1)}),(a=n).ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:function(){return a.execCommand("mceNonBreaking")}}),a.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:function(){return a.execCommand("mceNonBreaking")}}),0<(t="boolean"==typeof(i=(o=n).getParam("nonbreaking_force_tab",0))?!0===i?3:0:i)&&o.on("keydown",function(n){if(n.keyCode===c.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),r(o,t)}})})}()}(); -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/noneditable/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.4.2 (2020-08-17) 8 | */ 9 | !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Tools"),u=function(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")},f=function(n){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(n)}},s=function(i,o,c){return function(t){var n=arguments,e=n[n.length-2],r=0"===r){var a=o.lastIndexOf("<",e);if(-1!==a)if(-1!==o.substring(a,e).indexOf('contenteditable="false"'))return t}return''+i.dom.encode("string"==typeof n[1]?n[1]:n[0])+""}},n=function(n){var t,r="contenteditable",e=" "+l.trim(n.getParam("noneditable_editable_class","mceEditable"))+" ",a=" "+l.trim(u(n))+" ",i=f(e),o=f(a),c=(t=n.getParam("noneditable_regexp",[]))&&t.constructor===RegExp?[t]:t;n.on("PreInit",function(){0'};!function n(){e.add("pagebreak",function(e){var a,n,o,c,t,r;(a=e).addCommand("mcePageBreak",function(){i(a)?a.insertContent("

"+u()+"

"):a.insertContent(u())}),(n=e).ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:function(){return n.execCommand("mcePageBreak")}}),n.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:function(){return n.execCommand("mcePageBreak")}}),c=(o=e).getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e"),t=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),o.on("BeforeSetContent",function(e){e.content=e.content.replace(t,u())}),o.on("PreInit",function(){o.serializer.addNodeFilter("img",function(e){for(var a,n,t=e.length;t--;)if((n=(a=e[t]).attr("class"))&&-1!==n.indexOf("mce-pagebreak")){var r=a.parent;if(o.schema.getBlockElements()[r.name]&&i(o)){r.type=3,r.value=c,r.raw=!0,a.remove();continue}a.type=3,a.value=c,a.raw=!0}})}),(r=e).on("ResolveName",function(e){"IMG"===e.target.nodeName&&r.dom.hasClass(e.target,g())&&(e.name="pagebreak")})})}()}(); -------------------------------------------------------------------------------- /src/main/resources/static/layui-ext/tinymce/tinymce/plugins/preview/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.4.2 (2020-08-17) 8 | */ 9 | !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.Env"),w=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(e){var t=function(t){var n="",i=t.dom.encode,e=t.getParam("content_style","");n+='',e&&(n+='");var o=t.getParam("content_css_cors",!1,"boolean")?' crossorigin="anonymous"':"";w.each(t.contentCSS,function(e){n+='"});var r,a,c,s,d,m,l,u=-1===(s=(r=t).getParam("body_id","tinymce","string")).indexOf("=")?s:(c=(a=r).getParam("body_id","","hash"))[a.id]||c,y=-1===(l=(d=t).getParam("body_class","","string")).indexOf("=")?l:(m=d).getParam("body_class","","hash")[m.id]||"",v=' 23 | -------------------------------------------------------------------------------- /src/main/resources/templates/error/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Title 9 | 10 | 11 | 13 |
14 |

500

15 |

服务器好像除了点问题!请稍后试试...

16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Manager 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /src/main/resources/templates/users/update_password.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 |
8 | 9 | 10 |
11 |
12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 | 27 |
28 | 30 |
31 |
32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 44 | 45 | 46 | 67 | 68 | -------------------------------------------------------------------------------- /src/test/java/com/company/project/CompanyFrameApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.company.project; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class CompanyFrameApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | --------------------------------------------------------------------------------