mirror of
https://gitee.com/anji-plus/report.git
synced 2026-05-20 08:47:18 +08:00
是否开启flyway
This commit is contained in:
@@ -3,6 +3,7 @@ package com.anjiplus.template.gaea.business.config;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayProperties;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -18,6 +19,7 @@ import java.sql.Statement;
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@ConditionalOnProperty(value = {"spring.flyway.enabled"})
|
||||
public class DatabaseInitializer {
|
||||
|
||||
private final FlywayProperties flywayProperties;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Date;
|
||||
* @author 木子李·De <lide1202@hotmail.com>
|
||||
* @date 2019-02-17 08:50:10.009
|
||||
**/
|
||||
@TableName(value="access_authority")
|
||||
@TableName(keepGlobalPrefix=true, value="access_authority")
|
||||
@Data
|
||||
public class AccessAuthority extends GaeaBaseEntity {
|
||||
/** 父菜单代码 */
|
||||
@@ -40,4 +40,4 @@ public class AccessAuthority extends GaeaBaseEntity {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Date;
|
||||
* @author 木子李·De <lide1202@hotmail.com>
|
||||
* @date 2019-02-17 08:50:14.136
|
||||
**/
|
||||
@TableName(value="access_role")
|
||||
@TableName(keepGlobalPrefix=true, value="access_role")
|
||||
@Data
|
||||
public class AccessRole extends GaeaBaseEntity {
|
||||
|
||||
@@ -27,4 +27,4 @@ public class AccessRole extends GaeaBaseEntity {
|
||||
/** 0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG */
|
||||
private Integer enableFlag;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
* @author 木子李·De <lide1202@hotmail.com>
|
||||
* @date 2019-02-17 08:50:14.136
|
||||
**/
|
||||
@TableName(value="access_role_authority")
|
||||
@TableName(keepGlobalPrefix=true, value="access_role_authority")
|
||||
@Data
|
||||
public class AccessRoleAuthority extends GaeaBaseEntity {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @desc AccessRole 角色管理服务实现
|
||||
@@ -52,7 +53,14 @@ public class AccessRoleServiceImpl implements AccessRoleService {
|
||||
List<TreeNode> treeData = accessAuthorityService.getAuthorityTree(operator, true);
|
||||
|
||||
// 该角色已选中的菜单及按钮
|
||||
List<String> checkedKeys = accessRoleMapper.checkedAuthoritys(roleCode);
|
||||
// List<String> checkedKeys = accessRoleMapper.checkedAuthoritys(roleCode);
|
||||
|
||||
LambdaQueryWrapper<AccessRoleAuthority> accessRoleAuthorityWrapper = Wrappers.lambdaQuery();
|
||||
accessRoleAuthorityWrapper.select(AccessRoleAuthority::getTarget, AccessRoleAuthority::getAction);
|
||||
accessRoleAuthorityWrapper.eq(AccessRoleAuthority::getRoleCode, roleCode);
|
||||
List<AccessRoleAuthority> accessRoleAuthorities = accessRoleAuthorityMapper.selectList(accessRoleAuthorityWrapper);
|
||||
List<String> checkedKeys = accessRoleAuthorities.stream()
|
||||
.map(accessRoleAuthority -> accessRoleAuthority.getTarget().concat("_").concat(accessRoleAuthority.getAction())).distinct().collect(Collectors.toList());
|
||||
|
||||
result.put("treeData", treeData);
|
||||
result.put("checkedKeys", checkedKeys);
|
||||
@@ -90,4 +98,4 @@ public class AccessRoleServiceImpl implements AccessRoleService {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Date;
|
||||
* @author 木子李·De <lide1202@hotmail.com>
|
||||
* @date 2019-02-17 08:50:11.902
|
||||
**/
|
||||
@TableName(value="access_user")
|
||||
@TableName(keepGlobalPrefix=true, value="access_user")
|
||||
@Data
|
||||
public class AccessUser extends GaeaBaseEntity {
|
||||
|
||||
@@ -45,4 +45,4 @@ public class AccessUser extends GaeaBaseEntity {
|
||||
/** 最后一次登陆时间 */
|
||||
private Date lastLoginTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Date;
|
||||
* @author 木子李·De <lide1202@hotmail.com>
|
||||
* @date 2019-02-17 08:50:11.902
|
||||
**/
|
||||
@TableName(value="access_user_role")
|
||||
@TableName(keepGlobalPrefix=true, value="access_user_role")
|
||||
@Data
|
||||
public class AccessUserRole extends GaeaBaseEntity {
|
||||
|
||||
@@ -37,4 +37,4 @@ public class AccessUserRole extends GaeaBaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import com.anji.plus.gaea.utils.GaeaUtils;
|
||||
import com.anji.plus.gaea.utils.JwtBean;
|
||||
import com.anjiplus.template.gaea.business.code.ResponseCode;
|
||||
import com.anjiplus.template.gaea.business.constant.BusinessConstant;
|
||||
import com.anjiplus.template.gaea.business.modules.accessrole.dao.AccessRoleAuthorityMapper;
|
||||
import com.anjiplus.template.gaea.business.modules.accessrole.dao.AccessRoleMapper;
|
||||
import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRole;
|
||||
import com.anjiplus.template.gaea.business.modules.accessrole.dao.entity.AccessRoleAuthority;
|
||||
import com.anjiplus.template.gaea.business.modules.accessuser.controller.dto.AccessUserDto;
|
||||
import com.anjiplus.template.gaea.business.modules.accessuser.controller.dto.GaeaUserDto;
|
||||
import com.anjiplus.template.gaea.business.modules.accessuser.controller.dto.UpdatePasswordDto;
|
||||
@@ -31,10 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -54,6 +53,9 @@ public class AccessUserServiceImpl implements AccessUserService {
|
||||
@Autowired
|
||||
private AccessUserRoleMapper accessUserRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private AccessRoleAuthorityMapper accessRoleAuthorityMapper;
|
||||
|
||||
@Value("${customer.user.default.password:'123456'}")
|
||||
private String defaultPassword;
|
||||
|
||||
@@ -168,7 +170,24 @@ public class AccessUserServiceImpl implements AccessUserService {
|
||||
// 4.读取用户最新人权限主信息
|
||||
String userKey = String.format(BusinessConstant.GAEA_SECURITY_LOGIN_USER, loginName);
|
||||
|
||||
List<String> authorities = accessUserMapper.queryAuthoritiesByLoginName(loginName);
|
||||
//为了兼容底层其他数据库,不再写自定义sql
|
||||
// List<String> authorities = accessUserMapper.queryAuthoritiesByLoginName(loginName);
|
||||
|
||||
//当前用户的roleCode集合
|
||||
LambdaQueryWrapper<AccessUserRole> accessUserWrapper = Wrappers.lambdaQuery();
|
||||
accessUserWrapper.select(AccessUserRole::getRoleCode);
|
||||
accessUserWrapper.eq(AccessUserRole::getLoginName, loginName);
|
||||
List<AccessUserRole> accessUserRoles = accessUserRoleMapper.selectList(accessUserWrapper);
|
||||
Set<String> roleCodeSet = accessUserRoles.stream().map(AccessUserRole::getRoleCode).collect(Collectors.toSet());
|
||||
|
||||
LambdaQueryWrapper<AccessRoleAuthority> accessRoleAuthorityWrapper = Wrappers.lambdaQuery();
|
||||
accessRoleAuthorityWrapper.select(AccessRoleAuthority::getTarget, AccessRoleAuthority::getAction);
|
||||
accessRoleAuthorityWrapper.in(AccessRoleAuthority::getRoleCode, roleCodeSet);
|
||||
List<AccessRoleAuthority> accessRoleAuthorities = accessRoleAuthorityMapper.selectList(accessRoleAuthorityWrapper);
|
||||
List<String> authorities = accessRoleAuthorities.stream()
|
||||
.map(accessRoleAuthority -> accessRoleAuthority.getTarget().concat(":").concat(accessRoleAuthority.getAction())).distinct().collect(Collectors.toList());
|
||||
|
||||
|
||||
gaeaUser.setLoginName(loginName);
|
||||
gaeaUser.setRealName(accessUser.getRealName());
|
||||
gaeaUser.setToken(token);
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-04-12 14:52:21.761
|
||||
**/
|
||||
@TableName(value="gaea_report_dashboard")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_dashboard")
|
||||
@Data
|
||||
public class ReportDashboard extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "报表编码")
|
||||
|
||||
@@ -11,7 +11,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-04-12 15:12:43.724
|
||||
**/
|
||||
@TableName(value="gaea_report_dashboard_widget")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_dashboard_widget")
|
||||
@Data
|
||||
public class ReportDashboardWidget extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "报表编码")
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-03-18 12:11:31.150755900
|
||||
**/
|
||||
@TableName(value="gaea_report_data_set")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_data_set")
|
||||
@Data
|
||||
public class DataSet extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "数据集编码")
|
||||
|
||||
@@ -11,7 +11,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-03-18 12:12:33.108033200
|
||||
**/
|
||||
@TableName(value="gaea_report_data_set_param")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_data_set_param")
|
||||
@Data
|
||||
public class DataSetParam extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "数据集编码")
|
||||
|
||||
@@ -11,7 +11,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-03-18 12:13:15.591309400
|
||||
**/
|
||||
@TableName(value="gaea_report_data_set_transform")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_data_set_transform")
|
||||
@Data
|
||||
public class DataSetTransform extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "数据集编码")
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
* @author Raod
|
||||
* @date 2021-03-18 12:09:57.728203200
|
||||
**/
|
||||
@TableName(value="gaea_report_data_source")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_data_source")
|
||||
@Data
|
||||
public class DataSource extends GaeaBaseEntity {
|
||||
@ApiModelProperty(value = "数据源编码")
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.io.Serializable;
|
||||
* @author lr
|
||||
* @since 2021-02-23 10:01:02
|
||||
*/
|
||||
@TableName("gaea_dict")
|
||||
@TableName(keepGlobalPrefix=true, value = "gaea_dict")
|
||||
public class GaeaDict extends GaeaBaseEntity implements Serializable {
|
||||
/**
|
||||
* 字典名称
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.Serializable;
|
||||
* @author lirui
|
||||
* @since 2021-03-09 15:52:41
|
||||
*/
|
||||
@TableName("gaea_dict_item")
|
||||
@TableName(keepGlobalPrefix=true,value = "gaea_dict_item")
|
||||
@UnionUniqueCode(group = BusinessConstant.DICT_ITEM_EXIST_GROUP, code = ResponseCode.DICT_ITEM_REPEAT)
|
||||
public class GaeaDictItem extends GaeaBaseEntity implements Serializable {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.io.Serializable;
|
||||
* @author peiyanni
|
||||
* @since 2021-02-18 14:48:20
|
||||
*/
|
||||
@TableName("gaea_file")
|
||||
@TableName(keepGlobalPrefix=true, value = "gaea_file")
|
||||
@Data
|
||||
public class GaeaFile extends GaeaBaseEntity implements Serializable {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
* @author chenkening
|
||||
* @date 2021/3/26 10:20
|
||||
*/
|
||||
@TableName(value="gaea_report")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report")
|
||||
@Data
|
||||
public class Report extends GaeaBaseEntity {
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Date;
|
||||
* @author Raod
|
||||
* @date 2021-08-18 13:37:26.663
|
||||
**/
|
||||
@TableName(value="gaea_report_share")
|
||||
@TableName(keepGlobalPrefix=true, value="gaea_report_share")
|
||||
@Data
|
||||
public class ReportShare extends GaeaBaseEntity {
|
||||
/** 分享编码,系统生成,默认UUID */
|
||||
|
||||
@@ -37,6 +37,7 @@ spring:
|
||||
breakAfterAcquireFailure: true # 数据库服务宕机自动重连机制
|
||||
timeBetweenConnectErrorMillis: 300000 # 连接出错后重试时间间隔
|
||||
flyway:
|
||||
enabled: true #是否开启flyway,默认true.
|
||||
baseline-on-migrate: true
|
||||
#数据库连接配置
|
||||
url: ${spring.datasource.url}
|
||||
|
||||
Reference in New Issue
Block a user