├── sk-system └── src │ ├── .DS_Store │ └── main │ ├── .DS_Store │ ├── java │ ├── .DS_Store │ └── com │ │ ├── .DS_Store │ │ └── dxj │ │ ├── .DS_Store │ │ ├── module │ │ ├── .DS_Store │ │ ├── system │ │ │ ├── .DS_Store │ │ │ ├── domain │ │ │ │ ├── vo │ │ │ │ │ ├── UserPassVo.java │ │ │ │ │ ├── MenuMetaVo.java │ │ │ │ │ └── MenuVo.java │ │ │ │ ├── query │ │ │ │ │ ├── DictQuery.java │ │ │ │ │ ├── DictDetailQuery.java │ │ │ │ │ ├── RoleQuery.java │ │ │ │ │ ├── JobQuery.java │ │ │ │ │ ├── MenuQuery.java │ │ │ │ │ ├── DeptQuery.java │ │ │ │ │ └── UserQuery.java │ │ │ │ ├── dto │ │ │ │ │ ├── DeptSmallDTO.java │ │ │ │ │ ├── DictSmallDTO.java │ │ │ │ │ ├── JobSmallDTO.java │ │ │ │ │ ├── RoleSmallDTO.java │ │ │ │ │ ├── DictDTO.java │ │ │ │ │ ├── DictDetailDTO.java │ │ │ │ │ ├── RoleDTO.java │ │ │ │ │ ├── JobDTO.java │ │ │ │ │ ├── DeptDTO.java │ │ │ │ │ ├── UserDTO.java │ │ │ │ │ └── MenuDTO.java │ │ │ │ ├── mapstruct │ │ │ │ │ ├── DeptMapper.java │ │ │ │ │ ├── DictMapper.java │ │ │ │ │ ├── MenuMapper.java │ │ │ │ │ ├── JobSmallMapper.java │ │ │ │ │ ├── DeptSmallMapper.java │ │ │ │ │ ├── DictSmallMapper.java │ │ │ │ │ ├── JobMapper.java │ │ │ │ │ ├── RoleSmallMapper.java │ │ │ │ │ ├── RoleMapper.java │ │ │ │ │ ├── UserMapper.java │ │ │ │ │ └── DictDetailMapper.java │ │ │ │ └── entity │ │ │ │ │ ├── Dict.java │ │ │ │ │ ├── DictDetail.java │ │ │ │ │ ├── Job.java │ │ │ │ │ └── Dept.java │ │ │ ├── dao │ │ │ │ ├── DictDetailDao.java │ │ │ │ ├── JobDao.java │ │ │ │ ├── DictDao.java │ │ │ │ ├── DeptDao.java │ │ │ │ ├── RoleDao.java │ │ │ │ └── MenuDao.java │ │ │ ├── service │ │ │ │ ├── DataService.java │ │ │ │ ├── DictDetailService.java │ │ │ │ ├── VerifyService.java │ │ │ │ ├── DictService.java │ │ │ │ ├── JobService.java │ │ │ │ └── UserService.java │ │ │ └── controller │ │ │ │ └── LimitController.java │ │ ├── quartz │ │ │ ├── dao │ │ │ │ ├── QuartzLogDao.java │ │ │ │ └── QuartzJobDao.java │ │ │ ├── domain │ │ │ │ ├── query │ │ │ │ │ └── QuartzJobQuery.java │ │ │ │ ├── task │ │ │ │ │ └── TestTask.java │ │ │ │ └── entity │ │ │ │ │ ├── QuartzLog.java │ │ │ │ │ └── QuartzJob.java │ │ │ ├── util │ │ │ │ └── QuartzRunnable.java │ │ │ └── config │ │ │ │ ├── JobRunner.java │ │ │ │ └── QuartzConfig.java │ │ └── security │ │ │ ├── domain │ │ │ ├── dto │ │ │ │ ├── AuthUserDTO.java │ │ │ │ ├── OnlineUserDTO.java │ │ │ │ └── JwtUserDTO.java │ │ │ └── entity │ │ │ │ ├── JwtAccessDeniedHandler.java │ │ │ │ ├── JwtAuthenticationEntryPoint.java │ │ │ │ └── TokenConfigurer.java │ │ │ ├── service │ │ │ └── UserCacheClean.java │ │ │ ├── config │ │ │ ├── bean │ │ │ │ ├── SecurityProperties.java │ │ │ │ ├── LoginCodeEnum.java │ │ │ │ └── LoginCode.java │ │ │ └── ConfigBeanConfiguration.java │ │ │ └── controller │ │ │ └── OnlineController.java │ │ ├── config │ │ ├── WebSocketConfig.java │ │ ├── AuditorConfig.java │ │ └── ConfigurerAdapter.java │ │ └── SkApplication.java │ └── resources │ ├── ip2region │ └── ip2region.db │ ├── log4jdbc.log4j2.properties │ ├── generator.properties │ ├── banner.txt │ ├── template │ ├── generator │ │ ├── front │ │ │ └── api.ftl │ │ └── admin │ │ │ ├── Mapper.ftl │ │ │ ├── Repository.ftl │ │ │ ├── Dto.ftl │ │ │ └── Service.ftl │ └── email │ │ └── email.ftl │ ├── config │ └── application.yml │ └── logback.xml ├── sk-tool ├── src │ ├── .DS_Store │ └── main │ │ ├── .DS_Store │ │ └── java │ │ ├── .DS_Store │ │ └── com │ │ ├── .DS_Store │ │ └── dxj │ │ ├── .DS_Store │ │ ├── dao │ │ ├── EmailDao.java │ │ ├── LocalStorageDao.java │ │ ├── QiniuContentDao.java │ │ ├── PictureDao.java │ │ └── QiNiuConfigDao.java │ │ ├── domain │ │ ├── dto │ │ │ ├── QiNiuQuery.java │ │ │ ├── LocalStorageQuery.java │ │ │ ├── PictureQuery.java │ │ │ └── LocalStorageDTO.java │ │ ├── vo │ │ │ └── EmailVo.java │ │ └── entity │ │ │ ├── EmailConfig.java │ │ │ ├── QiniuContent.java │ │ │ ├── QiniuConfig.java │ │ │ ├── Picture.java │ │ │ └── LocalStorage.java │ │ ├── service │ │ ├── mapstruct │ │ │ └── LocalStorageMapper.java │ │ ├── EmailService.java │ │ ├── PictureService.java │ │ ├── LocalStorageService.java │ │ └── QiNiuService.java │ │ ├── util │ │ ├── QiNiuUtil.java │ │ └── CommonUtil.java │ │ ├── controller │ │ └── EmailController.java │ │ └── config │ │ └── MultipartConfig.java └── pom.xml ├── .gitignore ├── .gitattributes ├── sk-common ├── src │ └── main │ │ └── java │ │ └── com │ │ └── dxj │ │ ├── annotation │ │ ├── AnonymousAccess.java │ │ ├── Limit.java │ │ ├── DataPermission.java │ │ ├── Query.java │ │ └── rest │ │ │ └── AnonymousGetMapping.java │ │ ├── base │ │ ├── BaseDao.java │ │ ├── vo │ │ │ ├── PageVo.java │ │ │ └── Result.java │ │ ├── BaseMapper.java │ │ ├── BaseDTO.java │ │ ├── BaseEntity.java │ │ └── BEntity.java │ │ ├── exception │ │ ├── SkException.java │ │ ├── EntityExistException.java │ │ ├── EntityNotFoundException.java │ │ └── handler │ │ │ └── ApiError.java │ │ ├── thread │ │ ├── AsyncTaskProperties.java │ │ ├── ThreadPoolExecutorUtil.java │ │ ├── TheadFactoryName.java │ │ └── AsyncTaskExecutePool.java │ │ ├── config │ │ ├── SkPermissionConfig.java │ │ ├── FileProperties.java │ │ └── RsaProperties.java │ │ ├── aspect │ │ └── LimitType.java │ │ ├── util │ │ ├── ValidationUtil.java │ │ ├── ThrowableUtil.java │ │ ├── TranslatorUtil.java │ │ ├── ResultUtil.java │ │ └── SpringContextHolder.java │ │ ├── constant │ │ ├── SecurityConstant.java │ │ ├── CacheKey.java │ │ ├── RequestMethodEnum.java │ │ └── SettingConstant.java │ │ └── enumeration │ │ ├── CodeBiEnum.java │ │ ├── CodeEnum.java │ │ └── DataScopeEnum.java └── pom.xml ├── sk-generator ├── src │ └── main │ │ └── java │ │ └── com │ │ └── dxj │ │ ├── dao │ │ ├── GenConfigDao.java │ │ └── ColumnInfoDao.java │ │ ├── service │ │ ├── GenConfigService.java │ │ ├── impl │ │ │ └── GenConfigServiceImpl.java │ │ └── GeneratorService.java │ │ ├── domain │ │ ├── vo │ │ │ └── TableInfo.java │ │ └── entity │ │ │ ├── GenConfig.java │ │ │ └── ColumnInfo.java │ │ ├── util │ │ └── ColUtil.java │ │ └── controller │ │ └── GenConfigController.java └── pom.xml ├── sk-log ├── src │ └── main │ │ └── java │ │ └── com │ │ └── dxj │ │ ├── domain │ │ ├── mapstruct │ │ │ ├── LogErrorMapper.java │ │ │ └── LogSmallMapper.java │ │ ├── dto │ │ │ ├── LogSmallDTO.java │ │ │ ├── LogQuery.java │ │ │ └── LogErrorDTO.java │ │ └── entity │ │ │ └── Log.java │ │ ├── annotation │ │ ├── Log.java │ │ └── type │ │ │ └── LogActionType.java │ │ ├── dao │ │ └── LogDao.java │ │ └── service │ │ └── LogService.java └── pom.xml └── SECURITY.md /sk-system/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-tool/src/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # idea 2 | .idea 3 | *.iws 4 | *.iml 5 | *.ipr 6 | 7 | .DS_store 8 | */.DS_store 9 | 10 | -------------------------------------------------------------------------------- /sk-system/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-tool/src/main/.DS_Store -------------------------------------------------------------------------------- /sk-system/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/java/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-tool/src/main/java/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-tool/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /sk-system/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-tool/src/main/java/com/dxj/.DS_Store -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/java/com/dxj/.DS_Store -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/java/com/dxj/module/.DS_Store -------------------------------------------------------------------------------- /sk-system/src/main/resources/ip2region/ip2region.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/resources/ip2region/ip2region.db -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DengSinkiang/sk-admin/HEAD/sk-system/src/main/java/com/dxj/module/system/.DS_Store -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/dao/EmailDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.EmailConfig; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2018-12-26 9 | */ 10 | public interface EmailDao extends BaseDao { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.md linguist-language=Java 2 | *.yml linguist-language=Java 3 | *.html linguist-language=Java 4 | *.js linguist-language=Java 5 | *.xml linguist-language=Java 6 | *.css linguist-language=Java 7 | *.sql linguist-language=Java 8 | *.uml linguist-language=Java 9 | *.cmd linguist-language=Java 10 | 11 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/dao/LocalStorageDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | 4 | import com.dxj.base.BaseDao; 5 | import com.dxj.domain.entity.LocalStorage; 6 | 7 | /** 8 | * @author Sinkiang 9 | * @date 2019-09-05 10 | */ 11 | public interface LocalStorageDao extends BaseDao { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/dao/QuartzLogDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.dao; 2 | 3 | 4 | import com.dxj.base.BaseDao; 5 | import com.dxj.module.quartz.domain.entity.QuartzLog; 6 | 7 | /** 8 | * @author Sinkiang 9 | * @date 2019-01-07 10 | */ 11 | public interface QuartzLogDao extends BaseDao { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/log4jdbc.log4j2.properties: -------------------------------------------------------------------------------- 1 | # If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger 2 | log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator 3 | # 将 默认驱动改为 com.mysql.cj.jdbc.Driver 4 | log4jdbc.auto.load.popular.drivers=false 5 | log4jdbc.drivers=com.mysql.cj.jdbc.Driver 6 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/vo/UserPassVo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 修改密码的 Vo 类 7 | * @author Sinkiang 8 | * @date 2019年7月11日13:59:49 9 | */ 10 | @Data 11 | public class UserPassVo { 12 | 13 | private String oldPass; 14 | 15 | private String newPass; 16 | } 17 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/DictQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | /** 7 | * @author Sinkiang 8 | * 公共查询类 9 | */ 10 | @Data 11 | public class DictQuery { 12 | 13 | @Query(blurry = "name,description") 14 | private String blurry; 15 | } 16 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/annotation/AnonymousAccess.java: -------------------------------------------------------------------------------- 1 | package com.dxj.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author jacky 7 | * 用于标记匿名访问方法 8 | */ 9 | @Inherited 10 | @Documented 11 | @Target({ElementType.METHOD,ElementType.ANNOTATION_TYPE}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface AnonymousAccess { 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/DeptSmallDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author Sinkiang 9 | * @date 2019-6-10 16:32:18 10 | */ 11 | @Data 12 | public class DeptSmallDTO implements Serializable { 13 | 14 | private Long id; 15 | 16 | private String name; 17 | } 18 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/DictSmallDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-04-10 12 | */ 13 | @Getter 14 | @Setter 15 | @ToString 16 | public class DictSmallDTO implements Serializable { 17 | 18 | private Long id; 19 | } 20 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/dao/GenConfigDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.GenConfig; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2019-01-14 9 | */ 10 | public interface GenConfigDao extends BaseDao { 11 | 12 | /** 13 | * 查询表配置 14 | * @param tableName 表名 15 | * @return / 16 | */ 17 | GenConfig findByTableName(String tableName); 18 | } 19 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/JobSmallDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-6-10 16:32:18 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | public class JobSmallDTO implements Serializable { 15 | 16 | private Long id; 17 | 18 | private String name; 19 | } 20 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/RoleSmallDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author Sinkiang 9 | * @date 2018-11-23 10 | */ 11 | @Data 12 | public class RoleSmallDTO implements Serializable { 13 | 14 | private Long id; 15 | 16 | private String name; 17 | 18 | private Integer level; 19 | 20 | private String dataScope; 21 | } 22 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/generator.properties: -------------------------------------------------------------------------------- 1 | #数据库类型转Java类型 2 | tinyint=Integer 3 | smallint=Integer 4 | mediumint=Integer 5 | int=Integer 6 | integer=Integer 7 | 8 | bigint=Long 9 | 10 | float=Float 11 | 12 | double=Double 13 | 14 | decimal=BigDecimal 15 | 16 | bit=Boolean 17 | 18 | char=String 19 | varchar=String 20 | tinytext=String 21 | text=String 22 | mediumtext=String 23 | longtext=String 24 | 25 | date=Timestamp 26 | datetime=Timestamp 27 | timestamp=Timestamp -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/dao/QiniuContentDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.QiniuContent; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2018-12-31 9 | */ 10 | public interface QiniuContentDao extends BaseDao { 11 | 12 | /** 13 | * 根据key查询 14 | * 15 | * @param key 文件名 16 | * @return QiniuContent 17 | */ 18 | QiniuContent findByKey(String key); 19 | } 20 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/DictDetailQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2019-04-10 9 | */ 10 | @Data 11 | public class DictDetailQuery { 12 | 13 | @Query(type = Query.Type.INNER_LIKE) 14 | private String label; 15 | 16 | @Query(propName = "name",joinName = "dict") 17 | private String dictName; 18 | } 19 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/vo/MenuMetaVo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2018-12-20 11 | */ 12 | @Data 13 | @AllArgsConstructor 14 | public class MenuMetaVo implements Serializable { 15 | 16 | private String title; 17 | 18 | private String icon; 19 | 20 | private boolean noCache; 21 | } 22 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/dao/QuartzJobDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.quartz.domain.entity.QuartzJob; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-01-07 11 | */ 12 | public interface QuartzJobDao extends BaseDao { 13 | 14 | /** 15 | * 查询启用的任务 16 | * 17 | * @return List 18 | */ 19 | List findByIsPauseIsFalse(); 20 | } 21 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/dto/QiNiuQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-6-4 09:54:37 12 | */ 13 | @Data 14 | public class QiNiuQuery { 15 | 16 | @Query(type = Query.Type.INNER_LIKE) 17 | private String key; 18 | 19 | @Query(type = Query.Type.BETWEEN) 20 | private List createTime; 21 | } 22 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/dao/ColumnInfoDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | 4 | import com.dxj.base.BaseDao; 5 | import com.dxj.domain.entity.ColumnInfo; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-01-14 12 | */ 13 | public interface ColumnInfoDao extends BaseDao { 14 | 15 | /** 16 | * 查询表信息 17 | * @param tableName 表格名 18 | * @return 表信息 19 | */ 20 | List findByTableNameOrderByIdAsc(String tableName); 21 | } 22 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/RoleQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * 公共查询类 12 | */ 13 | @Data 14 | public class RoleQuery { 15 | 16 | @Query(blurry = "name,description") 17 | private String blurry; 18 | 19 | @Query(type = Query.Type.BETWEEN) 20 | private List createTime; 21 | } 22 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/DictDetailDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.DictDetail; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-04-10 11 | */ 12 | public interface DictDetailDao extends BaseDao { 13 | 14 | /** 15 | * 根据字典名称查询 16 | * @param name / 17 | * @return / 18 | */ 19 | List findByDictName(String name); 20 | } 21 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/dto/LocalStorageQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-09-05 12 | */ 13 | @Data 14 | public class LocalStorageQuery { 15 | 16 | @Query(blurry = "name,suffix,type,createBy,size") 17 | private String blurry; 18 | 19 | @Query(type = Query.Type.BETWEEN) 20 | private List createTime; 21 | } 22 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/mapstruct/LogErrorMapper.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.mapstruct; 2 | 3 | import com.dxj.base.BaseMapper; 4 | import com.dxj.domain.entity.Log; 5 | import com.dxj.domain.dto.LogErrorDTO; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.ReportingPolicy; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-5-22 12 | */ 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) 14 | public interface LogErrorMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/mapstruct/LogSmallMapper.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.mapstruct; 2 | 3 | import com.dxj.base.BaseMapper; 4 | import com.dxj.domain.entity.Log; 5 | import com.dxj.domain.dto.LogSmallDTO; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.ReportingPolicy; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-5-22 12 | */ 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) 14 | public interface LogSmallMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ${AnsiColor.BRIGHT_RED} 2 | _ _ _ 3 | | | | | (_) 4 | ___| | ________ __ _ __| |_ __ ___ _ _ __ 5 | / __| |/ /______/ _` |/ _` | '_ ` _ \| | '_ \ 6 | \__ \ < | (_| | (_| | | | | | | | | | | 7 | |___/_|\_\ \__,_|\__,_|_| |_| |_|_|_| |_| 8 | 9 | ${AnsiColor.BRIGHT_MAGENTA} 10 | Sk-Admin Version: 2.0 11 | Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} 12 | ${AnsiColor.BLACK} 13 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/dto/LogSmallDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.sql.Timestamp; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-5-22 11 | */ 12 | @Data 13 | public class LogSmallDTO implements Serializable { 14 | 15 | private String description; 16 | 17 | private String requestIp; 18 | 19 | private Long time; 20 | 21 | private String address; 22 | 23 | private String browser; 24 | 25 | private Timestamp createTime; 26 | } 27 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | /** 8 | * @author: Sinkiang 9 | * @date: 2019-08-24 15:44 10 | */ 11 | @Configuration 12 | public class WebSocketConfig { 13 | 14 | @Bean 15 | public ServerEndpointExporter serverEndpointExporter() { 16 | return new ServerEndpointExporter(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/dao/PictureDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.Picture; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2018-12-27 9 | */ 10 | public interface PictureDao extends BaseDao { 11 | 12 | /** 13 | * 根据 Mds 值查询文件 14 | * @param code 值 15 | * @return / 16 | */ 17 | Picture findByMd5Code(String code); 18 | 19 | /** 20 | * 根据连接地址查询 21 | * @param url / 22 | * @return / 23 | */ 24 | boolean existsByUrl(String url); 25 | } 26 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/service/mapstruct/LocalStorageMapper.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service.mapstruct; 2 | 3 | import com.dxj.base.BaseMapper; 4 | import com.dxj.domain.entity.LocalStorage; 5 | import com.dxj.domain.dto.LocalStorageDTO; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.ReportingPolicy; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-09-05 12 | */ 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) 14 | public interface LocalStorageMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base; 2 | 3 | 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 | import org.springframework.data.repository.NoRepositoryBean; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @author 12 | * 自定义接口 不会创建接口的实例 必须加此注解 13 | * @param 14 | * @param 15 | */ 16 | @NoRepositoryBean 17 | public interface BaseDao extends JpaRepository, JpaSpecificationExecutor { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/exception/SkException.java: -------------------------------------------------------------------------------- 1 | package com.dxj.exception; 2 | 3 | import lombok.Getter; 4 | import org.springframework.http.HttpStatus; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2018-11-23 9 | * 统一异常处理 10 | */ 11 | @Getter 12 | public class SkException extends RuntimeException { 13 | 14 | private Integer status = 400; 15 | 16 | public SkException(String msg) { 17 | super(msg); 18 | } 19 | 20 | public SkException(HttpStatus status, String msg){ 21 | super(msg); 22 | this.status = status.value(); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/service/GenConfigService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | 4 | import com.dxj.domain.entity.GenConfig; 5 | 6 | /** 7 | * @author Sinkiang 8 | * @date 2019-01-14 9 | */ 10 | public interface GenConfigService { 11 | 12 | /** 13 | * 查询表配置 14 | * @param tableName 表名 15 | * @return 表配置 16 | */ 17 | GenConfig find(String tableName); 18 | 19 | /** 20 | * 更新表配置 21 | * @param tableName 表名 22 | * @param genConfig 表配置 23 | * @return 表配置 24 | */ 25 | GenConfig update(String tableName, GenConfig genConfig); 26 | } 27 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/JobDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.Job; 5 | 6 | import java.util.Set; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-03-29 11 | */ 12 | public interface JobDao extends BaseDao { 13 | 14 | /** 15 | * 根据名称查询 16 | * @param name 名称 17 | * @return / 18 | */ 19 | Job findByName(String name); 20 | 21 | /** 22 | * 根据Id删除 23 | * @param ids / 24 | */ 25 | void deleteAllByIdIn(Set ids); 26 | } 27 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/dao/QiNiuConfigDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.QiniuConfig; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2018-12-31 11 | */ 12 | public interface QiNiuConfigDao extends BaseDao { 13 | 14 | /** 15 | * 编辑类型 16 | * @param type 17 | */ 18 | @Modifying 19 | @Query(value = "update QiniuConfig set type = ?1") 20 | void update(String type); 21 | } 22 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/domain/query/QuartzJobQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-6-4 10:33:02 12 | */ 13 | @Data 14 | public class QuartzJobQuery { 15 | 16 | @Query(type = Query.Type.INNER_LIKE) 17 | private String jobName; 18 | 19 | @Query 20 | private Boolean isSuccess; 21 | 22 | @Query(type = Query.Type.BETWEEN) 23 | private List createTime; 24 | } 25 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/generator/front/api.ftl: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function add(data) { 4 | return request({ 5 | url: 'api/${changeClassName}', 6 | method: 'post', 7 | data 8 | }) 9 | } 10 | 11 | export function del(ids) { 12 | return request({ 13 | url: 'api/${changeClassName}/', 14 | method: 'delete', 15 | data: ids 16 | }) 17 | } 18 | 19 | export function edit(data) { 20 | return request({ 21 | url: 'api/${changeClassName}', 22 | method: 'put', 23 | data 24 | }) 25 | } 26 | 27 | export default { add, edit, del } 28 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/dto/LogQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * 日志查询类 11 | * 12 | * @author Sinkiang 13 | * @date 2019-6-4 09:23:07 14 | */ 15 | @Data 16 | public class LogQuery { 17 | 18 | @Query(blurry = "username,description,address,requestIp,method,params") 19 | private String blurry; 20 | 21 | @Query 22 | private String logType; 23 | 24 | @Query(type = Query.Type.BETWEEN) 25 | private List createTime; 26 | } 27 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/domain/task/TestTask.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.domain.task; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * 测试用 8 | * @author Sinkiang 9 | * @date 2019-01-08 10 | */ 11 | @Slf4j 12 | @Component 13 | public class TestTask { 14 | 15 | public void run(){ 16 | log.info("run 执行成功"); 17 | } 18 | 19 | public void run1(String str){ 20 | log.info("run1 执行成功,参数为: {}" + str); 21 | } 22 | 23 | public void run2(){ 24 | log.info("run2 执行成功"); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/DictDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.Dict; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-04-10 12 | */ 13 | public interface DictDao extends BaseDao { 14 | 15 | /** 16 | * 删除 17 | * @param ids / 18 | */ 19 | void deleteByIdIn(Set ids); 20 | 21 | /** 22 | * 查询 23 | * @param ids / 24 | * @return / 25 | */ 26 | List findByIdIn(Set ids); 27 | } 28 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/dto/PictureQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * sm.ms图床 11 | * 12 | * @author Sinkiang 13 | * @date 2019-6-4 09:52:09 14 | */ 15 | @Data 16 | public class PictureQuery { 17 | 18 | @Query(type = Query.Type.INNER_LIKE) 19 | private String filename; 20 | 21 | @Query(type = Query.Type.INNER_LIKE) 22 | private String username; 23 | 24 | @Query(type = Query.Type.BETWEEN) 25 | private List createTime; 26 | } 27 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/thread/AsyncTaskProperties.java: -------------------------------------------------------------------------------- 1 | package com.dxj.thread; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 线程池配置属性类 9 | * @author https://juejin.im/entry/5abb8f6951882555677e9da2 10 | * @date 2019年10月31日14:58:18 11 | */ 12 | @Data 13 | @Component 14 | @ConfigurationProperties(prefix = "task.pool") 15 | public class AsyncTaskProperties { 16 | 17 | private int corePoolSize; 18 | 19 | private int maxPoolSize; 20 | 21 | private int keepAliveSeconds; 22 | 23 | private int queueCapacity; 24 | } 25 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/domain/vo/TableInfo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 表的数据信息 9 | * @author Sinkiang 10 | * @date 2019-01-02 11 | */ 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class TableInfo { 16 | 17 | /** 表名称 */ 18 | private Object tableName; 19 | 20 | /** 创建日期 */ 21 | private Object createTime; 22 | 23 | /** 数据库引擎 */ 24 | private Object engine; 25 | 26 | /** 编码集 */ 27 | private Object coding; 28 | 29 | /** 备注 */ 30 | private Object remark; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/dto/LogErrorDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.sql.Timestamp; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-5-22 11 | */ 12 | @Data 13 | public class LogErrorDTO implements Serializable { 14 | 15 | private Long id; 16 | 17 | private String username; 18 | 19 | private String description; 20 | 21 | private String method; 22 | 23 | private String params; 24 | 25 | private String browser; 26 | 27 | private String requestIp; 28 | 29 | private String address; 30 | 31 | private Timestamp createTime; 32 | } 33 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/DictDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | import java.util.List; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2019-04-10 15 | */ 16 | @Getter 17 | @Setter 18 | @ToString 19 | public class DictDTO extends BaseDTO implements Serializable { 20 | 21 | private Long id; 22 | 23 | private List dictDetails; 24 | 25 | private String name; 26 | 27 | private String description; 28 | } 29 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/dto/LocalStorageDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import java.io.Serializable; 8 | import java.sql.Timestamp; 9 | 10 | /** 11 | * @author Zheng Jie 12 | * @date 2019-09-05 13 | */ 14 | @EqualsAndHashCode(callSuper = true) 15 | @Data 16 | public class LocalStorageDTO extends BaseDTO implements Serializable { 17 | 18 | private Long id; 19 | 20 | private String realName; 21 | 22 | private String name; 23 | 24 | private String suffix; 25 | 26 | private String type; 27 | 28 | private String size; 29 | } 30 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/DictDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-04-10 14 | */ 15 | @Getter 16 | @Setter 17 | @ToString 18 | public class DictDetailDTO extends BaseDTO implements Serializable { 19 | 20 | private Long id; 21 | 22 | private DictSmallDTO dict; 23 | 24 | private String label; 25 | 26 | private String value; 27 | 28 | private Integer dictSort; 29 | } 30 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/JobQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.sql.Timestamp; 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-6-4 14:49:34 14 | */ 15 | @Data 16 | @NoArgsConstructor 17 | public class JobQuery { 18 | 19 | @Query(type = Query.Type.INNER_LIKE) 20 | private String name; 21 | 22 | @Query 23 | private Boolean enabled; 24 | 25 | @Query(type = Query.Type.BETWEEN) 26 | private List createTime; 27 | } 28 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/MenuQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.sql.Timestamp; 7 | import java.util.List; 8 | 9 | /** 10 | * @author Sinkiang 11 | * 公共查询类 12 | */ 13 | @Data 14 | public class MenuQuery { 15 | 16 | @Query(blurry = "title,component,permission") 17 | private String blurry; 18 | 19 | @Query(type = Query.Type.BETWEEN) 20 | private List createTime; 21 | 22 | @Query(type = Query.Type.IS_NULL, propName = "pid") 23 | private Boolean pidIsNull; 24 | 25 | @Query 26 | private Long pid; 27 | } 28 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/dto/AuthUserDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2018-11-30 11 | */ 12 | @Getter 13 | @Setter 14 | public class AuthUserDTO { 15 | 16 | @NotBlank 17 | private String username; 18 | 19 | @NotBlank 20 | private String password; 21 | 22 | private String code; 23 | 24 | private String uuid; 25 | 26 | @Override 27 | public String toString() { 28 | return "{username=" + username + ", password= ******}"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/vo/PageVo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author Sinkiang 10 | */ 11 | @Data 12 | public class PageVo implements Serializable { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | @ApiModelProperty(value = "页号") 17 | private int pageNumber; 18 | 19 | @ApiModelProperty(value = "页面大小") 20 | private int pageSize; 21 | 22 | @ApiModelProperty(value = "排序字段") 23 | private String sort; 24 | 25 | @ApiModelProperty(value = "排序方式 asc/desc") 26 | private String order; 27 | } 28 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/exception/EntityExistException.java: -------------------------------------------------------------------------------- 1 | package com.dxj.exception; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | /** 6 | * @author Sinkiang 7 | * @date 2018-11-23 8 | */ 9 | public class EntityExistException extends RuntimeException { 10 | 11 | public EntityExistException(Object o, String field, String val) { 12 | super(EntityExistException.generateMessage(o.getClass().getSimpleName(), field, val)); 13 | } 14 | 15 | private static String generateMessage(String entity, String field, String val) { 16 | return StringUtils.capitalize(entity) 17 | + " with " + field + " "+ val + " existed"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/annotation/Log.java: -------------------------------------------------------------------------------- 1 | package com.dxj.annotation; 2 | 3 | import com.dxj.annotation.type.LogActionType; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * @author Sinkiang 12 | * @date 2018-11-24 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | public @interface Log { 17 | String value() default ""; 18 | 19 | /** 20 | * 是否启用 21 | * 22 | * @return 23 | */ 24 | boolean enable() default true; 25 | 26 | LogActionType type() default LogActionType.SELECT; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/dao/LogDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.domain.entity.Log; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2018-11-24 12 | */ 13 | @Repository 14 | public interface LogDao extends BaseDao { 15 | 16 | /** 17 | * 根据日志类型删除信息 18 | * @param logType 日志类型 19 | */ 20 | @Modifying 21 | @Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true) 22 | void deleteByLogType(String logType); 23 | } 24 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/vo/EmailVo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotEmpty; 9 | import java.util.List; 10 | 11 | /** 12 | * 发送邮件时,接收参数的类 13 | * @author Sinkiang 14 | * @date 2018/09/28 12:02:14 15 | */ 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | public class EmailVo { 20 | 21 | /** 收件人,支持多个收件人 */ 22 | @NotEmpty 23 | private List tos; 24 | 25 | @NotBlank 26 | private String subject; 27 | 28 | @NotBlank 29 | private String content; 30 | } 31 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/exception/EntityNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.dxj.exception; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | /** 6 | * @author Sinkiang 7 | * @date 2018-11-23 8 | */ 9 | public class EntityNotFoundException extends RuntimeException { 10 | 11 | public EntityNotFoundException(Object o, String field, String val) { 12 | super(EntityNotFoundException.generateMessage(o.getClass().getSimpleName(), field, val)); 13 | } 14 | 15 | private static String generateMessage(String entity, String field, String val) { 16 | return StringUtils.capitalize(entity) 17 | + " with " + field + " "+ val + " does not exist"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/config/AuditorConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.config; 2 | 3 | import com.dxj.util.SecurityUtils; 4 | import org.springframework.data.domain.AuditorAware; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * @描述 : 设置审计 11 | * @author : Dong ZhaoYang 12 | * @日期 : 2019/10/28 13 | * @时间 : 10:29 14 | */ 15 | @Component("auditorAware") 16 | public class AuditorConfig implements AuditorAware { 17 | 18 | /** 19 | * 返回操作员标志信息 20 | * 21 | * @return / 22 | */ 23 | @Override 24 | public Optional getCurrentAuditor() { 25 | // 这里应根据实际业务情况获取具体信息 26 | return Optional.of(SecurityUtils.getCurrentUsername()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/vo/MenuVo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 构建前端路由时用到 11 | * @author Sinkiang 12 | * @date 2018-12-20 13 | */ 14 | @Data 15 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 16 | public class MenuVo implements Serializable { 17 | 18 | private String name; 19 | 20 | private String path; 21 | 22 | private Boolean hidden; 23 | 24 | private String redirect; 25 | 26 | private String component; 27 | 28 | private Boolean alwaysShow; 29 | 30 | private MenuMetaVo meta; 31 | 32 | private List children; 33 | } 34 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author Sinkiang 7 | * @date 2018-11-23 8 | */ 9 | public interface BaseMapper { 10 | 11 | /** 12 | * DTO转Entity 13 | * @param dto / 14 | * @return / 15 | */ 16 | E toEntity(D dto); 17 | 18 | /** 19 | * Entity转DTO 20 | * @param entity / 21 | * @return / 22 | */ 23 | D toDto(E entity); 24 | 25 | /** 26 | * DTO集合转Entity集合 27 | * @param dtoList / 28 | * @return / 29 | */ 30 | List toEntity(List dtoList); 31 | 32 | /** 33 | * Entity集合转DTO集合 34 | * @param entityList / 35 | * @return / 36 | */ 37 | List toDto(List entityList); 38 | } 39 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/RoleDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import java.io.Serializable; 8 | import java.sql.Timestamp; 9 | import java.util.Objects; 10 | import java.util.Set; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-11-23 15 | */ 16 | @Data 17 | @EqualsAndHashCode(callSuper = false) 18 | public class RoleDTO extends BaseDTO implements Serializable { 19 | 20 | private Long id; 21 | 22 | private Set menus; 23 | 24 | private Set depts; 25 | 26 | private String name; 27 | 28 | private String dataScope; 29 | 30 | private Integer level; 31 | 32 | private String description; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/JobDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | import java.io.Serializable; 10 | import java.sql.Timestamp; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2019-03-29 15 | */ 16 | @Getter 17 | @Setter 18 | @NoArgsConstructor 19 | @ToString 20 | public class JobDTO extends BaseDTO implements Serializable { 21 | 22 | private Long id; 23 | 24 | private Integer jobSort; 25 | 26 | private String name; 27 | 28 | private Boolean enabled; 29 | 30 | public JobDTO(String name, Boolean enabled) { 31 | this.name = name; 32 | this.enabled = enabled; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/DeptQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.DataPermission; 4 | import com.dxj.annotation.Query; 5 | import lombok.Data; 6 | 7 | import java.sql.Timestamp; 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-03-25 14 | */ 15 | @Data 16 | @DataPermission(fieldName = "id") 17 | public class DeptQuery { 18 | 19 | @Query(type = Query.Type.INNER_LIKE) 20 | private String name; 21 | 22 | @Query 23 | private Boolean enabled; 24 | 25 | @Query 26 | private Long pid; 27 | 28 | @Query(type = Query.Type.IS_NULL, propName = "pid") 29 | private Boolean pidIsNull; 30 | 31 | @Query(type = Query.Type.BETWEEN) 32 | private List createTime; 33 | } 34 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/config/SkPermissionConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.config; 2 | 3 | import com.dxj.util.SecurityUtils; 4 | import org.springframework.security.core.GrantedAuthority; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | import java.util.stream.Collectors; 10 | 11 | /** 12 | * @author Sinkiang 13 | */ 14 | @Service(value = "sk") 15 | public class SkPermissionConfig { 16 | 17 | public boolean check(String ...permissions){ 18 | // 获取当前用户的所有权限 19 | List skPermissions = SecurityUtils.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); 20 | // 判断当前用户的所有权限是否包含接口上定义的权限 21 | return skPermissions.contains("admin") || Arrays.stream(permissions).anyMatch(skPermissions::contains); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/service/EmailService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.EmailConfig; 4 | import com.dxj.domain.vo.EmailVo; 5 | import org.springframework.scheduling.annotation.Async; 6 | 7 | /** 8 | * @author Sinkiang 9 | * @date 2018-12-26 10 | */ 11 | public interface EmailService { 12 | 13 | /** 14 | * 更新邮件配置 15 | * @param emailConfig 邮箱配置 16 | * @param old / 17 | * @return / 18 | * @throws Exception / 19 | */ 20 | EmailConfig config(EmailConfig emailConfig, EmailConfig old) throws Exception; 21 | 22 | /** 23 | * 查询配置 24 | * @return EmailConfig 邮件配置 25 | */ 26 | EmailConfig find(); 27 | 28 | /** 29 | * 发送邮件 30 | * @param emailVo 邮件发送的内容 31 | * @param emailConfig 邮件配置 32 | */ 33 | void send(EmailVo emailVo, EmailConfig emailConfig); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/aspect/LimitType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.aspect; 17 | 18 | /** 19 | * 限流枚举 20 | * @author / 21 | */ 22 | public enum LimitType { 23 | // 默认 24 | CUSTOMER, 25 | // by ip addr 26 | IP 27 | } 28 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/util/ValidationUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import com.dxj.exception.SkException; 5 | import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; 6 | 7 | /** 8 | * 验证工具 9 | * 10 | * @author Sinkiang 11 | * @date 2018-11-23 12 | */ 13 | public class ValidationUtil { 14 | 15 | /** 16 | * 验证空 17 | */ 18 | public static void isNull(Object obj, String entity, String parameter, Object value) { 19 | if (ObjectUtil.isNull(obj)) { 20 | String msg = entity + " 不存在: " + parameter + " is " + value; 21 | throw new SkException(msg); 22 | } 23 | } 24 | 25 | /** 26 | * 验证是否为邮箱 27 | */ 28 | public static boolean isEmail(String email) { 29 | return new EmailValidator().isValid(email, null); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sk-log/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sk-admin 7 | com.dxj 8 | 2.0 9 | 10 | 4.0.0 11 | 12 | com.dxj.service 13 | sk-log 14 | 2.0 15 | 日志模块 16 | 17 | 18 | 19 | com.dxj.common 20 | sk-common 21 | 2.0 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/service/UserCacheClean.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.service; 2 | 3 | import com.dxj.util.StringUtils; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * @author: liaojinlong 8 | * @date: 2020/6/11 18:01 9 | * @apiNote: 用于清理 用户登录信息缓存,为防止Spring循环依赖与安全考虑 ,单独构成工具类 10 | */ 11 | @Component 12 | public class UserCacheClean { 13 | 14 | /** 15 | * 清理特定用户缓存信息
16 | * 用户信息变更时 17 | * 18 | * @param userName / 19 | */ 20 | public void cleanUserCache(String userName) { 21 | if (StringUtils.isNotEmpty(userName)) { 22 | UserDetailsServiceImpl.userDtoCache.remove(userName); 23 | } 24 | } 25 | 26 | /** 27 | * 清理所有用户的缓存信息
28 | * ,如发生角色授权信息变化,可以简便的全部失效缓存 29 | */ 30 | public void cleanAll() { 31 | UserDetailsServiceImpl.userDtoCache.clear(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/query/UserQuery.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.query; 2 | 3 | import com.dxj.annotation.Query; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.sql.Timestamp; 8 | import java.util.HashSet; 9 | import java.util.List; 10 | import java.util.Set; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-11-23 15 | */ 16 | @Data 17 | public class UserQuery implements Serializable { 18 | 19 | @Query 20 | private Long id; 21 | 22 | @Query(propName = "id", type = Query.Type.IN, joinName = "dept") 23 | private Set deptIds = new HashSet<>(); 24 | 25 | @Query(blurry = "email,username,nickName") 26 | private String blurry; 27 | 28 | @Query 29 | private Boolean enabled; 30 | 31 | private Long deptId; 32 | 33 | @Query(type = Query.Type.BETWEEN) 34 | private List createTime; 35 | } 36 | -------------------------------------------------------------------------------- /sk-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sk-admin 7 | com.dxj 8 | 2.0 9 | 10 | 4.0.0 11 | 12 | com.dxj.common 13 | sk-common 14 | 2.0 15 | 公共模块 16 | 17 | 18 | 19 | 20 | cn.hutool 21 | hutool-all 22 | 5.3.4 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/entity/JwtAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.entity; 2 | 3 | import org.springframework.security.access.AccessDeniedException; 4 | import org.springframework.security.web.access.AccessDeniedHandler; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | /** 12 | * @author Sinkiang 13 | */ 14 | @Component 15 | public class JwtAccessDeniedHandler implements AccessDeniedHandler { 16 | 17 | @Override 18 | public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException { 19 | //当用户在没有授权的情况下访问受保护的REST资源时,将调用此方法发送403 Forbidden响应 20 | response.sendError(HttpServletResponse.SC_FORBIDDEN, accessDeniedException.getMessage()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/thread/ThreadPoolExecutorUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.thread; 2 | 3 | import com.dxj.util.SpringContextHolder; 4 | 5 | import java.util.concurrent.ArrayBlockingQueue; 6 | import java.util.concurrent.ThreadPoolExecutor; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * 用于获取自定义线程池 11 | * 12 | * @author Sinkiang 13 | * @date 2019年10月31日18:16:47 14 | */ 15 | public class ThreadPoolExecutorUtil { 16 | 17 | public static ThreadPoolExecutor getPoll() { 18 | AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); 19 | return new ThreadPoolExecutor( 20 | properties.getCorePoolSize(), 21 | properties.getMaxPoolSize(), 22 | properties.getKeepAliveSeconds(), 23 | TimeUnit.SECONDS, 24 | new ArrayBlockingQueue<>(properties.getQueueCapacity()), 25 | new TheadFactoryName() 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/exception/handler/ApiError.java: -------------------------------------------------------------------------------- 1 | package com.dxj.exception.handler; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2018-11-23 11 | */ 12 | @Data 13 | class ApiError { 14 | 15 | private Integer status = 400; 16 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 17 | private LocalDateTime timestamp; 18 | private String message; 19 | 20 | private ApiError() { 21 | timestamp = LocalDateTime.now(); 22 | } 23 | 24 | public static ApiError error(String message){ 25 | ApiError apiError = new ApiError(); 26 | apiError.setMessage(message); 27 | return apiError; 28 | } 29 | 30 | public static ApiError error(Integer status, String message){ 31 | ApiError apiError = new ApiError(); 32 | apiError.setStatus(status); 33 | apiError.setMessage(message); 34 | return apiError; 35 | } 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/entity/JwtAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.entity; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | import org.springframework.security.web.AuthenticationEntryPoint; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | /** 12 | * @author Sinkiang 13 | */ 14 | @Component 15 | public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { 16 | 17 | @Override 18 | public void commence(HttpServletRequest request, 19 | HttpServletResponse response, 20 | AuthenticationException authException) throws IOException { 21 | // 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应 22 | response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException == null ? "Unauthorized" : authException.getMessage()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/util/ColUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import org.apache.commons.configuration.*; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | /** 8 | * sql字段转java 9 | * 10 | * @author Sinkiang 11 | * @date 2019-01-03 12 | */ 13 | public class ColUtil { 14 | private static final Logger log = LoggerFactory.getLogger(ColUtil.class); 15 | 16 | /** 17 | * 转换mysql数据类型为java数据类型 18 | * 19 | * @param type 数据库字段类型 20 | * @return String 21 | */ 22 | static String cloToJava(String type) { 23 | Configuration config = getConfig(); 24 | assert config != null; 25 | return config.getString(type, "unknowType"); 26 | } 27 | 28 | /** 29 | * 获取配置信息 30 | */ 31 | public static PropertiesConfiguration getConfig() { 32 | try { 33 | return new PropertiesConfiguration("generator.properties"); 34 | } catch (ConfigurationException e) { 35 | log.error(e.getMessage(), e); 36 | } 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/vo/Result.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base.vo; 2 | 3 | 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @author Sinkiang 12 | * 前后端交互数据标准 13 | */ 14 | @Data 15 | @ApiModel(value="接口返回对象", description="接口返回对象") 16 | public class Result implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * 成功标志 22 | */ 23 | @ApiModelProperty(value = "成功标志") 24 | private boolean success; 25 | 26 | /** 27 | * 返回处理消息 28 | */ 29 | @ApiModelProperty(value = "返回处理消息") 30 | private String message; 31 | 32 | /** 33 | * 返回状态码 34 | */ 35 | @ApiModelProperty(value = "返回状态码") 36 | private int code; 37 | 38 | /** 39 | * 时间戳 40 | */ 41 | @ApiModelProperty(value = "时间戳") 42 | private long timestamp = System.currentTimeMillis(); 43 | 44 | /** 45 | * 返回数据对象 46 | */ 47 | @ApiModelProperty(value = "返回数据对象") 48 | private T result; 49 | } 50 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/DataService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.service; 17 | 18 | import com.dxj.module.system.domain.dto.UserDTO; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | * 数据权限服务类 24 | * @author Sinkiang 25 | * @date 2020-05-07 26 | */ 27 | public interface DataService { 28 | 29 | /** 30 | * 获取数据权限 31 | * @param user / 32 | * @return / 33 | */ 34 | List getDeptIds(UserDTO user); 35 | } 36 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/util/ThrowableUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import com.dxj.exception.SkException; 4 | import org.hibernate.exception.ConstraintViolationException; 5 | 6 | import java.io.PrintWriter; 7 | import java.io.StringWriter; 8 | 9 | /** 10 | * 异常工具 2019-01-06 11 | * @author Sinkiang 12 | */ 13 | public class ThrowableUtil { 14 | 15 | /** 16 | * 获取堆栈信息 17 | */ 18 | public static String getStackTrace(Throwable throwable){ 19 | StringWriter sw = new StringWriter(); 20 | try (PrintWriter pw = new PrintWriter(sw)) { 21 | throwable.printStackTrace(pw); 22 | return sw.toString(); 23 | } 24 | } 25 | 26 | public static void throwForeignKeyException(Throwable e, String msg){ 27 | Throwable t = e.getCause(); 28 | while ((t != null) && !(t instanceof ConstraintViolationException)) { 29 | t = t.getCause(); 30 | } 31 | if (t != null) { 32 | throw new SkException(msg); 33 | } 34 | assert false; 35 | throw new SkException("删除失败:" + t.getMessage()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/dto/OnlineUserDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * @Description: 11 | * @Author: dengxj29231 12 | * @Date: 2020/4/22 18:05 13 | * @CopyRight: 2020 hundsun all rights reserved. 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class OnlineUserDTO { 19 | 20 | /** 21 | * 用户名 22 | */ 23 | private String userName; 24 | 25 | /** 26 | * 昵称 27 | */ 28 | private String nickName; 29 | 30 | /** 31 | * 岗位 32 | */ 33 | private String dept; 34 | 35 | /** 36 | * 浏览器 37 | */ 38 | private String browser; 39 | 40 | /** 41 | * IP 42 | */ 43 | private String ip; 44 | 45 | /** 46 | * 地址 47 | */ 48 | private String address; 49 | 50 | /** 51 | * token 52 | */ 53 | private String key; 54 | 55 | /** 56 | * 登录时间 57 | */ 58 | private Date loginTime; 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/constant/SecurityConstant.java: -------------------------------------------------------------------------------- 1 | package com.dxj.constant; 2 | 3 | /** 4 | * @author Sinkiang 5 | */ 6 | public interface SecurityConstant { 7 | 8 | /** 9 | * token分割 10 | */ 11 | String TOKEN_SPLIT = "Bearer "; 12 | 13 | /** 14 | * JWT签名加密key 15 | */ 16 | String JWT_SIGN_KEY = "sboot"; 17 | 18 | /** 19 | * token参数头 20 | */ 21 | String HEADER = "accessToken"; 22 | 23 | /** 24 | * 权限参数头 25 | */ 26 | String AUTHORITIES = "authorities"; 27 | 28 | /** 29 | * 用户选择JWT保存时间参数头 30 | */ 31 | String SAVE_LOGIN = "saveLogin"; 32 | 33 | /** 34 | * github保存state前缀key 35 | */ 36 | String GITHUB_STATE = "SBOOT_GITHUB:"; 37 | 38 | /** 39 | * qq保存state前缀key 40 | */ 41 | String QQ_STATE = "SBOOT_QQ:"; 42 | 43 | /** 44 | * qq保存state前缀key 45 | */ 46 | String WEIBO_STATE = "SBOOT_WEIBO:"; 47 | 48 | /** 49 | * 交互token前缀key 50 | */ 51 | String TOKEN_PRE = "SBOOT_TOKEN_PRE:"; 52 | 53 | /** 54 | * 用户token前缀key 单点登录使用 55 | */ 56 | String USER_TOKEN = "SBOOT_USER_TOKEN:"; 57 | } 58 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/config/bean/SecurityProperties.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.config.bean; 2 | 3 | import lombok.Data; 4 | /** 5 | * Jwt参数配置 6 | * 7 | * @author Sinkiang 8 | * @date 2019年11月28日 9 | */ 10 | @Data 11 | public class SecurityProperties { 12 | 13 | /** 14 | * Request Headers : Authorization 15 | */ 16 | private String header; 17 | 18 | /** 19 | * 令牌前缀,最后留个空格 Bearer 20 | */ 21 | private String tokenStartWith; 22 | 23 | /** 24 | * 必须使用最少88位的Base64对该令牌进行编码 25 | */ 26 | private String base64Secret; 27 | 28 | /** 29 | * 令牌过期时间 此处单位/毫秒 30 | */ 31 | private Long tokenValidityInSeconds; 32 | 33 | /** 34 | * 在线用户 key,根据 key 查询 redis 中在线用户的数据 35 | */ 36 | private String onlineKey; 37 | 38 | /** 39 | * 验证码 key 40 | */ 41 | private String codeKey; 42 | 43 | /** 44 | * token 续期检查 45 | */ 46 | private Long detect; 47 | 48 | /** 49 | * 续期时间 50 | */ 51 | private Long renew; 52 | 53 | public String getTokenStartWith() { 54 | return tokenStartWith + " "; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/BaseDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import org.apache.commons.lang3.builder.ToStringBuilder; 6 | 7 | import java.io.Serializable; 8 | import java.lang.reflect.Field; 9 | import java.sql.Timestamp; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019年10月24日20:48:53 14 | */ 15 | @Getter 16 | @Setter 17 | public class BaseDTO implements Serializable { 18 | 19 | private String createBy; 20 | 21 | private String updatedBy; 22 | 23 | private Timestamp createTime; 24 | 25 | private Timestamp updateTime; 26 | 27 | @Override 28 | public String toString() { 29 | ToStringBuilder builder = new ToStringBuilder(this); 30 | Field[] fields = this.getClass().getDeclaredFields(); 31 | try { 32 | for (Field f : fields) { 33 | f.setAccessible(true); 34 | builder.append(f.getName(), f.get(this)).append("\n"); 35 | } 36 | } catch (Exception e) { 37 | builder.append("toString builder encounter an error"); 38 | } 39 | return builder.toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/config/bean/LoginCodeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.security.config.bean; 17 | 18 | /** 19 | * 验证码配置枚举 20 | * 21 | * @author: liaojinlong 22 | * @date: 2020/6/10 17:40 23 | */ 24 | 25 | public enum LoginCodeEnum { 26 | /** 27 | * 算数 28 | */ 29 | arithmetic, 30 | /** 31 | * 中文 32 | */ 33 | chinese, 34 | /** 35 | * 中文闪图 36 | */ 37 | chinese_gif, 38 | /** 39 | * 闪图 40 | */ 41 | gif, 42 | spec 43 | } 44 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/DeptDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import com.fasterxml.jackson.annotation.JsonInclude; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import javax.validation.constraints.NotNull; 9 | import java.io.Serializable; 10 | import java.sql.Timestamp; 11 | import java.util.List; 12 | import java.util.Objects; 13 | 14 | /** 15 | * @author Sinkiang 16 | * @date 2019-03-25 17 | */ 18 | @Data 19 | @EqualsAndHashCode(callSuper = false) 20 | public class DeptDTO extends BaseDTO implements Serializable { 21 | 22 | private Long id; 23 | 24 | private String name; 25 | 26 | private Boolean enabled; 27 | 28 | private Integer deptSort; 29 | 30 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 31 | private List children; 32 | 33 | private Long pid; 34 | 35 | private Integer subCount; 36 | 37 | public Boolean getHasChildren() { 38 | return subCount > 0; 39 | } 40 | 41 | public Boolean getLeaf() { 42 | return subCount <= 0; 43 | } 44 | 45 | public String getLabel() { 46 | return name; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/UserDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import com.fasterxml.jackson.annotation.JsonIgnore; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | import java.util.Set; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-11-23 15 | */ 16 | @EqualsAndHashCode(callSuper = true) 17 | @Data 18 | public class UserDTO extends BaseDTO implements Serializable { 19 | 20 | private Long id; 21 | 22 | private Set roles; 23 | 24 | private Set jobs; 25 | 26 | private DeptSmallDTO dept; 27 | 28 | private Long deptId; 29 | 30 | private String username; 31 | 32 | private String nickName; 33 | 34 | private String email; 35 | 36 | private String phone; 37 | 38 | private String gender; 39 | 40 | private String avatarName; 41 | 42 | private String avatarPath; 43 | 44 | @JsonIgnore 45 | private String password; 46 | 47 | private Boolean enabled; 48 | 49 | @JsonIgnore 50 | private Boolean isAdmin; 51 | 52 | private Date pwdResetTime; 53 | } 54 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/DeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | 19 | import com.dxj.base.BaseMapper; 20 | import com.dxj.module.system.domain.dto.DeptDTO; 21 | import com.dxj.module.system.domain.entity.Dept; 22 | import org.mapstruct.Mapper; 23 | import org.mapstruct.ReportingPolicy; 24 | 25 | /** 26 | * @author Sinkiang 27 | * @date 2019-03-25 28 | */ 29 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 30 | public interface DeptMapper extends BaseMapper { 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/DictMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.DictDTO; 20 | import com.dxj.module.system.domain.entity.Dict; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-04-10 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface DictMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/MenuMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.MenuDTO; 20 | import com.dxj.module.system.domain.entity.Menu; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2018-12-17 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface MenuMapper extends BaseMapper { 30 | } 31 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/DictDetailService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.service; 2 | 3 | import com.dxj.module.system.domain.dto.DictDetailDTO; 4 | import com.dxj.module.system.domain.entity.DictDetail; 5 | import com.dxj.module.system.domain.query.DictDetailQuery; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-04-10 14 | */ 15 | public interface DictDetailService { 16 | 17 | /** 18 | * 创建 19 | * @param resources / 20 | */ 21 | void create(DictDetail resources); 22 | 23 | /** 24 | * 编辑 25 | * @param resources / 26 | */ 27 | void update(DictDetail resources); 28 | 29 | /** 30 | * 删除 31 | * @param id / 32 | */ 33 | void delete(Long id); 34 | 35 | /** 36 | * 分页查询 37 | * @param criteria 条件 38 | * @param pageable 分页参数 39 | * @return / 40 | */ 41 | Map queryAll(DictDetailQuery criteria, Pageable pageable); 42 | 43 | /** 44 | * 根据字典名称获取字典详情 45 | * @param name 字典名称 46 | * @return / 47 | */ 48 | List getDictByName(String name); 49 | } 50 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/config/FileProperties.java: -------------------------------------------------------------------------------- 1 | package com.dxj.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author jianghehe 9 | * @date 10 | */ 11 | @Data 12 | @Configuration 13 | @ConfigurationProperties(prefix = "file") 14 | public class FileProperties { 15 | 16 | /** 17 | * 文件大小限制 18 | */ 19 | private Long maxSize; 20 | 21 | /** 22 | * 头像大小限制 23 | */ 24 | private Long avatarMaxSize; 25 | 26 | private SkPath mac; 27 | 28 | private SkPath linux; 29 | 30 | private SkPath windows; 31 | 32 | public SkPath getPath() { 33 | String os = System.getProperty("os.name"); 34 | String win = "win"; 35 | String macName = "mac"; 36 | if (os.toLowerCase().startsWith(win)) { 37 | return windows; 38 | } else if (os.toLowerCase().startsWith(macName)) { 39 | return mac; 40 | } 41 | return linux; 42 | } 43 | 44 | @Data 45 | public static class SkPath { 46 | 47 | private String path; 48 | 49 | private String avatar; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/generator/admin/Mapper.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package ${package}.service.mapstruct; 17 | 18 | import me.zhengjie.base.BaseMapper; 19 | import ${package}.domain.${className}; 20 | import ${package}.service.dto.${className}Dto; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @website https://el-admin.vip 26 | * @author ${author} 27 | * @date ${date} 28 | **/ 29 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) 30 | public interface ${className}Mapper extends BaseMapper<${className}Dto, ${className}> { 31 | 32 | } -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/JobSmallMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.JobSmallDTO; 20 | import com.dxj.module.system.domain.entity.Job; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-03-29 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface JobSmallMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/VerifyService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.service; 17 | 18 | import com.dxj.domain.vo.EmailVo; 19 | 20 | /** 21 | * @author Sinkiang 22 | * @date 2018-12-26 23 | */ 24 | public interface VerifyService { 25 | 26 | /** 27 | * 发送验证码 28 | * @param email / 29 | * @param key / 30 | * @return / 31 | */ 32 | EmailVo sendEmail(String email, String key); 33 | 34 | 35 | /** 36 | * 验证 37 | * @param code / 38 | * @param key / 39 | */ 40 | void validated(String key, String code); 41 | } 42 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/entity/EmailConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | import javax.validation.constraints.NotBlank; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * 邮件配置类,覆盖式存入数据 15 | * @author Sinkiang 16 | * @date 2018-12-26 17 | */ 18 | @Entity 19 | @Data 20 | @Table(name = "tool_email_config") 21 | public class EmailConfig implements Serializable { 22 | 23 | @Id 24 | @Column(name = "config_id") 25 | @ApiModelProperty(value = "ID", hidden = true) 26 | private Long id; 27 | 28 | @NotBlank 29 | @ApiModelProperty(value = "邮件服务器SMTP地址") 30 | private String host; 31 | 32 | @NotBlank 33 | @ApiModelProperty(value = "邮件服务器 SMTP 端口") 34 | private String port; 35 | 36 | @NotBlank 37 | @ApiModelProperty(value = "发件者用户名") 38 | private String user; 39 | 40 | @NotBlank 41 | @ApiModelProperty(value = "密码") 42 | private String pass; 43 | 44 | @NotBlank 45 | @ApiModelProperty(value = "收件人") 46 | private String fromUser; 47 | } 48 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/DeptSmallMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.DeptSmallDTO; 20 | import com.dxj.module.system.domain.entity.Dept; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-03-25 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface DeptSmallMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/DictSmallMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.DictSmallDTO; 20 | import com.dxj.module.system.domain.entity.Dict; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-04-10 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface DictSmallMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/JobMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.JobDTO; 20 | import com.dxj.module.system.domain.entity.Job; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-03-29 27 | */ 28 | @Mapper(componentModel = "spring", uses = {DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface JobMapper extends BaseMapper { 30 | } 31 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/RoleSmallMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.RoleSmallDTO; 20 | import com.dxj.module.system.domain.entity.Role; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2019-5-23 27 | */ 28 | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface RoleSmallMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/config/RsaProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.config; 17 | 18 | import lombok.Data; 19 | import org.springframework.beans.factory.annotation.Value; 20 | import org.springframework.stereotype.Component; 21 | 22 | /** 23 | * @author Sinkiang 24 | * @website https://el-admin.vip 25 | * @description 26 | * @date 2020-05-18 27 | **/ 28 | @Data 29 | @Component 30 | public class RsaProperties { 31 | 32 | public static String privateKey; 33 | 34 | @Value("${rsa.private_key}") 35 | public void setPrivateKey(String privateKey) { 36 | RsaProperties.privateKey = privateKey; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/RoleMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.RoleDTO; 20 | import com.dxj.module.system.domain.entity.Role; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2018-11-23 27 | */ 28 | @Mapper(componentModel = "spring", uses = {MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface RoleMapper extends BaseMapper { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/UserMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.UserDTO; 20 | import com.dxj.module.system.domain.entity.User; 21 | import org.mapstruct.Mapper; 22 | import org.mapstruct.ReportingPolicy; 23 | 24 | /** 25 | * @author Sinkiang 26 | * @date 2018-11-23 27 | */ 28 | @Mapper(componentModel = "spring", uses = {RoleMapper.class, DeptMapper.class, JobMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) 29 | public interface UserMapper extends BaseMapper { 30 | } 31 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/mapstruct/DictDetailMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.mapstruct; 17 | 18 | import com.dxj.base.BaseMapper; 19 | import com.dxj.module.system.domain.dto.DictDetailDTO; 20 | 21 | import com.dxj.module.system.domain.entity.DictDetail; 22 | import org.mapstruct.Mapper; 23 | import org.mapstruct.ReportingPolicy; 24 | 25 | /** 26 | * @author Sinkiang 27 | * @date 2019-04-10 28 | */ 29 | @Mapper(componentModel = "spring", uses = {DictSmallMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) 30 | public interface DictDetailMapper extends BaseMapper { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sk-tool/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sk-admin 7 | com.dxj 8 | 2.0 9 | 10 | 4.0.0 11 | 12 | com.dxj.service 13 | sk-tool 14 | 2.0 15 | 工具模块 16 | 17 | 18 | 19 | com.dxj.service 20 | sk-log 21 | 2.0 22 | 23 | 24 | 25 | com.google.code.gson 26 | gson 27 | 2.8.9 28 | 29 | 30 | 31 | 32 | com.qiniu 33 | qiniu-java-sdk 34 | 7.2.28 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/annotation/type/LogActionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.annotation.type; 17 | 18 | /** 19 | * @author: liaojinlong 20 | * @date: 2020/6/11 19:47 21 | * @apiNote: 日志类型 22 | */ 23 | 24 | public enum LogActionType { 25 | /** 26 | * 增删改查 27 | */ 28 | ADD("新增"), 29 | SELECT("查询"), 30 | UPDATE("更新"), 31 | DELETE("删除"); 32 | private String value; 33 | 34 | LogActionType(String value) { 35 | this.value = value; 36 | } 37 | 38 | public String getValue() { 39 | return value; 40 | } 41 | 42 | public void setValue(String value) { 43 | this.value = value; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/util/QuartzRunnable.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.util; 2 | 3 | import com.dxj.util.SpringContextHolder; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.springframework.util.ReflectionUtils; 7 | 8 | import java.lang.reflect.Method; 9 | import java.util.concurrent.Callable; 10 | 11 | /** 12 | * 执行定时任务 13 | * @author / 14 | */ 15 | @Slf4j 16 | public class QuartzRunnable implements Callable { 17 | 18 | private final Object target; 19 | private final Method method; 20 | private final String params; 21 | 22 | QuartzRunnable(String beanName, String methodName, String params) 23 | throws NoSuchMethodException, SecurityException { 24 | this.target = SpringContextHolder.getBean(beanName); 25 | this.params = params; 26 | 27 | if (StringUtils.isNotBlank(params)) { 28 | this.method = target.getClass().getDeclaredMethod(methodName, String.class); 29 | } else { 30 | this.method = target.getClass().getDeclaredMethod(methodName); 31 | } 32 | } 33 | 34 | @Override 35 | public Object call() throws Exception { 36 | ReflectionUtils.makeAccessible(method); 37 | if (StringUtils.isNotBlank(params)) { 38 | method.invoke(target, params); 39 | } else { 40 | method.invoke(target); 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/config/JobRunner.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.config; 2 | 3 | import com.dxj.module.quartz.dao.QuartzJobDao; 4 | import com.dxj.module.quartz.domain.entity.QuartzJob; 5 | import com.dxj.module.quartz.util.QuartzManage; 6 | import lombok.RequiredArgsConstructor; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.boot.ApplicationArguments; 10 | import org.springframework.boot.ApplicationRunner; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @author Sinkiang 17 | * @date 2019-01-07 18 | */ 19 | @Component 20 | @RequiredArgsConstructor 21 | public class JobRunner implements ApplicationRunner { 22 | 23 | private static final Logger log = LoggerFactory.getLogger(JobRunner.class); 24 | private final QuartzJobDao quartzJobDao; 25 | private final QuartzManage quartzManage; 26 | 27 | /** 28 | * 项目启动时重新激活启用的定时任务 29 | * @param applicationArguments / 30 | */ 31 | @Override 32 | public void run(ApplicationArguments applicationArguments){ 33 | log.info("----- 开始注入定时任务 -----"); 34 | List quartzJobs = quartzJobDao.findByIsPauseIsFalse(); 35 | quartzJobs.forEach(quartzManage::addJob); 36 | log.info("----- 定时任务注入完成 -----"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/controller/GenConfigController.java: -------------------------------------------------------------------------------- 1 | package com.dxj.controller; 2 | 3 | import com.dxj.domain.entity.GenConfig; 4 | import com.dxj.service.GenConfigService; 5 | import io.swagger.annotations.Api; 6 | import io.swagger.annotations.ApiOperation; 7 | import lombok.RequiredArgsConstructor; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.validation.annotation.Validated; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2019-01-14 16 | */ 17 | @RestController 18 | @RequiredArgsConstructor 19 | @RequestMapping("/api/genConfig") 20 | @Api(tags = "系统:代码生成器配置管理") 21 | public class GenConfigController { 22 | 23 | private final GenConfigService genConfigService; 24 | 25 | @ApiOperation("查询") 26 | @GetMapping(value = "/{tableName}") 27 | public ResponseEntity query(@PathVariable String tableName) { 28 | return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); 29 | } 30 | 31 | @ApiOperation("修改") 32 | @PutMapping 33 | public ResponseEntity update(@Validated @RequestBody GenConfig genConfig) { 34 | return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig), HttpStatus.OK); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/dto/MenuDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.domain.dto; 2 | 3 | import com.dxj.base.BaseDTO; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import java.io.Serializable; 8 | import java.sql.Timestamp; 9 | import java.util.List; 10 | import java.util.Objects; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-12-17 15 | */ 16 | @Data 17 | @EqualsAndHashCode(callSuper = false) 18 | public class MenuDTO extends BaseDTO implements Serializable { 19 | 20 | private Long id; 21 | 22 | private List children; 23 | 24 | private Integer type; 25 | 26 | private String permission; 27 | 28 | private String title; 29 | 30 | private Integer menuSort; 31 | 32 | private String path; 33 | 34 | private String component; 35 | 36 | private Long pid; 37 | 38 | private Integer subCount; 39 | 40 | private Boolean iFrame; 41 | 42 | private Boolean cache; 43 | 44 | private Boolean hidden; 45 | 46 | private String componentName; 47 | 48 | private String icon; 49 | 50 | public Boolean getHasChildren() { 51 | return subCount > 0; 52 | } 53 | 54 | public Boolean getLeaf() { 55 | return subCount <= 0; 56 | } 57 | 58 | public String getLabel() { 59 | return title; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/entity/TokenConfigurer.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.entity; 2 | 3 | import com.dxj.module.security.config.bean.SecurityProperties; 4 | import com.dxj.module.security.service.UserCacheClean; 5 | import com.dxj.module.security.service.OnlineUserService; 6 | import lombok.RequiredArgsConstructor; 7 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.web.DefaultSecurityFilterChain; 10 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 11 | 12 | /** 13 | * @author / 14 | */ 15 | @RequiredArgsConstructor 16 | public class TokenConfigurer extends SecurityConfigurerAdapter { 17 | 18 | private final TokenProvider tokenProvider; 19 | private final SecurityProperties properties; 20 | private final OnlineUserService onlineUserService; 21 | private final UserCacheClean userCacheClean; 22 | 23 | @Override 24 | public void configure(HttpSecurity http) { 25 | TokenFilter customFilter = new TokenFilter(tokenProvider, properties, onlineUserService, userCacheClean); 26 | http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/entity/QiniuContent.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | import org.hibernate.annotations.UpdateTimestamp; 6 | 7 | import javax.persistence.*; 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | 11 | /** 12 | * 上传成功后,存储结果 13 | * @author Sinkiang 14 | * @date 2018-12-31 15 | */ 16 | @Data 17 | @Entity 18 | @Table(name = "tool_qiniu_content") 19 | public class QiniuContent implements Serializable { 20 | 21 | @Id 22 | @Column(name = "content_id") 23 | @ApiModelProperty(value = "ID", hidden = true) 24 | @GeneratedValue(strategy = GenerationType.IDENTITY) 25 | private Long id; 26 | 27 | @Column(name = "name") 28 | @ApiModelProperty(value = "文件名") 29 | private String key; 30 | 31 | @ApiModelProperty(value = "空间名") 32 | private String bucket; 33 | 34 | @ApiModelProperty(value = "大小") 35 | private String size; 36 | 37 | @ApiModelProperty(value = "文件地址") 38 | private String url; 39 | 40 | @ApiModelProperty(value = "文件类型") 41 | private String suffix; 42 | 43 | @ApiModelProperty(value = "空间类型:公开/私有") 44 | private String type = "公开"; 45 | 46 | @UpdateTimestamp 47 | @ApiModelProperty(value = "创建或更新时间") 48 | @Column(name = "update_time") 49 | private Timestamp updateTime; 50 | } 51 | -------------------------------------------------------------------------------- /sk-generator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sk-admin 7 | com.dxj 8 | 2.0 9 | 10 | 4.0.0 11 | 12 | com.dxj.service 13 | sk-generator 14 | 2.0 15 | 代码生成器模块 16 | 17 | 18 | 19 | com.dxj.common 20 | sk-common 21 | 2.0 22 | 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-freemarker 27 | 28 | 29 | 30 | 31 | commons-configuration 32 | commons-configuration 33 | 1.9 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/enumeration/CodeBiEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.enumeration; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | *

23 | * 验证码业务场景 24 | *

25 | * @author Sinkiang 26 | * @date 2020-05-02 27 | */ 28 | @Getter 29 | @AllArgsConstructor 30 | public enum CodeBiEnum { 31 | 32 | /* 旧邮箱修改邮箱 */ 33 | ONE(1, "旧邮箱修改邮箱"), 34 | 35 | /* 通过邮箱修改密码 */ 36 | TWO(2, "通过邮箱修改密码"); 37 | 38 | private final int code; 39 | private final String description; 40 | 41 | public static CodeBiEnum find(int code) { 42 | for (CodeBiEnum value : CodeBiEnum.values()) { 43 | if (code == value.getCode()) { 44 | return value; 45 | } 46 | } 47 | return null; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/annotation/Limit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.annotation; 17 | 18 | import com.dxj.aspect.LimitType; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * @author jacky 27 | */ 28 | @Target(ElementType.METHOD) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | public @interface Limit { 31 | 32 | // 资源名称,用于描述接口功能 33 | String name() default ""; 34 | 35 | // 资源 key 36 | String key() default ""; 37 | 38 | // key prefix 39 | String prefix() default ""; 40 | 41 | // 时间的,单位秒 42 | int period(); 43 | 44 | // 限制访问次数 45 | int count(); 46 | 47 | // 限制类型 48 | LimitType limitType() default LimitType.CUSTOMER; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/enumeration/CodeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.enumeration; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | *

23 | * 验证码业务场景对应的 Redis 中的 key 24 | *

25 | * @author Sinkiang 26 | * @date 2020-05-02 27 | */ 28 | @Getter 29 | @AllArgsConstructor 30 | public enum CodeEnum { 31 | 32 | /* 通过手机号码重置邮箱 */ 33 | PHONE_RESET_EMAIL_CODE("phone_reset_email_code_", "通过手机号码重置邮箱"), 34 | 35 | /* 通过旧邮箱重置邮箱 */ 36 | EMAIL_RESET_EMAIL_CODE("email_reset_email_code_", "通过旧邮箱重置邮箱"), 37 | 38 | /* 通过手机号码重置密码 */ 39 | PHONE_RESET_PWD_CODE("phone_reset_pwd_code_", "通过手机号码重置密码"), 40 | 41 | /* 通过邮箱重置密码 */ 42 | EMAIL_RESET_PWD_CODE("email_reset_pwd_code_", "通过邮箱重置密码"); 43 | 44 | private final String key; 45 | private final String description; 46 | } 47 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/DeptDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.Dept; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-03-25 14 | */ 15 | @SuppressWarnings("all") 16 | public interface DeptDao extends BaseDao { 17 | 18 | /** 19 | * 根据 PID 查询 20 | * @param id pid 21 | * @return / 22 | */ 23 | List findByPid(Long id); 24 | 25 | /** 26 | * 获取顶级部门 27 | * @return / 28 | */ 29 | List findByPidIsNull(); 30 | 31 | /** 32 | * 根据角色ID 查询 33 | * @param roleId 角色ID 34 | * @return / 35 | */ 36 | @Query(value = "select d.* from sys_dept d, sys_roles_depts r where " + 37 | "d.dept_id = r.dept_id and r.role_id = ?1", nativeQuery = true) 38 | Set findByRoleId(Long roleId); 39 | 40 | /** 41 | * 判断是否存在子节点 42 | * @param pid / 43 | * @return / 44 | */ 45 | int countByPid(Long pid); 46 | 47 | /** 48 | * 根据ID更新sub_count 49 | * @param count / 50 | * @param id / 51 | */ 52 | @Modifying 53 | @Query(value = " update sys_dept set sub_count = ?1 where dept_id = ?2 ",nativeQuery = true) 54 | void updateSubCntById(Integer count, Long id); 55 | } 56 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/domain/entity/Log.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | 9 | import javax.persistence.*; 10 | import java.io.Serializable; 11 | import java.sql.Timestamp; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2018-11-24 16 | */ 17 | @Entity 18 | @Getter 19 | @Setter 20 | @Table(name = "sys_log") 21 | @NoArgsConstructor 22 | public class Log implements Serializable { 23 | 24 | @Id 25 | @Column(name = "log_id") 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | private Long id; 28 | 29 | /** 操作用户 */ 30 | private String username; 31 | 32 | /** 描述 */ 33 | private String description; 34 | 35 | /** 方法名 */ 36 | private String method; 37 | 38 | /** 参数 */ 39 | private String params; 40 | 41 | /** 日志类型 */ 42 | private String logType; 43 | 44 | /** 请求ip */ 45 | private String requestIp; 46 | 47 | /** 地址 */ 48 | private String address; 49 | 50 | /** 浏览器 */ 51 | private String browser; 52 | 53 | /** 请求耗时 */ 54 | private Long time; 55 | 56 | /** 异常详细 */ 57 | private byte[] exceptionDetail; 58 | 59 | /** 创建日期 */ 60 | @CreationTimestamp 61 | private Timestamp createTime; 62 | 63 | public Log(String logType, Long time) { 64 | this.logType = logType; 65 | this.time = time; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/DictService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.service; 2 | 3 | import com.dxj.module.system.domain.dto.DictDTO; 4 | import com.dxj.module.system.domain.entity.Dict; 5 | import com.dxj.module.system.domain.query.DictQuery; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | import java.util.List; 11 | import java.util.Map; 12 | import java.util.Set; 13 | 14 | /** 15 | * @author Sinkiang 16 | * @date 2019-04-10 17 | */ 18 | public interface DictService { 19 | 20 | /** 21 | * 分页查询 22 | * @param criteria 条件 23 | * @param pageable 分页参数 24 | * @return / 25 | */ 26 | Map queryAll(DictQuery criteria, Pageable pageable); 27 | 28 | /** 29 | * 查询全部数据 30 | * @param dict / 31 | * @return / 32 | */ 33 | List queryAll(DictQuery dict); 34 | 35 | /** 36 | * 创建 37 | * @param resources / 38 | * @return / 39 | */ 40 | void create(Dict resources); 41 | 42 | /** 43 | * 编辑 44 | * @param resources / 45 | */ 46 | void update(Dict resources); 47 | 48 | /** 49 | * 删除 50 | * @param ids / 51 | */ 52 | void delete(Set ids); 53 | 54 | /** 55 | * 导出数据 56 | * @param queryAll 待导出的数据 57 | * @param response / 58 | * @throws IOException / 59 | */ 60 | void download(List queryAll, HttpServletResponse response) throws IOException; 61 | } 62 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/generator/admin/Repository.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package ${package}.repository; 17 | 18 | import ${package}.domain.${className}; 19 | import org.springframework.data.jpa.repository.JpaRepository; 20 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 21 | 22 | /** 23 | * @website https://el-admin.vip 24 | * @author ${author} 25 | * @date ${date} 26 | **/ 27 | public interface ${className}Repository extends JpaRepository<${className}, ${pkColumnType}>, JpaSpecificationExecutor<${className}> { 28 | <#if columns??> 29 | <#list columns as column> 30 | <#if column.columnKey = 'UNI'> 31 | /** 32 | * 根据 ${column.capitalColumnName} 查询 33 | * @param ${column.columnName} / 34 | * @return / 35 | */ 36 | ${className} findBy${column.capitalColumnName}(${column.columnType} ${column.columnName}); 37 | 38 | 39 | 40 | } -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/entity/QiniuConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | import javax.validation.constraints.NotBlank; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * 七牛云对象存储配置类 15 | * @author Sinkiang 16 | * @date 2018-12-31 17 | */ 18 | @Data 19 | @Entity 20 | @Table(name = "tool_qiniu_config") 21 | public class QiniuConfig implements Serializable { 22 | 23 | @Id 24 | @Column(name = "config_id") 25 | @ApiModelProperty(value = "ID") 26 | private Long id; 27 | 28 | @NotBlank 29 | @ApiModelProperty(value = "accessKey") 30 | private String accessKey; 31 | 32 | @NotBlank 33 | @ApiModelProperty(value = "secretKey") 34 | private String secretKey; 35 | 36 | @NotBlank 37 | @ApiModelProperty(value = "存储空间名称作为唯一的 Bucket 识别符") 38 | private String bucket; 39 | 40 | /** 41 | * Zone表示与机房的对应关系 42 | * 华东 Zone.zone0() 43 | * 华北 Zone.zone1() 44 | * 华南 Zone.zone2() 45 | * 北美 Zone.zoneNa0() 46 | * 东南亚 Zone.zoneAs0() 47 | */ 48 | @NotBlank 49 | @ApiModelProperty(value = "Zone表示与机房的对应关系") 50 | private String zone; 51 | 52 | @NotBlank 53 | @ApiModelProperty(value = "外链域名,可自定义,需在七牛云绑定") 54 | private String host; 55 | 56 | @ApiModelProperty(value = "空间类型:公开/私有") 57 | private String type = "公开"; 58 | } 59 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/config/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8000 3 | 4 | spring: 5 | freemarker: 6 | check-template-location: false 7 | profiles: 8 | active: dev 9 | jackson: 10 | time-zone: GMT+8 11 | data: 12 | redis: 13 | repositories: 14 | enabled: false 15 | 16 | #配置 Jpa 17 | jpa: 18 | properties: 19 | hibernate: 20 | ddl-auto: none 21 | dialect: org.hibernate.dialect.MySQL5InnoDBDialect 22 | open-in-view: true 23 | 24 | redis: 25 | #数据库索引 26 | database: 0 27 | host: 127.0.0.1 28 | port: 6379 29 | password: 30 | #连接超时时间 31 | timeout: 5000 32 | 33 | task: 34 | pool: 35 | # 核心线程池大小 36 | core-pool-size: 10 37 | # 最大线程数 38 | max-pool-size: 30 39 | # 活跃时间 40 | keep-alive-seconds: 60 41 | # 队列容量 42 | queue-capacity: 50 43 | 44 | #七牛云 45 | qiniu: 46 | # 文件大小 /M 47 | max-size: 15 48 | 49 | #邮箱验证码有效时间/秒 50 | code: 51 | expiration: 300 52 | 53 | #密码加密传输,前端公钥加密,后端私钥解密 54 | rsa: 55 | private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== 56 | 57 | # sm.ms 图床的 token 58 | smms: 59 | token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl 60 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/annotation/DataPermission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.annotation; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | *

25 | * 用于判断是否过滤数据权限 26 | * 1、如果没有用到 @OneToOne 这种关联关系,只需要填写 fieldName [参考:DeptQueryCriteria.class] 27 | * 2、如果用到了 @OneToOne ,fieldName 和 joinName 都需要填写,拿UserQueryCriteria.class举例: 28 | * 应该是 @DataPermission(joinName = "dept", fieldName = "id") 29 | *

30 | * @author Sinkiang 31 | * @date 2020-05-07 32 | **/ 33 | @Target(ElementType.TYPE) 34 | @Retention(RetentionPolicy.RUNTIME) 35 | public @interface DataPermission { 36 | 37 | /** 38 | * Entity 中的字段名称 39 | */ 40 | String fieldName() default ""; 41 | 42 | /** 43 | * Entity 中与部门关联的字段名称 44 | */ 45 | String joinName() default ""; 46 | } 47 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/enumeration/DataScopeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.enumeration; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | *

23 | * 数据权限枚举 24 | *

25 | * @author Sinkiang 26 | * @date 2020-05-07 27 | */ 28 | @Getter 29 | @AllArgsConstructor 30 | public enum DataScopeEnum { 31 | 32 | /* 全部的数据权限 */ 33 | ALL("全部", "全部的数据权限"), 34 | 35 | /* 自己部门的数据权限 */ 36 | THIS_LEVEL("本级", "自己部门的数据权限"), 37 | 38 | /* 自定义的数据权限 */ 39 | CUSTOMIZE("自定义", "自定义的数据权限"); 40 | 41 | private final String value; 42 | private final String description; 43 | 44 | public static DataScopeEnum find(String val) { 45 | for (DataScopeEnum dataScopeEnum : DataScopeEnum.values()) { 46 | if (val.equals(dataScopeEnum.getValue())) { 47 | return dataScopeEnum; 48 | } 49 | } 50 | return null; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/service/PictureService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.Picture; 4 | import com.dxj.domain.dto.PictureQuery; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | import java.util.List; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-12-27 15 | */ 16 | public interface PictureService { 17 | 18 | /** 19 | * 分页查询 20 | * @param criteria 条件 21 | * @param pageable 分页参数 22 | * @return / 23 | */ 24 | Object queryAll(PictureQuery criteria, Pageable pageable); 25 | 26 | /** 27 | * 查询全部数据 28 | * @param criteria 条件 29 | * @return / 30 | */ 31 | List queryAll(PictureQuery criteria); 32 | 33 | /** 34 | * 上传文件 35 | * @param file / 36 | * @param username / 37 | * @return / 38 | */ 39 | Picture upload(MultipartFile file, String username); 40 | 41 | /** 42 | * 根据ID查询 43 | * @param id / 44 | * @return / 45 | */ 46 | Picture findById(Long id); 47 | 48 | /** 49 | * 多选删除 50 | * @param ids / 51 | */ 52 | void deleteAll(Long[] ids); 53 | 54 | /** 55 | * 导出 56 | * @param queryAll 待导出的数据 57 | * @param response / 58 | * @throws IOException / 59 | */ 60 | void download(List queryAll, HttpServletResponse response) throws IOException; 61 | 62 | /** 63 | * 同步数据 64 | */ 65 | void synchronize(); 66 | } 67 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/config/bean/LoginCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.security.config.bean; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * 登录验证码配置信息 22 | * 23 | * @author: liaojinlong 24 | * @date: 2020/6/10 18:53 25 | */ 26 | @Data 27 | public class LoginCode { 28 | 29 | /** 30 | * 验证码配置 31 | */ 32 | private LoginCodeEnum codeType; 33 | /** 34 | * 验证码有效期 分钟 35 | */ 36 | private Long expiration = 2L; 37 | /** 38 | * 验证码内容长度 39 | */ 40 | private int length = 2; 41 | /** 42 | * 验证码宽度 43 | */ 44 | private int width = 111; 45 | /** 46 | * 验证码高度 47 | */ 48 | private int height = 36; 49 | /** 50 | * 验证码字体 51 | */ 52 | private String fontName; 53 | /** 54 | * 字体大小 55 | */ 56 | private int fontSize = 25; 57 | 58 | LoginCodeEnum getCodeType() { 59 | return codeType; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/domain/entity/QuartzLog.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | import org.hibernate.annotations.CreationTimestamp; 6 | 7 | import javax.persistence.*; 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2019-01-07 14 | */ 15 | @Entity 16 | @Data 17 | @Table(name = "sys_quartz_log") 18 | public class QuartzLog implements Serializable { 19 | 20 | @Id 21 | @Column(name = "log_id") 22 | @ApiModelProperty(value = "ID", hidden = true) 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) 24 | private Long id; 25 | 26 | @ApiModelProperty(value = "任务名称", hidden = true) 27 | private String jobName; 28 | 29 | @ApiModelProperty(value = "bean名称", hidden = true) 30 | private String beanName; 31 | 32 | @ApiModelProperty(value = "方法名称", hidden = true) 33 | private String methodName; 34 | 35 | @ApiModelProperty(value = "参数", hidden = true) 36 | private String params; 37 | 38 | @ApiModelProperty(value = "cron表达式", hidden = true) 39 | private String cronExpression; 40 | 41 | @ApiModelProperty(value = "状态", hidden = true) 42 | private Boolean isSuccess; 43 | 44 | @ApiModelProperty(value = "异常详情", hidden = true) 45 | private String exceptionDetail; 46 | 47 | @ApiModelProperty(value = "执行耗时", hidden = true) 48 | private Long time; 49 | 50 | @CreationTimestamp 51 | @ApiModelProperty(value = "创建时间", hidden = true) 52 | private Timestamp createTime; 53 | } 54 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/util/QiNiuUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import com.qiniu.storage.Region; 4 | 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | 8 | /** 9 | * 七牛云存储工具类 10 | * 11 | * @author Sinkiang 12 | * @date 2018-12-31 13 | */ 14 | public class QiNiuUtil { 15 | 16 | private static final String HUAD = "华东"; 17 | 18 | private static final String HUAB = "华北"; 19 | 20 | private static final String HUAN = "华南"; 21 | 22 | private static final String BEIM = "北美"; 23 | 24 | /** 25 | * 得到机房的对应关系 26 | * 27 | * @param zone 机房名称 28 | * @return Region 29 | */ 30 | public static Region getRegion(String zone) { 31 | 32 | if (HUAD.equals(zone)) { 33 | return Region.huadong(); 34 | } else if (HUAB.equals(zone)) { 35 | return Region.huabei(); 36 | } else if (HUAN.equals(zone)) { 37 | return Region.huanan(); 38 | } else if (BEIM.equals(zone)) { 39 | return Region.beimei(); 40 | // 否则就是东南亚 41 | } else { 42 | return Region.qvmHuadong(); 43 | } 44 | } 45 | 46 | /** 47 | * 默认不指定key的情况下,以文件内容的hash值作为文件名 48 | * 49 | * @param file 文件名 50 | * @return String 51 | */ 52 | public static String getKey(String file) { 53 | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); 54 | Date date = new Date(); 55 | return FileUtils.getFileNameNoEx(file) + "-" + 56 | sdf.format(date) + 57 | "." + 58 | FileUtils.getExtensionName(file); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/thread/TheadFactoryName.java: -------------------------------------------------------------------------------- 1 | package com.dxj.thread; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.util.concurrent.ThreadFactory; 6 | import java.util.concurrent.atomic.AtomicInteger; 7 | 8 | /** 9 | * 自定义线程名称 10 | * 11 | * @author Sinkiang 12 | * @date 2019年10月31日17:49:55 13 | */ 14 | @Component 15 | public class TheadFactoryName implements ThreadFactory { 16 | 17 | private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1); 18 | private final ThreadGroup group; 19 | private final AtomicInteger threadNumber = new AtomicInteger(1); 20 | private final String namePrefix; 21 | 22 | public TheadFactoryName() { 23 | this("sk-pool"); 24 | } 25 | 26 | private TheadFactoryName(String name) { 27 | SecurityManager s = System.getSecurityManager(); 28 | group = (s != null) ? s.getThreadGroup() : 29 | Thread.currentThread().getThreadGroup(); 30 | //此时namePrefix就是 name + 第几个用这个工厂创建线程池的 31 | this.namePrefix = name + 32 | POOL_NUMBER.getAndIncrement(); 33 | } 34 | 35 | @Override 36 | public Thread newThread(Runnable r) { 37 | //此时线程的名字 就是 namePrefix + -thread- + 这个线程池中第几个执行的线程 38 | Thread t = new Thread(group, r, 39 | namePrefix + "-thread-" + threadNumber.getAndIncrement(), 40 | 0); 41 | if (t.isDaemon()) { 42 | t.setDaemon(false); 43 | } 44 | if (t.getPriority() != Thread.NORM_PRIORITY) { 45 | t.setPriority(Thread.NORM_PRIORITY); 46 | } 47 | return t; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/entity/Picture.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | import org.hibernate.annotations.CreationTimestamp; 6 | 7 | import javax.persistence.*; 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | 11 | /** 12 | * sm.ms图床 13 | * 14 | * @author Sinkiang 15 | * @date 2018-12-27 16 | */ 17 | @Data 18 | @Entity 19 | @Table(name = "tool_picture") 20 | public class Picture implements Serializable { 21 | 22 | @Id 23 | @Column(name = "picture_id") 24 | @ApiModelProperty(value = "ID", hidden = true) 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) 26 | private Long id; 27 | 28 | @ApiModelProperty(value = "文件名") 29 | private String filename; 30 | 31 | @ApiModelProperty(value = "图片url") 32 | private String url; 33 | 34 | @ApiModelProperty(value = "图片大小") 35 | private String size; 36 | 37 | @ApiModelProperty(value = "图片高") 38 | private String height; 39 | 40 | @ApiModelProperty(value = "图片宽") 41 | private String width; 42 | 43 | @Column(name = "delete_url") 44 | @ApiModelProperty(value = "用于删除的url") 45 | private String delete; 46 | 47 | @ApiModelProperty(value = "创建者") 48 | private String username; 49 | 50 | @CreationTimestamp 51 | @ApiModelProperty(value = "创建时间") 52 | private Timestamp createTime; 53 | 54 | /** 用于检测文件是否重复 */ 55 | private String md5Code; 56 | 57 | @Override 58 | public String toString() { 59 | return "Picture{" + 60 | "filename='" + filename + '\'' + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/controller/EmailController.java: -------------------------------------------------------------------------------- 1 | package com.dxj.controller; 2 | 3 | import com.dxj.annotation.Log; 4 | import com.dxj.domain.entity.EmailConfig; 5 | import com.dxj.domain.vo.EmailVo; 6 | import com.dxj.service.EmailService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiOperation; 9 | import lombok.RequiredArgsConstructor; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.validation.annotation.Validated; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | /** 16 | * 发送邮件 17 | * 18 | * @author Sinkiang 19 | * @date 2018/09/28 6:55:53 20 | */ 21 | @RestController 22 | @RequiredArgsConstructor 23 | @RequestMapping("api/email") 24 | @Api(tags = "工具:邮件管理") 25 | public class EmailController { 26 | 27 | private final EmailService emailService; 28 | 29 | @GetMapping 30 | public ResponseEntity queryConfig() { 31 | return new ResponseEntity<>(emailService.find(), HttpStatus.OK); 32 | } 33 | 34 | @Log("配置邮件") 35 | @PutMapping 36 | @ApiOperation("配置邮件") 37 | public ResponseEntity updateConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { 38 | emailService.config(emailConfig, emailService.find()); 39 | return new ResponseEntity<>(HttpStatus.OK); 40 | } 41 | 42 | @Log("发送邮件") 43 | @PostMapping 44 | @ApiOperation("发送邮件") 45 | public ResponseEntity sendEmail(@Validated @RequestBody EmailVo emailVo) { 46 | emailService.send(emailVo, emailService.find()); 47 | return new ResponseEntity<>(HttpStatus.OK); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/domain/entity/GenConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | import javax.persistence.*; 10 | import javax.validation.constraints.NotBlank; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * 代码生成配置 15 | * 16 | * @author Sinkiang 17 | * @date 2019-01-03 18 | */ 19 | @Getter 20 | @Setter 21 | @Entity 22 | @NoArgsConstructor 23 | @Table(name = "code_gen_config") 24 | public class GenConfig implements Serializable { 25 | 26 | public GenConfig(String tableName) { 27 | this.tableName = tableName; 28 | } 29 | 30 | @Id 31 | @Column(name = "config_id") 32 | @ApiModelProperty(value = "ID", hidden = true) 33 | @GeneratedValue(strategy = GenerationType.IDENTITY) 34 | private Long id; 35 | 36 | @NotBlank 37 | @ApiModelProperty(value = "表名") 38 | private String tableName; 39 | 40 | @ApiModelProperty(value = "接口名称") 41 | private String apiAlias; 42 | 43 | @NotBlank 44 | @ApiModelProperty(value = "包路径") 45 | private String pack; 46 | 47 | @NotBlank 48 | @ApiModelProperty(value = "模块名") 49 | private String moduleName; 50 | 51 | @NotBlank 52 | @ApiModelProperty(value = "前端文件路径") 53 | private String path; 54 | 55 | @ApiModelProperty(value = "前端文件路径") 56 | private String apiPath; 57 | 58 | @ApiModelProperty(value = "作者") 59 | private String author; 60 | 61 | @ApiModelProperty(value = "表前缀") 62 | private String prefix; 63 | 64 | @ApiModelProperty(value = "是否覆盖") 65 | private Boolean cover = false; 66 | } 67 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/config/ConfigBeanConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.security.config; 17 | 18 | import com.dxj.module.security.config.bean.LoginProperties; 19 | import com.dxj.module.security.config.bean.SecurityProperties; 20 | import org.springframework.boot.context.properties.ConfigurationProperties; 21 | import org.springframework.context.annotation.Bean; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | /** 25 | * @apiNote 配置文件转换Pojo类的 统一配置类 26 | * @author: liaojinlong 27 | * @date: 2020/6/10 19:04 28 | */ 29 | @Configuration 30 | public class ConfigBeanConfiguration { 31 | 32 | @Bean 33 | @ConfigurationProperties(prefix = "login", ignoreUnknownFields = true) 34 | public LoginProperties loginProperties() { 35 | return new LoginProperties(); 36 | } 37 | 38 | @Bean 39 | @ConfigurationProperties(prefix = "jwt", ignoreUnknownFields = true) 40 | public SecurityProperties securityProperties() { 41 | return new SecurityProperties(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/service/LocalStorageService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.LocalStorage; 4 | import com.dxj.domain.dto.LocalStorageDTO; 5 | import com.dxj.domain.dto.LocalStorageQuery; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2019-09-05 16 | */ 17 | public interface LocalStorageService { 18 | 19 | /** 20 | * 分页查询 21 | * @param criteria 条件 22 | * @param pageable 分页参数 23 | * @return / 24 | */ 25 | Object queryAll(LocalStorageQuery criteria, Pageable pageable); 26 | 27 | /** 28 | * 查询全部数据 29 | * @param criteria 条件 30 | * @return / 31 | */ 32 | List queryAll(LocalStorageQuery criteria); 33 | 34 | /** 35 | * 根据ID查询 36 | * @param id / 37 | * @return / 38 | */ 39 | LocalStorageDTO findById(Long id); 40 | 41 | /** 42 | * 上传 43 | * @param name 文件名称 44 | * @param file 文件 45 | */ 46 | void create(String name, MultipartFile file); 47 | 48 | /** 49 | * 编辑 50 | * @param resources 文件信息 51 | */ 52 | void update(LocalStorage resources); 53 | 54 | /** 55 | * 多选删除 56 | * @param ids / 57 | */ 58 | void deleteAll(Long[] ids); 59 | 60 | /** 61 | * 导出数据 62 | * @param localStorageDtos 待导出的数据 63 | * @param response / 64 | * @throws IOException / 65 | */ 66 | void download(List localStorageDtos, HttpServletResponse response) throws IOException; 67 | } 68 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/generator/admin/Dto.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package ${package}.service.dto; 17 | 18 | import lombok.Data; 19 | <#if hasTimestamp> 20 | import java.sql.Timestamp; 21 | 22 | <#if hasBigDecimal> 23 | import java.math.BigDecimal; 24 | 25 | import java.io.Serializable; 26 | <#if !auto && pkColumnType = 'Long'> 27 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 28 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 29 | 30 | 31 | /** 32 | * @website https://el-admin.vip 33 | * @description / 34 | * @author ${author} 35 | * @date ${date} 36 | **/ 37 | @Data 38 | public class ${className}Dto implements Serializable { 39 | <#if columns??> 40 | <#list columns as column> 41 | 42 | <#if column.remark != ''> 43 | /** ${column.remark} */ 44 | 45 | <#if column.columnKey = 'PRI'> 46 | <#if !auto && pkColumnType = 'Long'> 47 | /** 防止精度丢失 */ 48 | @JsonSerialize(using= ToStringSerializer.class) 49 | 50 | 51 | private ${column.columnType} ${column.changeColumnName}; 52 | 53 | 54 | } -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/controller/LimitController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.controller; 17 | 18 | import com.dxj.annotation.Limit; 19 | import com.dxj.annotation.rest.AnonymousGetMapping; 20 | import io.swagger.annotations.Api; 21 | import io.swagger.annotations.ApiOperation; 22 | 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RestController; 25 | 26 | import java.util.concurrent.atomic.AtomicInteger; 27 | 28 | /** 29 | * @author / 30 | * 接口限流测试类 31 | */ 32 | @RestController 33 | @RequestMapping("/api/limit") 34 | @Api(tags = "系统:限流测试管理") 35 | public class LimitController { 36 | 37 | private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(); 38 | 39 | /** 40 | * 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test, 41 | */ 42 | @AnonymousGetMapping 43 | @ApiOperation("测试") 44 | @Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit") 45 | public int test() { 46 | return ATOMIC_INTEGER.incrementAndGet(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/JobService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.service; 2 | 3 | import com.dxj.module.system.domain.dto.JobDTO; 4 | import com.dxj.module.system.domain.entity.Job; 5 | import com.dxj.module.system.domain.query.JobQuery; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | import java.util.List; 11 | import java.util.Map; 12 | import java.util.Set; 13 | 14 | /** 15 | * @author Sinkiang 16 | * @date 2019-03-29 17 | */ 18 | public interface JobService { 19 | 20 | /** 21 | * 根据ID查询 22 | * @param id / 23 | * @return / 24 | */ 25 | JobDTO findById(Long id); 26 | 27 | /** 28 | * 创建 29 | * @param resources / 30 | * @return / 31 | */ 32 | void create(Job resources); 33 | 34 | /** 35 | * 编辑 36 | * @param resources / 37 | */ 38 | void update(Job resources); 39 | 40 | /** 41 | * 删除 42 | * @param ids / 43 | */ 44 | void delete(Set ids); 45 | 46 | /** 47 | * 分页查询 48 | * @param criteria 条件 49 | * @param pageable 分页参数 50 | * @return / 51 | */ 52 | Map queryAll(JobQuery criteria, Pageable pageable); 53 | 54 | /** 55 | * 查询全部数据 56 | * @param criteria / 57 | * @return / 58 | */ 59 | List queryAll(JobQuery criteria); 60 | 61 | /** 62 | * 导出数据 63 | * @param queryAll 待导出的数据 64 | * @param response / 65 | * @throws IOException / 66 | */ 67 | void download(List queryAll, HttpServletResponse response) throws IOException; 68 | 69 | /** 70 | * 验证是否被用户关联 71 | * @param ids / 72 | */ 73 | void verification(Set ids); 74 | } 75 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/constant/CacheKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.constant; 17 | 18 | /** 19 | * @author: liaojinlong 20 | * @date: 2020/6/11 15:49 21 | * @apiNote: 关于缓存的Key集合 22 | */ 23 | public interface CacheKey { 24 | 25 | /** 26 | * 内置 用户、岗位、应用、菜单、角色 相关key 27 | */ 28 | String USER_MODIFY_TIME_KEY = "user:modify:time:key:"; 29 | String APP_MODIFY_TIME_KEY = "app:modify:time:key:"; 30 | String JOB_MODIFY_TIME_KEY = "job:modify:time:key:"; 31 | String MENU_MODIFY_TIME_KEY = "menu:modify:time:key:"; 32 | String ROLE_MODIFY_TIME_KEY = "role:modify:time:key:"; 33 | String DEPT_MODIFY_TIME_KEY = "dept:modify:time:key:"; 34 | 35 | /** 36 | * 用户 37 | */ 38 | String USER_ID = "user::id:"; 39 | String USER_NAME = "user::username:"; 40 | /** 41 | * 数据 42 | */ 43 | String DATA_USER = "data::user:"; 44 | /** 45 | * 菜单 46 | */ 47 | String MENU_USER = "menu::user:"; 48 | /** 49 | * 角色授权 50 | */ 51 | String ROLE_AUTH = "role::auth:"; 52 | /** 53 | * 角色信息 54 | */ 55 | String ROLE_ID = "role::id:"; 56 | } 57 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/config/MultipartConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.config; 17 | 18 | import org.springframework.boot.web.servlet.MultipartConfigFactory; 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | import javax.servlet.MultipartConfigElement; 23 | import java.io.File; 24 | 25 | /** 26 | * @date 2018-12-28 27 | * @author https://blog.csdn.net/llibin1024530411/article/details/79474953 28 | */ 29 | @Configuration 30 | public class MultipartConfig { 31 | 32 | /** 33 | * 文件上传临时路径 34 | */ 35 | @Bean 36 | MultipartConfigElement multipartConfigElement() { 37 | MultipartConfigFactory factory = new MultipartConfigFactory(); 38 | String location = System.getProperty("user.home") + "/.skadmin/file/tmp"; 39 | File tmpFile = new File(location); 40 | if (!tmpFile.exists()) { 41 | if (!tmpFile.mkdirs()) { 42 | System.out.println("create was not successful."); 43 | } 44 | } 45 | factory.setLocation(location); 46 | return factory.createMultipartConfig(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sk-Admin 4 | 5 | 6 | 7 | 8 | 9 | 10 | ${log.pattern} 11 | ${log.charset} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/util/TranslatorUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import cn.hutool.json.JSONArray; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.InputStreamReader; 7 | import java.net.HttpURLConnection; 8 | import java.net.URL; 9 | import java.net.URLEncoder; 10 | 11 | /** 12 | * @author Sinkiang 13 | * 翻译工具类 14 | */ 15 | public class TranslatorUtil { 16 | 17 | public static String translate(String word){ 18 | try { 19 | String url = "https://translate.googleapis.com/translate_a/single?" + 20 | "client=gtx&" + 21 | "sl=en" + 22 | "&tl=zh-CN" + 23 | "&dt=t&q=" + URLEncoder.encode(word, "UTF-8"); 24 | 25 | URL obj = new URL(url); 26 | HttpURLConnection con = (HttpURLConnection) obj.openConnection(); 27 | con.setRequestProperty("User-Agent", "Mozilla/5.0"); 28 | 29 | BufferedReader in = new BufferedReader( 30 | new InputStreamReader(con.getInputStream())); 31 | String inputLine; 32 | StringBuilder response = new StringBuilder(); 33 | 34 | while ((inputLine = in.readLine()) != null) { 35 | response.append(inputLine); 36 | } 37 | in.close(); 38 | return parseResult(response.toString()); 39 | }catch (Exception e){ 40 | return word; 41 | } 42 | } 43 | 44 | private static String parseResult(String inputJson){ 45 | JSONArray jsonArray2 = (JSONArray) new JSONArray(inputJson).get(0); 46 | StringBuilder result = new StringBuilder(); 47 | for (Object o : jsonArray2) { 48 | result.append(((JSONArray) o).get(0).toString()); 49 | } 50 | return result.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/domain/dto/JwtUserDTO.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.domain.dto; 2 | 3 | import com.dxj.module.system.domain.dto.UserDTO; 4 | import com.fasterxml.jackson.annotation.JsonIgnore; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import org.springframework.security.core.GrantedAuthority; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | 11 | import java.util.List; 12 | import java.util.Set; 13 | import java.util.stream.Collectors; 14 | 15 | /** 16 | * @author Sinkiang 17 | * @date 2018-11-23 18 | */ 19 | @Getter 20 | @AllArgsConstructor 21 | @ToString 22 | public class JwtUserDTO implements UserDetails { 23 | 24 | private final UserDTO user; 25 | 26 | private final List dataScopes; 27 | 28 | @JsonIgnore 29 | private final List authorities; 30 | 31 | public Set getRoles() { 32 | return authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.toSet()); 33 | } 34 | 35 | @Override 36 | @JsonIgnore 37 | public String getPassword() { 38 | return user.getPassword(); 39 | } 40 | 41 | @Override 42 | @JsonIgnore 43 | public String getUsername() { 44 | return user.getUsername(); 45 | } 46 | 47 | @JsonIgnore 48 | @Override 49 | public boolean isAccountNonExpired() { 50 | return true; 51 | } 52 | 53 | @JsonIgnore 54 | @Override 55 | public boolean isAccountNonLocked() { 56 | return true; 57 | } 58 | 59 | @JsonIgnore 60 | @Override 61 | public boolean isCredentialsNonExpired() { 62 | return true; 63 | } 64 | 65 | @Override 66 | @JsonIgnore 67 | public boolean isEnabled() { 68 | return user.getEnabled(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/entity/Dict.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.entity; 17 | 18 | import com.dxj.base.BEntity; 19 | import io.swagger.annotations.ApiModelProperty; 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import javax.persistence.*; 24 | import javax.validation.constraints.NotBlank; 25 | import javax.validation.constraints.NotNull; 26 | import java.io.Serializable; 27 | import java.util.List; 28 | 29 | /** 30 | * @author Sinkiang 31 | * @date 2019-04-10 32 | */ 33 | @Entity 34 | @Getter 35 | @Setter 36 | @Table(name="sys_dict") 37 | public class Dict extends BEntity implements Serializable { 38 | 39 | @Id 40 | @Column(name = "dict_id") 41 | @NotNull(groups = Update.class) 42 | @ApiModelProperty(value = "ID", hidden = true) 43 | @GeneratedValue(strategy = GenerationType.IDENTITY) 44 | private Long id; 45 | 46 | @OneToMany(mappedBy = "dict",cascade={CascadeType.PERSIST,CascadeType.REMOVE}) 47 | private List dictDetails; 48 | 49 | @NotBlank 50 | @ApiModelProperty(value = "名称") 51 | private String name; 52 | 53 | @ApiModelProperty(value = "描述") 54 | private String description; 55 | } 56 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/annotation/Query.java: -------------------------------------------------------------------------------- 1 | package com.dxj.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author Sinkiang 10 | * @date 2019-6-4 13:52:30 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Query { 15 | 16 | // Dong ZhaoYang 2017/8/7 基本对象的属性名 17 | String propName() default ""; 18 | // Dong ZhaoYang 2017/8/7 查询方式 19 | Type type() default Type.EQUAL; 20 | 21 | /** 22 | * 连接查询的属性名,如User类中的dept 23 | */ 24 | String joinName() default ""; 25 | 26 | /** 27 | * 默认左连接 28 | */ 29 | Join join() default Join.LEFT; 30 | 31 | /** 32 | * 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如@Query(blurry = "email,username") 33 | */ 34 | String blurry() default ""; 35 | 36 | enum Type { 37 | // jie 2019/6/4 相等 38 | EQUAL 39 | // Dong ZhaoYang 2017/8/7 大于等于 40 | , GREATER_THAN 41 | // Dong ZhaoYang 2017/8/7 小于等于 42 | , LESS_THAN 43 | // Dong ZhaoYang 2017/8/7 中模糊查询 44 | , INNER_LIKE 45 | // Dong ZhaoYang 2017/8/7 左模糊查询 46 | , LEFT_LIKE 47 | // Dong ZhaoYang 2017/8/7 右模糊查询 48 | , RIGHT_LIKE 49 | // Dong ZhaoYang 2017/8/7 小于 50 | , LESS_THAN_NQ 51 | // jie 2019/6/4 包含 52 | , IN 53 | // 不等于 54 | ,NOT_EQUAL 55 | // between 56 | ,BETWEEN 57 | // 不为空 58 | ,NOT_NULL 59 | // 为空 60 | ,IS_NULL 61 | } 62 | 63 | /** 64 | * @author Zheng Jie 65 | * 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询 66 | */ 67 | enum Join { 68 | /** jie 2019-6-4 13:18:30 */ 69 | LEFT, RIGHT, INNER 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/entity/DictDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.entity; 17 | 18 | import com.dxj.base.BEntity; 19 | import io.swagger.annotations.ApiModelProperty; 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import javax.persistence.*; 24 | import javax.validation.constraints.NotNull; 25 | import java.io.Serializable; 26 | 27 | /** 28 | * @author Sinkiang 29 | * @date 2019-04-10 30 | */ 31 | @Entity 32 | @Getter 33 | @Setter 34 | @Table(name="sys_dict_detail") 35 | public class DictDetail extends BEntity implements Serializable { 36 | 37 | @Id 38 | @Column(name = "detail_id") 39 | @NotNull(groups = Update.class) 40 | @ApiModelProperty(value = "ID", hidden = true) 41 | @GeneratedValue(strategy = GenerationType.IDENTITY) 42 | private Long id; 43 | 44 | @JoinColumn(name = "dict_id") 45 | @ManyToOne(fetch=FetchType.LAZY) 46 | @ApiModelProperty(value = "字典", hidden = true) 47 | private Dict dict; 48 | 49 | @ApiModelProperty(value = "字典标签") 50 | private String label; 51 | 52 | @ApiModelProperty(value = "字典值") 53 | private String value; 54 | 55 | @ApiModelProperty(value = "排序") 56 | private Integer dictSort = 999; 57 | } 58 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/domain/entity/LocalStorage.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.core.bean.copier.CopyOptions; 5 | import com.dxj.base.BEntity; 6 | import io.swagger.annotations.ApiModelProperty; 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Setter; 10 | import org.hibernate.annotations.CreationTimestamp; 11 | 12 | import javax.persistence.*; 13 | import java.io.Serializable; 14 | import java.sql.Timestamp; 15 | 16 | /** 17 | * @author Sinkiang 18 | * @date 2019-09-05 19 | */ 20 | @Getter 21 | @Setter 22 | @Entity 23 | @Table(name="tool_local_storage") 24 | @NoArgsConstructor 25 | public class LocalStorage extends BEntity implements Serializable { 26 | 27 | @Id 28 | @Column(name = "storage_id") 29 | @ApiModelProperty(value = "ID", hidden = true) 30 | @GeneratedValue(strategy = GenerationType.IDENTITY) 31 | private Long id; 32 | 33 | @ApiModelProperty(value = "真实文件名") 34 | private String realName; 35 | 36 | @ApiModelProperty(value = "文件名") 37 | private String name; 38 | 39 | @ApiModelProperty(value = "后缀") 40 | private String suffix; 41 | 42 | @ApiModelProperty(value = "路径") 43 | private String path; 44 | 45 | @ApiModelProperty(value = "类型") 46 | private String type; 47 | 48 | @ApiModelProperty(value = "大小") 49 | private String size; 50 | 51 | public LocalStorage(String realName,String name, String suffix, String path, String type, String size) { 52 | this.realName = realName; 53 | this.name = name; 54 | this.suffix = suffix; 55 | this.path = path; 56 | this.type = type; 57 | this.size = size; 58 | } 59 | 60 | public void copy(LocalStorage source){ 61 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/SkApplication.java: -------------------------------------------------------------------------------- 1 | package com.dxj; 2 | 3 | import com.dxj.annotation.AnonymousAccess; 4 | import com.dxj.util.SpringContextHolder; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; 8 | import org.springframework.boot.web.servlet.server.ServletWebServerFactory; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.data.jpa.repository.config.EnableJpaAuditing; 11 | import org.springframework.scheduling.annotation.EnableAsync; 12 | import org.springframework.transaction.annotation.EnableTransactionManagement; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | /** 17 | * @Author: dxj 18 | * @Date: 2019-12-24 15:42 19 | */ 20 | @EnableAsync 21 | @RestController 22 | @EnableJpaAuditing(auditorAwareRef = "auditorAware") 23 | @SpringBootApplication 24 | @EnableTransactionManagement 25 | public class SkApplication { 26 | 27 | public static void main(String[] args) { 28 | SpringApplication.run(SkApplication.class, args); 29 | } 30 | 31 | @Bean 32 | public SpringContextHolder springContextHolder() { 33 | return new SpringContextHolder(); 34 | } 35 | 36 | @Bean 37 | public ServletWebServerFactory webServerFactory() { 38 | TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory(); 39 | fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}")); 40 | return fa; 41 | } 42 | 43 | /** 44 | * 访问首页提示 45 | * @return / 46 | */ 47 | @GetMapping("/") 48 | @AnonymousAccess 49 | public String index() { 50 | return "Backend service started successfully"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/RoleDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.Role; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * @author Sinkiang 13 | * @date 2018-12-03 14 | */ 15 | @SuppressWarnings("all") 16 | public interface RoleDao extends BaseDao { 17 | 18 | /** 19 | * 根据名称查询 20 | * @param name / 21 | * @return / 22 | */ 23 | Role findByName(String name); 24 | 25 | /** 26 | * 删除多个角色 27 | * @param ids / 28 | */ 29 | void deleteAllByIdIn(Set ids); 30 | 31 | /** 32 | * 根据用户ID查询 33 | * @param id 用户ID 34 | * @return / 35 | */ 36 | @Query(value = "SELECT r.* FROM sys_role r, sys_users_roles u WHERE " + 37 | "r.role_id = u.role_id AND u.user_id = ?1",nativeQuery = true) 38 | Set findByUserId(Long id); 39 | 40 | /** 41 | * 解绑角色菜单 42 | * @param id 菜单ID 43 | */ 44 | @Modifying 45 | @Query(value = "delete from sys_roles_menus where menu_id = ?1",nativeQuery = true) 46 | void untiedMenu(Long id); 47 | 48 | /** 49 | * 根据部门查询 50 | * @param deptIds / 51 | * @return / 52 | */ 53 | @Query(value = "select count(1) from sys_role r, sys_roles_depts d where " + 54 | "r.role_id = d.role_id and d.dept_id in ?1",nativeQuery = true) 55 | int countByDepts(Set deptIds); 56 | 57 | /** 58 | * 根据菜单Id查询 59 | * @param menuIds / 60 | * @return / 61 | */ 62 | @Query(value = "SELECT r.* FROM sys_role r, sys_roles_menus m WHERE " + 63 | "r.role_id = m.role_id AND m.menu_id in ?1",nativeQuery = true) 64 | List findInMenuId(List menuIds); 65 | } 66 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/config/QuartzConfig.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.config; 2 | 3 | import org.quartz.Scheduler; 4 | import org.quartz.spi.TriggerFiredBundle; 5 | import org.springframework.beans.factory.config.AutowireCapableBeanFactory; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.scheduling.quartz.AdaptableJobFactory; 9 | import org.springframework.scheduling.quartz.SchedulerFactoryBean; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * 定时任务配置 14 | * @author Sinkiang 15 | * @date 2019-01-07 16 | */ 17 | @Configuration 18 | public class QuartzConfig { 19 | 20 | /** 21 | * 解决Job中注入Spring Bean为null的问题 22 | */ 23 | @Component("quartzJobFactory") 24 | public static class QuartzJobFactory extends AdaptableJobFactory { 25 | 26 | private final AutowireCapableBeanFactory capableBeanFactory; 27 | 28 | public QuartzJobFactory(AutowireCapableBeanFactory capableBeanFactory) { 29 | this.capableBeanFactory = capableBeanFactory; 30 | } 31 | 32 | @Override 33 | protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { 34 | 35 | //调用父类的方法 36 | Object jobInstance = super.createJobInstance(bundle); 37 | capableBeanFactory.autowireBean(jobInstance); 38 | return jobInstance; 39 | } 40 | } 41 | 42 | /** 43 | * 注入scheduler到spring 44 | * @param quartzJobFactory / 45 | * @return Scheduler 46 | * @throws Exception / 47 | */ 48 | @Bean(name = "scheduler") 49 | public Scheduler scheduler(QuartzJobFactory quartzJobFactory) throws Exception { 50 | SchedulerFactoryBean factoryBean=new SchedulerFactoryBean(); 51 | factoryBean.setJobFactory(quartzJobFactory); 52 | factoryBean.afterPropertiesSet(); 53 | Scheduler scheduler=factoryBean.getScheduler(); 54 | scheduler.start(); 55 | return scheduler; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/dao/MenuDao.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.dao; 2 | 3 | import com.dxj.base.BaseDao; 4 | import com.dxj.module.system.domain.entity.Menu; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import java.util.LinkedHashSet; 9 | import java.util.List; 10 | import java.util.Set; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2018-12-17 15 | */ 16 | @SuppressWarnings("all") 17 | public interface MenuDao extends BaseDao { 18 | 19 | /** 20 | * 根据菜单标题查询 21 | * @param title 菜单标题 22 | * @return / 23 | */ 24 | Menu findByTitle(String title); 25 | 26 | /** 27 | * 根据组件名称查询 28 | * @param name 组件名称 29 | * @return / 30 | */ 31 | Menu findByComponentName(String name); 32 | 33 | /** 34 | * 根据菜单的 PID 查询 35 | * @param pid / 36 | * @return / 37 | */ 38 | List findByPid(long pid); 39 | 40 | /** 41 | * 查询顶级菜单 42 | * @return / 43 | */ 44 | List findByPidIsNull(); 45 | 46 | /** 47 | * 根据角色ID与菜单类型查询菜单 48 | * @param roleIds roleIDs 49 | * @param type 类型 50 | * @return / 51 | */ 52 | @Query(value = "SELECT m.* FROM sys_menu m, sys_roles_menus r WHERE " + 53 | "m.menu_id = r.menu_id AND r.role_id IN ?1 AND type != ?2 order by m.menu_sort asc",nativeQuery = true) 54 | LinkedHashSet findByRoleIdsAndTypeNot(Set roleIds, int type); 55 | 56 | /** 57 | * 获取节点数量 58 | * @param id / 59 | * @return / 60 | */ 61 | int countByPid(Long id); 62 | 63 | /** 64 | * 更新节点数目 65 | * @param count / 66 | * @param menuId / 67 | */ 68 | @Modifying 69 | @Query(value = " update sys_menu set sub_count = ?1 where menu_id = ?2 ",nativeQuery = true) 70 | void updateSubCntById(int count, Long menuId); 71 | } 72 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/constant/RequestMethodEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.constant; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | * @author Zheng Jie 23 | * @website https://el-admin.vip 24 | * @description 25 | * @date 2020-06-10 26 | **/ 27 | @Getter 28 | @AllArgsConstructor 29 | public enum RequestMethodEnum { 30 | 31 | /** 32 | * 搜寻 @AnonymousGetMapping 33 | */ 34 | GET("GET"), 35 | 36 | /** 37 | * 搜寻 @AnonymousPostMapping 38 | */ 39 | POST("POST"), 40 | 41 | /** 42 | * 搜寻 @AnonymousPutMapping 43 | */ 44 | PUT("PUT"), 45 | 46 | /** 47 | * 搜寻 @AnonymousPatchMapping 48 | */ 49 | PATCH("PATCH"), 50 | 51 | /** 52 | * 搜寻 @AnonymousDeleteMapping 53 | */ 54 | DELETE("DELETE"), 55 | 56 | /** 57 | * 否则就是所有 Request 接口都放行 58 | */ 59 | ALL("All"); 60 | 61 | /** 62 | * Request 类型 63 | */ 64 | private final String type; 65 | 66 | public static RequestMethodEnum find(String type) { 67 | for (RequestMethodEnum value : RequestMethodEnum.values()) { 68 | if (type.equals(value.getType())) { 69 | return value; 70 | } 71 | } 72 | return ALL; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /sk-log/src/main/java/com/dxj/service/LogService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.Log; 4 | import com.dxj.domain.dto.LogQuery; 5 | import org.aspectj.lang.ProceedingJoinPoint; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.scheduling.annotation.Async; 8 | 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2018-11-24 16 | */ 17 | public interface LogService { 18 | 19 | /** 20 | * 分页查询 21 | * @param criteria 查询条件 22 | * @param pageable 分页参数 23 | * @return / 24 | */ 25 | Object queryAll(LogQuery criteria, Pageable pageable); 26 | 27 | /** 28 | * 查询全部数据 29 | * @param criteria 查询条件 30 | * @return / 31 | */ 32 | List queryAll(LogQuery criteria); 33 | 34 | /** 35 | * 查询用户日志 36 | * @param criteria 查询条件 37 | * @param pageable 分页参数 38 | * @return - 39 | */ 40 | Object queryAllByUser(LogQuery criteria, Pageable pageable); 41 | 42 | /** 43 | * 保存日志数据 44 | * @param username 用户 45 | * @param browser 浏览器 46 | * @param ip 请求IP 47 | * @param joinPoint / 48 | * @param log 日志实体 49 | */ 50 | @Async 51 | void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log log); 52 | 53 | /** 54 | * 查询异常详情 55 | * @param id 日志ID 56 | * @return Object 57 | */ 58 | Object findByErrDetail(Long id); 59 | 60 | /** 61 | * 导出日志 62 | * @param logs 待导出的数据 63 | * @param response / 64 | * @throws IOException / 65 | */ 66 | void download(List logs, HttpServletResponse response) throws IOException; 67 | 68 | /** 69 | * 删除所有错误日志 70 | */ 71 | void delAllByError(); 72 | 73 | /** 74 | * 删除所有INFO日志 75 | */ 76 | void delAllByInfo(); 77 | } 78 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/quartz/domain/entity/QuartzJob.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.quartz.domain.entity; 2 | 3 | import com.dxj.base.BEntity; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | import javax.persistence.*; 9 | import javax.validation.constraints.NotBlank; 10 | import javax.validation.constraints.NotNull; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2019-01-07 16 | */ 17 | @Getter 18 | @Setter 19 | @Entity 20 | @Table(name = "sys_quartz_job") 21 | public class QuartzJob extends BEntity implements Serializable { 22 | 23 | public static final String JOB_KEY = "JOB_KEY"; 24 | 25 | @Id 26 | @Column(name = "job_id") 27 | @NotNull(groups = {Update.class}) 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) 29 | private Long id; 30 | 31 | @Transient 32 | @ApiModelProperty(value = "用于子任务唯一标识", hidden = true) 33 | private String uuid; 34 | 35 | @ApiModelProperty(value = "定时器名称") 36 | private String jobName; 37 | 38 | @NotBlank 39 | @ApiModelProperty(value = "Bean名称") 40 | private String beanName; 41 | 42 | @NotBlank 43 | @ApiModelProperty(value = "方法名称") 44 | private String methodName; 45 | 46 | @ApiModelProperty(value = "参数") 47 | private String params; 48 | 49 | @NotBlank 50 | @ApiModelProperty(value = "cron表达式") 51 | private String cronExpression; 52 | 53 | @ApiModelProperty(value = "状态,暂时或启动") 54 | private Boolean isPause = false; 55 | 56 | @ApiModelProperty(value = "负责人") 57 | private String personInCharge; 58 | 59 | @ApiModelProperty(value = "报警邮箱") 60 | private String email; 61 | 62 | @ApiModelProperty(value = "子任务") 63 | private String subTask; 64 | 65 | @ApiModelProperty(value = "失败后暂停") 66 | private Boolean pauseAfterFailure; 67 | 68 | @NotBlank 69 | @ApiModelProperty(value = "备注") 70 | private String description; 71 | 72 | public @interface Update {} 73 | } 74 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/security/controller/OnlineController.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.security.controller; 2 | 3 | import com.dxj.annotation.Log; 4 | import com.dxj.module.security.service.OnlineUserService; 5 | import com.dxj.util.EncryptUtils; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import lombok.RequiredArgsConstructor; 9 | import org.springframework.data.domain.Pageable; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.security.access.prepost.PreAuthorize; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | import java.util.Set; 18 | 19 | /** 20 | * @author Sinkiang 21 | */ 22 | @RestController 23 | @RequiredArgsConstructor 24 | @RequestMapping("/auth/online") 25 | @Api(tags = "系统:在线用户管理") 26 | public class OnlineController { 27 | 28 | private final OnlineUserService onlineUserService; 29 | 30 | @ApiOperation("查询在线用户") 31 | @GetMapping 32 | @PreAuthorize("@sk.check()") 33 | public ResponseEntity query(String filter, Pageable pageable){ 34 | return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK); 35 | } 36 | 37 | @Log("导出数据") 38 | @ApiOperation("导出数据") 39 | @GetMapping(value = "/download") 40 | @PreAuthorize("@sk.check()") 41 | public void download(HttpServletResponse response, String filter) throws IOException { 42 | onlineUserService.download(onlineUserService.getAll(filter), response); 43 | } 44 | 45 | @ApiOperation("踢出用户") 46 | @DeleteMapping 47 | @PreAuthorize("@sk.check()") 48 | public ResponseEntity delete(@RequestBody Set keys) throws Exception { 49 | for (String key : keys) { 50 | // 解密Key 51 | key = EncryptUtils.desDecrypt(key); 52 | onlineUserService.kickOut(key); 53 | } 54 | return new ResponseEntity<>(HttpStatus.OK); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/service/impl/GenConfigServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service.impl; 2 | 3 | import com.dxj.dao.GenConfigDao; 4 | import com.dxj.domain.entity.GenConfig; 5 | import com.dxj.service.GenConfigService; 6 | import com.dxj.util.StringUtils; 7 | import lombok.RequiredArgsConstructor; 8 | import org.springframework.cache.annotation.CacheConfig; 9 | import org.springframework.cache.annotation.CachePut; 10 | import org.springframework.cache.annotation.Cacheable; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.io.File; 14 | 15 | /** 16 | * @author Sinkiang 17 | * @date 2019-01-14 18 | */ 19 | @Service 20 | @RequiredArgsConstructor 21 | public class GenConfigServiceImpl implements GenConfigService { 22 | 23 | private final GenConfigDao genConfigDao; 24 | 25 | @Override 26 | public GenConfig find(String tableName) { 27 | GenConfig genConfig = genConfigDao.findByTableName(tableName); 28 | if(genConfig == null){ 29 | return new GenConfig(tableName); 30 | } 31 | return genConfig; 32 | } 33 | 34 | @Override 35 | public GenConfig update(String tableName, GenConfig genConfig) { 36 | // 如果 api 路径为空,则自动生成路径 37 | if(StringUtils.isBlank(genConfig.getApiPath())){ 38 | String separator = File.separator; 39 | String[] paths; 40 | String symbol = "\\"; 41 | if (symbol.equals(separator)) { 42 | paths = genConfig.getPath().split("\\\\"); 43 | } else { 44 | paths = genConfig.getPath().split(File.separator); 45 | } 46 | StringBuilder api = new StringBuilder(); 47 | for (String path : paths) { 48 | api.append(path); 49 | api.append(separator); 50 | if ("src".equals(path)) { 51 | api.append("api"); 52 | break; 53 | } 54 | } 55 | genConfig.setApiPath(api.toString()); 56 | } 57 | return genConfigDao.save(genConfig); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/util/ResultUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | 4 | import com.dxj.base.vo.Result; 5 | 6 | /** 7 | * @author Sinkiang 8 | */ 9 | public class ResultUtil { 10 | 11 | private Result result; 12 | 13 | public ResultUtil() { 14 | result = new Result<>(); 15 | result.setSuccess(true); 16 | result.setMessage("success"); 17 | result.setCode(200); 18 | } 19 | 20 | public Result setData(T t) { 21 | this.result.setResult(t); 22 | this.result.setCode(200); 23 | return this.result; 24 | } 25 | 26 | public Result setSuccessMsg(String msg) { 27 | result.setSuccess(true); 28 | result.setMessage(msg); 29 | result.setCode(200); 30 | return this.result; 31 | } 32 | 33 | public Result setData(T t, String msg) { 34 | result.setResult(t); 35 | result.setCode(200); 36 | result.setMessage(msg); 37 | return result; 38 | } 39 | 40 | public Result setErrorMsg(String msg) { 41 | result.setSuccess(false); 42 | result.setMessage(msg); 43 | result.setCode(500); 44 | return result; 45 | } 46 | 47 | public Result setErrorMsg(Integer code, String msg) { 48 | result.setSuccess(false); 49 | result.setMessage(msg); 50 | result.setCode(code); 51 | return result; 52 | } 53 | 54 | public static Result data(T t) { 55 | return new ResultUtil().setData(t); 56 | } 57 | 58 | public static Result data(T t, String msg) { 59 | return new ResultUtil().setData(t, msg); 60 | } 61 | 62 | public static Result success(String msg) { 63 | return new ResultUtil().setSuccessMsg(msg); 64 | } 65 | 66 | public static Result error(String msg) { 67 | return new ResultUtil().setErrorMsg(msg); 68 | } 69 | 70 | public static Result error(Integer code, String msg) { 71 | return new ResultUtil().setErrorMsg(code, msg); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/thread/AsyncTaskExecutePool.java: -------------------------------------------------------------------------------- 1 | package com.dxj.thread; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.AsyncConfigurer; 7 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 8 | 9 | import java.util.concurrent.Executor; 10 | import java.util.concurrent.ThreadPoolExecutor; 11 | 12 | /** 13 | * 异步任务线程池装配类 14 | * 15 | * @author https://juejin.im/entry/5abb8f6951882555677e9da2 16 | * @date 2019年10月31日15:06:18 17 | */ 18 | @Slf4j 19 | @Configuration 20 | public class AsyncTaskExecutePool implements AsyncConfigurer { 21 | 22 | /** 23 | * 注入配置类 24 | */ 25 | private final AsyncTaskProperties config; 26 | 27 | public AsyncTaskExecutePool(AsyncTaskProperties config) { 28 | this.config = config; 29 | } 30 | 31 | @Override 32 | public Executor getAsyncExecutor() { 33 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 34 | //核心线程池大小 35 | executor.setCorePoolSize(config.getCorePoolSize()); 36 | //最大线程数 37 | executor.setMaxPoolSize(config.getMaxPoolSize()); 38 | //队列容量 39 | executor.setQueueCapacity(config.getQueueCapacity()); 40 | //活跃时间 41 | executor.setKeepAliveSeconds(config.getKeepAliveSeconds()); 42 | //线程名字前缀 43 | executor.setThreadNamePrefix("sk-async-"); 44 | // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务 45 | // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行 46 | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); 47 | executor.initialize(); 48 | return executor; 49 | } 50 | 51 | @Override 52 | public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { 53 | return (throwable, method, objects) -> { 54 | log.error("====" + throwable.getMessage() + "====", throwable); 55 | log.error("exception method:" + method.getName()); 56 | }; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/email/email.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 15 |
21 |
22 |

尊敬的用户,您好:

23 |

您正在申请邮箱验证,您的验证码为:

24 |

${code}

32 | 41 |
46 |
47 |
51 | Copyright ©${.now?string("yyyy")} SK-ADMIN 后台管理系统 All Rights Reserved. 52 |
53 | 54 |
55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/config/ConfigurerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dxj.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.EnableWebMvc; 9 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 11 | 12 | /** 13 | * WebMvcConfigurer 14 | * 15 | * @author Sinkiang 16 | * @date 2018-11-30 17 | */ 18 | @Configuration 19 | @EnableWebMvc 20 | public class ConfigurerAdapter implements WebMvcConfigurer { 21 | 22 | /** 文件配置 */ 23 | private final FileProperties properties; 24 | 25 | public ConfigurerAdapter(FileProperties properties) { 26 | this.properties = properties; 27 | } 28 | 29 | @Bean 30 | public CorsFilter corsFilter() { 31 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 32 | CorsConfiguration config = new CorsConfiguration(); 33 | config.setAllowCredentials(true); 34 | config.addAllowedOrigin("*"); 35 | config.addAllowedHeader("*"); 36 | config.addAllowedMethod("*"); 37 | source.registerCorsConfiguration("/**", config); 38 | return new CorsFilter(source); 39 | } 40 | 41 | @Override 42 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 43 | FileProperties.SkPath path = properties.getPath(); 44 | String avatarUtl = "file:" + path.getAvatar().replace("\\","/"); 45 | String pathUtl = "file:" + path.getPath().replace("\\","/"); 46 | registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0); 47 | registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0); 48 | registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/util/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import com.dxj.constant.SettingConstant; 4 | 5 | import java.util.Random; 6 | import java.util.UUID; 7 | 8 | /** 9 | * @author Sinkiang 10 | */ 11 | public class CommonUtil { 12 | 13 | /** 14 | * 以UUID重命名 15 | * 16 | * @param fileName 17 | * @return 18 | */ 19 | public static String renamePic(String fileName) { 20 | String extName = fileName.substring(fileName.lastIndexOf(".")); 21 | return UUID.randomUUID().toString().replace("-", "") + extName; 22 | } 23 | 24 | /** 25 | * 获得短信模版Key 26 | * 27 | * @param type 28 | * @return 29 | */ 30 | public static String getSmsTemplate(int type) { 31 | switch (type) { 32 | case 0: 33 | return SettingConstant.ALI_SMS_COMMON; 34 | case 1: 35 | return SettingConstant.ALI_SMS_REGISTER; 36 | case 2: 37 | return SettingConstant.ALI_SMS_LOGIN; 38 | case 3: 39 | return SettingConstant.ALI_SMS_CHANGE_MOBILE; 40 | case 4: 41 | return SettingConstant.ALI_SMS_CHANGE_PASS; 42 | case 5: 43 | return SettingConstant.ALI_SMS_RESET_PASS; 44 | case 6: 45 | return SettingConstant.ALI_SMS_ACTIVITI; 46 | default: 47 | return SettingConstant.ALI_SMS_COMMON; 48 | } 49 | } 50 | 51 | /** 52 | * 随机6位数生成 53 | */ 54 | public static String getRandomNum() { 55 | 56 | Random random = new Random(); 57 | int num = random.nextInt(999999); 58 | //不足六位前面补0 59 | return String.format("%06d", num); 60 | } 61 | 62 | /** 63 | * 批量递归删除时 判断target是否在ids中 避免重复删除 64 | * 65 | * @param target 66 | * @param ids 67 | * @return 68 | */ 69 | public static boolean judgeIds(String target, String[] ids) { 70 | 71 | boolean flag = false; 72 | for (String id : ids) { 73 | if (id.equals(target)) { 74 | flag = true; 75 | break; 76 | } 77 | } 78 | return flag; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base; 2 | 3 | import com.dxj.constant.CommonConstant; 4 | import com.dxj.util.SnowFlakeUtil; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import io.swagger.annotations.ApiModelProperty; 8 | import lombok.Data; 9 | import org.springframework.data.annotation.CreatedBy; 10 | import org.springframework.data.annotation.CreatedDate; 11 | import org.springframework.data.annotation.LastModifiedBy; 12 | import org.springframework.data.annotation.LastModifiedDate; 13 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; 14 | import org.springframework.format.annotation.DateTimeFormat; 15 | 16 | import javax.persistence.EntityListeners; 17 | import javax.persistence.Id; 18 | import javax.persistence.MappedSuperclass; 19 | import java.io.Serializable; 20 | import java.time.LocalDateTime; 21 | import java.util.Date; 22 | 23 | /** 24 | * @author Sinkiang 25 | */ 26 | @Data 27 | @MappedSuperclass 28 | @EntityListeners(AuditingEntityListener.class) 29 | @JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"}) 30 | public abstract class BaseEntity implements Serializable { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | @Id 35 | @ApiModelProperty(value = "唯一标识") 36 | private String id = String.valueOf(SnowFlakeUtil.getFlowIdInstance().nextId()); 37 | 38 | @ApiModelProperty(value = "创建者") 39 | @CreatedBy 40 | private String createdBy; 41 | 42 | @CreatedDate 43 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 44 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 45 | @ApiModelProperty(value = "创建时间") 46 | private LocalDateTime createTime; 47 | 48 | @ApiModelProperty(value = "更新者") 49 | @LastModifiedBy 50 | private String updatedBy; 51 | 52 | @LastModifiedDate 53 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 54 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 55 | @ApiModelProperty(value = "更新时间") 56 | private LocalDateTime updateTime; 57 | 58 | @ApiModelProperty(value = "删除标志 默认0") 59 | private Integer delFlag = CommonConstant.STATUS_NORMAL; 60 | } 61 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/entity/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.entity; 17 | 18 | import com.dxj.base.BEntity; 19 | import io.swagger.annotations.ApiModelProperty; 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import javax.persistence.*; 24 | import javax.validation.constraints.NotBlank; 25 | import javax.validation.constraints.NotNull; 26 | import java.io.Serializable; 27 | import java.util.Objects; 28 | 29 | /** 30 | * @author Zheng Jie 31 | * @date 2019-03-29 32 | */ 33 | @Entity 34 | @Getter 35 | @Setter 36 | @Table(name="sys_job") 37 | public class Job extends BEntity implements Serializable { 38 | 39 | @Id 40 | @Column(name = "job_id") 41 | @NotNull(groups = Update.class) 42 | @ApiModelProperty(value = "ID", hidden = true) 43 | @GeneratedValue(strategy = GenerationType.IDENTITY) 44 | private Long id; 45 | 46 | @NotBlank 47 | @ApiModelProperty(value = "岗位名称") 48 | private String name; 49 | 50 | @NotNull 51 | @ApiModelProperty(value = "岗位排序") 52 | private Long jobSort; 53 | 54 | @NotNull 55 | @ApiModelProperty(value = "是否启用") 56 | private Boolean enabled; 57 | 58 | @Override 59 | public boolean equals(Object o) { 60 | if (this == o) { 61 | return true; 62 | } 63 | if (o == null || getClass() != o.getClass()) { 64 | return false; 65 | } 66 | Job job = (Job) o; 67 | return Objects.equals(id, job.id); 68 | } 69 | 70 | @Override 71 | public int hashCode() { 72 | return Objects.hash(id); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/service/GeneratorService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.ColumnInfo; 4 | import com.dxj.domain.entity.GenConfig; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.scheduling.annotation.Async; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.util.List; 11 | 12 | /** 13 | * @author Sinkiang 14 | * @date 2019-01-02 15 | */ 16 | public interface GeneratorService { 17 | 18 | /** 19 | * 查询数据库元数据 20 | * 21 | * @param name 表名 22 | * @param startEnd 分页参数 23 | * @return / 24 | */ 25 | Object getTables(String name, int[] startEnd); 26 | 27 | /** 28 | * 得到数据表的元数据 29 | * 30 | * @param name 表名 31 | * @return / 32 | */ 33 | List getColumns(String name); 34 | 35 | /** 36 | * 同步表数据 37 | * 38 | * @param columnInfos / 39 | * @param columnInfoList / 40 | */ 41 | @Async 42 | void sync(List columnInfos, List columnInfoList); 43 | 44 | /** 45 | * 保持数据 46 | * 47 | * @param columnInfos / 48 | */ 49 | void save(List columnInfos); 50 | 51 | /** 52 | * 获取所有table 53 | * 54 | * @return / 55 | */ 56 | Object getTables(); 57 | 58 | /** 59 | * 代码生成 60 | * 61 | * @param genConfig 配置信息 62 | * @param columns 字段信息 63 | */ 64 | void generator(GenConfig genConfig, List columns); 65 | 66 | /** 67 | * 预览 68 | * 69 | * @param genConfig 配置信息 70 | * @param columns 字段信息 71 | * @return / 72 | */ 73 | ResponseEntity preview(GenConfig genConfig, List columns); 74 | 75 | /** 76 | * 打包下载 77 | * 78 | * @param genConfig 配置信息 79 | * @param columns 字段信息 80 | * @param request / 81 | * @param response / 82 | */ 83 | void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response); 84 | 85 | /** 86 | * 查询数据库的表字段数据数据 87 | * 88 | * @param table / 89 | * @return / 90 | */ 91 | List query(String table); 92 | } 93 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/util/SpringContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.dxj.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.beans.factory.DisposableBean; 6 | import org.springframework.context.ApplicationContext; 7 | import org.springframework.context.ApplicationContextAware; 8 | 9 | /** 10 | * @author Sinkiang 11 | * @date 2019-01-07 12 | */ 13 | @Slf4j 14 | public class SpringContextHolder implements ApplicationContextAware, DisposableBean { 15 | 16 | private static ApplicationContext applicationContext = null; 17 | 18 | /** 19 | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. 20 | */ 21 | @SuppressWarnings("unchecked") 22 | public static T getBean(String name) { 23 | assertContextInjected(); 24 | return (T) applicationContext.getBean(name); 25 | } 26 | 27 | /** 28 | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. 29 | */ 30 | public static T getBean(Class requiredType) { 31 | assertContextInjected(); 32 | return applicationContext.getBean(requiredType); 33 | } 34 | 35 | /** 36 | * 检查ApplicationContext不为空. 37 | */ 38 | private static void assertContextInjected() { 39 | if (applicationContext == null) { 40 | throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" + 41 | ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); 42 | } 43 | } 44 | 45 | /** 46 | * 清除SpringContextHolder中的ApplicationContext为Null. 47 | */ 48 | private static void clearHolder() { 49 | log.debug("清除SpringContextHolder中的ApplicationContext:" 50 | + applicationContext); 51 | applicationContext = null; 52 | } 53 | 54 | @Override 55 | public void destroy(){ 56 | SpringContextHolder.clearHolder(); 57 | } 58 | 59 | @Override 60 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 61 | if (SpringContextHolder.applicationContext != null) { 62 | log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); 63 | } 64 | SpringContextHolder.applicationContext = applicationContext; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/base/BEntity.java: -------------------------------------------------------------------------------- 1 | package com.dxj.base; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import org.apache.commons.lang3.builder.ToStringBuilder; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | import org.springframework.data.annotation.CreatedBy; 10 | import org.springframework.data.annotation.LastModifiedBy; 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; 12 | 13 | import javax.persistence.Column; 14 | import javax.persistence.EntityListeners; 15 | import javax.persistence.MappedSuperclass; 16 | import java.io.Serializable; 17 | import java.lang.reflect.Field; 18 | import java.sql.Timestamp; 19 | 20 | /** 21 | * @AUTHOR: sinkiang 22 | * @DATE: 2020-07-03 21:02 23 | */ 24 | @Getter 25 | @Setter 26 | @MappedSuperclass 27 | @EntityListeners(AuditingEntityListener.class) 28 | public class BEntity implements Serializable { 29 | 30 | @CreatedBy 31 | @Column(name = "create_by", updatable = false) 32 | @ApiModelProperty(value = "创建人", hidden = true) 33 | private String createBy; 34 | 35 | @LastModifiedBy 36 | @Column(name = "update_by") 37 | @ApiModelProperty(value = "更新人", hidden = true) 38 | private String updatedBy; 39 | 40 | @CreationTimestamp 41 | @Column(name = "create_time", updatable = false) 42 | @ApiModelProperty(value = "创建时间", hidden = true) 43 | private Timestamp createTime; 44 | 45 | @UpdateTimestamp 46 | @Column(name = "update_time") 47 | @ApiModelProperty(value = "更新时间", hidden = true) 48 | private Timestamp updateTime; 49 | 50 | /* 分组校验 */ 51 | public @interface Create {} 52 | 53 | /* 分组校验 */ 54 | public @interface Update {} 55 | 56 | @Override 57 | public String toString() { 58 | ToStringBuilder builder = new ToStringBuilder(this); 59 | Field[] fields = this.getClass().getDeclaredFields(); 60 | try { 61 | for (Field f : fields) { 62 | f.setAccessible(true); 63 | builder.append(f.getName(), f.get(this)).append("\n"); 64 | } 65 | } catch (Exception e) { 66 | builder.append("toString builder encounter an error"); 67 | } 68 | return builder.toString(); 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /sk-system/src/main/resources/template/generator/admin/Service.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package ${package}.service; 17 | 18 | import ${package}.domain.${className}; 19 | import ${package}.service.dto.${className}Dto; 20 | import ${package}.service.dto.${className}QueryCriteria; 21 | import org.springframework.data.domain.Pageable; 22 | import java.util.Map; 23 | import java.util.List; 24 | import java.io.IOException; 25 | import javax.servlet.http.HttpServletResponse; 26 | 27 | /** 28 | * @website https://el-admin.vip 29 | * @description 服务接口 30 | * @author ${author} 31 | * @date ${date} 32 | **/ 33 | public interface ${className}Service { 34 | 35 | /** 36 | * 查询数据分页 37 | * @param criteria 条件 38 | * @param pageable 分页参数 39 | * @return Map 40 | */ 41 | Map queryAll(${className}QueryCriteria criteria, Pageable pageable); 42 | 43 | /** 44 | * 查询所有数据不分页 45 | * @param criteria 条件参数 46 | * @return List<${className}Dto> 47 | */ 48 | List<${className}Dto> queryAll(${className}QueryCriteria criteria); 49 | 50 | /** 51 | * 根据ID查询 52 | * @param ${pkChangeColName} ID 53 | * @return ${className}Dto 54 | */ 55 | ${className}Dto findById(${pkColumnType} ${pkChangeColName}); 56 | 57 | /** 58 | * 创建 59 | * @param resources / 60 | * @return ${className}Dto 61 | */ 62 | ${className}Dto create(${className} resources); 63 | 64 | /** 65 | * 编辑 66 | * @param resources / 67 | */ 68 | void update(${className} resources); 69 | 70 | /** 71 | * 多选删除 72 | * @param ids / 73 | */ 74 | void deleteAll(${pkColumnType}[] ids); 75 | 76 | /** 77 | * 导出数据 78 | * @param all 待导出的数据 79 | * @param response / 80 | * @throws IOException / 81 | */ 82 | void download(List<${className}Dto> all, HttpServletResponse response) throws IOException; 83 | } -------------------------------------------------------------------------------- /sk-generator/src/main/java/com/dxj/domain/entity/ColumnInfo.java: -------------------------------------------------------------------------------- 1 | package com.dxj.domain.entity; 2 | 3 | import com.dxj.util.GenUtil; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.Setter; 9 | 10 | import javax.persistence.*; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * 列的数据信息 15 | * @author Sinkiang 16 | * @date 2019-01-02 17 | */ 18 | @Getter 19 | @Setter 20 | @Entity 21 | @NoArgsConstructor 22 | @Table(name = "code_column_config") 23 | public class ColumnInfo implements Serializable { 24 | 25 | @Id 26 | @Column(name = "column_id") 27 | @ApiModelProperty(value = "ID", hidden = true) 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) 29 | private Long id; 30 | 31 | @ApiModelProperty(value = "表名") 32 | private String tableName; 33 | 34 | @ApiModelProperty(value = "数据库字段名称") 35 | private String columnName; 36 | 37 | @ApiModelProperty(value = "数据库字段类型") 38 | private String columnType; 39 | 40 | @ApiModelProperty(value = "数据库字段键类型") 41 | private String keyType; 42 | 43 | @ApiModelProperty(value = "字段额外的参数") 44 | private String extra; 45 | 46 | @ApiModelProperty(value = "数据库字段描述") 47 | private String remark; 48 | 49 | @ApiModelProperty(value = "是否必填") 50 | private Boolean notNull; 51 | 52 | @ApiModelProperty(value = "是否在列表显示") 53 | private Boolean listShow; 54 | 55 | @ApiModelProperty(value = "是否表单显示") 56 | private Boolean formShow; 57 | 58 | @ApiModelProperty(value = "表单类型") 59 | private String formType; 60 | 61 | @ApiModelProperty(value = "查询 1:模糊 2:精确") 62 | private String queryType; 63 | 64 | @ApiModelProperty(value = "字典名称") 65 | private String dictName; 66 | 67 | @ApiModelProperty(value = "日期注解") 68 | private String dateAnnotation; 69 | 70 | public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) { 71 | this.tableName = tableName; 72 | this.columnName = columnName; 73 | this.columnType = columnType; 74 | this.keyType = keyType; 75 | this.extra = extra; 76 | this.notNull = notNull; 77 | if(GenUtil.PK.equalsIgnoreCase(keyType) && GenUtil.EXTRA.equalsIgnoreCase(extra)){ 78 | this.notNull = false; 79 | } 80 | this.remark = remark; 81 | this.listShow = true; 82 | this.formShow = true; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.module.system.service; 2 | 3 | import com.dxj.module.system.domain.dto.UserDTO; 4 | import com.dxj.module.system.domain.entity.User; 5 | import com.dxj.module.system.domain.query.UserQuery; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.util.List; 12 | import java.util.Map; 13 | import java.util.Set; 14 | 15 | /** 16 | * @author Sinkiang 17 | * @date 2018-11-23 18 | */ 19 | public interface UserService { 20 | 21 | /** 22 | * 根据ID查询 23 | * @param id ID 24 | * @return / 25 | */ 26 | UserDTO findById(long id); 27 | 28 | /** 29 | * 新增用户 30 | * @param resources / 31 | */ 32 | void create(User resources); 33 | 34 | /** 35 | * 编辑用户 36 | * @param resources / 37 | */ 38 | void update(User resources); 39 | 40 | /** 41 | * 删除用户 42 | * @param ids / 43 | */ 44 | void delete(Set ids); 45 | 46 | /** 47 | * 根据用户名查询 48 | * @param userName / 49 | * @return / 50 | */ 51 | UserDTO findByName(String userName); 52 | 53 | /** 54 | * 修改密码 55 | * @param username 用户名 56 | * @param encryptPassword 密码 57 | */ 58 | void updatePass(String username, String encryptPassword); 59 | 60 | /** 61 | * 修改头像 62 | * @param file 文件 63 | * @return / 64 | */ 65 | Map updateAvatar(MultipartFile file); 66 | 67 | /** 68 | * 修改邮箱 69 | * @param username 用户名 70 | * @param email 邮箱 71 | */ 72 | void updateEmail(String username, String email); 73 | 74 | /** 75 | * 查询全部 76 | * @param criteria 条件 77 | * @param pageable 分页参数 78 | * @return / 79 | */ 80 | Object queryAll(UserQuery criteria, Pageable pageable); 81 | 82 | /** 83 | * 查询全部不分页 84 | * @param criteria 条件 85 | * @return / 86 | */ 87 | List queryAll(UserQuery criteria); 88 | 89 | /** 90 | * 导出数据 91 | * @param queryAll 待导出的数据 92 | * @param response / 93 | * @throws IOException / 94 | */ 95 | void download(List queryAll, HttpServletResponse response) throws IOException; 96 | 97 | /** 98 | * 用户自助修改资料 99 | * @param resources / 100 | */ 101 | void updateCenter(User resources); 102 | } 103 | -------------------------------------------------------------------------------- /sk-tool/src/main/java/com/dxj/service/QiNiuService.java: -------------------------------------------------------------------------------- 1 | package com.dxj.service; 2 | 3 | import com.dxj.domain.entity.QiniuConfig; 4 | import com.dxj.domain.entity.QiniuContent; 5 | import com.dxj.domain.dto.QiNiuQuery; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Sinkiang 15 | * @date 2018-12-31 16 | */ 17 | public interface QiNiuService { 18 | 19 | /** 20 | * 查配置 21 | * @return QiniuConfig 22 | */ 23 | QiniuConfig find(); 24 | 25 | /** 26 | * 修改配置 27 | * @param qiniuConfig 配置 28 | * @return QiniuConfig 29 | */ 30 | QiniuConfig config(QiniuConfig qiniuConfig); 31 | 32 | /** 33 | * 分页查询 34 | * @param criteria 条件 35 | * @param pageable 分页参数 36 | * @return / 37 | */ 38 | Object queryAll(QiNiuQuery criteria, Pageable pageable); 39 | 40 | /** 41 | * 查询全部 42 | * @param criteria 条件 43 | * @return / 44 | */ 45 | List queryAll(QiNiuQuery criteria); 46 | 47 | /** 48 | * 上传文件 49 | * @param file 文件 50 | * @param qiniuConfig 配置 51 | * @return QiniuContent 52 | */ 53 | QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig); 54 | 55 | /** 56 | * 查询文件 57 | * @param id 文件ID 58 | * @return QiniuContent 59 | */ 60 | QiniuContent findByContentId(Long id); 61 | 62 | /** 63 | * 下载文件 64 | * @param content 文件信息 65 | * @param config 配置 66 | * @return String 67 | */ 68 | String download(QiniuContent content, QiniuConfig config); 69 | 70 | /** 71 | * 删除文件 72 | * @param content 文件 73 | * @param config 配置 74 | */ 75 | void delete(QiniuContent content, QiniuConfig config); 76 | 77 | /** 78 | * 同步数据 79 | * @param config 配置 80 | */ 81 | void synchronize(QiniuConfig config); 82 | 83 | /** 84 | * 删除文件 85 | * @param ids 文件ID数组 86 | * @param config 配置 87 | */ 88 | void deleteAll(Long[] ids, QiniuConfig config); 89 | 90 | /** 91 | * 更新数据 92 | * @param type 类型 93 | */ 94 | void update(String type); 95 | 96 | /** 97 | * 导出数据 98 | * @param queryAll / 99 | * @param response / 100 | * @throws IOException / 101 | */ 102 | void downloadList(List queryAll, HttpServletResponse response) throws IOException; 103 | } 104 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/constant/SettingConstant.java: -------------------------------------------------------------------------------- 1 | package com.dxj.constant; 2 | 3 | /** 4 | * @author Sinkiang 5 | */ 6 | public interface SettingConstant { 7 | 8 | /** 9 | * 当前使用OSS 10 | */ 11 | String OSS_USED = "OSS_USED"; 12 | 13 | /** 14 | * 七牛OSS配置 15 | */ 16 | String QINIU_OSS = "QINIU_OSS"; 17 | 18 | /** 19 | * 七牛云存储区域 自动判断 20 | */ 21 | int ZONE_AUTO = -1; 22 | 23 | /** 24 | * 七牛云存储区域 华东 25 | */ 26 | int ZONE_ZERO = 0; 27 | 28 | /** 29 | * 七牛云存储区域 华北 30 | */ 31 | int ZONE_ONE = 1; 32 | 33 | /** 34 | * 七牛云存储区域 华南 35 | */ 36 | int ZONE_TWO = 2; 37 | 38 | /** 39 | * 七牛云存储区域 北美 40 | */ 41 | int ZONE_THREE = 3; 42 | 43 | /** 44 | * 七牛云存储区域 东南亚 45 | */ 46 | int ZONE_FOUR = 4; 47 | 48 | /** 49 | * 阿里OSS配置 50 | */ 51 | String ALI_OSS = "ALI_OSS"; 52 | 53 | /** 54 | * 腾讯COS配置 55 | */ 56 | String TENCENT_OSS = "TENCENT_OSS"; 57 | 58 | /** 59 | * 本地OSS配置 60 | */ 61 | String LOCAL_OSS = "LOCAL_OSS"; 62 | 63 | /** 64 | * Minio配置 65 | */ 66 | String MINIO_OSS = "MINIO_OSS"; 67 | 68 | /** 69 | * 当前使用短信 70 | */ 71 | String SMS_USED = "SMS_USED"; 72 | 73 | /** 74 | * 阿里短信配置 75 | */ 76 | String ALI_SMS = "ALI_SMS"; 77 | 78 | /** 79 | * 阿里短信 通用 80 | */ 81 | String ALI_SMS_COMMON = "ALI_SMS_COMMON"; 82 | 83 | /** 84 | * 阿里短信 登录验证码 85 | */ 86 | String ALI_SMS_LOGIN = "ALI_SMS_LOGIN"; 87 | 88 | /** 89 | * 阿里短信 注册验证码 90 | */ 91 | String ALI_SMS_REGISTER = "ALI_SMS_REGISTER"; 92 | 93 | /** 94 | * 阿里短信 修改手机 95 | */ 96 | String ALI_SMS_CHANGE_MOBILE = "ALI_SMS_CHANGE_MOBILE"; 97 | 98 | /** 99 | * 阿里短信 修改密码 100 | */ 101 | String ALI_SMS_CHANGE_PASS = "ALI_SMS_CHANGE_PASS"; 102 | 103 | /** 104 | * 阿里短信 重置密码 105 | */ 106 | String ALI_SMS_RESET_PASS = "ALI_SMS_RESET_PASS"; 107 | 108 | /** 109 | * 阿里短信 工作流消息 110 | */ 111 | String ALI_SMS_ACTIVITI = "ALI_SMS_ACTIVITI"; 112 | 113 | /** 114 | * 邮箱配置 115 | */ 116 | String EMAIL_SETTING = "EMAIL_SETTING"; 117 | 118 | /** 119 | * vapthca验证码配置 120 | */ 121 | String VAPTCHA_SETTING = "VAPTCHA_SETTING"; 122 | 123 | /** 124 | * 其他配置 125 | */ 126 | String OTHER_SETTING = "OTHER_SETTING"; 127 | 128 | /** 129 | * VAPTCHA验证链接 130 | */ 131 | String VAPTCHA_URL = "http://api.vaptcha.com/v2/validate"; 132 | } 133 | -------------------------------------------------------------------------------- /sk-system/src/main/java/com/dxj/module/system/domain/entity/Dept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Zheng Jie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dxj.module.system.domain.entity; 17 | 18 | import com.dxj.base.BEntity; 19 | import com.fasterxml.jackson.annotation.JsonIgnore; 20 | import io.swagger.annotations.ApiModelProperty; 21 | import lombok.Getter; 22 | import lombok.Setter; 23 | 24 | import javax.persistence.*; 25 | import javax.validation.constraints.NotBlank; 26 | import javax.validation.constraints.NotNull; 27 | import java.io.Serializable; 28 | import java.util.Objects; 29 | import java.util.Set; 30 | 31 | /** 32 | * @author Sinkiang 33 | * @date 2019-03-25 34 | */ 35 | @Entity 36 | @Getter 37 | @Setter 38 | @Table(name = "sys_dept") 39 | public class Dept extends BEntity implements Serializable { 40 | 41 | @Id 42 | @Column(name = "dept_id") 43 | @NotNull(groups = Update.class) 44 | @ApiModelProperty(value = "ID", hidden = true) 45 | @GeneratedValue(strategy = GenerationType.IDENTITY) 46 | private Long id; 47 | 48 | @JsonIgnore 49 | @ManyToMany(mappedBy = "depts") 50 | @ApiModelProperty(value = "角色") 51 | private Set roles; 52 | 53 | @ApiModelProperty(value = "排序") 54 | private Integer deptSort; 55 | 56 | @NotBlank 57 | @ApiModelProperty(value = "部门名称") 58 | private String name; 59 | 60 | @NotNull 61 | @ApiModelProperty(value = "是否启用") 62 | private Boolean enabled; 63 | 64 | @ApiModelProperty(value = "上级部门") 65 | private Long pid; 66 | 67 | @ApiModelProperty(value = "子节点数目", hidden = true) 68 | private Integer subCount = 0; 69 | 70 | @Override 71 | public boolean equals(Object o) { 72 | if (this == o) { 73 | return true; 74 | } 75 | if (o == null || getClass() != o.getClass()) { 76 | return false; 77 | } 78 | Dept dept = (Dept) o; 79 | return Objects.equals(id, dept.id) && 80 | Objects.equals(name, dept.name); 81 | } 82 | 83 | @Override 84 | public int hashCode() { 85 | return Objects.hash(id, name); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /sk-common/src/main/java/com/dxj/annotation/rest/AnonymousGetMapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.dxj.annotation.rest; 18 | 19 | import com.dxj.annotation.AnonymousAccess; 20 | import org.springframework.core.annotation.AliasFor; 21 | import org.springframework.web.bind.annotation.RequestMapping; 22 | import org.springframework.web.bind.annotation.RequestMethod; 23 | 24 | import java.lang.annotation.*; 25 | 26 | /** 27 | * Annotation for mapping HTTP {@code GET} requests onto specific handler 28 | * methods. 29 | *

30 | * 支持匿名访问 GetMapping 31 | * 32 | * @author liaojinlong 33 | * @see RequestMapping 34 | */ 35 | @AnonymousAccess 36 | @Target(ElementType.METHOD) 37 | @Retention(RetentionPolicy.RUNTIME) 38 | @Documented 39 | @RequestMapping(method = RequestMethod.GET) 40 | public @interface AnonymousGetMapping { 41 | 42 | /** 43 | * Alias for {@link RequestMapping#name}. 44 | */ 45 | @AliasFor(annotation = RequestMapping.class) 46 | String name() default ""; 47 | 48 | /** 49 | * Alias for {@link RequestMapping#value}. 50 | */ 51 | @AliasFor(annotation = RequestMapping.class) 52 | String[] value() default {}; 53 | 54 | /** 55 | * Alias for {@link RequestMapping#path}. 56 | */ 57 | @AliasFor(annotation = RequestMapping.class) 58 | String[] path() default {}; 59 | 60 | /** 61 | * Alias for {@link RequestMapping#params}. 62 | */ 63 | @AliasFor(annotation = RequestMapping.class) 64 | String[] params() default {}; 65 | 66 | /** 67 | * Alias for {@link RequestMapping#headers}. 68 | */ 69 | @AliasFor(annotation = RequestMapping.class) 70 | String[] headers() default {}; 71 | 72 | /** 73 | * Alias for {@link RequestMapping#consumes}. 74 | * 75 | * @since 4.3.5 76 | */ 77 | @AliasFor(annotation = RequestMapping.class) 78 | String[] consumes() default {}; 79 | 80 | /** 81 | * Alias for {@link RequestMapping#produces}. 82 | */ 83 | @AliasFor(annotation = RequestMapping.class) 84 | String[] produces() default {}; 85 | 86 | } 87 | --------------------------------------------------------------------------------