├── .gitattributes ├── .github └── workflows │ └── maven.yml ├── .gitignore ├── LICENSE ├── README.md ├── ancba-admin ├── .dockerignore ├── Dockerfile ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ └── admin │ │ └── AncbaAdminApplication.java │ └── resources │ └── application.yml ├── ancba-authorizer-oauth2 ├── .dockerignore ├── Dockerfile ├── Dockerfilebak ├── pom.xml └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ ├── AncbaAuthorizerApplication.java │ │ ├── api │ │ └── controller │ │ │ ├── README.md │ │ │ └── UserController.java │ │ ├── app │ │ └── service │ │ │ ├── IRoleService.java │ │ │ ├── ISysUserInfoService.java │ │ │ ├── README.md │ │ │ ├── UserDetailService.java │ │ │ └── impl │ │ │ ├── RoleServiceImpl.java │ │ │ └── SysUserInfoServiceImpl.java │ │ ├── core │ │ ├── annotation │ │ │ └── README.md │ │ ├── config │ │ │ ├── CustomAuthenticationProvider.java │ │ │ ├── JwtCustomerAccessTokenConverter.java │ │ │ ├── MybatisPrimaryConfig.java │ │ │ ├── MybatisSecondConfig.java │ │ │ ├── OAuth2AuthorizationServerConfig.java │ │ │ ├── WebConfig.java │ │ │ └── WebSecurityConfig.java │ │ ├── constant │ │ │ ├── CommonConstant.java │ │ │ └── README.md │ │ ├── exception │ │ │ ├── CommonExceptionHandler.java │ │ │ ├── README.md │ │ │ └── ServiceException.java │ │ └── util │ │ │ ├── README.md │ │ │ └── UserPasswordEncoder.java │ │ ├── domain │ │ ├── dto │ │ │ ├── README.md │ │ │ └── User.java │ │ ├── entity │ │ │ ├── BaseEntity.java │ │ │ ├── README.md │ │ │ ├── Role.java │ │ │ └── SysUserInfo.java │ │ ├── repository │ │ │ └── README.md │ │ ├── request │ │ │ └── README.md │ │ └── vo │ │ │ ├── ApiResultVo.java │ │ │ └── README.md │ │ └── infra │ │ ├── constant │ │ └── README.md │ │ ├── mapper │ │ ├── primary │ │ │ ├── README.md │ │ │ ├── RoleMapper.java │ │ │ └── SysUserInfoMapper.java │ │ └── second │ │ │ └── README.md │ │ └── repository │ │ └── impl │ │ └── README.md │ └── resources │ ├── application-dev.yml │ ├── application.yml │ └── mapper │ ├── primary │ └── README.md │ └── second │ └── README.md ├── ancba-blog ├── .dockerignore ├── .gitattributes ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── Dockerfile ├── DockerfileBak ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── skywalking │ └── Dockerfile └── src │ ├── main │ ├── java │ │ └── club │ │ │ └── neters │ │ │ └── blog │ │ │ ├── AncbaBlogApplication.java │ │ │ ├── api │ │ │ ├── README.md │ │ │ └── controller │ │ │ │ ├── BlogController.java │ │ │ │ └── CSRFController.java │ │ │ ├── app │ │ │ └── service │ │ │ │ ├── IAdvertisementService.java │ │ │ │ ├── IBlogArticleService.java │ │ │ │ ├── IGuestbookService.java │ │ │ │ ├── IModulePermissionService.java │ │ │ │ ├── IModuleService.java │ │ │ │ ├── IModulesService.java │ │ │ │ ├── IOperateLogService.java │ │ │ │ ├── IPasswordLibService.java │ │ │ │ ├── IPermissionService.java │ │ │ │ ├── IRoleModulePermissionService.java │ │ │ │ ├── IRoleService.java │ │ │ │ ├── ISysUserInfoService.java │ │ │ │ ├── ITasksQzService.java │ │ │ │ ├── ITestMuchTableResultService.java │ │ │ │ ├── ITopicDetailService.java │ │ │ │ ├── ITopicService.java │ │ │ │ ├── IUserRoleService.java │ │ │ │ └── impl │ │ │ │ ├── AdvertisementServiceImpl.java │ │ │ │ ├── BlogArticleServiceImpl.java │ │ │ │ ├── GuestbookServiceImpl.java │ │ │ │ ├── ModulePermissionServiceImpl.java │ │ │ │ ├── ModuleServiceImpl.java │ │ │ │ ├── ModulesServiceImpl.java │ │ │ │ ├── OperateLogServiceImpl.java │ │ │ │ ├── PasswordLibServiceImpl.java │ │ │ │ ├── PermissionServiceImpl.java │ │ │ │ ├── RoleModulePermissionServiceImpl.java │ │ │ │ ├── RoleServiceImpl.java │ │ │ │ ├── SysUserInfoServiceImpl.java │ │ │ │ ├── TasksQzServiceImpl.java │ │ │ │ ├── TestMuchTableResultServiceImpl.java │ │ │ │ ├── TopicDetailServiceImpl.java │ │ │ │ ├── TopicServiceImpl.java │ │ │ │ └── UserRoleServiceImpl.java │ │ │ ├── core │ │ │ ├── annotation │ │ │ │ └── EntityDoc.java │ │ │ ├── config │ │ │ │ ├── MybatisPrimaryConfig.java │ │ │ │ ├── MybatisSecondConfig.java │ │ │ │ └── Security │ │ │ │ │ └── OAuth2ResourceServerConfig.java │ │ │ ├── constant │ │ │ │ └── CommonConstant.java │ │ │ ├── exception │ │ │ │ ├── CommonExceptionHandler.java │ │ │ │ └── ServiceException.java │ │ │ └── util │ │ │ │ ├── JsonUtil.java │ │ │ │ └── JwtUtils.java │ │ │ ├── domain │ │ │ ├── dto │ │ │ │ └── README.md │ │ │ ├── entity │ │ │ │ ├── Advertisement.java │ │ │ │ ├── BaseEntity.java │ │ │ │ ├── BlogArticle.java │ │ │ │ ├── Guestbook.java │ │ │ │ ├── Module.java │ │ │ │ ├── ModulePermission.java │ │ │ │ ├── Modules.java │ │ │ │ ├── OperateLog.java │ │ │ │ ├── PasswordLib.java │ │ │ │ ├── Permission.java │ │ │ │ ├── Role.java │ │ │ │ ├── RoleModulePermission.java │ │ │ │ ├── SysUserInfo.java │ │ │ │ ├── TasksQz.java │ │ │ │ ├── TestMuchTableResult.java │ │ │ │ ├── Topic.java │ │ │ │ ├── TopicDetail.java │ │ │ │ └── UserRole.java │ │ │ ├── repository │ │ │ │ └── README.md │ │ │ ├── request │ │ │ │ ├── role │ │ │ │ │ └── README.md │ │ │ │ └── user │ │ │ │ │ └── UserInfoRequest.java │ │ │ └── vo │ │ │ │ ├── ApiResultVo.java │ │ │ │ └── user │ │ │ │ └── UserInfoVo.java │ │ │ ├── generator │ │ │ └── MyBatisPlusGenerator.java │ │ │ └── infra │ │ │ ├── constant │ │ │ └── README.md │ │ │ ├── mapper │ │ │ ├── primary │ │ │ │ ├── AdvertisementMapper.java │ │ │ │ ├── BlogArticleMapper.java │ │ │ │ ├── GuestbookMapper.java │ │ │ │ ├── ModuleMapper.java │ │ │ │ ├── ModulePermissionMapper.java │ │ │ │ ├── ModulesMapper.java │ │ │ │ ├── OperateLogMapper.java │ │ │ │ ├── PasswordLibMapper.java │ │ │ │ ├── PermissionMapper.java │ │ │ │ ├── RoleMapper.java │ │ │ │ ├── RoleModulePermissionMapper.java │ │ │ │ ├── SysUserInfoMapper.java │ │ │ │ ├── TasksQzMapper.java │ │ │ │ ├── TestMuchTableResultMapper.java │ │ │ │ ├── TopicDetailMapper.java │ │ │ │ ├── TopicMapper.java │ │ │ │ └── UserRoleMapper.java │ │ │ └── second │ │ │ │ └── README.md │ │ │ └── repository │ │ │ └── impl │ │ │ └── README.md │ └── resources │ │ ├── application-local.yml │ │ ├── application.yml │ │ ├── banner.txt │ │ ├── logback-spring.xml │ │ └── mapper │ │ ├── primary │ │ ├── AdvertisementMapper.xml │ │ ├── BlogArticleMapper.xml │ │ ├── GuestbookMapper.xml │ │ ├── ModuleMapper.xml │ │ ├── ModulePermissionMapper.xml │ │ ├── ModulesMapper.xml │ │ ├── OperateLogMapper.xml │ │ ├── PasswordLibMapper.xml │ │ ├── PermissionMapper.xml │ │ ├── RoleMapper.xml │ │ ├── RoleModulePermissionMapper.xml │ │ ├── SysUserInfoMapper.xml │ │ ├── TasksQzMapper.xml │ │ ├── TestMuchTableResultMapper.xml │ │ ├── TopicDetailMapper.xml │ │ ├── TopicMapper.xml │ │ └── UserRoleMapper.xml │ │ └── second │ │ └── README.md │ └── test │ └── java │ └── club │ └── neters │ └── blog │ └── AncbaBlogApplicationTests.java ├── ancba-common ├── pom.xml └── src │ └── main │ └── java │ └── club │ └── neters │ └── common │ ├── annotaion │ └── EnableAncbaSwagger.java │ ├── config │ └── swagger │ │ ├── SwaggerConfig.java │ │ ├── SwaggerConfigProperties.java │ │ └── SwaggerRegistrar.java │ ├── constant │ └── CommonConstant.java │ ├── domain │ └── vo │ │ └── ApiResultVo.java │ └── util │ ├── JsonUtil.java │ ├── ResultCode.java │ ├── ResultGenerator.java │ └── excel │ ├── ExcelData.java │ ├── ExcelDemoVo.java │ ├── ExcelEasyService.java │ ├── ExcelUtil.java │ └── ResultExcel.java ├── ancba-gateway ├── .dockerignore ├── Dockerfile ├── pom.xml └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ └── gateway │ │ ├── AncbaGateWayApplication.java │ │ ├── config │ │ ├── apidoc │ │ │ ├── SwaggerHandler.java │ │ │ └── SwaggerProvider.java │ │ ├── limit │ │ │ ├── LimitConfig.java │ │ │ └── LimitFilter.java │ │ ├── loging │ │ │ ├── RequestLoggingDecorator.java │ │ │ └── RequestLoggingFilter.java │ │ └── security │ │ │ ├── AccessManager.java │ │ │ └── WebSecurityConfig.java │ │ └── controller │ │ └── CSRFController.java │ └── resources │ ├── application.yml │ └── bootstrap.properties ├── ancba-maven-archetype ├── pom.xml └── src │ └── main │ └── resources │ ├── META-INF │ └── maven │ │ └── archetype-metadata.xml │ └── archetype-resources │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── pom.xml │ └── src │ └── main │ ├── java │ ├── __artifactIdBig__Application.java │ ├── api │ │ └── controller │ │ │ └── README.md │ ├── app │ │ └── service │ │ │ └── README.md │ ├── core │ │ ├── annotation │ │ │ └── README.md │ │ ├── config │ │ │ ├── MybatisPrimaryConfig.java │ │ │ └── MybatisSecondConfig.java │ │ ├── constant │ │ │ └── README.md │ │ ├── exception │ │ │ ├── CommonExceptionHandler.java │ │ │ ├── README.md │ │ │ └── ServiceException.java │ │ └── util │ │ │ └── README.md │ ├── domain │ │ ├── dto │ │ │ └── README.md │ │ ├── entity │ │ │ └── README.md │ │ ├── repository │ │ │ └── README.md │ │ ├── request │ │ │ └── README.md │ │ └── vo │ │ │ ├── ApiResultVo.java │ │ │ └── README.md │ └── infra │ │ ├── constant │ │ └── README.md │ │ ├── mapper │ │ ├── primary │ │ │ └── README.md │ │ └── second │ │ │ └── README.md │ │ └── repository │ │ └── impl │ │ └── README.md │ └── resources │ ├── application-dev.yml │ ├── application.yml │ └── mapper │ ├── primary │ └── README.md │ └── second │ └── README.md ├── ancba-shrio-demo ├── .dockerignore ├── Dockerfile ├── pom.xml └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ └── shrio │ │ └── demo │ │ ├── AncbaShrioDemoApplication.java │ │ ├── api │ │ └── controller │ │ │ ├── LoginController.java │ │ │ ├── README.md │ │ │ └── UserController.java │ │ ├── app │ │ └── service │ │ │ ├── IRoleService.java │ │ │ ├── ISysUserInfoService.java │ │ │ ├── README.md │ │ │ └── impl │ │ │ ├── RoleServiceImpl.java │ │ │ └── SysUserInfoServiceImpl.java │ │ ├── core │ │ ├── annotation │ │ │ └── README.md │ │ ├── config │ │ │ ├── MybatisPrimaryConfig.java │ │ │ ├── MybatisSecondConfig.java │ │ │ ├── SecurityPermitAllConfig.java │ │ │ └── ShiroConfig.java │ │ ├── constant │ │ │ ├── CommonConstant.java │ │ │ └── README.md │ │ ├── exception │ │ │ ├── CommonExceptionHandler.java │ │ │ ├── README.md │ │ │ └── ServiceException.java │ │ ├── generator │ │ │ └── MyBatisPlusGenerator.java │ │ └── util │ │ │ ├── HttpContextUtil.java │ │ │ ├── JsonUtil.java │ │ │ ├── JwtUtil.java │ │ │ └── README.md │ │ ├── domain │ │ ├── dto │ │ │ └── README.md │ │ ├── entity │ │ │ ├── BaseEntity.java │ │ │ ├── README.md │ │ │ ├── Role.java │ │ │ └── SysUserInfo.java │ │ ├── repository │ │ │ └── README.md │ │ ├── request │ │ │ └── README.md │ │ └── vo │ │ │ ├── ApiResultVo.java │ │ │ └── README.md │ │ └── infra │ │ ├── constant │ │ └── README.md │ │ ├── mapper │ │ ├── primary │ │ │ ├── README.md │ │ │ ├── RoleMapper.java │ │ │ └── SysUserInfoMapper.java │ │ └── second │ │ │ └── README.md │ │ ├── repository │ │ └── impl │ │ │ └── README.md │ │ └── shiro │ │ ├── AuthFilter.java │ │ └── UserRealm.java │ └── resources │ ├── application-dev.yml │ ├── application.yml │ └── mapper │ ├── primary │ ├── README.md │ └── SysUserInfoMapper.xml │ └── second │ └── README.md ├── ancba-task-xxl ├── .dockerignore ├── Dockerfile ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ └── schedule │ │ ├── AncbaScheduleApplication.java │ │ ├── config │ │ └── XxlJobConfig.java │ │ └── service │ │ └── XxlJobService.java │ └── resources │ ├── application-dev.yml │ └── application.yml ├── ancba-user ├── .dockerignore ├── Dockerfile ├── Dockerfilebak ├── pom.xml ├── skywalking │ └── Dockerfile └── src │ └── main │ ├── java │ └── club │ │ └── neters │ │ └── user │ │ ├── AncbaUserApplication.java │ │ ├── api │ │ └── controller │ │ │ ├── README.md │ │ │ └── UserController.java │ │ ├── app │ │ └── service │ │ │ ├── README.md │ │ │ └── UserApiService.java │ │ ├── core │ │ ├── annotation │ │ │ ├── AnonAllowed.java │ │ │ └── README.md │ │ ├── config │ │ │ ├── MybatisPrimaryConfig.java │ │ │ ├── MybatisSecondConfig.java │ │ │ ├── feign │ │ │ │ └── FeignConfig.java │ │ │ └── security │ │ │ │ ├── AdminAccessDeineHandler.java │ │ │ │ ├── CustomAccessDecisionVoter.java │ │ │ │ └── CustomWebSecurityConfigurer.java │ │ ├── constant │ │ │ ├── CommonConstant.java │ │ │ └── README.md │ │ ├── exception │ │ │ ├── CommonExceptionHandler.java │ │ │ ├── README.md │ │ │ └── ServiceException.java │ │ └── util │ │ │ ├── ApplicationContextUtil.java │ │ │ ├── HandlerMethodUtil.java │ │ │ ├── JsonUtil.java │ │ │ └── README.md │ │ ├── domain │ │ ├── dto │ │ │ └── README.md │ │ ├── entity │ │ │ ├── BlogArticle.java │ │ │ └── README.md │ │ ├── repository │ │ │ └── README.md │ │ ├── request │ │ │ ├── README.md │ │ │ └── UserInfoRequestFromBlog.java │ │ └── vo │ │ │ ├── ApiResultVo.java │ │ │ ├── README.md │ │ │ └── UserInfoVoFromBlog.java │ │ └── infra │ │ ├── constant │ │ └── README.md │ │ ├── mapper │ │ ├── primary │ │ │ └── README.md │ │ └── second │ │ │ └── README.md │ │ └── repository │ │ └── impl │ │ └── README.md │ └── resources │ ├── application-dev.yml │ ├── application.yml │ └── mapper │ ├── primary │ └── README.md │ └── second │ └── README.md ├── azure-pipelines.yml ├── doc ├── admin-more.png ├── admin.png ├── ancba-docker-run.txt ├── limit.png ├── nacos.png ├── wechat.png ├── xxl.png ├── z2.png └── zipkin.png ├── docker-compose.yml └── pom.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | logs 35 | 36 | **/application-local.properties 37 | **/application-dev.properties 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 anjoy8 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 | -------------------------------------------------------------------------------- /ancba-admin/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-admin.jar 7 | EXPOSE 8088 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-admin.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-admin/README.md: -------------------------------------------------------------------------------- 1 | # blog-spring 2 | 3 | #### 如果配置admin的客户端,步骤如下 4 | 5 | - [x] 1、pom文件中,引用依赖; 6 | ```xml 7 | 8 | 9 | de.codecentric 10 | spring-boot-admin-starter-client 11 | 2.3.1 12 | 13 | 14 | 15 | ``` 16 | - [x] 2、yaml文件中,配置admin地址等信息 17 | ``` 18 | spring: 19 | application: 20 | name: admin-client # 给client应用取个名字 21 | boot: 22 | admin: 23 | client: 24 | url: http://localhost:8088 25 | 26 | 27 | 28 | #开放端点用于SpringBoot Admin的监控 29 | management: 30 | endpoints: 31 | web: 32 | exposure: 33 | include: '*' 34 | endpoint: 35 | health: 36 | show-details: ALWAYS 37 | 38 | #配置生成日志文件名称 39 | logging: 40 | file: 41 | name: admin-client.log 42 | ``` 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ancba-admin/src/main/java/club/neters/admin/AncbaAdminApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.admin; 2 | 3 | import de.codecentric.boot.admin.server.config.EnableAdminServer; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @EnableAdminServer 9 | public class AncbaAdminApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(AncbaAdminApplication.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ancba-admin/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8088 -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM apache/skywalking-java-agent:8.8.0-java11 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-oauth.jar 7 | EXPOSE 8181 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-oauth.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/Dockerfilebak: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-oauth.jar 7 | EXPOSE 8181 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-oauth.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/AncbaAuthorizerApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | /** 8 | * @author maven plugin 9 | * @date 2021/6/25 10 | */ 11 | @SpringBootApplication 12 | @EnableDiscoveryClient 13 | public class AncbaAuthorizerApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(AncbaAuthorizerApplication.class, args); 16 | System.out.println("=================鉴权认证中心启动成功============="); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/api/controller/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/api/controller/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/api/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package club.neters.api.controller; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class UserController { 10 | 11 | @RequestMapping("/api/me") 12 | public Object user() { 13 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 14 | System.out.println(authentication); 15 | return 100; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/app/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.app.service; 2 | 3 | import club.neters.domain.entity.Role; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author laozhang 14 | * @since 2021-06-30 15 | */ 16 | public interface IRoleService extends IService { 17 | List findAllByUId(Integer uID); 18 | } 19 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/app/service/ISysUserInfoService.java: -------------------------------------------------------------------------------- 1 | package club.neters.app.service; 2 | 3 | import club.neters.domain.entity.SysUserInfo; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author laozhang 14 | * @since 2021-06-30 15 | */ 16 | public interface ISysUserInfoService extends IService { 17 | SysUserInfo findOne(String name, String pass); 18 | List allSysUserInfo(Integer uID); 19 | } 20 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/app/service/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/app/service/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/app/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.app.service.impl; 2 | 3 | import club.neters.app.service.IRoleService; 4 | import club.neters.domain.entity.Role; 5 | import club.neters.infra.mapper.primary.RoleMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 服务实现类 15 | *

