diff --git a/backend/src/main/java/io/dataease/controller/LicenseController.java b/backend/src/main/java/io/dataease/controller/LicenseController.java index 4071f6b811..160dc80d1b 100644 --- a/backend/src/main/java/io/dataease/controller/LicenseController.java +++ b/backend/src/main/java/io/dataease/controller/LicenseController.java @@ -23,9 +23,9 @@ public class LicenseController { @GetMapping(value = "anonymous/license/validate") public ResultHolder validateLicense() throws Exception { -// if (!need_validate_lic) { -// return ResultHolder.success(null); -// } + if (!need_validate_lic) { + return ResultHolder.success(null); + } F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense(); System.out.println(new Gson().toJson(f2CLicenseResponse)); switch (f2CLicenseResponse.getStatus()) { diff --git a/backend/src/main/java/io/dataease/dto/chart/ChartViewFieldDTO.java b/backend/src/main/java/io/dataease/dto/chart/ChartViewFieldDTO.java index 6725720bdb..b21b9adc8c 100644 --- a/backend/src/main/java/io/dataease/dto/chart/ChartViewFieldDTO.java +++ b/backend/src/main/java/io/dataease/dto/chart/ChartViewFieldDTO.java @@ -38,4 +38,8 @@ public class ChartViewFieldDTO implements Serializable { private List filter; private Integer deExtractType; + + private String dateStyle; + + private String datePattern; } diff --git a/backend/src/main/java/io/dataease/plugins/loader/MyScanner.java b/backend/src/main/java/io/dataease/plugins/loader/MyScanner.java index 8fbeada3fb..fa099f7f27 100644 --- a/backend/src/main/java/io/dataease/plugins/loader/MyScanner.java +++ b/backend/src/main/java/io/dataease/plugins/loader/MyScanner.java @@ -8,20 +8,16 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.stereotype.Component; -import javax.annotation.Resource; - @Component public class MyScanner implements BeanDefinitionRegistryPostProcessor { - @Resource - private MapperScannerConfigurer mapperScannerConfigurer; + private BeanDefinitionRegistry beanDefinitionRegistry; @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException { this.beanDefinitionRegistry = beanDefinitionRegistry; - System.out.println("-----"); } @Override @@ -30,9 +26,7 @@ public class MyScanner implements BeanDefinitionRegistryPostProcessor { } public void scanner() { - if (null == mapperScannerConfigurer){ - mapperScannerConfigurer = SpringContextUtil.getBean(MapperScannerConfigurer.class); - } + MapperScannerConfigurer mapperScannerConfigurer = SpringContextUtil.getBean(MapperScannerConfigurer.class); mapperScannerConfigurer.postProcessBeanDefinitionRegistry(this.beanDefinitionRegistry); } diff --git a/backend/src/main/java/io/dataease/plugins/util/PluginUtils.java b/backend/src/main/java/io/dataease/plugins/util/PluginUtils.java index b8bcb043a7..52c422b870 100644 --- a/backend/src/main/java/io/dataease/plugins/util/PluginUtils.java +++ b/backend/src/main/java/io/dataease/plugins/util/PluginUtils.java @@ -1,21 +1,51 @@ package io.dataease.plugins.util; +import io.dataease.commons.license.DefaultLicenseService; +import io.dataease.commons.license.F2CLicenseResponse; import io.dataease.plugins.common.dto.PluginSysMenu; import io.dataease.plugins.common.service.PluginMenuService; import io.dataease.plugins.config.SpringContextUtil; - +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +@Component public class PluginUtils { + + + private static DefaultLicenseService defaultLicenseService; + + @Autowired + public void setDefaultLicenseService(DefaultLicenseService defaultLicenseService) { + PluginUtils.defaultLicenseService = defaultLicenseService; + } + public static List pluginMenus() { + F2CLicenseResponse f2CLicenseResponse = currentLic(); + if (f2CLicenseResponse.getStatus() != F2CLicenseResponse.Status.valid) + return new ArrayList<>(); Map pluginMenuServiceMap = SpringContextUtil.getApplicationContext().getBeansOfType(PluginMenuService.class); List menus = pluginMenuServiceMap.values().stream().flatMap(item -> item.menus().stream()).collect(Collectors.toList()); return menus; } + public static F2CLicenseResponse currentLic() { + Environment environment = SpringContextUtil.getBean(Environment.class); + Boolean need_validate_lic = environment.getProperty("dataease.need_validate_lic", Boolean.class, true); + if (!need_validate_lic) { + F2CLicenseResponse f2CLicenseResponse = new F2CLicenseResponse(); + f2CLicenseResponse.setStatus(F2CLicenseResponse.Status.valid); + return f2CLicenseResponse; + } + F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense(); + return f2CLicenseResponse; + } + diff --git a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java index d840005eb0..04d99e6a0b 100644 --- a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java @@ -131,22 +131,26 @@ public class DorisQueryProvider extends QueryProvider { // 如果原始类型为时间 if (x.getDeExtractType() == 1) { if (x.getDeType() == 2 || x.getDeType() == 3) { - stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as ").append(x.getDataeaseName()); + stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as _").append(x.getDataeaseName()); + } else if (x.getDeType() == 1) { + String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); + stringBuilder.append("DATE_FORMAT(").append(x.getDataeaseName()).append(",'").append(format).append("') as _").append(x.getDataeaseName()); } else { - stringBuilder.append(x.getDataeaseName()); + stringBuilder.append(x.getDataeaseName()).append(" as _").append(x.getDataeaseName()); } } else { if (x.getDeType() == 1) { - stringBuilder.append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(x.getDataeaseName()); + String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); + stringBuilder.append("DATE_FORMAT(").append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S')").append(",'").append(format).append("') as _").append(x.getDataeaseName()); } else { - stringBuilder.append(x.getDataeaseName()); + stringBuilder.append(x.getDataeaseName()).append(" as _").append(x.getDataeaseName()); } } return stringBuilder.toString(); }).toArray(String[]::new); - String[] group = xAxis.stream().map(ChartViewFieldDTO::getDataeaseName).toArray(String[]::new); + String[] group = xAxis.stream().map(x -> "_" + x.getDataeaseName()).toArray(String[]::new); String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none")) - .map(f -> f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new); + .map(f -> "_" + f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new); String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none")) .map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getDataeaseName(), "*") ? "" : f.getDataeaseName()) + " " + f.getSort()).toArray(String[]::new); String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length); @@ -330,4 +334,30 @@ public class DorisQueryProvider extends QueryProvider { } return filter.toString(); } + + private String transDateFormat(String dateStyle, String datePattern) { + String split = "-"; + if (StringUtils.equalsIgnoreCase(datePattern, "date_sub")) { + split = "-"; + } else if (StringUtils.equalsIgnoreCase(datePattern, "date_split")) { + split = "/"; + } + + switch (dateStyle) { + case "y": + return "%Y"; + case "y_M": + return "%Y" + split + "%m"; + case "y_M_d": + return "%Y" + split + "%m" + split + "%d"; + case "H_m_s": + return "%H:%i:%S"; + case "y_M_d_H_m": + return "%Y" + split + "%m" + split + "%d" + " %H:%i"; + case "y_M_d_H_m_s": + return "%Y" + split + "%m" + split + "%d" + " %H:%i:%S"; + default: + return "%Y-%m-%d %H:%i:%S"; + } + } } diff --git a/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java index 9f1a8244ce..066204f1f2 100644 --- a/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java @@ -137,22 +137,26 @@ public class MysqlQueryProvider extends QueryProvider { // 如果原始类型为时间 if (x.getDeExtractType() == 1) { if (x.getDeType() == 2 || x.getDeType() == 3) { - stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as ").append(x.getDataeaseName()); + stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as _").append(x.getDataeaseName()); + } else if (x.getDeType() == 1) { + String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); + stringBuilder.append("DATE_FORMAT(").append(x.getDataeaseName()).append(",'").append(format).append("') as _").append(x.getDataeaseName()); } else { - stringBuilder.append(x.getDataeaseName()); + stringBuilder.append(x.getDataeaseName()).append(" as _").append(x.getDataeaseName()); } } else { if (x.getDeType() == 1) { - stringBuilder.append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(x.getDataeaseName()); + String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); + stringBuilder.append("DATE_FORMAT(").append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S')").append(",'").append(format).append("') as _").append(x.getDataeaseName()); } else { - stringBuilder.append(x.getDataeaseName()); + stringBuilder.append(x.getDataeaseName()).append(" as _").append(x.getDataeaseName()); } } return stringBuilder.toString(); }).toArray(String[]::new); - String[] group = xAxis.stream().map(ChartViewFieldDTO::getDataeaseName).toArray(String[]::new); + String[] group = xAxis.stream().map(x -> "_" + x.getDataeaseName()).toArray(String[]::new); String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none")) - .map(f -> f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new); + .map(f -> "_" + f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new); String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none")) .map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getDataeaseName(), "*") ? "" : f.getDataeaseName()) + " " + f.getSort()).toArray(String[]::new); String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length); @@ -344,4 +348,30 @@ public class MysqlQueryProvider extends QueryProvider { } return sql; } + + private String transDateFormat(String dateStyle, String datePattern) { + String split = "-"; + if (StringUtils.equalsIgnoreCase(datePattern, "date_sub")) { + split = "-"; + } else if (StringUtils.equalsIgnoreCase(datePattern, "date_split")) { + split = "/"; + } + + switch (dateStyle) { + case "y": + return "%Y"; + case "y_M": + return "%Y" + split + "%m"; + case "y_M_d": + return "%Y" + split + "%m" + split + "%d"; + case "H_m_s": + return "%H:%i:%S"; + case "y_M_d_H_m": + return "%Y" + split + "%m" + split + "%d" + " %H:%i"; + case "y_M_d_H_m_s": + return "%Y" + split + "%m" + split + "%d" + " %H:%i:%S"; + default: + return "%Y-%m-%d %H:%i:%S"; + } + } } diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index a9c61f76f7..36b1e343f2 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -26,6 +26,7 @@ import io.dataease.provider.QueryProvider; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -45,6 +46,7 @@ import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.text.MessageFormat; import java.text.NumberFormat; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -273,16 +275,16 @@ public class DataSetTableService { map.put("status", "warnning"); map.put("msg", Translator.get("i18n_processing_data")); dataSetPreviewPage.setTotal(0); - }else if (datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Error.name())) { + } else if (datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Error.name())) { List datasetTableTaskLogs = dataSetTableTaskLogService.getByTableId(datasetTable.getId()); map.put("status", "error"); - if(CollectionUtils.isNotEmpty(datasetTableTaskLogs)){ + if (CollectionUtils.isNotEmpty(datasetTableTaskLogs)) { map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo()); - }else { + } else { map.put("msg", "Failed to extract data."); } dataSetPreviewPage.setTotal(0); - }else { + } else { Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource"); JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class); DatasourceRequest datasourceRequest = new DatasourceRequest(); @@ -336,9 +338,9 @@ public class DataSetTableService { }).collect(Collectors.toList()); } - if(!map.containsKey("status")){ - map.put("status", "success"); - } + if (!map.containsKey("status")) { + map.put("status", "success"); + } map.put("fields", fields); map.put("data", jsonArray); map.put("page", dataSetPreviewPage); @@ -583,7 +585,7 @@ public class DataSetTableService { switch (field) { case "TEXT": return 0; - case "TIME": + case "DATETIME": return 1; case "LONG": case "INT": @@ -701,16 +703,17 @@ public class DataSetTableService { TableFiled tableFiled = new TableFiled(); tableFiled.setFieldType("TEXT"); tableFiled.setFieldSize(1024); - String columnName = readCell(row.getCell(j)); + String columnName = readCell(row.getCell(j), false, null); if (StringUtils.isEmpty(columnName)) { columnName = "NONE_" + String.valueOf(j); } tableFiled.setFieldName(columnName); tableFiled.setRemarks(columnName); - fields.add(tableFiled); - } else { - r[j] = readCell(row.getCell(j)); + } else if (i == 1){ + r[j] = readCell(row.getCell(j), true, fields.get(j)); + }else { + r[j] = readCell(row.getCell(j), false, null); } } if (i > 0) { @@ -740,15 +743,17 @@ public class DataSetTableService { TableFiled tableFiled = new TableFiled(); tableFiled.setFieldType("TEXT"); tableFiled.setFieldSize(1024); - String columnName = readCell(row.getCell(j)); + String columnName = readCell(row.getCell(j),false, null); if (StringUtils.isEmpty(columnName)) { columnName = "NONE_" + String.valueOf(j); } tableFiled.setFieldName(columnName); tableFiled.setRemarks(columnName); fields.add(tableFiled); - } else { - r[j] = readCell(row.getCell(j)); + } else if (i == 1){ + r[j] = readCell(row.getCell(j), true, fields.get(j)); + }else { + r[j] = readCell(row.getCell(j), false, null); } } if (i > 0) { @@ -792,64 +797,51 @@ public class DataSetTableService { inputStream.close(); Map map = new HashMap<>(); - inferFieldType(fields, data); map.put("fields", fields); map.put("data", jsonArray); map.put("sheets", sheets); return map; } - private void inferFieldType(List fields, List data){ - if(CollectionUtils.isEmpty(fields) || CollectionUtils.isEmpty(data)) { - return; - } - String[] firstLine = data.get(0); - for (int i=0; i< fields.size()&& i < firstLine.length; i++) { - TableFiled filed = fields.get(i); - try{ - Integer.valueOf(firstLine[i]); - filed.setFieldType("INT"); - continue; - }catch (Exception ignore ){ - } - try{ - Long.valueOf(firstLine[i]); - filed.setFieldType("LONG"); - continue; - }catch (Exception ignore ){} - try{ - Double.valueOf(firstLine[i]); - filed.setFieldType("DOUBLE"); - continue; - }catch (Exception ignore ){} - } - } - - private String readCell(Cell cell) { + private String readCell(Cell cell, boolean cellType, TableFiled tableFiled) { CellType cellTypeEnum = cell.getCellTypeEnum(); if (cellTypeEnum.equals(CellType.STRING)) { + if(cellType){ tableFiled.setFieldType("TEXT"); } return cell.getStringCellValue(); - } else if (cellTypeEnum.equals(CellType.NUMERIC)) { - double d = cell.getNumericCellValue(); - try { - Double value = new Double(d); - double eps = 1e-10; - if(value - Math.floor(value) < eps){ - return value.longValue() + ""; - }else { - NumberFormat nf = NumberFormat.getInstance(); - nf.setGroupingUsed(false); - return nf.format(value); - } - } catch (Exception e) { - BigDecimal b = new BigDecimal(d); - return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + ""; - } - } else if (cellTypeEnum.equals(CellType.BOOLEAN)) { - return cell.getBooleanCellValue() ? "1" : "0"; - } else { - return ""; } + if (cellTypeEnum.equals(CellType.NUMERIC)) { + if(HSSFDateUtil.isCellDateFormatted(cell)){ + if(cellType) { tableFiled.setFieldType("DATETIME"); } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + return sdf.format(cell.getDateCellValue()); + }catch (Exception e){ + return ""; + } + }else { + double d = cell.getNumericCellValue(); + try { + Double value = new Double(d); + double eps = 1e-10; + if(value - Math.floor(value) < eps){ + if(cellType) { tableFiled.setFieldType("LONG"); } + return value.longValue() + ""; + }else { + if(cellType){ tableFiled.setFieldType("DOUBLE");} + NumberFormat nf = NumberFormat.getInstance(); + nf.setGroupingUsed(false); + return nf.format(value); + } + } catch (Exception e) { + BigDecimal b = new BigDecimal(d); + return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + ""; + } + } + } + if (cellTypeEnum.equals(CellType.BOOLEAN)) { + return cell.getBooleanCellValue() ? "1" : "0"; + } + return ""; } private String saveFile(MultipartFile file) throws Exception { @@ -885,20 +877,20 @@ public class DataSetTableService { private UtilMapper utilMapper; @QuartzScheduled(cron = "0 0/3 * * * ?") - public void updateDatasetTableStatus(){ + public void updateDatasetTableStatus() { List qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null); List activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > utilMapper.currentTimestamp()).map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList()); List jobStoppeddDatasetTables = new ArrayList<>(); DatasetTableExample example = new DatasetTableExample(); example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name()); - datasetTableMapper.selectByExample(example).forEach(datasetTable -> { - if(StringUtils.isEmpty(datasetTable.getQrtzInstance()) || !activeQrtzInstances.contains(datasetTable.getQrtzInstance().substring(0, datasetTable.getQrtzInstance().length() - 13))){ - jobStoppeddDatasetTables.add(datasetTable); - } - }); + datasetTableMapper.selectByExample(example).forEach(datasetTable -> { + if (StringUtils.isEmpty(datasetTable.getQrtzInstance()) || !activeQrtzInstances.contains(datasetTable.getQrtzInstance().substring(0, datasetTable.getQrtzInstance().length() - 13))) { + jobStoppeddDatasetTables.add(datasetTable); + } + }); - if(CollectionUtils.isEmpty(jobStoppeddDatasetTables)){ + if (CollectionUtils.isEmpty(jobStoppeddDatasetTables)) { return; } diff --git a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java index aac392e3a5..b28d14cc2c 100644 --- a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java +++ b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java @@ -155,6 +155,7 @@ public class ExtractDataService { break; } } + Column_Fields = Column_Fields.substring(0, Column_Fields.length() - 2); Column_Fields = "(" + Column_Fields + ")\n"; return Column_Fields; @@ -637,7 +638,12 @@ public class ExtractDataService { for (int i = 0; i < datasetTableFields.size(); i++) { ExcelInputField field = new ExcelInputField(); field.setName(datasetTableFields.get(i).getOriginName()); - field.setType("String"); + if(datasetTableFields.get(i).getDeExtractType() == 1){ + field.setType("Date"); + field.setFormat("yyyy-MM-dd HH:mm:ss"); + }else { + field.setType("String"); + } fields[i] = field; } diff --git a/backend/src/main/resources/db/migration/V2__dataease_ddl.sql b/backend/src/main/resources/db/migration/V2__dataease_ddl.sql index 28f8009981..c980bc0363 100644 --- a/backend/src/main/resources/db/migration/V2__dataease_ddl.sql +++ b/backend/src/main/resources/db/migration/V2__dataease_ddl.sql @@ -66,100 +66,100 @@ CREATE TABLE IF NOT EXISTS `dataset_group` ( DROP TABLE IF EXISTS `sys_dept`; CREATE TABLE `sys_dept` ( - `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', - `sub_count` int(5) DEFAULT '0' COMMENT '子部门数目', - `name` varchar(255) NOT NULL COMMENT '名称', - `dept_sort` int(5) DEFAULT '999' COMMENT '排序', - `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', - `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', - `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', - `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`dept_id`) USING BTREE, - KEY `inx_pid` (`pid`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门'; + `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', + `sub_count` int(5) DEFAULT '0' COMMENT '子部门数目', + `name` varchar(255) NOT NULL COMMENT '名称', + `dept_sort` int(5) DEFAULT '999' COMMENT '排序', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', + `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', + `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', + `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`dept_id`) USING BTREE, + KEY `inx_pid` (`pid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='组织机构'; DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE `sys_menu` ( - `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID', - `sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目', - `type` int(11) DEFAULT NULL COMMENT '菜单类型', - `title` varchar(255) DEFAULT NULL COMMENT '菜单标题', - `name` varchar(255) DEFAULT NULL COMMENT '组件名称', - `component` varchar(255) DEFAULT NULL COMMENT '组件', - `menu_sort` int(5) DEFAULT NULL COMMENT '排序', - `icon` varchar(255) DEFAULT NULL COMMENT '图标', - `path` varchar(255) DEFAULT NULL COMMENT '链接地址', - `i_frame` bit(1) DEFAULT NULL COMMENT '是否外链', - `cache` bit(1) DEFAULT b'0' COMMENT '缓存', - `hidden` bit(1) DEFAULT b'0' COMMENT '隐藏', - `permission` varchar(255) DEFAULT NULL COMMENT '权限', - `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', - `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', - `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', - `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`menu_id`) USING BTREE, - UNIQUE KEY `uniq_title` (`title`), - UNIQUE KEY `uniq_name` (`name`), - KEY `inx_pid` (`pid`) -) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单'; + `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID', + `sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目', + `type` int(11) DEFAULT NULL COMMENT '菜单类型', + `title` varchar(255) DEFAULT NULL COMMENT '菜单标题', + `name` varchar(255) DEFAULT NULL COMMENT '组件名称', + `component` varchar(255) DEFAULT NULL COMMENT '组件', + `menu_sort` int(5) DEFAULT NULL COMMENT '排序', + `icon` varchar(255) DEFAULT NULL COMMENT '图标', + `path` varchar(255) DEFAULT NULL COMMENT '链接地址', + `i_frame` bit(1) DEFAULT NULL COMMENT '是否外链', + `cache` bit(1) DEFAULT b'0' COMMENT '缓存', + `hidden` bit(1) DEFAULT b'0' COMMENT '隐藏', + `permission` varchar(255) DEFAULT NULL COMMENT '权限', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', + `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', + `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', + `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`menu_id`) USING BTREE, + UNIQUE KEY `uniq_title` (`title`), + UNIQUE KEY `uniq_name` (`name`), + KEY `inx_pid` (`pid`) +) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单'; DROP TABLE IF EXISTS `sys_user`; CREATE TABLE `sys_user` ( - `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `dept_id` bigint(20) DEFAULT NULL COMMENT '部门名称', - `username` varchar(255) DEFAULT NULL COMMENT '用户名', - `nick_name` varchar(255) DEFAULT NULL COMMENT '昵称', - `gender` varchar(2) DEFAULT NULL COMMENT '性别', - `phone` varchar(255) DEFAULT NULL COMMENT '手机号码', - `email` varchar(255) DEFAULT NULL COMMENT '邮箱', - `password` varchar(255) DEFAULT NULL COMMENT '密码', - `is_admin` bit(1) DEFAULT b'0' COMMENT '是否为admin账号', - `enabled` bigint(20) DEFAULT NULL COMMENT '状态:1启用、0禁用', - `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', - `update_by` varchar(255) DEFAULT NULL COMMENT '更新着', - `pwd_reset_time` bigint(13) DEFAULT NULL COMMENT '修改密码的时间', - `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', - `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', - `language` varchar(20) DEFAULT NULL COMMENT '语言', - PRIMARY KEY (`user_id`) USING BTREE, - UNIQUE KEY `UK_kpubos9gc2cvtkb0thktkbkes` (`email`) USING BTREE, - UNIQUE KEY `username` (`username`) USING BTREE, - UNIQUE KEY `uniq_username` (`username`), - UNIQUE KEY `uniq_email` (`email`), - KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`) USING BTREE, - KEY `inx_enabled` (`enabled`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户'; + `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `dept_id` bigint(20) DEFAULT NULL COMMENT '部门名称', + `username` varchar(255) DEFAULT NULL COMMENT '用户名', + `nick_name` varchar(255) DEFAULT NULL COMMENT '昵称', + `gender` varchar(2) DEFAULT NULL COMMENT '性别', + `phone` varchar(255) DEFAULT NULL COMMENT '手机号码', + `email` varchar(255) DEFAULT NULL COMMENT '邮箱', + `password` varchar(255) DEFAULT NULL COMMENT '密码', + `is_admin` bit(1) DEFAULT b'0' COMMENT '是否为admin账号', + `enabled` bigint(20) DEFAULT NULL COMMENT '状态:1启用、0禁用', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', + `update_by` varchar(255) DEFAULT NULL COMMENT '更新着', + `pwd_reset_time` bigint(13) DEFAULT NULL COMMENT '修改密码的时间', + `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', + `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', + `language` varchar(20) DEFAULT NULL COMMENT '语言', + PRIMARY KEY (`user_id`) USING BTREE, + UNIQUE KEY `UK_kpubos9gc2cvtkb0thktkbkes` (`email`) USING BTREE, + UNIQUE KEY `username` (`username`) USING BTREE, + UNIQUE KEY `uniq_username` (`username`), + UNIQUE KEY `uniq_email` (`email`), + KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`) USING BTREE, + KEY `inx_enabled` (`enabled`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户'; DROP TABLE IF EXISTS `sys_role`; CREATE TABLE `sys_role` ( - `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `name` varchar(255) NOT NULL COMMENT '名称', - `description` varchar(255) DEFAULT NULL COMMENT '描述', - `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', - `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', - `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', - `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`role_id`) USING BTREE, - UNIQUE KEY `uniq_name` (`name`), - KEY `role_name_index` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表'; + `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(255) NOT NULL COMMENT '名称', + `description` varchar(255) DEFAULT NULL COMMENT '描述', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建者', + `update_by` varchar(255) DEFAULT NULL COMMENT '更新者', + `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', + `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`role_id`) USING BTREE, + UNIQUE KEY `uniq_name` (`name`), + KEY `role_name_index` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表'; DROP TABLE IF EXISTS `sys_roles_menus`; CREATE TABLE `sys_roles_menus` ( - `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', - `role_id` bigint(20) NOT NULL COMMENT '角色ID', - PRIMARY KEY (`menu_id`,`role_id`) USING BTREE, - KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE + `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`menu_id`,`role_id`) USING BTREE, + KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色菜单关联'; DROP TABLE IF EXISTS `sys_users_roles`; CREATE TABLE `sys_users_roles` ( - `user_id` bigint(20) NOT NULL COMMENT '用户ID', - `role_id` bigint(20) NOT NULL COMMENT '角色ID', - PRIMARY KEY (`user_id`,`role_id`) USING BTREE, - KEY `FKq4eq273l04bpu4efj0jd0jb98` (`role_id`) USING BTREE + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`,`role_id`) USING BTREE, + KEY `FKq4eq273l04bpu4efj0jd0jb98` (`role_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户角色关联'; DROP TABLE IF EXISTS `my_plugin`; diff --git a/backend/src/main/resources/db/migration/V3__init_data.sql b/backend/src/main/resources/db/migration/V3__init_data.sql index b0daf01eda..2a37e98509 100644 --- a/backend/src/main/resources/db/migration/V3__init_data.sql +++ b/backend/src/main/resources/db/migration/V3__init_data.sql @@ -2,38 +2,17 @@ INSERT INTO system_parameter (param_key, param_value, type, sort) VALUES ('default.language', 'zh_CN', 'text', 5); BEGIN; -INSERT INTO `sys_dept` VALUES (18, 0, 1, '上海飞致云', 1, NULL, NULL, 1614048906358, 1614048906358); -INSERT INTO `sys_dept` VALUES (19, 0, 1, '北京飞致云', 2, NULL, NULL, 1614048918465, 1614048918465); -INSERT INTO `sys_dept` VALUES (20, 18, 1, '营销部', 1, NULL, NULL, 1614048946370, 1614049006759); -INSERT INTO `sys_dept` VALUES (21, 19, 0, '综合部', 3, NULL, NULL, 1614048963483, 1619667528267); -INSERT INTO `sys_dept` VALUES (25, 20, 0, '售前组', 1, NULL, NULL, 1615791706945, 1615791706945); +INSERT INTO `sys_dept` VALUES (1, 0, 0, '默认组织', 0, NULL, NULL, 1622533297817, 1622533297817); COMMIT; BEGIN; INSERT INTO `sys_menu` VALUES (1, 0, 3, 0, '系统管理', 'system', 'Layout', 6, 'system', '/system', NULL, b'0', b'0', 'dir:sys', NULL, NULL, NULL, 1614916695777); INSERT INTO `sys_menu` VALUES (2, 1, 4, 1, '用户管理', 'system-user', 'system/user/index', 1, 'peoples', 'user', NULL, b'0', b'0', 'user:read', NULL, NULL, NULL, 1620281952752); -/*INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '菜单管理', 'system-menu', 'system/menu/index', 2, 'menu', 'menu', NULL, b'0', b'0', 'menu:read', NULL, NULL, NULL, NULL);*/ -/*INSERT INTO `sys_menu` VALUES (4, 1, 3, 1, '组织管理', 'system-dept', 'system/dept/index', 3, 'dept', 'dept', NULL, b'0', b'0', 'dept:read', NULL, NULL, NULL, NULL);*/ - -/*INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '角色管理', 'system-role', 'system/role/index', 4, 'role', 'role', b'0', b'0', b'0', 'role:read', NULL, NULL, 1614683852133, 1614683852133); -INSERT INTO `sys_menu` VALUES (6, 1, 0, 1, '参数管理', 'system-param', 'system/systemParamSettings/index', 5, 'sys-tools', 'systemParamSettings', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1615790294169);*/ INSERT INTO `sys_menu` VALUES (8, 0, 0, 1, '数据集', 'dataset', 'dataset/index', 3, '', '/dataset', NULL, b'0', b'0', 'data:read', NULL, NULL, NULL, 1614916684821); INSERT INTO `sys_menu` VALUES (10, 0, 0, 1, '视图', 'view', 'chart/index', 2, '', '/chart', NULL, b'0', b'0', 'chart:read', NULL, NULL, NULL, 1614915491036); -/*INSERT INTO `sys_menu` VALUES (12, 3, 0, 2, '创建菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:add', NULL, NULL, 1614924617327, 1614924617327); -INSERT INTO `sys_menu` VALUES (13, 3, 0, 2, '删除菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:del', NULL, NULL, 1614924667808, 1614924667808); -INSERT INTO `sys_menu` VALUES (14, 3, 0, 2, '编辑菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:edit', NULL, NULL, 1614930734224, 1614936429773);*/ INSERT INTO `sys_menu` VALUES (15, 2, 0, 2, '创建用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:add', NULL, NULL, 1614930862373, 1614930862373); INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:del', NULL, NULL, 1614930903502, 1614930903502); INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529); -/* -INSERT INTO `sys_menu` VALUES (18, 4, 0, 2, '创建组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:add', NULL, NULL, 1614930976297, 1614930976297); -INSERT INTO `sys_menu` VALUES (19, 4, 0, 2, '删除组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:del', NULL, NULL, 1614930997130, 1614930997130); -INSERT INTO `sys_menu` VALUES (20, 4, 0, 2, '编辑组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:edit', NULL, NULL, 1614931022967, 1614931022967); -INSERT INTO `sys_menu` VALUES (21, 5, 0, 2, '创建角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:add', NULL, NULL, 1614931069408, 1614931069408); -INSERT INTO `sys_menu` VALUES (22, 5, 0, 2, '删除角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:del', NULL, NULL, 1614931097720, 1614931097720); -INSERT INTO `sys_menu` VALUES (23, 5, 0, 2, '编辑角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:edit', NULL, NULL, 1614931124782, 1614931124782); - - */ INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537); INSERT INTO `sys_menu` VALUES (25, 34, 0, 2, '删除连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:del', NULL, NULL, 1614931205899, 1614931205899); INSERT INTO `sys_menu` VALUES (26, 34, 0, 2, '编辑连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:edit', NULL, NULL, 1614931234105, 1614931234105); @@ -42,70 +21,70 @@ INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NUL INSERT INTO `sys_menu` VALUES (30, 0, 0, 1, '仪表板', 'panel', 'panel/index', 1, NULL, '/panel', b'0', b'0', b'0', 'panel:read', NULL, NULL, NULL, 1619081449067); INSERT INTO `sys_menu` VALUES (34, 0, 4, 1, '数据源', 'datasource', 'system/datasource/index', 4, NULL, '/datasource', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (35, 1, 0, 1, '用户表单', 'system-user-form', 'system/user/form', 10, '', 'user-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); -/*INSERT INTO `sys_menu` VALUES (36, 1, 0, 1, '菜单表单', 'system-menu-form', 'system/menu/form', 11, '', 'menu-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/ -/*INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', 'system-dept-form', 'system/dept/form', 12, '', 'dept-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/ -/*INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', 'system-role-form', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/ INSERT INTO `sys_menu` VALUES (39, 0, 0, 1, '数据源表单', 'datasource-form', 'system/datasource/form', 5, NULL, '/ds-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (40, 1, 0, 1, '模板管理', 'system-template', 'panel/template/index', 13, 'dashboard', 'panel/template/index', NULL, b'0', b'0', 'template:read', NULL, NULL, NULL, 1620444227389); -/* -INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', 'system-auth', 'system/authority/index', 14, 'password', 'system/authority/index', b'0', b'0', b'0', 'auth:read', NULL, NULL, NULL, 1620447312657); -INSERT INTO `sys_menu` VALUES (42, 1, 0, 1, '插件管理', 'system-plugin', 'system/plugin/index', 15, 'sys-tools', '/plugin', b'0', b'0', b'0', 'plugin:read', NULL, NULL, NULL, NULL); - */ INSERT INTO `sys_menu` VALUES (50, 0, 0, 1, '个人信息', 'person-info', 'system/user/privateForm', 999, NULL, '/person-info', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (51, 0, 0, 1, '重置密码', 'person-pwd-reset', 'system/user/personPwd', 999, NULL, '/person-pwd', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (52, 0, 0, 1, '关于', 'about', 'system/about/index', 16, 'system', '/about', b'0', b'0', b'1', NULL, NULL, NULL, NULL, 1620897406691); COMMIT; BEGIN; -INSERT INTO `sys_user` VALUES (4, 0, 'admin', '管理员', '男', NULL, 'admin@fit2cloud.com', '40b8893ea9ebc2d631c4bb42bb1e8996', b'1', 1, NULL, NULL, NULL, NULL, 1615184951534,'zh_CN'); -INSERT INTO `sys_user` VALUES (19, 25, 'demo', 'demo', '男', NULL, 'demo@fit2cloud.com', '40b8893ea9ebc2d631c4bb42bb1e8996', b'0', 0, NULL, NULL, NULL, 1619086036234, 1619086036234,'zh_CN'); +INSERT INTO `sys_user` VALUES (1, 0, 'admin', '管理员', '男', NULL, 'admin@fit2cloud.com', '40b8893ea9ebc2d631c4bb42bb1e8996', b'1', 1, NULL, NULL, NULL, NULL, 1615184951534, 'zh_CN'); +INSERT INTO `sys_user` VALUES (2, 1, 'demo', 'demo', '男', NULL, 'demo@fit2cloud.com', '40b8893ea9ebc2d631c4bb42bb1e8996', b'0', 1, NULL, NULL, NULL, 1619086036234, 1622533509697, 'zh_CN'); COMMIT; BEGIN; -INSERT INTO `sys_role` VALUES (3, '管理员', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null); -INSERT INTO `sys_role` VALUES (4, '普通员工', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null); +INSERT INTO `sys_role` VALUES (1, '管理员', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null); +INSERT INTO `sys_role` VALUES (2, '普通员工', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null); COMMIT; BEGIN; -INSERT INTO `sys_roles_menus` VALUES (1, 3); -INSERT INTO `sys_roles_menus` VALUES (2, 3); -INSERT INTO `sys_roles_menus` VALUES (3, 3); -INSERT INTO `sys_roles_menus` VALUES (4, 3); -INSERT INTO `sys_roles_menus` VALUES (5, 3); -INSERT INTO `sys_roles_menus` VALUES (6, 3); -INSERT INTO `sys_roles_menus` VALUES (8, 3); -INSERT INTO `sys_roles_menus` VALUES (10, 3); -INSERT INTO `sys_roles_menus` VALUES (11, 3); -INSERT INTO `sys_roles_menus` VALUES (14, 3); -INSERT INTO `sys_roles_menus` VALUES (15, 3); -INSERT INTO `sys_roles_menus` VALUES (16, 3); -INSERT INTO `sys_roles_menus` VALUES (17, 3); -INSERT INTO `sys_roles_menus` VALUES (18, 3); -INSERT INTO `sys_roles_menus` VALUES (19, 3); -INSERT INTO `sys_roles_menus` VALUES (20, 3); -INSERT INTO `sys_roles_menus` VALUES (21, 3); -INSERT INTO `sys_roles_menus` VALUES (22, 3); -INSERT INTO `sys_roles_menus` VALUES (23, 3); -INSERT INTO `sys_roles_menus` VALUES (24, 3); -INSERT INTO `sys_roles_menus` VALUES (25, 3); -INSERT INTO `sys_roles_menus` VALUES (26, 3); -INSERT INTO `sys_roles_menus` VALUES (27, 3); -INSERT INTO `sys_roles_menus` VALUES (28, 3); -INSERT INTO `sys_roles_menus` VALUES (30, 3); -INSERT INTO `sys_roles_menus` VALUES (31, 3); -INSERT INTO `sys_roles_menus` VALUES (32, 3); -INSERT INTO `sys_roles_menus` VALUES (34, 3); -INSERT INTO `sys_roles_menus` VALUES (40, 3); -INSERT INTO `sys_roles_menus` VALUES (41, 3); -INSERT INTO `sys_roles_menus` VALUES (42, 3); -INSERT INTO `sys_roles_menus` VALUES (30, 4); +INSERT INTO `sys_roles_menus` VALUES (1, 1); +INSERT INTO `sys_roles_menus` VALUES (2, 1); +INSERT INTO `sys_roles_menus` VALUES (3, 1); +INSERT INTO `sys_roles_menus` VALUES (4, 1); +INSERT INTO `sys_roles_menus` VALUES (5, 1); +INSERT INTO `sys_roles_menus` VALUES (6, 1); +INSERT INTO `sys_roles_menus` VALUES (8, 1); +INSERT INTO `sys_roles_menus` VALUES (10, 1); +INSERT INTO `sys_roles_menus` VALUES (11, 1); +INSERT INTO `sys_roles_menus` VALUES (14, 1); +INSERT INTO `sys_roles_menus` VALUES (15, 1); +INSERT INTO `sys_roles_menus` VALUES (16, 1); +INSERT INTO `sys_roles_menus` VALUES (17, 1); +INSERT INTO `sys_roles_menus` VALUES (18, 1); +INSERT INTO `sys_roles_menus` VALUES (19, 1); +INSERT INTO `sys_roles_menus` VALUES (20, 1); +INSERT INTO `sys_roles_menus` VALUES (21, 1); +INSERT INTO `sys_roles_menus` VALUES (22, 1); +INSERT INTO `sys_roles_menus` VALUES (23, 1); +INSERT INTO `sys_roles_menus` VALUES (24, 1); +INSERT INTO `sys_roles_menus` VALUES (25, 1); +INSERT INTO `sys_roles_menus` VALUES (26, 1); +INSERT INTO `sys_roles_menus` VALUES (27, 1); +INSERT INTO `sys_roles_menus` VALUES (28, 1); +INSERT INTO `sys_roles_menus` VALUES (30, 1); +INSERT INTO `sys_roles_menus` VALUES (31, 1); +INSERT INTO `sys_roles_menus` VALUES (32, 1); +INSERT INTO `sys_roles_menus` VALUES (34, 1); +INSERT INTO `sys_roles_menus` VALUES (40, 1); +INSERT INTO `sys_roles_menus` VALUES (41, 1); +INSERT INTO `sys_roles_menus` VALUES (42, 1); +INSERT INTO `sys_roles_menus` VALUES (8, 2); +INSERT INTO `sys_roles_menus` VALUES (10, 2); +INSERT INTO `sys_roles_menus` VALUES (24, 2); +INSERT INTO `sys_roles_menus` VALUES (25, 2); +INSERT INTO `sys_roles_menus` VALUES (26, 2); +INSERT INTO `sys_roles_menus` VALUES (27, 2); +INSERT INTO `sys_roles_menus` VALUES (30, 2); +INSERT INTO `sys_roles_menus` VALUES (34, 2); COMMIT; BEGIN; -INSERT INTO `sys_users_roles` VALUES (4, 3); -INSERT INTO `sys_users_roles` VALUES (19, 4); +INSERT INTO `sys_users_roles` VALUES (1, 1); +INSERT INTO `sys_users_roles` VALUES (2, 2); COMMIT; INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.favicon', NULL, 'file', 6); diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 203f0e05b9..690683ae65 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -692,7 +692,18 @@ export default { chart_pie_rose: 'Rose Pie', chart_funnel: 'Funnel', chart_radar: 'Radar', - chart_gauge: 'Gauge' + chart_gauge: 'Gauge', + dateStyle: '日期顯示', + datePattern: '日期格式', + y: 'Year', + y_M: 'Year Month', + y_M_d: 'Year Month Day', + H_m_s: 'Hour Minute Second', + y_M_d_H_m: 'Year Month Day Hour Minute', + y_M_d_H_m_s: 'Year Month Day Hour Minute Second', + date_sub: 'yyyy-MM-dd', + date_split: 'yyyy/MM/dd', + chartName: 'New Chart' }, dataset: { sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 8f98524d29..12b90b152c 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -692,7 +692,18 @@ export default { chart_pie_rose: '南丁格爾玫瑰圖', chart_funnel: '漏鬥圖', chart_radar: '雷達圖', - chart_gauge: '儀表盤' + chart_gauge: '儀表盤', + dateStyle: '日期顯示', + datePattern: '日期格式', + y: '年', + y_M: '年月', + y_M_d: '年月日', + H_m_s: '時分秒', + y_M_d_H_m: '年月日時分', + y_M_d_H_m_s: '年月日時分秒', + date_sub: 'yyyy-MM-dd', + date_split: 'yyyy/MM/dd', + chartName: '新建視圖' }, dataset: { sheet_warn: '有多個sheet頁面,默認抽取第一個', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 0d821fab25..2dc5383712 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -692,7 +692,18 @@ export default { chart_pie_rose: '南丁格尔玫瑰图', chart_funnel: '漏斗图', chart_radar: '雷达图', - chart_gauge: '仪表盘' + chart_gauge: '仪表盘', + dateStyle: '日期显示', + datePattern: '日期格式', + y: '年', + y_M: '年月', + y_M_d: '年月日', + H_m_s: '时分秒', + y_M_d_H_m: '年月日时分', + y_M_d_H_m_s: '年月日时分秒', + date_sub: 'yyyy-MM-dd', + date_split: 'yyyy/MM/dd', + chartName: '新建视图' }, dataset: { sheet_warn: '有多个Sheet页,默认抽取第一个', diff --git a/frontend/src/layout/components/Licbar.vue b/frontend/src/layout/components/Licbar.vue index e18e473f6a..96ffb1873c 100644 --- a/frontend/src/layout/components/Licbar.vue +++ b/frontend/src/layout/components/Licbar.vue @@ -1,5 +1,5 @@ @@ -20,9 +20,12 @@ export default { theme() { return this.$store.state.settings.theme }, - licstatus() { + licValidate() { return this.$store.state.lic.validate }, + licStatus() { + return this.$store.state.lic.licStatus || '' + }, licMsg() { return this.$store.state.lic.licMsg ? ('license.' + this.$store.state.lic.licMsg) : null } diff --git a/frontend/src/permission.js b/frontend/src/permission.js index 309e89e800..2fae911066 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -152,12 +152,8 @@ const hasPermission = (router, user_permissions) => { } return true } -const xpackMenuNames = ['system-param', 'system-plugin'] const filterLic = (router) => { - if (xpackMenuNames.some(name => name === router.name) && !store.getters.validate) { - return false - } - return true + return !router.isPlugin || store.getters.validate } router.afterEach(() => { // finish progress bar diff --git a/frontend/src/store/modules/lic.js b/frontend/src/store/modules/lic.js index e3380eb4ba..96aaa420d0 100644 --- a/frontend/src/store/modules/lic.js +++ b/frontend/src/store/modules/lic.js @@ -1,6 +1,7 @@ import { validateLic } from '@/api/system/lic' const state = { validate: true, + licStatus: null, licMsg: null } @@ -10,6 +11,9 @@ const mutations = { }, SET_LIC_MSG: (state, msg) => { state.licMsg = msg + }, + SET_LIC_STATUS: (state, data) => { + state.licStatus = data } } @@ -22,8 +26,15 @@ const actions = { return new Promise((resolve, reject) => { validateLic().then(response => { const { data } = response - commit('SET_VALIDATE', true) - commit('SET_LIC_MSG', null) + if (data && data.status && data.status === 'no_record') { + commit('SET_VALIDATE', false) + commit('SET_LIC_MSG', data.message) + commit('SET_LIC_STATUS', data.status) + } else { + commit('SET_VALIDATE', true) + commit('SET_LIC_MSG', null) + } + resolve(data) }).catch(error => { commit('SET_VALIDATE', false) diff --git a/frontend/src/views/chart/components/drag-item/DimensionItem.vue b/frontend/src/views/chart/components/drag-item/DimensionItem.vue index 1c07723b81..6e9d770323 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionItem.vue @@ -26,6 +26,44 @@ {{ $t('chart.filter') }}... + + + + + + + {{ $t('chart.dateStyle') }} + ({{ $t('chart.'+item.dateStyle) }}) + + + + + {{ $t('chart.y') }} + {{ $t('chart.y_M') }} + {{ $t('chart.y_M_d') }} + {{ $t('chart.H_m_s') }} + {{ $t('chart.y_M_d_H_m') }} + {{ $t('chart.y_M_d_H_m_s') }} + + + + + + + + + {{ $t('chart.datePattern') }} + ({{ $t('chart.'+item.datePattern) }}) + + + + + {{ $t('chart.date_sub') }}(1990-01-01) + {{ $t('chart.date_split') }}(1990/01/01) + + + + {{ $t('chart.show_name_set') }} @@ -91,6 +129,26 @@ export default { type: type } }, + dateStyle(param) { + // console.log(param) + this.item.dateStyle = param.type + this.$emit('onDimensionItemChange', this.item) + }, + beforeDateStyle(type) { + return { + type: type + } + }, + datePattern(param) { + // console.log(param) + this.item.datePattern = param.type + this.$emit('onDimensionItemChange', this.item) + }, + beforeDatePattern(type) { + return { + type: type + } + }, editFilter() { this.item.index = this.index this.$emit('editItemFilter', this.item) @@ -129,4 +187,16 @@ export default { span { font-size: 12px; } + + .summary-span{ + margin-left: 4px; + color: #878d9f;; + } + + .inner-dropdown-menu{ + display: flex; + justify-content: space-between; + align-items: center; + width: 100% + } diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index d425abcd65..6e37a985d6 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -275,7 +275,7 @@ export default { selectTableFlag: false, table: {}, tables: [], - chartName: '' + chartName: this.$t('chart.chartName') } }, computed: { diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 200c90dae6..6b49d78479 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -469,6 +469,12 @@ export default { // if (!ele.summary || ele.summary === '') { // ele.summary = 'sum' // } + if (!ele.dateStyle || ele.dateStyle === '') { + ele.dateStyle = 'y_M_d' + } + if (!ele.datePattern || ele.datePattern === '') { + ele.datePattern = 'date_sub' + } if (!ele.sort || ele.sort === '') { ele.sort = 'none' } diff --git a/frontend/src/views/dataset/common/DatasetGroupSelector.vue b/frontend/src/views/dataset/common/DatasetGroupSelector.vue index 6027df0e8c..2f3e06d6bc 100644 --- a/frontend/src/views/dataset/common/DatasetGroupSelector.vue +++ b/frontend/src/views/dataset/common/DatasetGroupSelector.vue @@ -1,7 +1,7 @@