16 | * 17 | * @author laozhang 18 | * @since 2021-06-23 19 | */ 20 | @Service 21 | public class RoleServiceImpl extends ServiceImpl implements IRoleService { 22 | 23 | private final RoleMapper roleMapper; 24 | 25 | @Autowired 26 | public RoleServiceImpl(RoleMapper roleMapper){ 27 | this.roleMapper = roleMapper; 28 | } 29 | 30 | @Override 31 | public List findAllByUId(Integer uID) { 32 | return roleMapper.findAllByUId(uID); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/app/service/impl/SysUserInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.app.service.impl; 2 | 3 | import club.neters.app.service.ISysUserInfoService; 4 | import club.neters.domain.entity.SysUserInfo; 5 | import club.neters.infra.mapper.primary.SysUserInfoMapper; 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 7 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * 服务实现类 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Service 23 | public class SysUserInfoServiceImpl extends ServiceImpl implements ISysUserInfoService { 24 | 25 | private final SysUserInfoMapper sysUserInfoMapper; 26 | 27 | @Autowired 28 | public SysUserInfoServiceImpl(SysUserInfoMapper sysUserInfoMapper){ 29 | this.sysUserInfoMapper = sysUserInfoMapper; 30 | } 31 | 32 | @Override 33 | public SysUserInfo findOne(String name, String pass) { 34 | LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); 35 | wrapper.eq(SysUserInfo::getTdIsDelete, 0) 36 | .eq(SysUserInfo::getULoginName, name) 37 | .eq(SysUserInfo::getULoginPWD, pass.toUpperCase()); 38 | return getOne(wrapper); 39 | } 40 | 41 | @Override 42 | public List allSysUserInfo(Integer uID) { 43 | return sysUserInfoMapper.allSysUserInfo(uID); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/annotation/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/core/annotation/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/config/CustomAuthenticationProvider.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.config; 2 | 3 | import org.springframework.security.authentication.AuthenticationServiceException; 4 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 5 | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; 6 | import org.springframework.security.core.AuthenticationException; 7 | import org.springframework.security.core.userdetails.UserDetails; 8 | import org.springframework.util.DigestUtils; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | public class CustomAuthenticationProvider extends DaoAuthenticationProvider { 13 | @Override 14 | protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { 15 | // HttpServletRequest req = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); 16 | 17 | Object rawPassword = authentication.getCredentials(); 18 | // 单独对密码器做处理,注意大小写 19 | String md5Pwd = DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes(StandardCharsets.UTF_8)); 20 | if (!md5Pwd.toUpperCase().equals(userDetails.getPassword())) { 21 | throw new AuthenticationServiceException("密码错误"); 22 | } 23 | 24 | // String input_code = req.getParameter("code"); 25 | // String verify = (String) req.getSession().getAttribute("verifyCode"); 26 | // if (input_code == null || !input_code.equals(verify)) { 27 | // throw new AuthenticationServiceException("验证码错误"); 28 | // } 29 | 30 | super.additionalAuthenticationChecks(userDetails, authentication); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/config/JwtCustomerAccessTokenConverter.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.config; 2 | 3 | 4 | import club.neters.domain.dto.User; 5 | import org.springframework.security.core.Authentication; 6 | import org.springframework.security.core.authority.AuthorityUtils; 7 | import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter; 8 | import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter; 9 | 10 | import java.util.LinkedHashMap; 11 | import java.util.Map; 12 | 13 | public class JwtCustomerAccessTokenConverter extends DefaultAccessTokenConverter { 14 | 15 | public JwtCustomerAccessTokenConverter() { 16 | super.setUserTokenConverter(new CustomerUserAuthenticationConverter()); 17 | } 18 | 19 | private class CustomerUserAuthenticationConverter extends DefaultUserAuthenticationConverter { 20 | 21 | @Override 22 | public Map convertUserAuthentication(Authentication authentication) { 23 | LinkedHashMap response = new LinkedHashMap(); 24 | //这里添加你的参数 25 | response.put("role", ((User) authentication.getPrincipal()).getUserRole()); 26 | response.put("username", ((User) authentication.getPrincipal()).getUsername()); 27 | if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) { 28 | response.put("authorities", AuthorityUtils.authorityListToSet(authentication.getAuthorities())); 29 | } 30 | 31 | return response; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 10 | 11 | 12 | @Configuration 13 | public class WebConfig implements WebMvcConfigurer { 14 | private CorsConfiguration buildConfig() { 15 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 16 | corsConfiguration.addAllowedOrigin("*"); 17 | corsConfiguration.addAllowedHeader("*"); 18 | corsConfiguration.addAllowedMethod("*"); 19 | corsConfiguration.addExposedHeader("Authorization"); 20 | return corsConfiguration; 21 | } 22 | 23 | @Bean 24 | public CorsFilter corsFilter() { 25 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 26 | source.registerCorsConfiguration("/**", buildConfig()); 27 | return new CorsFilter(source); 28 | } 29 | 30 | @Override 31 | public void addCorsMappings(CorsRegistry registry) { 32 | registry.addMapping("/**") 33 | .allowedOriginPatterns("*") 34 | .allowCredentials(true) 35 | .allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS") 36 | .maxAge(3600); 37 | } 38 | } -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.constant; 2 | 3 | public class CommonConstant { 4 | public static final String JWT_HMAC256_SECRET = "sdfsdfsrty45634kkhllghtdgdfss345t678fs"; 5 | public static final String JWT_ISSUER = "Blog.Core"; 6 | public static final String JWT_TOKEN_HEADER = "Authorization"; 7 | } 8 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/core/constant/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/exception/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/core/exception/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.exception; 2 | 3 | /** 4 | * custom exception 5 | * 6 | * @author maven plugin 7 | * @date 2021/6/16 8 | */ 9 | public class ServiceException extends RuntimeException { 10 | 11 | public ServiceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ServiceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ServiceException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/util/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/core/util/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/core/util/UserPasswordEncoder.java: -------------------------------------------------------------------------------- 1 | package club.neters.core.util; 2 | 3 | import org.springframework.security.crypto.password.PasswordEncoder; 4 | import org.springframework.util.DigestUtils; 5 | 6 | import java.nio.charset.StandardCharsets; 7 | 8 | public class UserPasswordEncoder implements PasswordEncoder { 9 | @Override 10 | public String encode(CharSequence rawPassword) { 11 | return null; 12 | } 13 | 14 | @Override 15 | public boolean matches(CharSequence rawPassword, String encodedPassword) { 16 | if (rawPassword == null) { 17 | return false; 18 | } 19 | 20 | // 单独对密码器做处理,注意大小写 21 | String md5Pwd = DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes(StandardCharsets.UTF_8)); 22 | 23 | return md5Pwd.toUpperCase().equals(encodedPassword); 24 | } 25 | } -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/dto/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/domain/dto/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/dto/User.java: -------------------------------------------------------------------------------- 1 | package club.neters.domain.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | import org.springframework.security.core.GrantedAuthority; 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | 10 | import java.util.Collection; 11 | import java.util.Set; 12 | 13 | @Getter 14 | @Setter 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class User implements UserDetails { 18 | 19 | /** 20 | * 用户名称 21 | */ 22 | private String userName; 23 | 24 | /** 25 | * 用户角色 26 | */ 27 | private String userRole; 28 | private Set authorities; 29 | /** 30 | * 用户密码 31 | */ 32 | private String userPassword; 33 | 34 | @Override 35 | public Collection getAuthorities() { 36 | return this.authorities; 37 | } 38 | 39 | public void setAuthorities(Set authorities) { 40 | this.authorities = authorities; 41 | } 42 | 43 | @Override 44 | public String getPassword() { 45 | return this.userPassword; 46 | } 47 | 48 | @Override 49 | public String getUsername() { 50 | return this.userName; 51 | } 52 | 53 | @Override 54 | public boolean isAccountNonExpired() { 55 | return true; 56 | } 57 | 58 | @Override 59 | public boolean isAccountNonLocked() { 60 | return true; 61 | } 62 | 63 | @Override 64 | public boolean isCredentialsNonExpired() { 65 | return true; 66 | } 67 | 68 | @Override 69 | public boolean isEnabled() { 70 | return true; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/entity/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package club.neters.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.baomidou.mybatisplus.annotation.TableId; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * 基础实体类 16 | * 17 | * @author laozhang 18 | * @date 2021/06/12 19 | */ 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | public class BaseEntity implements Serializable { 24 | 25 | @TableId(value = "Id", type = IdType.AUTO) 26 | private Integer Id; 27 | 28 | @TableField("CreateId") 29 | private Integer CreateId; 30 | 31 | @TableField("CreateBy") 32 | private String CreateBy; 33 | 34 | @TableField(value = "CreateTime", fill = FieldFill.INSERT) 35 | protected Date CreateTime; 36 | 37 | @TableField("ModifyId") 38 | private Integer ModifyId; 39 | 40 | @TableField("ModifyBy") 41 | private String ModifyBy; 42 | 43 | @TableField(value = "ModifyTime", fill = FieldFill.INSERT) 44 | protected Date ModifyTime; 45 | 46 | @TableField("tdIsDelete") 47 | private Boolean IsDeleted; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/entity/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/domain/entity/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/entity/Role.java: -------------------------------------------------------------------------------- 1 | package club.neters.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | /** 11 | * 角色信息表 12 | * 13 | * @author laozhang 14 | * @date 2021/06/16 15 | */ 16 | @EqualsAndHashCode(callSuper = false) 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | @TableName("Role") 21 | public class Role extends BaseEntity { 22 | @TableField("Name") 23 | private String Name; 24 | 25 | @TableField("Description") 26 | private String Description; 27 | 28 | @TableField("OrderSort") 29 | private Integer OrderSort; 30 | 31 | @TableField("Enabled") 32 | private Boolean Enabled; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/entity/SysUserInfo.java: -------------------------------------------------------------------------------- 1 | package club.neters.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | import java.time.LocalDateTime; 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("SysUserInfo") 25 | public class SysUserInfo implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "uID", type = IdType.AUTO) 30 | private Integer uID; 31 | 32 | @TableField("uLoginName") 33 | private String uLoginName; 34 | 35 | @TableField("uLoginPWD") 36 | private String uLoginPWD; 37 | 38 | @TableField("uRealName") 39 | private String uRealName; 40 | 41 | @TableField("uStatus") 42 | private Integer uStatus; 43 | 44 | @TableField("uRemark") 45 | private String uRemark; 46 | 47 | @TableField("uCreateTime") 48 | private LocalDateTime uCreateTime; 49 | 50 | @TableField("uUpdateTime") 51 | private LocalDateTime uUpdateTime; 52 | 53 | @TableField("uLastErrTime") 54 | private LocalDateTime uLastErrTime; 55 | 56 | @TableField("uErrorCount") 57 | private Integer uErrorCount; 58 | 59 | @TableField("name") 60 | private String name; 61 | 62 | @TableField("sex") 63 | private Integer sex; 64 | 65 | @TableField("age") 66 | private Integer age; 67 | 68 | @TableField("birth") 69 | private LocalDateTime birth; 70 | 71 | @TableField("addr") 72 | private String addr; 73 | 74 | @TableField("tdIsDelete") 75 | private Boolean tdIsDelete; 76 | 77 | 78 | @TableField(exist = false) //不是数据库字段,但必须使用 79 | private List roles; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/repository/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/domain/repository/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/request/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/domain/request/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/vo/ApiResultVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * common vo 7 | * 8 | * @author maven plugin 9 | * @date 2021/6/16 10 | */ 11 | @Data 12 | public class ApiResultVo { 13 | 14 | /** 15 | * 错误代码 16 | */ 17 | private long code; 18 | 19 | /** 20 | * 错误信息 21 | */ 22 | private String message; 23 | 24 | /** 25 | * 返回数据 26 | */ 27 | private T data; 28 | 29 | public static ApiResultVo ok(T data) { 30 | return ok(data, "success"); 31 | } 32 | 33 | public static ApiResultVo ok(T data, String msg) { 34 | ApiResultVo bean = new ApiResultVo<>(); 35 | bean.setData(data); 36 | bean.setCode(200); 37 | bean.setMessage(msg); 38 | return bean; 39 | } 40 | 41 | 42 | public static ApiResultVo error(T data) { 43 | return error(data, "服务器异常"); 44 | } 45 | 46 | public static ApiResultVo error(String msg) { 47 | return error(null, msg); 48 | } 49 | 50 | public static ApiResultVo error(T data, String msg) { 51 | ApiResultVo bean = new ApiResultVo<>(); 52 | bean.setData(data); 53 | bean.setCode(500); 54 | bean.setMessage(msg); 55 | return bean; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/domain/vo/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/domain/vo/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/infra/constant/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/primary/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.infra.mapper.primary; 2 | 3 | 4 | import club.neters.domain.entity.Role; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author laozhang 17 | * @since 2021-06-23 18 | */ 19 | @Repository 20 | public interface RoleMapper extends BaseMapper { 21 | @Select("select * from Role where Id in (select RoleId from UserRole where UserId = #{uID})") 22 | List findAllByUId(Integer uID); 23 | } 24 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/primary/SysUserInfoMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.infra.mapper.primary; 2 | 3 | import club.neters.domain.entity.SysUserInfo; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Many; 6 | import org.apache.ibatis.annotations.Result; 7 | import org.apache.ibatis.annotations.Results; 8 | import org.apache.ibatis.annotations.Select; 9 | import org.apache.ibatis.mapping.FetchType; 10 | import org.springframework.stereotype.Repository; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * Mapper 接口 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Repository 23 | public interface SysUserInfoMapper extends BaseMapper { 24 | 25 | @Select("select * from SysUserInfo where uID = #{uID}") 26 | @Results(id="UserMap",value={ 27 | @Result(property = "roles",column = "uID", 28 | many = @Many(select = "club.neters.infra.mapper.primary.RoleMapper.findAllByUId", 29 | fetchType = FetchType.LAZY)) 30 | }) 31 | List allSysUserInfo(Integer uID); 32 | } 33 | -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/infra/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/java/club/neters/infra/repository/impl/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/java/club/neters/infra/repository/impl/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8181 3 | 4 | spring: 5 | application: 6 | name: ancba-authorizer-oauth2 7 | profiles: 8 | active: dev 9 | boot: 10 | admin: 11 | client: 12 | url: http://localhost:8088 13 | enabled: false 14 | cloud: 15 | nacos: 16 | discovery: 17 | server-addr: http://localhost:8918 18 | 19 | management: 20 | endpoints: 21 | web: 22 | exposure: 23 | include: '*' 24 | endpoint: 25 | health: 26 | show-details: ALWAYS -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/resources/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/resources/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-authorizer-oauth2/src/main/resources/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-authorizer-oauth2/src/main/resources/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-blog/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-blog/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /ancba-blog/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-blog/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ancba-blog/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /ancba-blog/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM apache/skywalking-java-agent:8.8.0-java11 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-blog.jar 7 | EXPOSE 9092 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-blog.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-blog/DockerfileBak: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-blog.jar 7 | EXPOSE 9092 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-blog.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-blog/skywalking/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM apache/skywalking-java-agent:8.8.0-java11 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-blog.jar 7 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="10.168.37.36:11800" \ 8 | SW_AGENT_NAME="ancba-blog" 9 | 10 | EXPOSE 9092 11 | #指定server 12 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 13 | CMD ["java", "-jar", "-Xmx128M", "/app/app-blog.jar","--spring.config.location=../opt/application.yml"] 14 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/AncbaBlogApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog; 2 | 3 | import club.neters.common.annotaion.EnableAncbaSwagger; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @EnableAncbaSwagger(basePackage = "club.neters.blog", title = "接口文档", description = "博客模块接口文档") 9 | @SpringBootApplication 10 | @EnableDiscoveryClient 11 | public class AncbaBlogApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(AncbaBlogApplication.class, args); 15 | System.out.println("=================blog微服务启动成功============="); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/api/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-blog/src/main/java/club/neters/blog/api/README.md -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/api/controller/CSRFController.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.api.controller; 2 | 3 | import org.springframework.http.ResponseEntity; 4 | import org.springframework.security.web.csrf.CsrfToken; 5 | import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import springfox.documentation.annotations.ApiIgnore; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | @RestController 13 | @ApiIgnore 14 | public class CSRFController { 15 | @GetMapping(value = "/csrf") 16 | public ResponseEntity getToken(HttpServletRequest request) { 17 | return ResponseEntity.ok().body(new HttpSessionCsrfTokenRepository().generateToken(request)); 18 | } 19 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IAdvertisementService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Advertisement; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IAdvertisementService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IBlogArticleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.BlogArticle; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IBlogArticleService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IGuestbookService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Guestbook; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IGuestbookService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IModulePermissionService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.ModulePermission; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IModulePermissionService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IModuleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Module; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IModuleService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IModulesService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Modules; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IModulesService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IOperateLogService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.OperateLog; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IOperateLogService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IPasswordLibService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.PasswordLib; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * WMBLOG_MSSQL_2 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IPasswordLibService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IPermissionService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Permission; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IPermissionService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IRoleModulePermissionService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.RoleModulePermission; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IRoleModulePermissionService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Role; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IRoleService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/ISysUserInfoService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.SysUserInfo; 4 | import club.neters.blog.domain.request.user.UserInfoRequest; 5 | import club.neters.blog.domain.vo.user.UserInfoVo; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author laozhang 16 | * @since 2021-06-23 17 | */ 18 | public interface ISysUserInfoService extends IService { 19 | 20 | List findList(UserInfoRequest query); 21 | 22 | SysUserInfo findOne(String name, String pass); 23 | } 24 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/ITasksQzService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.TasksQz; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ITasksQzService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/ITestMuchTableResultService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.TestMuchTableResult; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ITestMuchTableResultService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/ITopicDetailService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.TopicDetail; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ITopicDetailService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/ITopicService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.Topic; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ITopicService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/IUserRoleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service; 2 | 3 | import club.neters.blog.domain.entity.UserRole; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface IUserRoleService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/AdvertisementServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.Advertisement; 4 | import club.neters.blog.infra.mapper.primary.AdvertisementMapper; 5 | import club.neters.blog.app.service.IAdvertisementService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class AdvertisementServiceImpl extends ServiceImpl implements IAdvertisementService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/BlogArticleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.BlogArticle; 4 | import club.neters.blog.infra.mapper.primary.BlogArticleMapper; 5 | import club.neters.blog.app.service.IBlogArticleService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class BlogArticleServiceImpl extends ServiceImpl implements IBlogArticleService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/GuestbookServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.Guestbook; 4 | import club.neters.blog.infra.mapper.primary.GuestbookMapper; 5 | import club.neters.blog.app.service.IGuestbookService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class GuestbookServiceImpl extends ServiceImpl implements IGuestbookService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/ModulePermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.ModulePermission; 4 | import club.neters.blog.infra.mapper.primary.ModulePermissionMapper; 5 | import club.neters.blog.app.service.IModulePermissionService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class ModulePermissionServiceImpl extends ServiceImpl implements IModulePermissionService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/ModuleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.Module; 4 | import club.neters.blog.infra.mapper.primary.ModuleMapper; 5 | import club.neters.blog.app.service.IModuleService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class ModuleServiceImpl extends ServiceImpl implements IModuleService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/ModulesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.Modules; 4 | import club.neters.blog.infra.mapper.primary.ModulesMapper; 5 | import club.neters.blog.app.service.IModulesService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class ModulesServiceImpl extends ServiceImpl implements IModulesService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/OperateLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.OperateLog; 4 | import club.neters.blog.infra.mapper.primary.OperateLogMapper; 5 | import club.neters.blog.app.service.IOperateLogService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class OperateLogServiceImpl extends ServiceImpl implements IOperateLogService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/PasswordLibServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.PasswordLib; 4 | import club.neters.blog.infra.mapper.primary.PasswordLibMapper; 5 | import club.neters.blog.app.service.IPasswordLibService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * WMBLOG_MSSQL_2 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class PasswordLibServiceImpl extends ServiceImpl implements IPasswordLibService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/PermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.IPermissionService; 4 | import club.neters.blog.domain.entity.Permission; 5 | import club.neters.blog.infra.mapper.primary.PermissionMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class PermissionServiceImpl extends ServiceImpl implements IPermissionService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/RoleModulePermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.IRoleModulePermissionService; 4 | import club.neters.blog.domain.entity.RoleModulePermission; 5 | import club.neters.blog.infra.mapper.primary.RoleModulePermissionMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class RoleModulePermissionServiceImpl extends ServiceImpl implements IRoleModulePermissionService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.IRoleService; 4 | import club.neters.blog.domain.entity.Role; 5 | import club.neters.blog.infra.mapper.primary.RoleMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class RoleServiceImpl extends ServiceImpl implements IRoleService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/TasksQzServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.ITasksQzService; 4 | import club.neters.blog.domain.entity.TasksQz; 5 | import club.neters.blog.infra.mapper.primary.TasksQzMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class TasksQzServiceImpl extends ServiceImpl implements ITasksQzService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/TestMuchTableResultServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.domain.entity.TestMuchTableResult; 4 | import club.neters.blog.infra.mapper.primary.TestMuchTableResultMapper; 5 | import club.neters.blog.app.service.ITestMuchTableResultService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class TestMuchTableResultServiceImpl extends ServiceImpl implements ITestMuchTableResultService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/TopicDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.ITopicDetailService; 4 | import club.neters.blog.domain.entity.TopicDetail; 5 | import club.neters.blog.infra.mapper.primary.TopicDetailMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class TopicDetailServiceImpl extends ServiceImpl implements ITopicDetailService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/TopicServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.ITopicService; 4 | import club.neters.blog.domain.entity.Topic; 5 | import club.neters.blog.infra.mapper.primary.TopicMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class TopicServiceImpl extends ServiceImpl implements ITopicService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/app/service/impl/UserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.app.service.impl; 2 | 3 | import club.neters.blog.app.service.IUserRoleService; 4 | import club.neters.blog.domain.entity.UserRole; 5 | import club.neters.blog.infra.mapper.primary.UserRoleMapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Service 18 | public class UserRoleServiceImpl extends ServiceImpl implements IUserRoleService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/core/annotation/EntityDoc.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.core.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 实体类注释 11 | * 用于代码生成器获取实体类注释及其字段注释 12 | * 13 | * @author laozhang 14 | * @date 2021/06/12 15 | */ 16 | @Target({ElementType.FIELD, ElementType.TYPE}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface EntityDoc { 19 | 20 | /** 21 | * 注释 22 | * 类注释/字段注释 23 | * 24 | * @return note 25 | */ 26 | String note() default ""; 27 | 28 | /** 29 | * 是否属于类注释 30 | * 31 | * @return 是否是类 32 | */ 33 | boolean isClass() default false; 34 | } 35 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/core/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.core.constant; 2 | 3 | public class CommonConstant { 4 | public static final String JWT_HMAC256_SECRET = "sdfsdfsrty45634kkhllghtdgdfss345t678fs"; 5 | public static final String JWT_ISSUER = "Blog.Core"; 6 | } 7 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/core/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.core.exception; 2 | 3 | /** 4 | * custom exception 5 | * 6 | * @author wuare 7 | * @date 2021/6/16 8 | */ 9 | public class ServiceException extends RuntimeException { 10 | 11 | public ServiceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ServiceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ServiceException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/core/util/JsonUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.core.util; 2 | 3 | import club.neters.blog.core.exception.ServiceException; 4 | import com.fasterxml.jackson.core.JsonProcessingException; 5 | import com.fasterxml.jackson.core.type.TypeReference; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Json Util 13 | * 14 | * @author wuare 15 | * @date 2021/6/16 16 | */ 17 | public class JsonUtil { 18 | 19 | private static final ObjectMapper objectMapper = new ObjectMapper(); 20 | 21 | private JsonUtil() { 22 | } 23 | 24 | /** 25 | * json to bean 26 | */ 27 | public static T toBean(String content, Class valueType) { 28 | try { 29 | return objectMapper.readValue(content, valueType); 30 | } catch (JsonProcessingException e) { 31 | throw new ServiceException(e); 32 | } 33 | } 34 | 35 | /** 36 | * json to map 37 | */ 38 | public static Map toMap(String content) { 39 | try { 40 | return objectMapper.readValue(content, new TypeReference>() { 41 | }); 42 | } catch (JsonProcessingException e) { 43 | throw new ServiceException(e); 44 | } 45 | } 46 | 47 | /** 48 | * json to list 49 | */ 50 | public static List toList(String content) { 51 | try { 52 | return objectMapper.readValue(content, new TypeReference>() { 53 | }); 54 | } catch (JsonProcessingException e) { 55 | throw new ServiceException(e); 56 | } 57 | } 58 | 59 | /** 60 | * object to json 61 | */ 62 | public static String toJson(T value) { 63 | try { 64 | return objectMapper.writeValueAsString(value); 65 | } catch (JsonProcessingException e) { 66 | throw new ServiceException(e); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/core/util/JwtUtils.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.core.util; 2 | 3 | import club.neters.blog.core.constant.CommonConstant; 4 | import com.auth0.jwt.JWT; 5 | import com.auth0.jwt.JWTCreator; 6 | import com.auth0.jwt.algorithms.Algorithm; 7 | import com.auth0.jwt.interfaces.DecodedJWT; 8 | 9 | import java.util.Calendar; 10 | import java.util.Map; 11 | 12 | public class JwtUtils { 13 | 14 | /** 15 | * 生成token header.payload.sing 16 | */ 17 | public static String getToken(Map map) { 18 | Calendar instance = Calendar.getInstance(); 19 | instance.add(Calendar.HOUR, 1); 20 | //创建jwt builder 21 | JWTCreator.Builder builder = JWT.create(); 22 | //payload 23 | map.forEach(builder::withClaim); 24 | //生成token,头部默认jwt和Base64编码 25 | return builder 26 | .withExpiresAt(instance.getTime()) //设置过期时间 27 | .withIssuer(CommonConstant.JWT_ISSUER) //设置issuer 28 | .sign(Algorithm.HMAC256(CommonConstant.JWT_HMAC256_SECRET)); 29 | } 30 | 31 | /** 32 | * 验证 token 合法性 33 | */ 34 | public static DecodedJWT verify(String token) { 35 | return JWT.require(Algorithm.HMAC256(CommonConstant.JWT_HMAC256_SECRET)).build().verify(token); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/dto/README.md: -------------------------------------------------------------------------------- 1 | ## dto -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Advertisement.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * Advertisement表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "Advertisement", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("Advertisement") 24 | public class Advertisement { 25 | 26 | @EntityDoc(note = "Id") 27 | @TableId(value = "Id", type = IdType.AUTO) 28 | private Integer Id; 29 | 30 | @EntityDoc(note = "ImgUrl") 31 | @TableField("ImgUrl") 32 | private String ImgUrl; 33 | 34 | @EntityDoc(note = "Title") 35 | @TableField("Title") 36 | private String Title; 37 | 38 | @EntityDoc(note = "Url") 39 | @TableField("Url") 40 | private String Url; 41 | 42 | @EntityDoc(note = "Remark") 43 | @TableField("Remark") 44 | private String Remark; 45 | 46 | @EntityDoc(note = "Createdate") 47 | @TableField("Createdate") 48 | private Date Createdate; 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.FieldFill; 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | 15 | /** 16 | * 基础实体类 17 | * 18 | * @author laozhang 19 | * @date 2021/06/12 20 | */ 21 | @Data 22 | @NoArgsConstructor 23 | @AllArgsConstructor 24 | public class BaseEntity implements Serializable { 25 | 26 | @EntityDoc(note = "Id") 27 | @TableId(value = "Id", type = IdType.AUTO) 28 | private Integer Id; 29 | 30 | @EntityDoc(note = "创建人Id") 31 | @TableField("CreateId") 32 | private Integer CreateId; 33 | 34 | @EntityDoc(note = "创建人名称") 35 | @TableField("CreateBy") 36 | private String CreateBy; 37 | 38 | @EntityDoc(note = "创建时间") 39 | @TableField(value = "CreateTime", fill = FieldFill.INSERT) 40 | protected Date CreateTime; 41 | 42 | @EntityDoc(note = "修改人Id") 43 | @TableField("ModifyId") 44 | private Integer ModifyId; 45 | 46 | @EntityDoc(note = "修改人名称") 47 | @TableField("ModifyBy") 48 | private String ModifyBy; 49 | 50 | @EntityDoc(note = "修改时间") 51 | @TableField(value = "ModifyTime", fill = FieldFill.INSERT) 52 | protected Date ModifyTime; 53 | 54 | @EntityDoc(note = "是否删除") 55 | @TableField("tdIsDelete") 56 | private Boolean IsDeleted; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/BlogArticle.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * BlogArticle表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "BlogArticle", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("BlogArticle") 24 | public class BlogArticle { 25 | 26 | @EntityDoc(note = "bID") 27 | @TableId(value = "bID", type = IdType.AUTO) 28 | private Integer bID; 29 | 30 | @EntityDoc(note = "bsubmitter") 31 | @TableField("bsubmitter") 32 | private String bsubmitter; 33 | 34 | @EntityDoc(note = "btitle") 35 | @TableField("btitle") 36 | private String btitle; 37 | 38 | @EntityDoc(note = "bcategory") 39 | @TableField("bcategory") 40 | private String bcategory; 41 | 42 | @EntityDoc(note = "bcontent") 43 | @TableField("bcontent") 44 | private String bcontent; 45 | 46 | @EntityDoc(note = "btraffic") 47 | @TableField("btraffic") 48 | private Integer btraffic; 49 | 50 | @EntityDoc(note = "bcommentNum") 51 | @TableField("bcommentNum") 52 | private Integer bcommentNum; 53 | 54 | @EntityDoc(note = "bUpdateTime") 55 | @TableField("bUpdateTime") 56 | private Date bUpdateTime; 57 | 58 | @EntityDoc(note = "bCreateTime") 59 | @TableField("bCreateTime") 60 | private Date bCreateTime; 61 | 62 | @EntityDoc(note = "bRemark") 63 | @TableField("bRemark") 64 | private String bRemark; 65 | 66 | @EntityDoc(note = "IsDeleted") 67 | @TableField("IsDeleted") 68 | private Boolean IsDeleted; 69 | 70 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Guestbook.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * Guestbook表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "Guestbook", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("Guestbook") 24 | public class Guestbook { 25 | 26 | @EntityDoc(note = "Id") 27 | @TableId(value = "Id", type = IdType.AUTO) 28 | private Integer Id; 29 | 30 | @EntityDoc(note = "blogId") 31 | @TableField("blogId") 32 | private Integer blogId; 33 | 34 | @EntityDoc(note = "createdate") 35 | @TableField("createdate") 36 | private Date createdate; 37 | 38 | @EntityDoc(note = "username") 39 | @TableField("username") 40 | private String username; 41 | 42 | @EntityDoc(note = "phone") 43 | @TableField("phone") 44 | private String phone; 45 | 46 | @EntityDoc(note = "QQ") 47 | @TableField("QQ") 48 | private String QQ; 49 | 50 | @EntityDoc(note = "body") 51 | @TableField("body") 52 | private String body; 53 | 54 | @EntityDoc(note = "ip") 55 | @TableField("ip") 56 | private String ip; 57 | 58 | @EntityDoc(note = "isshow") 59 | @TableField("isshow") 60 | private Boolean isshow; 61 | } 62 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/ModulePermission.java: -------------------------------------------------------------------------------- 1 | 2 | package club.neters.blog.domain.entity; 3 | 4 | import club.neters.blog.core.annotation.EntityDoc; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.NoArgsConstructor; 11 | 12 | /** 13 | * ModulePermission表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode(callSuper = false) 19 | @EntityDoc(note = "ModulePermission", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("ModulePermission") 24 | 25 | 26 | public class ModulePermission extends BaseEntity { 27 | 28 | @EntityDoc(note = "ModuleId") 29 | @TableField("ModuleId") 30 | private Integer ModuleId; 31 | 32 | @EntityDoc(note = "PermissionId") 33 | @TableField("PermissionId") 34 | private Integer PermissionId; 35 | 36 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Modules.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * Modules表 13 | * 14 | * @author laozhang 15 | * @date 2021/06/12 16 | */ 17 | @EqualsAndHashCode(callSuper = false) 18 | @EntityDoc(note = "Modules", isClass = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @TableName("Modules") 23 | public class Modules extends BaseEntity { 24 | 25 | 26 | @EntityDoc(note = "Name") 27 | @TableField("Name") 28 | private String Name; 29 | 30 | @EntityDoc(note = "LinkUrl") 31 | @TableField("LinkUrl") 32 | private String LinkUrl; 33 | 34 | @EntityDoc(note = "Area") 35 | @TableField("Area") 36 | private String Area; 37 | 38 | @EntityDoc(note = "Controller") 39 | @TableField("Controller") 40 | private String Controller; 41 | 42 | @EntityDoc(note = "Action") 43 | @TableField("Action") 44 | private String Action; 45 | 46 | @EntityDoc(note = "Icon") 47 | @TableField("Icon") 48 | private String Icon; 49 | 50 | @EntityDoc(note = "Code") 51 | @TableField("Code") 52 | private String Code; 53 | 54 | @EntityDoc(note = "OrderSort") 55 | @TableField("OrderSort") 56 | private Integer OrderSort; 57 | 58 | @EntityDoc(note = "Description") 59 | @TableField("Description") 60 | private String Description; 61 | 62 | @EntityDoc(note = "IsMenu") 63 | @TableField("IsMenu") 64 | private Boolean IsMenu; 65 | 66 | @EntityDoc(note = "Enabled") 67 | @TableField("Enabled") 68 | private Boolean Enabled; 69 | 70 | 71 | @EntityDoc(note = "ParentId") 72 | @TableField("ParentId") 73 | private Integer ParentId; 74 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/OperateLog.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * OperateLog表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "OperateLog", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("OperateLog") 24 | 25 | 26 | public class OperateLog { 27 | 28 | @EntityDoc(note = "Id") 29 | @TableId(value = "Id", type = IdType.AUTO) 30 | private Integer Id; 31 | 32 | @EntityDoc(note = "IsDeleted") 33 | @TableField("IsDeleted") 34 | private Boolean IsDeleted; 35 | 36 | @EntityDoc(note = "Area") 37 | @TableField("Area") 38 | private String Area; 39 | 40 | @EntityDoc(note = "Controller") 41 | @TableField("Controller") 42 | private String Controller; 43 | 44 | @EntityDoc(note = "Action") 45 | @TableField("Action") 46 | private String Action; 47 | 48 | @EntityDoc(note = "IPAddress") 49 | @TableField("IPAddress") 50 | private String IPAddress; 51 | 52 | @EntityDoc(note = "Description") 53 | @TableField("Description") 54 | private String Description; 55 | 56 | @EntityDoc(note = "LogTime") 57 | @TableField("LogTime") 58 | private Date LogTime; 59 | 60 | @EntityDoc(note = "LoginName") 61 | @TableField("LoginName") 62 | private String LoginName; 63 | 64 | @EntityDoc(note = "UserId") 65 | @TableField("UserId") 66 | private Integer UserId; 67 | 68 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/PasswordLib.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * PasswordLib表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "PasswordLib", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("PasswordLib") 24 | public class PasswordLib{ 25 | 26 | @EntityDoc(note = "PLID") 27 | @TableId(value = "PLID", type = IdType.AUTO) 28 | private Integer PLID ; 29 | 30 | @EntityDoc(note = "IsDeleted") 31 | @TableField("IsDeleted") 32 | private Boolean IsDeleted ; 33 | 34 | @EntityDoc(note = "plURL") 35 | @TableField("plURL") 36 | private String plURL ; 37 | 38 | @EntityDoc(note = "plPWD") 39 | @TableField("plPWD") 40 | private String plPWD ; 41 | 42 | @EntityDoc(note = "plAccountName") 43 | @TableField("plAccountName") 44 | private String plAccountName ; 45 | 46 | @EntityDoc(note = "plStatus") 47 | @TableField("plStatus") 48 | private Integer plStatus ; 49 | 50 | @EntityDoc(note = "plErrorCount") 51 | @TableField("plErrorCount") 52 | private Integer plErrorCount ; 53 | 54 | @EntityDoc(note = "plHintPwd") 55 | @TableField("plHintPwd") 56 | private String plHintPwd ; 57 | 58 | @EntityDoc(note = "plHintquestion") 59 | @TableField("plHintquestion") 60 | private String plHintquestion ; 61 | 62 | @EntityDoc(note = "plCreateTime") 63 | @TableField("plCreateTime") 64 | private Date plCreateTime ; 65 | 66 | @EntityDoc(note = "plUpdateTime") 67 | @TableField("plUpdateTime") 68 | private Date plUpdateTime ; 69 | 70 | @EntityDoc(note = "plLastErrTime") 71 | @TableField("plLastErrTime") 72 | private Date plLastErrTime ; 73 | 74 | @EntityDoc(note = "test") 75 | @TableField("test") 76 | private String test ; 77 | 78 | } 79 | 80 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Permission.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * Permission表 13 | * 14 | * @author laozhang 15 | * @date 2021/06/12 16 | */ 17 | @EqualsAndHashCode(callSuper = false) 18 | @EntityDoc(note = "Permission", isClass = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @TableName("Permission") 23 | public class Permission extends BaseEntity { 24 | 25 | @EntityDoc(note = "Code") 26 | @TableField("Code") 27 | private String Code; 28 | 29 | @EntityDoc(note = "Name") 30 | @TableField("Name") 31 | private String Name; 32 | 33 | @EntityDoc(note = "IsButton") 34 | @TableField("IsButton") 35 | private Boolean IsButton; 36 | 37 | @EntityDoc(note = "IsHide") 38 | @TableField("IsHide") 39 | private Boolean IsHide; 40 | 41 | @EntityDoc(note = "IskeepAlive") 42 | @TableField("IskeepAlive") 43 | private Boolean IskeepAlive; 44 | 45 | @EntityDoc(note = "Func") 46 | @TableField("Func") 47 | private String Func; 48 | 49 | @EntityDoc(note = "OrderSort") 50 | @TableField("OrderSort") 51 | private Integer OrderSort; 52 | 53 | @EntityDoc(note = "Icon") 54 | @TableField("Icon") 55 | private String Icon; 56 | 57 | @EntityDoc(note = "Description") 58 | @TableField("Description") 59 | private String Description; 60 | 61 | @EntityDoc(note = "Enabled") 62 | @TableField("Enabled") 63 | private Boolean Enabled; 64 | 65 | 66 | @EntityDoc(note = "Pid") 67 | @TableField("Pid") 68 | private int Pid; 69 | 70 | @EntityDoc(note = "Mid") 71 | @TableField("Mid") 72 | private int Mid; 73 | 74 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Role.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * 角色信息表 13 | * 14 | * @author laozhang 15 | * @date 2021/06/16 16 | */ 17 | @EqualsAndHashCode(callSuper = false) 18 | @EntityDoc(note = "角色表", isClass = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @TableName("Role") 23 | public class Role extends BaseEntity { 24 | @EntityDoc(note = "角色名") 25 | @TableField("Name") 26 | private String Name; 27 | 28 | @EntityDoc(note = "描述") 29 | @TableField("Description") 30 | private String Description; 31 | 32 | @EntityDoc(note = "排序") 33 | @TableField("OrderSort") 34 | private Integer OrderSort; 35 | 36 | @EntityDoc(note = "是否启用") 37 | @TableField("Enabled") 38 | private Boolean Enabled; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/RoleModulePermission.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * 用户模块菜单关系表 13 | * 14 | * @author laozhang 15 | * @date 2021/06/16 16 | */ 17 | @EqualsAndHashCode(callSuper = false) 18 | @EntityDoc(note = "用户模块菜单关系表", isClass = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @TableName("RoleModulePermission") 23 | public class RoleModulePermission extends BaseEntity { 24 | 25 | @EntityDoc(note = "RoleId") 26 | @TableField("RoleId") 27 | private Integer RoleId; 28 | 29 | @EntityDoc(note = "ModuleId") 30 | @TableField("ModuleId") 31 | private Integer ModuleId; 32 | 33 | @EntityDoc(note = "PermissionId") 34 | @TableField("PermissionId") 35 | private Integer PermissionId; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/TestMuchTableResult.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author laozhang 15 | * @since 2021-06-23 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @TableName("TestMuchTableResult") 20 | public class TestMuchTableResult implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | @TableField("moduleName") 25 | private String moduleName; 26 | 27 | @TableField("permName") 28 | private String permName; 29 | 30 | @TableField("rid") 31 | private Integer rid; 32 | 33 | @TableField("mid") 34 | private Integer mid; 35 | 36 | @TableField("pid") 37 | private Integer pid; 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/Topic.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * Topic表 14 | * 15 | * @author laozhang 16 | * @date 2021/06/12 17 | */ 18 | @EqualsAndHashCode() 19 | @EntityDoc(note = "Topic", isClass = true) 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @TableName("Topic") 24 | public class Topic { 25 | 26 | @EntityDoc(note = "Id") 27 | @TableId(value = "Id", type = IdType.AUTO) 28 | private Integer Id; 29 | 30 | @EntityDoc(note = "tLogo") 31 | @TableField("tLogo") 32 | private String tLogo; 33 | 34 | @EntityDoc(note = "tName") 35 | @TableField("tName") 36 | private String tName; 37 | 38 | @EntityDoc(note = "tDetail") 39 | @TableField("tDetail") 40 | private String tDetail; 41 | 42 | @EntityDoc(note = "tAuthor") 43 | @TableField("tAuthor") 44 | private String tAuthor; 45 | 46 | @EntityDoc(note = "tSectendDetail") 47 | @TableField("tSectendDetail") 48 | private String tSectendDetail; 49 | 50 | @EntityDoc(note = "tIsDelete") 51 | @TableField("tIsDelete") 52 | private Boolean tIsDelete; 53 | 54 | @EntityDoc(note = "tRead") 55 | @TableField("tRead") 56 | private Integer tRead; 57 | 58 | @EntityDoc(note = "tCommend") 59 | @TableField("tCommend") 60 | private Integer tCommend; 61 | 62 | @EntityDoc(note = "tGood") 63 | @TableField("tGood") 64 | private Integer tGood; 65 | 66 | @EntityDoc(note = "tCreatetime") 67 | @TableField("tCreatetime") 68 | private Date tCreatetime; 69 | 70 | @EntityDoc(note = "tUpdatetime") 71 | @TableField("tUpdatetime") 72 | private Date tUpdatetime; 73 | 74 | } -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/entity/UserRole.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.entity; 2 | 3 | import club.neters.blog.core.annotation.EntityDoc; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * 用户角色关系表 13 | * 14 | * @author laozhang 15 | * @date 2021/06/16 16 | */ 17 | @EqualsAndHashCode(callSuper = false) 18 | @EntityDoc(note = "用户角色关系表", isClass = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @TableName("UserRole") 23 | public class UserRole extends BaseEntity { 24 | 25 | @EntityDoc(note = "UserId") 26 | @TableField("UserId") 27 | private Integer UserId; 28 | 29 | @EntityDoc(note = "RoleId") 30 | @TableField("RoleId") 31 | private Integer RoleId; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/repository/README.md: -------------------------------------------------------------------------------- 1 | ### 仓储接口 -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/request/role/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-blog/src/main/java/club/neters/blog/domain/request/role/README.md -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/request/user/UserInfoRequest.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.request.user; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * user information query object 8 | * 9 | * @author wuare 10 | * @date 2021/6/16 11 | */ 12 | @Data 13 | public class UserInfoRequest { 14 | 15 | @ApiModelProperty(value = "id") 16 | private Integer uID; 17 | 18 | @ApiModelProperty(value = "登录名") 19 | private String uLoginName; 20 | 21 | @ApiModelProperty(value = "真实名") 22 | private String uRealName; 23 | 24 | @ApiModelProperty(value = "名字") 25 | private String name; 26 | } 27 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/vo/ApiResultVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.vo; 2 | 3 | import lombok.Data; 4 | import org.springframework.http.HttpStatus; 5 | 6 | /** 7 | * common vo 8 | * 9 | * @author wuare 10 | * @date 2021/6/16 11 | */ 12 | @Data 13 | public class ApiResultVo { 14 | 15 | /** 16 | * 错误代码 17 | */ 18 | private long code; 19 | 20 | /** 21 | * 错误信息 22 | */ 23 | private String message; 24 | 25 | /** 26 | * 返回数据 27 | */ 28 | private T data; 29 | 30 | public static ApiResultVo ok(T data) { 31 | return ok(data, "success"); 32 | } 33 | 34 | public static ApiResultVo ok(T data, String msg) { 35 | ApiResultVo bean = new ApiResultVo<>(); 36 | bean.setData(data); 37 | bean.setCode(200); 38 | bean.setMessage(msg); 39 | return bean; 40 | } 41 | 42 | 43 | public static ApiResultVo error(T data) { 44 | return error(data, "服务器异常"); 45 | } 46 | 47 | public static ApiResultVo error(String msg) { 48 | return error(null, msg); 49 | } 50 | 51 | public static ApiResultVo error(T data, String msg) { 52 | ApiResultVo bean = new ApiResultVo<>(); 53 | bean.setData(data); 54 | bean.setCode(500); 55 | bean.setMessage(msg); 56 | return bean; 57 | } 58 | 59 | public static ApiResultVo badRequest(String msg) { 60 | ApiResultVo bean = new ApiResultVo<>(); 61 | bean.setCode(400); 62 | bean.setMessage(msg); 63 | return bean; 64 | } 65 | 66 | public static ApiResultVo unauthorized(String msg) { 67 | ApiResultVo bean = new ApiResultVo<>(); 68 | bean.setCode(401); 69 | bean.setMessage(msg); 70 | return bean; 71 | } 72 | 73 | public static ApiResultVo forbidden(String msg) { 74 | ApiResultVo bean = new ApiResultVo<>(); 75 | bean.setCode(403); 76 | bean.setMessage(msg); 77 | return bean; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/domain/vo/user/UserInfoVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.domain.vo.user; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * user information view object 12 | * 13 | * @author wuare 14 | * @date 2021/6/16 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @Builder 20 | public class UserInfoVo { 21 | private Integer uID; 22 | 23 | private String uLoginName; 24 | 25 | 26 | private String uRealName; 27 | 28 | private Integer uStatus; 29 | 30 | private String uRemark; 31 | 32 | protected Date uCreateTime; 33 | 34 | protected Date uUpdateTime; 35 | 36 | private String name; 37 | 38 | private Integer sex; 39 | 40 | private Integer age; 41 | 42 | protected Date birth; 43 | 44 | private String addr; 45 | 46 | 47 | /** 48 | * 手机号 49 | */ 50 | private String phone; 51 | 52 | 53 | /** 54 | * 验证码 登录用 55 | */ 56 | private String verifyCode; 57 | 58 | 59 | /** 60 | * 新密码 61 | */ 62 | private String newPassword; 63 | } 64 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/constant/README.md: -------------------------------------------------------------------------------- 1 | ## 基础设施层的某些常量 -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/AdvertisementMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Advertisement; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface AdvertisementMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/BlogArticleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.BlogArticle; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface BlogArticleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/GuestbookMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Guestbook; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface GuestbookMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/ModuleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Module; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ModuleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/ModulePermissionMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.ModulePermission; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ModulePermissionMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/ModulesMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Modules; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface ModulesMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/OperateLogMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.OperateLog; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface OperateLogMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/PasswordLibMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.PasswordLib; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * WMBLOG_MSSQL_2 Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface PasswordLibMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/PermissionMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Permission; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface PermissionMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Role; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface RoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/RoleModulePermissionMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.RoleModulePermission; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface RoleModulePermissionMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/SysUserInfoMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.SysUserInfo; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface SysUserInfoMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/TasksQzMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.TasksQz; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface TasksQzMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/TestMuchTableResultMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.TestMuchTableResult; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface TestMuchTableResultMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/TopicDetailMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.TopicDetail; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface TopicDetailMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/TopicMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.Topic; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface TopicMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/primary/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog.infra.mapper.primary; 2 | 3 | import club.neters.blog.domain.entity.UserRole; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author laozhang 12 | * @since 2021-06-23 13 | */ 14 | public interface UserRoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-blog/src/main/java/club/neters/blog/infra/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-blog/src/main/java/club/neters/blog/infra/repository/impl/README.md: -------------------------------------------------------------------------------- 1 | ## 仓储实现 -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/application-local.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9092 3 | 4 | spring: 5 | application: 6 | name: ancba-blog 7 | profiles: 8 | active: local 9 | boot: 10 | admin: 11 | client: 12 | url: http://localhost:8088 13 | enabled: false 14 | cloud: 15 | nacos: 16 | discovery: 17 | server-addr: http://localhost:8918 18 | enabled: true 19 | 20 | zipkin: 21 | base-url: http://neters.club:9411/ # zipkin服务器的地址 22 | # 关闭服务发现,否则Spring Cloud会把zipkin的url当做服务名称 23 | discoveryClientEnabled: false 24 | sender: 25 | type: web # 设置使用http的方式传输数据 26 | sleuth: 27 | sampler: 28 | probability: 1 # 设置抽样采集率为100%,默认为0.1,即10% 29 | 30 | management: 31 | endpoints: 32 | web: 33 | exposure: 34 | include: '*' 35 | endpoint: 36 | health: 37 | show-details: ALWAYS 38 | 39 | logback: 40 | appName: blog-spring 41 | fileType: log 42 | logDir: logs 43 | 44 | security: 45 | server: 46 | url: http://localhost:8181/oauth/token -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ___ _ __ _ ___ _ __ _ __ _ 2 | | _ ) | | ___ / _` | / __| | '_ \ _ _ (_) _ _ / _` | 3 | | _ \ | | / _ \ \__, | _ \__ \ | .__/ | '_| | | | ' \ \__, | 4 | |___/ _|_|_ \___/ |___/ _(_)_ |___/ |_|__ _|_|_ _|_|_ |_||_| |___/ 5 | _|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| 6 | "`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' 7 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/AdvertisementMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/BlogArticleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/GuestbookMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/ModuleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/ModulePermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/ModulesMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/OperateLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/PasswordLibMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/PermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/RoleModulePermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/SysUserInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/TasksQzMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/TestMuchTableResultMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/TopicDetailMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/TopicMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/primary/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-blog/src/main/resources/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-blog/src/main/resources/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-blog/src/test/java/club/neters/blog/AncbaBlogApplicationTests.java: -------------------------------------------------------------------------------- 1 | package club.neters.blog; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AncbaBlogApplicationTests { 8 | @Test 9 | void contextLoads() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/annotaion/EnableAncbaSwagger.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.annotaion; 2 | 3 | import club.neters.common.config.swagger.SwaggerRegistrar; 4 | import org.springframework.context.annotation.Import; 5 | 6 | import java.lang.annotation.Documented; 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * @author wuare 14 | * @date 2021/6/29 15 | */ 16 | @Target({ElementType.TYPE}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | @Import(SwaggerRegistrar.class) 20 | public @interface EnableAncbaSwagger { 21 | 22 | String basePackage(); 23 | 24 | String title() default "Api Documentation"; 25 | 26 | String description() default "Api Documentation"; 27 | 28 | String version() default "1.0"; 29 | 30 | String email() default "laozhang@azlinli.com"; 31 | 32 | boolean oauth() default true; 33 | } 34 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/config/swagger/SwaggerConfigProperties.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.config.swagger; 2 | 3 | import org.springframework.core.Ordered; 4 | 5 | /** 6 | * @author wuare 7 | * @date 2021/6/29 8 | */ 9 | public class SwaggerConfigProperties implements Ordered { 10 | 11 | private String basePackage; 12 | private String title; 13 | private String description; 14 | private String version; 15 | private String email; 16 | private Boolean oauth = true; 17 | 18 | public String getBasePackage() { 19 | return basePackage; 20 | } 21 | 22 | public void setBasePackage(String basePackage) { 23 | this.basePackage = basePackage; 24 | } 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public void setTitle(String title) { 31 | this.title = title; 32 | } 33 | 34 | public String getDescription() { 35 | return description; 36 | } 37 | 38 | public void setDescription(String description) { 39 | this.description = description; 40 | } 41 | 42 | public String getVersion() { 43 | return version; 44 | } 45 | 46 | public void setVersion(String version) { 47 | this.version = version; 48 | } 49 | 50 | public String getEmail() { 51 | return email; 52 | } 53 | 54 | public void setEmail(String email) { 55 | this.email = email; 56 | } 57 | 58 | @Override 59 | public int getOrder() { 60 | return 0; 61 | } 62 | 63 | public Boolean getOauth() { 64 | return oauth; 65 | } 66 | 67 | public void setOauth(Boolean oauth) { 68 | this.oauth = oauth; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.constant; 2 | 3 | public class CommonConstant { 4 | public static final String JWT_HMAC256_SECRET = "sdfsdfsrty45634kkhllghtdgdfss345t678fs"; 5 | public static final String JWT_ISSUER = "Blog.Core"; 6 | public static final String AUTHORIZATION_PREFIX = "Bearer"; 7 | public static final String REDIS_SECURITY_ROLE_API_KEY = "security:roles_apis:"; 8 | public static final String[] GW_SECURITY_WHITELIST = {"/", "/doc.html", "/oauth/**", 9 | "/*/v2/api-docs", 10 | "/*/v2/api-docs-ext", 11 | "/actuator/**", "/error", "/open/api", "/actuator/health", "/actuator", "/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/v2/**", "/error"}; 12 | } 13 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/JsonUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.core.type.TypeReference; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | 7 | /** 8 | * Json Util 9 | * 10 | * @author wuare 11 | * @date 2021/6/16 12 | */ 13 | public class JsonUtil { 14 | 15 | private static final ObjectMapper objectMapper = new ObjectMapper(); 16 | 17 | private JsonUtil() { 18 | } 19 | 20 | /** 21 | * json to bean 22 | */ 23 | public static T toBean(String content, Class valueType) { 24 | try { 25 | return objectMapper.readValue(content, valueType); 26 | } catch (JsonProcessingException e) { 27 | throw new RuntimeException(e); 28 | } 29 | } 30 | 31 | /** 32 | * json to bean 33 | */ 34 | public static T toBean(String content, TypeReference typeReference) { 35 | try { 36 | return objectMapper.readValue(content, typeReference); 37 | } catch (JsonProcessingException e) { 38 | throw new RuntimeException(e); 39 | } 40 | } 41 | 42 | /** 43 | * object to json 44 | */ 45 | public static String toJson(T value) { 46 | try { 47 | return objectMapper.writeValueAsString(value); 48 | } catch (JsonProcessingException e) { 49 | throw new RuntimeException(e); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/ResultCode.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util; 2 | 3 | /** 4 | * 响应码枚举,参考HTTP状态码的语义 5 | */ 6 | public enum ResultCode { 7 | SUCCESS(200, "成功"),//成功 8 | FAIL(400, "内部错误"),//失败 9 | UNAUTHORIZED(401, "未签名"), 10 | VALID_ERROR(1000, "参数校验错误"), 11 | EXCEL_LACK_FIELD(1001, "excel缺少字段"), 12 | EXCEL_CELL_PARSE_ERROR(1002, "excel中单元格解析错误"), 13 | EXCEL_TYPE_ERROR(1003, "excel文件类型错误"), 14 | ; 15 | 16 | private final int code; 17 | private final String message; 18 | 19 | ResultCode(int code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | 24 | public int code() { 25 | return code; 26 | } 27 | 28 | public String message() {return message;} 29 | } 30 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/ResultGenerator.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util; 2 | 3 | import club.neters.common.util.excel.ResultExcel; 4 | import org.apache.commons.lang3.exception.ExceptionUtils; 5 | 6 | /** 7 | * 响应结果生成工具 8 | */ 9 | public class ResultGenerator { 10 | private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS"; 11 | 12 | public static ResultExcel genSuccessResult() { 13 | return new ResultExcel() 14 | .setCode(ResultCode.SUCCESS) 15 | .setMessage(DEFAULT_SUCCESS_MESSAGE); 16 | } 17 | 18 | public static ResultExcel genSuccessResult(T data) { 19 | return new ResultExcel() 20 | .setCode(ResultCode.SUCCESS) 21 | .setMessage(DEFAULT_SUCCESS_MESSAGE) 22 | .setData(data); 23 | } 24 | 25 | public static ResultExcel genFailResult(String message) { 26 | return new ResultExcel() 27 | .setCode(ResultCode.FAIL) 28 | .setMessage(message); 29 | } 30 | 31 | public static ResultExcel genErrorResult(Exception exception) { 32 | ResultExcel result = new ResultExcel<>(); 33 | result.setCode(ResultCode.FAIL); 34 | result.setData(ExceptionUtils.getStackTrace(exception)); 35 | result.setData(exception.getMessage()); 36 | return result; 37 | } 38 | 39 | public static ResultExcel errorResult(Exception exception) { 40 | ResultExcel result = new ResultExcel(); 41 | result.setCode(ResultCode.FAIL); 42 | result.setData(ExceptionUtils.getStackTrace(exception)); 43 | return result; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/excel/ExcelData.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util.excel; 2 | 3 | import lombok.Data; 4 | import lombok.ToString; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * excel 导出 11 | */ 12 | @ToString 13 | @Data 14 | @Accessors(chain = true) 15 | public class ExcelData { 16 | /** 17 | * excel 名称 18 | */ 19 | private String fileName; 20 | /** 21 | * 导出的数据 22 | */ 23 | private List data; 24 | } 25 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/excel/ExcelDemoVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util.excel; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ExcelDemoVo { 7 | private String policyNumber; 8 | private String insurerName; 9 | private String deal; 10 | private String vin; 11 | private String plateNumber; 12 | private String inceptionDate; 13 | private String error; 14 | } 15 | -------------------------------------------------------------------------------- /ancba-common/src/main/java/club/neters/common/util/excel/ResultExcel.java: -------------------------------------------------------------------------------- 1 | package club.neters.common.util.excel; 2 | 3 | import club.neters.common.util.ResultCode; 4 | 5 | /** 6 | * 统一API响应结果封装 7 | */ 8 | public class ResultExcel { 9 | private int code; 10 | private String message; 11 | private T data; 12 | 13 | public ResultExcel setCode(ResultCode resultCode) { 14 | this.code = resultCode.code(); 15 | return this; 16 | } 17 | 18 | public int getCode() { 19 | return code; 20 | } 21 | 22 | public String getMessage() { 23 | return message; 24 | } 25 | 26 | public ResultExcel setMessage(String message) { 27 | this.message = message; 28 | return this; 29 | } 30 | 31 | public T getData() { 32 | return data; 33 | } 34 | 35 | public ResultExcel setData(T data) { 36 | this.data = data; 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ancba-gateway/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-gateway.jar 7 | EXPOSE 9999 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-gateway.jar"] 11 | -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/AncbaGateWayApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.context.ConfigurableApplicationContext; 7 | 8 | /** 9 | * gateway 10 | * 11 | * @author wuare 12 | * @date 2021/6/25 13 | */ 14 | 15 | @SpringBootApplication 16 | @EnableDiscoveryClient 17 | public class AncbaGateWayApplication { 18 | 19 | public static void main(String[] args) { 20 | ConfigurableApplicationContext applicationContext = SpringApplication.run(AncbaGateWayApplication.class, args); 21 | // 读取启用配置文件中的属性 22 | String authorName = applicationContext.getEnvironment().getProperty("demo"); 23 | System.out.println("================= gw网关服务启动成功,作者:" + authorName + "============="); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/config/apidoc/SwaggerHandler.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway.config.apidoc; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | import reactor.core.publisher.Mono; 10 | import springfox.documentation.swagger.web.*; 11 | 12 | import java.util.Optional; 13 | 14 | 15 | @RestController 16 | @RequestMapping("/swagger-resources") 17 | public class SwaggerHandler { 18 | 19 | /** 20 | * 权限配置,没有的不用关注 21 | */ 22 | @Autowired(required = false) 23 | private SecurityConfiguration securityConfiguration; 24 | 25 | @Autowired(required = false) 26 | private UiConfiguration uiConfiguration; 27 | 28 | private final SwaggerResourcesProvider swaggerResources; 29 | 30 | @Autowired 31 | public SwaggerHandler(SwaggerResourcesProvider swaggerResources) { 32 | this.swaggerResources = swaggerResources; 33 | } 34 | 35 | 36 | @GetMapping("/configuration/security") 37 | public Mono> securityConfiguration() { 38 | return Mono.just(new ResponseEntity<>( 39 | Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()), HttpStatus.OK)); 40 | } 41 | 42 | @GetMapping("/configuration/ui") 43 | public Mono> uiConfiguration() { 44 | return Mono.just(new ResponseEntity<>( 45 | Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK)); 46 | } 47 | 48 | @GetMapping("") 49 | public Mono swaggerResources() { 50 | return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); 51 | } 52 | } -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/config/limit/LimitConfig.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway.config.limit; 2 | 3 | import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver; 4 | import org.springframework.cloud.gateway.filter.ratelimit.RedisRateLimiter; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.core.annotation.Order; 8 | import reactor.core.publisher.Mono; 9 | 10 | @Configuration 11 | public class LimitConfig { 12 | 13 | @Bean 14 | public KeyResolver ipKeyResolver() { 15 | return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName()); 16 | } 17 | 18 | 19 | @Bean 20 | @Order(-100) 21 | public RedisRateLimiter redisRateLimiter() { 22 | return new RedisRateLimiter(1, 2); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/config/loging/RequestLoggingDecorator.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway.config.loging; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.core.io.buffer.DataBuffer; 6 | import org.springframework.http.server.reactive.ServerHttpRequest; 7 | import org.springframework.http.server.reactive.ServerHttpRequestDecorator; 8 | import reactor.core.publisher.Flux; 9 | 10 | import java.io.ByteArrayOutputStream; 11 | import java.io.IOException; 12 | import java.nio.channels.Channels; 13 | import java.nio.charset.StandardCharsets; 14 | 15 | public class RequestLoggingDecorator extends ServerHttpRequestDecorator { 16 | 17 | private static final Logger LOGGER = LoggerFactory.getLogger(RequestLoggingDecorator.class); 18 | 19 | public RequestLoggingDecorator(ServerHttpRequest delegate) { 20 | super(delegate); 21 | } 22 | 23 | @Override 24 | public Flux getBody() { 25 | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); 26 | return super.getBody().doOnNext(dataBuffer -> { 27 | try { 28 | Channels.newChannel(byteArrayOutputStream).write(dataBuffer.asByteBuffer().asReadOnlyBuffer()); 29 | String body = new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8); 30 | LOGGER.info("Request: payload={}", body); 31 | } catch (IOException e) { 32 | e.printStackTrace(); 33 | } finally { 34 | try { 35 | byteArrayOutputStream.close(); 36 | } catch (IOException e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | }); 41 | } 42 | } -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/config/loging/RequestLoggingFilter.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway.config.loging; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.http.server.reactive.ServerHttpRequest; 5 | import org.springframework.web.server.ServerWebExchange; 6 | import org.springframework.web.server.ServerWebExchangeDecorator; 7 | import org.springframework.web.server.WebFilter; 8 | import org.springframework.web.server.WebFilterChain; 9 | import reactor.core.publisher.Mono; 10 | 11 | @Configuration 12 | public class RequestLoggingFilter implements WebFilter { 13 | @Override 14 | public Mono filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) { 15 | ServerWebExchangeDecorator decorator = 16 | new ServerWebExchangeDecorator(serverWebExchange) { 17 | @Override 18 | public ServerHttpRequest getRequest() { 19 | return new RequestLoggingDecorator(serverWebExchange.getRequest()); 20 | } 21 | }; 22 | 23 | return webFilterChain.filter(decorator); 24 | } 25 | } -------------------------------------------------------------------------------- /ancba-gateway/src/main/java/club/neters/gateway/controller/CSRFController.java: -------------------------------------------------------------------------------- 1 | package club.neters.gateway.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | 8 | @RestController 9 | public class CSRFController { 10 | @Value("${demo.user}") 11 | private String userName; 12 | 13 | @GetMapping(value = "/v2/test") 14 | public String test() { 15 | return userName + "are u?"; 16 | } 17 | } -------------------------------------------------------------------------------- /ancba-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: ancba-gateway 4 | boot: 5 | admin: 6 | client: 7 | url: http://host.docker.internal:8088 8 | enabled: true 9 | redis: 10 | host: localhost 11 | port: 6379 12 | database: 0 13 | 14 | cloud: 15 | gateway: 16 | globalcors: 17 | cors-configurations: 18 | '[/**]': 19 | # 不建议全部放开,建议使用nginx反向代理或者只开放前端域名 20 | # 允许携带认证信息 21 | # 允许跨域的源(网站域名/ip),设置*为全部 22 | # 允许跨域请求里的head字段,设置*为全部 23 | # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 24 | # 跨域允许的有效期 25 | allow-credentials: true 26 | allowed-origins: 27 | - "http://localhost:5500" 28 | - "http://localhost:5501" 29 | allowed-headers: "*" 30 | allowed-methods: 31 | - OPTIONS 32 | - GET 33 | - POST 34 | max-age: 3600 35 | discovery: 36 | locator: 37 | # enabled: true 38 | routes: 39 | - id: blog-spring 40 | uri: lb://ancba-blog 41 | predicates: 42 | - Path=/ancba-blog/** 43 | filters: 44 | - StripPrefix=1 45 | - name: RequestRateLimiter 46 | args: 47 | redis-rate-limiter.replenishRate: 1 48 | redis-rate-limiter.burstCapacity: 2 49 | key-resolver: "#{@ipKeyResolver}" 50 | - id: ancba-user 51 | uri: lb://ancba-user 52 | predicates: 53 | - Path=/ancba-user/** 54 | filters: 55 | - StripPrefix=1 56 | - name: RequestRateLimiter 57 | args: 58 | redis-rate-limiter.replenishRate: 1 59 | redis-rate-limiter.burstCapacity: 2 60 | key-resolver: "#{@ipKeyResolver}" 61 | 62 | management: 63 | endpoints: 64 | web: 65 | exposure: 66 | include: '*' 67 | endpoint: 68 | health: 69 | show-details: ALWAYS 70 | 71 | security: 72 | server: 73 | url: http://localhost:8181/oauth/token -------------------------------------------------------------------------------- /ancba-gateway/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | spring.cloud.nacos.config.server-addr=ancba.neters.club:8918 2 | spring.cloud.nacos.discovery.server-addr=ancba.neters.club:8918 3 | server.port=9999 -------------------------------------------------------------------------------- /ancba-maven-archetype/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | club.neters 6 | ancba-maven-archetype 7 | 1.0.0 8 | maven-archetype 9 | 10 | ancba-maven-archetype 11 | 12 | 13 | 14 | 15 | org.apache.maven.archetype 16 | archetype-packaging 17 | 3.2.0 18 | 19 | 20 | 21 | 22 | 23 | 24 | maven-archetype-plugin 25 | 3.2.0 26 | 27 | 28 | 29 | 30 | 31 | Parent pom providing dependency and plugin management for applications built with Maven 32 | 33 | 34 | 35 | laozhang 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | src/main/java 8 | 9 | **/*.java 10 | 11 | 12 | 13 | src/main/java 14 | 15 | **/*.md 16 | 17 | 18 | 19 | src/main/resources 20 | 21 | **/*.md 22 | **/*.yml 23 | 24 | 25 | 26 | 27 | 28 | *.iml 29 | 30 | 31 | 32 | 33 | 34 | AncbaDemo 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/__artifactIdBig__Application.java: -------------------------------------------------------------------------------- 1 | #set( $symbol_pound = '#' ) 2 | #set( $symbol_dollar = '$' ) 3 | #set( $symbol_escape = '\' ) 4 | package ${package}; 5 | 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | 9 | /** 10 | * @author maven plugin 11 | * @date 2021/6/25 12 | */ 13 | @SpringBootApplication 14 | public class ${artifactIdBig}Application { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(${artifactIdBig}Application.class, args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/api/controller/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/api/controller/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/app/service/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/app/service/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/annotation/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/annotation/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/constant/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/exception/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/exception/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | #set( $symbol_pound = '#' ) 2 | #set( $symbol_dollar = '$' ) 3 | #set( $symbol_escape = '\' ) 4 | package ${package}.core.exception; 5 | 6 | /** 7 | * custom exception 8 | * 9 | * @author maven plugin 10 | * @date 2021/6/16 11 | */ 12 | public class ServiceException extends RuntimeException { 13 | 14 | public ServiceException(String message) { 15 | super(message); 16 | } 17 | 18 | public ServiceException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public ServiceException(Throwable cause) { 23 | super(cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/util/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/core/util/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/dto/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/dto/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/entity/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/entity/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/repository/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/repository/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/request/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/request/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/vo/ApiResultVo.java: -------------------------------------------------------------------------------- 1 | #set( $symbol_pound = '#' ) 2 | #set( $symbol_dollar = '$' ) 3 | #set( $symbol_escape = '\' ) 4 | package ${package}.domain.vo; 5 | 6 | import lombok.Data; 7 | 8 | /** 9 | * common vo 10 | * 11 | * @author maven plugin 12 | * @date 2021/6/16 13 | */ 14 | @Data 15 | public class ApiResultVo { 16 | 17 | /** 18 | * 错误代码 19 | */ 20 | private long code; 21 | 22 | /** 23 | * 错误信息 24 | */ 25 | private String message; 26 | 27 | /** 28 | * 返回数据 29 | */ 30 | private T data; 31 | 32 | public static ApiResultVo ok(T data) { 33 | return ok(data, "success"); 34 | } 35 | 36 | public static ApiResultVo ok(T data, String msg) { 37 | ApiResultVo bean = new ApiResultVo<>(); 38 | bean.setData(data); 39 | bean.setCode(200); 40 | bean.setMessage(msg); 41 | return bean; 42 | } 43 | 44 | 45 | public static ApiResultVo error(T data) { 46 | return error(data, "服务器异常"); 47 | } 48 | 49 | public static ApiResultVo error(String msg) { 50 | return error(null, msg); 51 | } 52 | 53 | public static ApiResultVo error(T data, String msg) { 54 | ApiResultVo bean = new ApiResultVo<>(); 55 | bean.setData(data); 56 | bean.setCode(500); 57 | bean.setMessage(msg); 58 | return bean; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/vo/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/domain/vo/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/constant/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/repository/impl/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/java/infra/repository/impl/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8083 3 | 4 | spring: 5 | application: 6 | name: ancba-demo 7 | profiles: 8 | active: dev 9 | 10 | eureka: 11 | instance: 12 | instance-id: ${spring.application.name}:${server.port} 13 | prefer-ip-address: true 14 | client: 15 | service-url: 16 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-maven-archetype/src/main/resources/archetype-resources/src/main/resources/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-shrio-demo.jar 7 | EXPOSE 8083 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar","-Xmx128M", "/app/app-shrio-demo.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/AncbaShrioDemoApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo; 2 | 3 | import club.neters.common.annotaion.EnableAncbaSwagger; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * @author wuare 9 | * @date 2021/6/25 10 | */ 11 | @SpringBootApplication 12 | @EnableAncbaSwagger(basePackage = "club.neters.shrio.demo", title = "接口文档", description = "Shiro案例模块接口文档", oauth = false) 13 | public class AncbaShrioDemoApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(AncbaShrioDemoApplication.class, args); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/api/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.api.controller; 2 | 3 | import club.neters.shrio.demo.domain.vo.ApiResultVo; 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.apache.shiro.SecurityUtils; 7 | import org.apache.shiro.authc.AuthenticationException; 8 | import org.apache.shiro.authc.IncorrectCredentialsException; 9 | import org.apache.shiro.authc.LockedAccountException; 10 | import org.apache.shiro.authc.UnknownAccountException; 11 | import org.apache.shiro.authc.UsernamePasswordToken; 12 | import org.apache.shiro.subject.Subject; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | /** 17 | * login controller 18 | * 19 | * @author wuare 20 | * @date 2021/6/25 21 | */ 22 | @Api(tags = "登录管理") 23 | @RestController 24 | public class LoginController { 25 | 26 | @ApiOperation(value = "获取令牌") 27 | @GetMapping("/login") 28 | public ApiResultVo login(String username, String password) { 29 | try { 30 | UsernamePasswordToken token = new UsernamePasswordToken(username, password); 31 | Subject subject = SecurityUtils.getSubject(); 32 | subject.login(token); 33 | return ApiResultVo.ok((String) subject.getPrincipal()); 34 | } catch (UnknownAccountException | IncorrectCredentialsException | LockedAccountException e) { 35 | return ApiResultVo.error(e.getMessage()); 36 | } catch (AuthenticationException e) { 37 | return ApiResultVo.error("认证失败"); 38 | } 39 | } 40 | 41 | /** 42 | * 退出 43 | */ 44 | @ApiOperation(value = "退出") 45 | @GetMapping("/logout1") 46 | public ApiResultVo logout1() { 47 | Subject subject = SecurityUtils.getSubject(); 48 | subject.logout(); 49 | return ApiResultVo.ok("退出成功"); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/api/controller/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/api/controller/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/api/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.api.controller; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.apache.shiro.authz.annotation.RequiresRoles; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | @Api(tags = "用户管理") 10 | @RestController 11 | public class UserController { 12 | 13 | @ApiOperation(value = "测试授权AdminTest") 14 | @RequiresRoles({"AdminTest"}) 15 | @GetMapping("/test") 16 | public String test(){ 17 | return "xx"; 18 | } 19 | 20 | @ApiOperation(value = "测试授权AdminTest2") 21 | @RequiresRoles({"AdminTest2"}) 22 | @GetMapping("/test2") 23 | public String test2(){ 24 | return "yy"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.app.service; 2 | 3 | import club.neters.shrio.demo.domain.entity.Role; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author laozhang 14 | * @since 2021-06-23 15 | */ 16 | public interface IRoleService extends IService { 17 | List findAllByUId(Integer uID); 18 | } 19 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/ISysUserInfoService.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.app.service; 2 | 3 | import club.neters.shrio.demo.domain.entity.SysUserInfo; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author laozhang 14 | * @since 2021-06-25 15 | */ 16 | public interface ISysUserInfoService extends IService { 17 | SysUserInfo findOne(String name, String pass); 18 | List allSysUserInfo(Integer uID); 19 | } 20 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.app.service.impl; 2 | 3 | import club.neters.shrio.demo.infra.mapper.primary.RoleMapper; 4 | import club.neters.shrio.demo.app.service.IRoleService; 5 | import club.neters.shrio.demo.domain.entity.Role; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 服务实现类 15 | *

16 | * 17 | * @author laozhang 18 | * @since 2021-06-23 19 | */ 20 | @Service 21 | public class RoleServiceImpl extends ServiceImpl implements IRoleService { 22 | 23 | private final RoleMapper roleMapper; 24 | 25 | @Autowired 26 | public RoleServiceImpl(RoleMapper roleMapper){ 27 | this.roleMapper = roleMapper; 28 | } 29 | 30 | @Override 31 | public List findAllByUId(Integer uID) { 32 | return roleMapper.findAllByUId(uID); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/app/service/impl/SysUserInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.app.service.impl; 2 | 3 | import club.neters.shrio.demo.domain.entity.SysUserInfo; 4 | import club.neters.shrio.demo.infra.mapper.primary.SysUserInfoMapper; 5 | import club.neters.shrio.demo.app.service.ISysUserInfoService; 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 7 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * 服务实现类 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Service 23 | public class SysUserInfoServiceImpl extends ServiceImpl implements ISysUserInfoService { 24 | 25 | private final SysUserInfoMapper sysUserInfoMapper; 26 | 27 | @Autowired 28 | public SysUserInfoServiceImpl(SysUserInfoMapper sysUserInfoMapper){ 29 | this.sysUserInfoMapper = sysUserInfoMapper; 30 | } 31 | 32 | @Override 33 | public SysUserInfo findOne(String name, String pass) { 34 | LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); 35 | wrapper.eq(SysUserInfo::getTdIsDelete, 0) 36 | .eq(SysUserInfo::getULoginName, name) 37 | .eq(SysUserInfo::getULoginPWD, pass.toUpperCase()); 38 | return getOne(wrapper); 39 | } 40 | 41 | @Override 42 | public List allSysUserInfo(Integer uID) { 43 | return sysUserInfoMapper.allSysUserInfo(uID); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/annotation/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/annotation/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/config/SecurityPermitAllConfig.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.core.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class SecurityPermitAllConfig extends WebSecurityConfigurerAdapter { 9 | @Override 10 | protected void configure(HttpSecurity http) throws Exception { 11 | http.authorizeRequests().anyRequest().permitAll() 12 | .and().csrf().disable(); 13 | } 14 | } -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.core.constant; 2 | 3 | public class CommonConstant { 4 | public static final String JWT_HMAC256_SECRET = "sdfsdfsrty45634kkhllghtdgdfss345t678fs"; 5 | public static final String JWT_ISSUER = "Blog.Core"; 6 | public static final String JWT_TOKEN_HEADER = "Authorization"; 7 | } 8 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/constant/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/exception/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/exception/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.core.exception; 2 | 3 | /** 4 | * custom exception 5 | * 6 | * @author wuare 7 | * @date 2021/6/16 8 | */ 9 | public class ServiceException extends RuntimeException { 10 | 11 | public ServiceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ServiceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ServiceException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/util/HttpContextUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.core.util; 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 | 8 | public class HttpContextUtil { 9 | public static HttpServletRequest getHttpServletRequest() { 10 | return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); 11 | } 12 | 13 | public static String getDomain() { 14 | HttpServletRequest request = getHttpServletRequest(); 15 | StringBuffer url = request.getRequestURL(); 16 | return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString(); 17 | } 18 | 19 | public static String getOrigin() { 20 | HttpServletRequest request = getHttpServletRequest(); 21 | return request.getHeader("Origin"); 22 | } 23 | } -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/util/JsonUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.core.util; 2 | 3 | import club.neters.shrio.demo.core.exception.ServiceException; 4 | import com.fasterxml.jackson.core.JsonProcessingException; 5 | import com.fasterxml.jackson.core.type.TypeReference; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Json Util 13 | * 14 | * @author wuare 15 | * @date 2021/6/16 16 | */ 17 | public class JsonUtil { 18 | 19 | private static final ObjectMapper objectMapper = new ObjectMapper(); 20 | 21 | private JsonUtil() { 22 | } 23 | 24 | /** 25 | * json to bean 26 | */ 27 | public static T toBean(String content, Class valueType) { 28 | try { 29 | return objectMapper.readValue(content, valueType); 30 | } catch (JsonProcessingException e) { 31 | throw new ServiceException(e); 32 | } 33 | } 34 | 35 | /** 36 | * json to map 37 | */ 38 | public static Map toMap(String content) { 39 | try { 40 | return objectMapper.readValue(content, new TypeReference>() { 41 | }); 42 | } catch (JsonProcessingException e) { 43 | throw new ServiceException(e); 44 | } 45 | } 46 | 47 | /** 48 | * json to list 49 | */ 50 | public static List toList(String content) { 51 | try { 52 | return objectMapper.readValue(content, new TypeReference>() { 53 | }); 54 | } catch (JsonProcessingException e) { 55 | throw new ServiceException(e); 56 | } 57 | } 58 | 59 | /** 60 | * object to json 61 | */ 62 | public static String toJson(T value) { 63 | try { 64 | return objectMapper.writeValueAsString(value); 65 | } catch (JsonProcessingException e) { 66 | throw new ServiceException(e); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/util/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/core/util/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/dto/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/dto/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/entity/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.baomidou.mybatisplus.annotation.TableId; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * 基础实体类 16 | * 17 | * @author laozhang 18 | * @date 2021/06/12 19 | */ 20 | @Data 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | public class BaseEntity implements Serializable { 24 | 25 | @TableId(value = "Id", type = IdType.AUTO) 26 | private Integer Id; 27 | 28 | @TableField("CreateId") 29 | private Integer CreateId; 30 | 31 | @TableField("CreateBy") 32 | private String CreateBy; 33 | 34 | @TableField(value = "CreateTime", fill = FieldFill.INSERT) 35 | protected Date CreateTime; 36 | 37 | @TableField("ModifyId") 38 | private Integer ModifyId; 39 | 40 | @TableField("ModifyBy") 41 | private String ModifyBy; 42 | 43 | @TableField(value = "ModifyTime", fill = FieldFill.INSERT) 44 | protected Date ModifyTime; 45 | 46 | @TableField("tdIsDelete") 47 | private Boolean IsDeleted; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/entity/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/entity/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/entity/Role.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | 10 | /** 11 | * 角色信息表 12 | * 13 | * @author laozhang 14 | * @date 2021/06/16 15 | */ 16 | @EqualsAndHashCode(callSuper = false) 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | @TableName("Role") 21 | public class Role extends BaseEntity { 22 | @TableField("Name") 23 | private String Name; 24 | 25 | @TableField("Description") 26 | private String Description; 27 | 28 | @TableField("OrderSort") 29 | private Integer OrderSort; 30 | 31 | @TableField("Enabled") 32 | private Boolean Enabled; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/entity/SysUserInfo.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.domain.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import java.time.LocalDateTime; 7 | import com.baomidou.mybatisplus.annotation.TableField; 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("SysUserInfo") 25 | public class SysUserInfo implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "uID", type = IdType.AUTO) 30 | private Integer uID; 31 | 32 | @TableField("uLoginName") 33 | private String uLoginName; 34 | 35 | @TableField("uLoginPWD") 36 | private String uLoginPWD; 37 | 38 | @TableField("uRealName") 39 | private String uRealName; 40 | 41 | @TableField("uStatus") 42 | private Integer uStatus; 43 | 44 | @TableField("uRemark") 45 | private String uRemark; 46 | 47 | @TableField("uCreateTime") 48 | private LocalDateTime uCreateTime; 49 | 50 | @TableField("uUpdateTime") 51 | private LocalDateTime uUpdateTime; 52 | 53 | @TableField("uLastErrTime") 54 | private LocalDateTime uLastErrTime; 55 | 56 | @TableField("uErrorCount") 57 | private Integer uErrorCount; 58 | 59 | @TableField("name") 60 | private String name; 61 | 62 | @TableField("sex") 63 | private Integer sex; 64 | 65 | @TableField("age") 66 | private Integer age; 67 | 68 | @TableField("birth") 69 | private LocalDateTime birth; 70 | 71 | @TableField("addr") 72 | private String addr; 73 | 74 | @TableField("tdIsDelete") 75 | private Boolean tdIsDelete; 76 | 77 | 78 | @TableField(exist = false) //不是数据库字段,但必须使用 79 | private List roles; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/repository/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/repository/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/request/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/request/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/vo/ApiResultVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * common vo 7 | * 8 | * @author wuare 9 | * @date 2021/6/16 10 | */ 11 | @Data 12 | public class ApiResultVo { 13 | 14 | /** 15 | * 错误代码 16 | */ 17 | private long code; 18 | 19 | /** 20 | * 错误信息 21 | */ 22 | private String message; 23 | 24 | /** 25 | * 返回数据 26 | */ 27 | private T data; 28 | 29 | public static ApiResultVo ok(T data) { 30 | return ok(data, "success"); 31 | } 32 | 33 | public static ApiResultVo ok(T data, String msg) { 34 | ApiResultVo bean = new ApiResultVo<>(); 35 | bean.setData(data); 36 | bean.setCode(200); 37 | bean.setMessage(msg); 38 | return bean; 39 | } 40 | 41 | 42 | public static ApiResultVo error(T data) { 43 | return error(data, "服务器异常"); 44 | } 45 | 46 | public static ApiResultVo error(String msg) { 47 | return error(null, msg); 48 | } 49 | 50 | public static ApiResultVo error(T data, String msg) { 51 | ApiResultVo bean = new ApiResultVo<>(); 52 | bean.setData(data); 53 | bean.setCode(500); 54 | bean.setMessage(msg); 55 | return bean; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/vo/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/domain/vo/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/constant/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/primary/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.infra.mapper.primary; 2 | 3 | 4 | import club.neters.shrio.demo.domain.entity.Role; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author laozhang 17 | * @since 2021-06-23 18 | */ 19 | @Repository 20 | public interface RoleMapper extends BaseMapper { 21 | @Select("select * from Role where Id in (select RoleId from UserRole where UserId = #{uID})") 22 | List findAllByUId(Integer uID); 23 | } 24 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/primary/SysUserInfoMapper.java: -------------------------------------------------------------------------------- 1 | package club.neters.shrio.demo.infra.mapper.primary; 2 | 3 | import club.neters.shrio.demo.domain.entity.SysUserInfo; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Many; 6 | import org.apache.ibatis.annotations.Result; 7 | import org.apache.ibatis.annotations.Results; 8 | import org.apache.ibatis.annotations.Select; 9 | import org.apache.ibatis.mapping.FetchType; 10 | import org.springframework.stereotype.Repository; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * Mapper 接口 17 | *

18 | * 19 | * @author laozhang 20 | * @since 2021-06-25 21 | */ 22 | @Repository 23 | public interface SysUserInfoMapper extends BaseMapper { 24 | 25 | @Select("select * from SysUserInfo where uID = #{uID}") 26 | @Results(id="UserMap",value={ 27 | @Result(property = "roles",column = "uID", 28 | many = @Many(select = "club.neters.shrio.demo.infra.mapper.primary.RoleMapper.findAllByUId", 29 | fetchType = FetchType.LAZY)) 30 | }) 31 | List allSysUserInfo(Integer uID); 32 | } 33 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/repository/impl/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/java/club/neters/shrio/demo/infra/repository/impl/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8083 3 | 4 | spring: 5 | main: 6 | allow-bean-definition-overriding: true 7 | application: 8 | name: ancba-shrio-demo 9 | profiles: 10 | active: dev 11 | boot: 12 | admin: 13 | client: 14 | url: http://localhost:8088 15 | enabled: false 16 | 17 | eureka: 18 | instance: 19 | instance-id: ${spring.application.name}:${server.port} 20 | health-check-url-path: /actuator/health 21 | prefer-ip-address: true 22 | client: 23 | service-url: 24 | defaultZone: http://localhost:8761/eureka/ 25 | enabled: false 26 | 27 | management: 28 | endpoints: 29 | web: 30 | exposure: 31 | include: '*' 32 | endpoint: 33 | health: 34 | show-details: ALWAYS 35 | 36 | security: 37 | server: 38 | url: http://localhost:8181/oauth/token 39 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/resources/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/resources/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/resources/mapper/primary/SysUserInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ancba-shrio-demo/src/main/resources/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-shrio-demo/src/main/resources/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-task-xxl/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md 26 | -------------------------------------------------------------------------------- /ancba-task-xxl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-task.jar 7 | EXPOSE 8186 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-task.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-task-xxl/README.md: -------------------------------------------------------------------------------- 1 | ### 安装步骤 2 | 3 | ps:命令中包含有网桥配置,如果不需要,可以去掉 4 | 5 | #### 1、启动admin调度中心 6 | ``` 7 | docker run -d \ 8 | -e PARAMS="--spring.datasource.url=jdbc:mysql://118.25.25.13:3069/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=UTC --spring.datasource.username=root --spring.datasource.password=root --spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver" \ 9 | -p 8080:8080 \ 10 | -v /data/xxl-admin/logs:/data/applogs \ 11 | --name my-xxl-job-admin-2.2.0 \ 12 | -d xuxueli/xxl-job-admin:2.2.0 13 | ``` 14 | 15 | #### 2、启动executor执行器 16 | ``` 17 | docker run --name=ancba-task-xxl-container \ 18 | -d -v /data/ancba/ancba-task-xxl/application-dev.yml:/opt/application-dev.yml \ 19 | --add-host=host.docker.internal:host-gateway --network dev-ops --network-alias devops-ancba-task-xxl \ 20 | -it -p 8186:8186 -p 9876:9876 laozhangisphi/ancba-task-xxl:0.0.1-SNAPSHOT 21 | ``` -------------------------------------------------------------------------------- /ancba-task-xxl/src/main/java/club/neters/schedule/AncbaScheduleApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.schedule; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 任务调度 8 | * 9 | */ 10 | @SpringBootApplication 11 | public class AncbaScheduleApplication 12 | { 13 | public static void main(String[] args) { 14 | SpringApplication.run(AncbaScheduleApplication.class, args); 15 | System.out.println("================= task微服务启动成功 ============="); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ancba-task-xxl/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 11 | -------------------------------------------------------------------------------- /ancba-task-xxl/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8186 3 | 4 | spring: 5 | application: 6 | name: ancba-task-xxl 7 | profiles: 8 | active: dev 9 | boot: 10 | admin: 11 | client: 12 | url: http://localhost:8088 13 | enabled: false 14 | 15 | cloud: 16 | nacos: 17 | discovery: 18 | server-addr: http://localhost:8918 19 | 20 | management: 21 | endpoints: 22 | web: 23 | exposure: 24 | include: '*' 25 | endpoint: 26 | health: 27 | show-details: ALWAYS 28 | 29 | # xxl-job配置 30 | xxl: 31 | job: 32 | admin: 33 | addresses: http://localhost:8380/xxl-job-admin 34 | executor: 35 | address: 36 | appname: ancba-task-xxl 37 | ip: 38 | port: 9876 39 | logpath: /logs/xxl-job/jobhandler 40 | logretentiondays: 15 41 | accessToken: 42 | 43 | security: 44 | server: 45 | url: http://localhost:8181/oauth/token -------------------------------------------------------------------------------- /ancba-user/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /ancba-user/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM apache/skywalking-java-agent:8.8.0-java11 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-user.jar 7 | EXPOSE 8085 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-user.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-user/Dockerfilebak: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk:11-jre-hotspot 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-user.jar 7 | EXPOSE 8085 8 | #指定server 9 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 10 | CMD ["java", "-jar", "-Xmx128M", "/app/app-user.jar","--spring.config.location=../opt/application.yml"] 11 | -------------------------------------------------------------------------------- /ancba-user/skywalking/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM apache/skywalking-java-agent:8.8.0-java11 2 | MAINTAINER laozhang 3 | VOLUME /tmp 4 | COPY ./src/main/resources /opt 5 | ARG JAR_FILE 6 | ADD ${JAR_FILE} /app/app-user.jar 7 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="10.168.37.36:11800" \ 8 | SW_AGENT_NAME="ancba-user" 9 | 10 | EXPOSE 8085 11 | #指定server 12 | #ENTRYPOINT ["java","-jar","/app/app.jar","0.0.0.0"] 13 | CMD ["java", "-jar", "-Xmx128M", "/app/app-user.jar","--spring.config.location=../opt/application.yml"] 14 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/AncbaUserApplication.java: -------------------------------------------------------------------------------- 1 | package club.neters.user; 2 | 3 | import club.neters.common.annotaion.EnableAncbaSwagger; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | 9 | /** 10 | * @author maven plugin 11 | * @date 2021/6/25 12 | */ 13 | @SpringBootApplication 14 | @EnableAncbaSwagger(basePackage = "club.neters.user", title = "接口文档", description = "用户模块接口文档") 15 | @EnableFeignClients 16 | @EnableDiscoveryClient 17 | public class AncbaUserApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(AncbaUserApplication.class, args); 21 | System.out.println("================= user微服务启动成功 ============="); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/api/controller/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/api/controller/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/api/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.api.controller; 2 | 3 | import club.neters.user.app.service.UserApiService; 4 | import club.neters.user.core.annotation.AnonAllowed; 5 | import club.neters.user.domain.entity.BlogArticle; 6 | import club.neters.user.domain.request.UserInfoRequestFromBlog; 7 | import club.neters.user.domain.vo.ApiResultVo; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.core.Authentication; 10 | import org.springframework.security.core.context.SecurityContext; 11 | import org.springframework.security.core.context.SecurityContextHolder; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author wuare 19 | * @date 2021/7/1 20 | */ 21 | @RestController 22 | public class UserController { 23 | @Autowired 24 | private UserApiService userApiService; 25 | 26 | @GetMapping("/test") 27 | public String test() { 28 | SecurityContext context = SecurityContextHolder.getContext(); 29 | Authentication authentication = context.getAuthentication(); 30 | System.out.println(authentication.getAuthorities()); 31 | return "test"; 32 | } 33 | 34 | @GetMapping("/test1") 35 | public String test1() { 36 | SecurityContext context = SecurityContextHolder.getContext(); 37 | Authentication authentication = context.getAuthentication(); 38 | System.out.println(authentication.getAuthorities()); 39 | return "test1"; 40 | } 41 | 42 | @GetMapping("/user/testNo") 43 | @AnonAllowed 44 | public ApiResultVo> testNo() { 45 | return userApiService.loadUserListPage(new UserInfoRequestFromBlog()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/app/service/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/app/service/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/app/service/UserApiService.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.app.service; 2 | 3 | import club.neters.user.core.config.feign.FeignConfig; 4 | import club.neters.user.domain.entity.BlogArticle; 5 | import club.neters.user.domain.request.UserInfoRequestFromBlog; 6 | import club.neters.user.domain.vo.ApiResultVo; 7 | import org.springframework.cloud.openfeign.FeignClient; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | 11 | import java.util.List; 12 | 13 | @FeignClient(value = "ancba-blog", configuration = {FeignConfig.class}) 14 | public interface UserApiService { 15 | /** 16 | * 查询用户数据 17 | */ 18 | @RequestMapping(value = "/list", method = RequestMethod.GET) 19 | ApiResultVo> loadUserListPage(UserInfoRequestFromBlog query); 20 | } 21 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/annotation/AnonAllowed.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * @author wuare 11 | * @date 2021/7/2 12 | */ 13 | @Target({ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Documented 16 | public @interface AnonAllowed { 17 | } 18 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/annotation/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/core/annotation/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/config/feign/FeignConfig.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.config.feign; 2 | 3 | import feign.RequestInterceptor; 4 | import feign.RequestTemplate; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.http.HttpHeaders; 7 | import org.springframework.web.context.request.RequestContextHolder; 8 | import org.springframework.web.context.request.ServletRequestAttributes; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | @Configuration 13 | public class FeignConfig implements RequestInterceptor { 14 | @Override 15 | public void apply(RequestTemplate requestTemplate) { 16 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); 17 | HttpServletRequest request = attributes.getRequest(); 18 | requestTemplate.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION)); 19 | } 20 | } -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/config/security/AdminAccessDeineHandler.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.config.security; 2 | 3 | import club.neters.user.core.util.JsonUtil; 4 | import club.neters.user.domain.vo.ApiResultVo; 5 | import org.springframework.security.access.AccessDeniedException; 6 | import org.springframework.security.web.access.AccessDeniedHandler; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | 12 | public class AdminAccessDeineHandler implements AccessDeniedHandler { 13 | @Override 14 | public void handle(HttpServletRequest request, HttpServletResponse response, 15 | AccessDeniedException accessDeniedException) throws IOException { 16 | response.setCharacterEncoding("utf-8"); 17 | response.setContentType("text/javascript;charset=utf-8"); 18 | response.getWriter().print(JsonUtil.toJson(ApiResultVo.forbidden("授权失败,请联系管理员!"))); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.constant; 2 | 3 | public class CommonConstant { 4 | public static final String JWT_HMAC256_SECRET = "sdfsdfsrty45634kkhllghtdgdfss345t678fs"; 5 | public static final String JWT_ISSUER = "Blog.Core"; 6 | public static final String[] SECURITY_WHITELIST = {"/", "/actuator/health", "/actuator", "/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/v2/**", "/error"}; 7 | } 8 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/core/constant/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/exception/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/core/exception/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.exception; 2 | 3 | /** 4 | * custom exception 5 | * 6 | * @author maven plugin 7 | * @date 2021/6/16 8 | */ 9 | public class ServiceException extends RuntimeException { 10 | 11 | public ServiceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ServiceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ServiceException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/util/ApplicationContextUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.util; 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 | * @author wuare 10 | * @date 2021/7/2 11 | */ 12 | @Component 13 | public class ApplicationContextUtil implements ApplicationContextAware { 14 | 15 | private static ApplicationContext applicationContext; 16 | 17 | @Override 18 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 19 | ApplicationContextUtil.applicationContext = applicationContext; 20 | } 21 | 22 | public static ApplicationContext getApplicationContext() { 23 | return applicationContext; 24 | } 25 | 26 | public static T getBean(Class clazz) { 27 | return applicationContext.getBean(clazz); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/util/HandlerMethodUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.util; 2 | 3 | import org.springframework.web.method.HandlerMethod; 4 | import org.springframework.web.servlet.DispatcherServlet; 5 | import org.springframework.web.servlet.HandlerExecutionChain; 6 | import org.springframework.web.servlet.HandlerMapping; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | /** 11 | * @author wuare 12 | * @date 2021/7/2 13 | */ 14 | public class HandlerMethodUtil { 15 | 16 | public static HandlerMethod getHandlerMethod(HttpServletRequest request) { 17 | DispatcherServlet dispatcherServlet = ApplicationContextUtil.getBean(DispatcherServlet.class); 18 | try { 19 | HandlerExecutionChain handlerExecutionChain = findHandler(dispatcherServlet, request); 20 | if (handlerExecutionChain == null) { 21 | return null; 22 | } 23 | Object handler = handlerExecutionChain.getHandler(); 24 | if (!(handler instanceof HandlerMethod)) { 25 | return null; 26 | } 27 | return (HandlerMethod) handler; 28 | } catch (Exception ignored) { 29 | return null; 30 | } 31 | } 32 | 33 | private static HandlerExecutionChain findHandler(DispatcherServlet dispatcherServlet, HttpServletRequest request) throws Exception { 34 | if (dispatcherServlet.getHandlerMappings() != null) { 35 | for (HandlerMapping mapping : dispatcherServlet.getHandlerMappings()) { 36 | HandlerExecutionChain handler = mapping.getHandler(request); 37 | if (handler != null) { 38 | return handler; 39 | } 40 | } 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/util/JsonUtil.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.core.util; 2 | 3 | import club.neters.user.core.exception.ServiceException; 4 | import com.fasterxml.jackson.core.JsonProcessingException; 5 | import com.fasterxml.jackson.core.type.TypeReference; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Json Util 13 | * 14 | * @author wuare 15 | * @date 2021/6/16 16 | */ 17 | public class JsonUtil { 18 | 19 | private static final ObjectMapper objectMapper = new ObjectMapper(); 20 | 21 | private JsonUtil() { 22 | } 23 | 24 | /** 25 | * json to bean 26 | */ 27 | public static T toBean(String content, Class valueType) { 28 | try { 29 | return objectMapper.readValue(content, valueType); 30 | } catch (JsonProcessingException e) { 31 | throw new ServiceException(e); 32 | } 33 | } 34 | 35 | /** 36 | * json to map 37 | */ 38 | public static Map toMap(String content) { 39 | try { 40 | return objectMapper.readValue(content, new TypeReference>() { 41 | }); 42 | } catch (JsonProcessingException e) { 43 | throw new ServiceException(e); 44 | } 45 | } 46 | 47 | /** 48 | * json to list 49 | */ 50 | public static List toList(String content) { 51 | try { 52 | return objectMapper.readValue(content, new TypeReference>() { 53 | }); 54 | } catch (JsonProcessingException e) { 55 | throw new ServiceException(e); 56 | } 57 | } 58 | 59 | /** 60 | * object to json 61 | */ 62 | public static String toJson(T value) { 63 | try { 64 | return objectMapper.writeValueAsString(value); 65 | } catch (JsonProcessingException e) { 66 | throw new ServiceException(e); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/core/util/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/core/util/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/dto/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/domain/dto/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/entity/BlogArticle.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.domain.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * BlogArticle表 12 | * 13 | * @author laozhang 14 | * @date 2021/06/12 15 | */ 16 | @EqualsAndHashCode() 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | public class BlogArticle { 21 | 22 | private Integer bID; 23 | 24 | private String bsubmitter; 25 | 26 | private String btitle; 27 | 28 | private String bcategory; 29 | 30 | private String bcontent; 31 | 32 | private Integer btraffic; 33 | 34 | private Integer bcommentNum; 35 | 36 | private Date bUpdateTime; 37 | 38 | private Date bCreateTime; 39 | 40 | private String bRemark; 41 | 42 | private Boolean IsDeleted; 43 | 44 | } -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/entity/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/domain/entity/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/repository/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/domain/repository/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/request/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/domain/request/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/request/UserInfoRequestFromBlog.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.domain.request; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * user information query object 8 | * 9 | * @author wuare 10 | * @date 2021/6/16 11 | */ 12 | @Data 13 | public class UserInfoRequestFromBlog { 14 | 15 | @ApiModelProperty(value = "id") 16 | private Integer uID; 17 | 18 | @ApiModelProperty(value = "登录名") 19 | private String uLoginName; 20 | 21 | @ApiModelProperty(value = "真实名") 22 | private String uRealName; 23 | 24 | @ApiModelProperty(value = "名字") 25 | private String name; 26 | } 27 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/vo/ApiResultVo.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * common vo 7 | * 8 | * @author wuare 9 | * @date 2021/6/16 10 | */ 11 | @Data 12 | public class ApiResultVo { 13 | 14 | /** 15 | * 错误代码 16 | */ 17 | private long code; 18 | 19 | /** 20 | * 错误信息 21 | */ 22 | private String message; 23 | 24 | /** 25 | * 返回数据 26 | */ 27 | private T data; 28 | 29 | public static ApiResultVo ok(T data) { 30 | return ok(data, "success"); 31 | } 32 | 33 | public static ApiResultVo ok(T data, String msg) { 34 | ApiResultVo bean = new ApiResultVo<>(); 35 | bean.setData(data); 36 | bean.setCode(200); 37 | bean.setMessage(msg); 38 | return bean; 39 | } 40 | 41 | 42 | public static ApiResultVo error(T data) { 43 | return error(data, "服务器异常"); 44 | } 45 | 46 | public static ApiResultVo error(String msg) { 47 | return error(null, msg); 48 | } 49 | 50 | public static ApiResultVo error(T data, String msg) { 51 | ApiResultVo bean = new ApiResultVo<>(); 52 | bean.setData(data); 53 | bean.setCode(500); 54 | bean.setMessage(msg); 55 | return bean; 56 | } 57 | 58 | public static ApiResultVo badRequest(String msg) { 59 | ApiResultVo bean = new ApiResultVo<>(); 60 | bean.setCode(400); 61 | bean.setMessage(msg); 62 | return bean; 63 | } 64 | 65 | public static ApiResultVo unauthorized(String msg) { 66 | ApiResultVo bean = new ApiResultVo<>(); 67 | bean.setCode(401); 68 | bean.setMessage(msg); 69 | return bean; 70 | } 71 | 72 | public static ApiResultVo forbidden(String msg) { 73 | ApiResultVo bean = new ApiResultVo<>(); 74 | bean.setCode(403); 75 | bean.setMessage(msg); 76 | return bean; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/vo/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/domain/vo/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/domain/vo/UserInfoVoFromBlog.java: -------------------------------------------------------------------------------- 1 | package club.neters.user.domain.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * user information view object 12 | * 13 | * @author wuare 14 | * @date 2021/6/16 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @Builder 20 | public class UserInfoVoFromBlog { 21 | private Integer uID; 22 | 23 | private String uLoginName; 24 | 25 | 26 | private String uRealName; 27 | 28 | private Integer uStatus; 29 | 30 | private String uRemark; 31 | 32 | protected Date uCreateTime; 33 | 34 | protected Date uUpdateTime; 35 | 36 | private String name; 37 | 38 | private Integer sex; 39 | 40 | private Integer age; 41 | 42 | protected Date birth; 43 | 44 | private String addr; 45 | 46 | 47 | /** 48 | * 手机号 49 | */ 50 | private String phone; 51 | 52 | 53 | /** 54 | * 验证码 登录用 55 | */ 56 | private String verifyCode; 57 | 58 | 59 | /** 60 | * 新密码 61 | */ 62 | private String newPassword; 63 | } 64 | -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/infra/constant/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/infra/constant/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/infra/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/infra/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/infra/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/infra/mapper/second/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/java/club/neters/user/infra/repository/impl/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/java/club/neters/user/infra/repository/impl/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | primary: 4 | jdbc-url: jdbc:mysql://118.25.25.13:3096/blogcore001?charset=utf8&useSSL=false&serverTimezone=GMT&useUnicode=true&characterEncoding=UTF-8 5 | driver-class-name: com.mysql.cj.jdbc.Driver 6 | username: root 7 | password: J 8 | hikari: 9 | maximum-pool-size: 20 10 | minimum-idle: 5 -------------------------------------------------------------------------------- /ancba-user/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8085 3 | 4 | spring: 5 | application: 6 | name: ancba-user 7 | profiles: 8 | active: dev 9 | boot: 10 | admin: 11 | client: 12 | url: http://localhost:8088 13 | enabled: false 14 | 15 | cloud: 16 | nacos: 17 | discovery: 18 | server-addr: http://localhost:8918 19 | enabled: true 20 | zipkin: 21 | base-url: http://neters.club:9411/ # zipkin服务器的地址 22 | # 关闭服务发现,否则Spring Cloud会把zipkin的url当做服务名称 23 | discoveryClientEnabled: false 24 | sender: 25 | type: web # 设置使用http的方式传输数据 26 | sleuth: 27 | sampler: 28 | probability: 1 # 设置抽样采集率为100%,默认为0.1,即10% 29 | 30 | management: 31 | endpoints: 32 | web: 33 | exposure: 34 | include: '*' 35 | endpoint: 36 | health: 37 | show-details: ALWAYS 38 | 39 | security: 40 | server: 41 | url: http://localhost:8181/oauth/token -------------------------------------------------------------------------------- /ancba-user/src/main/resources/mapper/primary/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/resources/mapper/primary/README.md -------------------------------------------------------------------------------- /ancba-user/src/main/resources/mapper/second/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/ancba-user/src/main/resources/mapper/second/README.md -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Maven 2 | # Build your Java project and run tests with Apache Maven. 3 | # Add steps that analyze code, save build artifacts, deploy, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/java 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: ubuntu-latest 11 | 12 | steps: 13 | - task: Maven@3 14 | inputs: 15 | mavenPomFile: 'pom.xml' 16 | mavenOptions: '-Xmx3072m' 17 | javaHomeOption: 'JDKVersion' 18 | jdkVersionOption: '1.8' 19 | jdkArchitectureOption: 'x64' 20 | publishJUnitResults: true 21 | testResultsFiles: '**/surefire-reports/TEST-*.xml' 22 | goals: 'package' 23 | -------------------------------------------------------------------------------- /doc/admin-more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/admin-more.png -------------------------------------------------------------------------------- /doc/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/admin.png -------------------------------------------------------------------------------- /doc/limit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/limit.png -------------------------------------------------------------------------------- /doc/nacos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/nacos.png -------------------------------------------------------------------------------- /doc/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/wechat.png -------------------------------------------------------------------------------- /doc/xxl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/xxl.png -------------------------------------------------------------------------------- /doc/z2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/z2.png -------------------------------------------------------------------------------- /doc/zipkin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anjoy8/ancba/eda87d22a246efb97f5fd1076d60a714f9b71b0c/doc/zipkin.png -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | ancba-admin: 4 | image: 'laozhangisphi/ancba-admin:0.0.1-SNAPSHOT' 5 | build: 6 | context: . 7 | dockerfile: ancba-admin/Dockerfile 8 | ancba-authorizer-oauth2: 9 | image: 'laozhangisphi/ancba-authorizer-oauth2:0.0.1-SNAPSHOT' 10 | build: 11 | context: . 12 | dockerfile: ancba-authorizer-oauth2/Dockerfile 13 | ancba-blog: 14 | image: 'laozhangisphi/ancba-blog:0.0.1-SNAPSHOT' 15 | build: 16 | context: . 17 | dockerfile: ancba-blog/Dockerfile 18 | ancba-gateway: 19 | image: 'laozhangisphi/ancba-gateway:0.0.1-SNAPSHOT' 20 | build: 21 | context: . 22 | dockerfile: ancba-gateway/Dockerfile 23 | ancba-user: 24 | image: 'laozhangisphi/ancba-user:0.0.1-SNAPSHOT' 25 | build: 26 | context: . 27 | dockerfile: ancba-user/Dockerfile --------------------------------------------------------------------------------