| | |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MySql --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle.database.jdbc</groupId> |
| | | <artifactId>ojdbc8</artifactId> |
| | | </dependency> |
| | | <!-- PostgreSql --> |
| | | <dependency> |
| | | <groupId>org.postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | </dependency> |
| | | <!-- SqlServer --> |
| | | <dependency> |
| | | <groupId>com.microsoft.sqlserver</groupId> |
| | | <artifactId>mssql-jdbc</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | import com.ruoyi.generator.service.IGenTableColumnService; |
| | | import com.ruoyi.generator.service.IGenTableService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public class GenController extends BaseController { |
| | | |
| | | private final IGenTableService genTableService; |
| | | private final IGenTableColumnService genTableColumnService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä»£ç çæå表 |
| | |
| | | public R<Map<String, Object>> getInfo(@PathVariable Long talbleId) { |
| | | GenTable table = genTableService.selectGenTableById(talbleId); |
| | | List<GenTable> tables = genTableService.selectGenTableAll(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); |
| | | List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(talbleId); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("info", table); |
| | | map.put("rows", list); |
| | |
| | | @GetMapping(value = "/column/{talbleId}") |
| | | public TableDataInfo<GenTableColumn> columnList(Long tableId) { |
| | | TableDataInfo<GenTableColumn> dataInfo = new TableDataInfo<>(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); |
| | | List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(tableId); |
| | | dataInfo.setRows(list); |
| | | dataInfo.setTotal(list.size()); |
| | | return dataInfo; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.generator.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.ruoyi.common.core.mapper.BaseMapperPlus; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä¸å¡å段 æ°æ®å± |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @InterceptorIgnore(dataPermission = "true") |
| | | public interface OracleGenTableColumnMapper extends BaseMapperPlus<OracleGenTableColumnMapper, GenTableColumn, GenTableColumn> { |
| | | /** |
| | | * æ ¹æ®è¡¨åç§°æ¥è¯¢åä¿¡æ¯ |
| | | * |
| | | * @param tableName 表åç§° |
| | | * @return åä¿¡æ¯ |
| | | */ |
| | | List<GenTableColumn> selectDbTableColumnsByName(String tableName); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.generator.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.mapper.BaseMapperPlus; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä¸å¡ æ°æ®å± |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @InterceptorIgnore(dataPermission = "true") |
| | | public interface OracleGenTableMapper extends BaseMapperPlus<OracleGenTableMapper, GenTable, GenTable> { |
| | | |
| | | Page<GenTable> selectPageDbTableList(@Param("page") Page<GenTable> page, @Param(Constants.WRAPPER) Wrapper<Object> queryWrapper); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | List<GenTable> selectDbTableList(@Param(Constants.WRAPPER) Wrapper<Object> queryWrapper); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param tableNames 表åç§°ç» |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | List<GenTable> selectGenTableAll(); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨IDä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸å¡ID |
| | | * @return ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | GenTable selectGenTableById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨åç§°ä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param tableName 表åç§° |
| | | * @return ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | GenTable selectGenTableByName(String tableName); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.generator.service; |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.lang.Dict; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.JsonUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | import com.ruoyi.generator.util.VelocityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.sql.DatabaseMetaData; |
| | | import java.sql.SQLException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * ä¸å¡ æå¡å±å®ç° |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @DS("#header.datasource") |
| | | @Primary |
| | | @Service |
| | | public class BaseGenTableServiceImpl implements IGenTableService { |
| | | |
| | | @Autowired |
| | | private DataSource dataSource; |
| | | |
| | | public BaseGenTableServiceImpl getService() { |
| | | DynamicRoutingDataSource ds = (DynamicRoutingDataSource) this.dataSource; |
| | | DataSource dataSource = ds.determineDataSource(); |
| | | try { |
| | | DatabaseMetaData metaData = dataSource.getConnection().getMetaData(); |
| | | String databaseProductName = metaData.getDatabaseProductName(); |
| | | if ("MySQL".equals(databaseProductName)) { |
| | | return SpringUtils.getBean(GenTableServiceImpl.class); |
| | | } else if ("Oracle".equals(databaseProductName)) { |
| | | return SpringUtils.getBean(OracleGenTableServiceImpl.class); |
| | | } else if ("PostgreSQL".equals(databaseProductName)) { |
| | | |
| | | } else if ("Microsoft SQL Server".equals(databaseProductName)) { |
| | | |
| | | } else { |
| | | throw new ServiceException("å½åæ°æ®åºç±»å䏿¯æ => " + databaseProductName); |
| | | } |
| | | } catch (SQLException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å段å表 |
| | | * |
| | | * @param tableId ä¸å¡å段ç¼å· |
| | | * @return ä¸å¡å段éå |
| | | */ |
| | | @Override |
| | | public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { |
| | | return getService().selectGenTableColumnListByTableId(tableId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸å¡ID |
| | | * @return ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public GenTable selectGenTableById(Long id) { |
| | | return getService().selectGenTableById(id); |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) { |
| | | return getService().selectPageGenTableList(genTable, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å表 |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return ä¸å¡éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectGenTableList(GenTable genTable) { |
| | | return getService().selectGenTableList(genTable); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery){ |
| | | return getService().selectPageDbTableList(genTable, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectDbTableList(GenTable genTable) { |
| | | return getService().selectDbTableList(genTable); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param tableNames 表åç§°ç» |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames) { |
| | | return getService().selectDbTableListByNames(tableNames); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectGenTableAll() { |
| | | return getService().selectGenTableAll(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸å¡ |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public void updateGenTable(GenTable genTable) { |
| | | getService().updateGenTable(genTable); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸å¡å¯¹è±¡ |
| | | * |
| | | * @param tableIds éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public void deleteGenTableByIds(Long[] tableIds) { |
| | | getService().deleteGenTableByIds(tableIds); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥è¡¨ç»æ |
| | | * |
| | | * @param tableList 导å
¥è¡¨å表 |
| | | */ |
| | | @Override |
| | | public void importGenTable(List<GenTable> tableList) { |
| | | getService().importGenTable(tableList); |
| | | } |
| | | |
| | | /** |
| | | * é¢è§ä»£ç |
| | | * |
| | | * @param tableId 表ç¼å· |
| | | * @return é¢è§æ°æ®å表 |
| | | */ |
| | | @Override |
| | | public Map<String, String> previewCode(Long tableId) { |
| | | return getService().previewCode(tableId); |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼ä¸è½½æ¹å¼ï¼ |
| | | * |
| | | * @param tableName 表åç§° |
| | | * @return æ°æ® |
| | | */ |
| | | @Override |
| | | public byte[] downloadCode(String tableName) { |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | ZipOutputStream zip = new ZipOutputStream(outputStream); |
| | | generatorCode(tableName, zip); |
| | | IoUtil.close(zip); |
| | | return outputStream.toByteArray(); |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼ |
| | | * |
| | | * @param tableName 表åç§° |
| | | */ |
| | | @Override |
| | | public void generatorCode(String tableName) { |
| | | getService().generatorCode(tableName); |
| | | } |
| | | |
| | | /** |
| | | * åæ¥æ°æ®åº |
| | | * |
| | | * @param tableName 表åç§° |
| | | */ |
| | | @Override |
| | | public void synchDb(String tableName) { |
| | | getService().synchDb(tableName); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éçæä»£ç ï¼ä¸è½½æ¹å¼ï¼ |
| | | * |
| | | * @param tableNames 表æ°ç» |
| | | * @return æ°æ® |
| | | */ |
| | | @Override |
| | | public byte[] downloadCode(String[] tableNames) { |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | ZipOutputStream zip = new ZipOutputStream(outputStream); |
| | | for (String tableName : tableNames) { |
| | | generatorCode(tableName, zip); |
| | | } |
| | | IoUtil.close(zip); |
| | | return outputStream.toByteArray(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨ä¿¡æ¯å¹¶çæä»£ç |
| | | */ |
| | | public void generatorCode(String tableName, ZipOutputStream zip) { |
| | | getService().generatorCode(tableName, zip); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååæ°æ ¡éª |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public void validateEdit(GenTable genTable) { |
| | | if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { |
| | | String options = JsonUtils.toJsonString(genTable.getParams()); |
| | | Dict paramsObj = JsonUtils.parseMap(options); |
| | | if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_CODE))) { |
| | | throw new ServiceException("æ ç¼ç åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_PARENT_CODE))) { |
| | | throw new ServiceException("æ ç¶ç¼ç åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_NAME))) { |
| | | throw new ServiceException("æ åç§°åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { |
| | | if (StringUtils.isEmpty(genTable.getSubTableName())) { |
| | | throw new ServiceException("å
³èå表ç表åä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) { |
| | | throw new ServiceException("å表å
³èçå¤é®åä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置主é®åä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | */ |
| | | public void setPkColumn(GenTable table) { |
| | | for (GenTableColumn column : table.getColumns()) { |
| | | if (column.isPk()) { |
| | | table.setPkColumn(column); |
| | | break; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNull(table.getPkColumn())) { |
| | | table.setPkColumn(table.getColumns().get(0)); |
| | | } |
| | | if (GenConstants.TPL_SUB.equals(table.getTplCategory())) { |
| | | for (GenTableColumn column : table.getSubTable().getColumns()) { |
| | | if (column.isPk()) { |
| | | table.getSubTable().setPkColumn(column); |
| | | break; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNull(table.getSubTable().getPkColumn())) { |
| | | table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置代ç çæå
¶ä»éé¡¹å¼ |
| | | * |
| | | * @param genTable 设置åççæå¯¹è±¡ |
| | | */ |
| | | public void setTableFromOptions(GenTable genTable) { |
| | | Dict paramsObj = JsonUtils.parseMap(genTable.getOptions()); |
| | | if (ObjectUtil.isNotNull(paramsObj)) { |
| | | String treeCode = paramsObj.getStr(GenConstants.TREE_CODE); |
| | | String treeParentCode = paramsObj.getStr(GenConstants.TREE_PARENT_CODE); |
| | | String treeName = paramsObj.getStr(GenConstants.TREE_NAME); |
| | | String parentMenuId = paramsObj.getStr(GenConstants.PARENT_MENU_ID); |
| | | String parentMenuName = paramsObj.getStr(GenConstants.PARENT_MENU_NAME); |
| | | |
| | | genTable.setTreeCode(treeCode); |
| | | genTable.setTreeParentCode(treeParentCode); |
| | | genTable.setTreeName(treeName); |
| | | genTable.setParentMenuId(parentMenuId); |
| | | genTable.setParentMenuName(parentMenuName); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å代ç çæå°å |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | * @param template æ¨¡æ¿æä»¶è·¯å¾ |
| | | * @return çæå°å |
| | | */ |
| | | public static String getGenPath(GenTable table, String template) { |
| | | String genPath = table.getGenPath(); |
| | | if (StringUtils.equals(genPath, "/")) { |
| | | return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); |
| | | } |
| | | return genPath + File.separator + VelocityUtils.getFileName(template, table); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.lang.Dict; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | |
| | | import org.apache.velocity.VelocityContext; |
| | | import org.apache.velocity.app.Velocity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.StringWriter; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class GenTableServiceImpl implements IGenTableService { |
| | | public class GenTableServiceImpl extends BaseGenTableServiceImpl { |
| | | |
| | | private final GenTableMapper baseMapper; |
| | | private final GenTableColumnMapper genTableColumnMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å段å表 |
| | | * |
| | | * @param tableId ä¸å¡å段ç¼å· |
| | | * @return ä¸å¡å段éå |
| | | */ |
| | | @Override |
| | | public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { |
| | | return genTableColumnMapper.selectList(new LambdaQueryWrapper<GenTableColumn>() |
| | | .eq(GenTableColumn::getTableId, tableId) |
| | | .orderByAsc(GenTableColumn::getSort)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡ä¿¡æ¯ |
| | |
| | | Map<String, Object> params = genTable.getParams(); |
| | | QueryWrapper<Object> wrapper = Wrappers.query(); |
| | | wrapper.apply("table_schema = (select database())") |
| | | .notLike("table_name", "xxl_job_%") |
| | | .notLike("table_name", "gen_%") |
| | | .notLike("table_name", "xxl_job_") |
| | | .notLike("table_name", "gen_") |
| | | .notInSql("table_name", "select table_name from gen_table") |
| | | .like(StringUtils.isNotBlank(genTable.getTableName()), "lower(table_name)", StringUtils.lowerCase(genTable.getTableName())) |
| | | .like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment())) |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateGenTable(GenTable genTable) { |
| | | String options = JsonUtils.toJsonString(genTable.getParams()); |
| | | genTable.setOptions(options); |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteGenTableByIds(Long[] tableIds) { |
| | | List<Long> ids = Arrays.asList(tableIds); |
| | | baseMapper.deleteBatchIds(ids); |
| | |
| | | * @param tableList 导å
¥è¡¨å表 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importGenTable(List<GenTable> tableList) { |
| | | String operName = LoginHelper.getUsername(); |
| | | try { |
| | |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼ä¸è½½æ¹å¼ï¼ |
| | | * |
| | | * @param tableName 表åç§° |
| | | * @return æ°æ® |
| | | */ |
| | | @Override |
| | | public byte[] downloadCode(String tableName) { |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | ZipOutputStream zip = new ZipOutputStream(outputStream); |
| | | generatorCode(tableName, zip); |
| | | IoUtil.close(zip); |
| | | return outputStream.toByteArray(); |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼ |
| | | * |
| | | * @param tableName 表åç§° |
| | |
| | | * @param tableName 表åç§° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void synchDb(String tableName) { |
| | | GenTable table = baseMapper.selectGenTableByName(tableName); |
| | | List<GenTableColumn> tableColumns = table.getColumns(); |
| | |
| | | column.setQueryType(prevColumn.getQueryType()); |
| | | } |
| | | if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() |
| | | && (column.isInsert() || column.isEdit()) |
| | | && ((column.isUsableColumn()) || (!column.isSuperColumn()))) |
| | | { |
| | | && (column.isInsert() || column.isEdit()) |
| | | && ((column.isUsableColumn()) || (!column.isSuperColumn()))) { |
| | | // 妿æ¯(æ°å¢/ä¿®æ¹&é主é®/é忽ç¥åç¶å±æ§)ï¼ç»§ç»ä¿çå¿
å¡«/æ¾ç¤ºç±»åé项 |
| | | column.setIsRequired(prevColumn.getIsRequired()); |
| | | column.setHtmlType(prevColumn.getHtmlType()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¹éçæä»£ç ï¼ä¸è½½æ¹å¼ï¼ |
| | | * |
| | | * @param tableNames 表æ°ç» |
| | | * @return æ°æ® |
| | | */ |
| | | @Override |
| | | public byte[] downloadCode(String[] tableNames) { |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | ZipOutputStream zip = new ZipOutputStream(outputStream); |
| | | for (String tableName : tableNames) { |
| | | generatorCode(tableName, zip); |
| | | } |
| | | IoUtil.close(zip); |
| | | return outputStream.toByteArray(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨ä¿¡æ¯å¹¶çæä»£ç |
| | | */ |
| | | private void generatorCode(String tableName, ZipOutputStream zip) { |
| | | @Override |
| | | public void generatorCode(String tableName, ZipOutputStream zip) { |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = baseMapper.selectGenTableByName(tableName); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååæ°æ ¡éª |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public void validateEdit(GenTable genTable) { |
| | | if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { |
| | | String options = JsonUtils.toJsonString(genTable.getParams()); |
| | | Dict paramsObj = JsonUtils.parseMap(options); |
| | | if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_CODE))) { |
| | | throw new ServiceException("æ ç¼ç åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_PARENT_CODE))) { |
| | | throw new ServiceException("æ ç¶ç¼ç åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(paramsObj.getStr(GenConstants.TREE_NAME))) { |
| | | throw new ServiceException("æ åç§°åæ®µä¸è½ä¸ºç©º"); |
| | | } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { |
| | | if (StringUtils.isEmpty(genTable.getSubTableName())) { |
| | | throw new ServiceException("å
³èå表ç表åä¸è½ä¸ºç©º"); |
| | | } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) { |
| | | throw new ServiceException("å表å
³èçå¤é®åä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置主é®åä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | */ |
| | | public void setPkColumn(GenTable table) { |
| | | for (GenTableColumn column : table.getColumns()) { |
| | | if (column.isPk()) { |
| | | table.setPkColumn(column); |
| | | break; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNull(table.getPkColumn())) { |
| | | table.setPkColumn(table.getColumns().get(0)); |
| | | } |
| | | if (GenConstants.TPL_SUB.equals(table.getTplCategory())) { |
| | | for (GenTableColumn column : table.getSubTable().getColumns()) { |
| | | if (column.isPk()) { |
| | | table.getSubTable().setPkColumn(column); |
| | | break; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNull(table.getSubTable().getPkColumn())) { |
| | | table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置主åè¡¨ä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置代ç çæå
¶ä»éé¡¹å¼ |
| | | * |
| | | * @param genTable 设置åççæå¯¹è±¡ |
| | | */ |
| | | public void setTableFromOptions(GenTable genTable) { |
| | | Dict paramsObj = JsonUtils.parseMap(genTable.getOptions()); |
| | | if (ObjectUtil.isNotNull(paramsObj)) { |
| | | String treeCode = paramsObj.getStr(GenConstants.TREE_CODE); |
| | | String treeParentCode = paramsObj.getStr(GenConstants.TREE_PARENT_CODE); |
| | | String treeName = paramsObj.getStr(GenConstants.TREE_NAME); |
| | | String parentMenuId = paramsObj.getStr(GenConstants.PARENT_MENU_ID); |
| | | String parentMenuName = paramsObj.getStr(GenConstants.PARENT_MENU_NAME); |
| | | |
| | | genTable.setTreeCode(treeCode); |
| | | genTable.setTreeParentCode(treeParentCode); |
| | | genTable.setTreeName(treeName); |
| | | genTable.setParentMenuId(parentMenuId); |
| | | genTable.setParentMenuName(parentMenuName); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å代ç çæå°å |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | * @param template æ¨¡æ¿æä»¶è·¯å¾ |
| | | * @return çæå°å |
| | | */ |
| | | public static String getGenPath(GenTable table, String template) { |
| | | String genPath = table.getGenPath(); |
| | | if (StringUtils.equals(genPath, "/")) { |
| | | return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); |
| | | } |
| | | return genPath + File.separator + VelocityUtils.getFileName(template, table); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | public interface IGenTableService { |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å段å表 |
| | | * |
| | | * @param tableId ä¸å¡å段ç¼å· |
| | | * @return ä¸å¡å段éå |
| | | */ |
| | | List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); |
| | | |
| | | |
| | | TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery); |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.generator.service; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.helper.LoginHelper; |
| | | import com.ruoyi.common.utils.JsonUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | import com.ruoyi.generator.mapper.OracleGenTableColumnMapper; |
| | | import com.ruoyi.generator.mapper.OracleGenTableMapper; |
| | | import com.ruoyi.generator.util.GenUtils; |
| | | import com.ruoyi.generator.util.VelocityInitializer; |
| | | import com.ruoyi.generator.util.VelocityUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.velocity.Template; |
| | | import org.apache.velocity.VelocityContext; |
| | | import org.apache.velocity.app.Velocity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.StringWriter; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * ä¸å¡ æå¡å±å®ç° |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class OracleGenTableServiceImpl extends BaseGenTableServiceImpl { |
| | | |
| | | private final OracleGenTableMapper baseMapper; |
| | | private final OracleGenTableColumnMapper genTableColumnMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å段å表 |
| | | * |
| | | * @param tableId ä¸å¡å段ç¼å· |
| | | * @return ä¸å¡å段éå |
| | | */ |
| | | @Override |
| | | public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { |
| | | return genTableColumnMapper.selectList(new LambdaQueryWrapper<GenTableColumn>() |
| | | .eq(GenTableColumn::getTableId, tableId) |
| | | .orderByAsc(GenTableColumn::getSort)); |
| | | } |
| | | /** |
| | | * æ¥è¯¢ä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸å¡ID |
| | | * @return ä¸å¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public GenTable selectGenTableById(Long id) { |
| | | GenTable genTable = baseMapper.selectGenTableById(id); |
| | | setTableFromOptions(genTable); |
| | | return genTable; |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) { |
| | | Page<GenTable> page = baseMapper.selectPage(pageQuery.build(), this.buildGenTableQueryWrapper(genTable)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å表 |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return ä¸å¡éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectGenTableList(GenTable genTable) { |
| | | return baseMapper.selectList(this.buildGenTableQueryWrapper(genTable)); |
| | | } |
| | | |
| | | private QueryWrapper<GenTable> buildGenTableQueryWrapper(GenTable genTable) { |
| | | Map<String, Object> params = genTable.getParams(); |
| | | QueryWrapper<GenTable> wrapper = Wrappers.query(); |
| | | wrapper.like(StringUtils.isNotBlank(genTable.getTableName()), "lower(table_name)", StringUtils.lowerCase(genTable.getTableName())) |
| | | .like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment())) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | "create_time", params.get("beginTime"), params.get("endTime")); |
| | | return wrapper; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) { |
| | | Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), this.buildDbTableQueryWrapper(genTable)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectDbTableList(GenTable genTable) { |
| | | return baseMapper.selectDbTableList(this.buildDbTableQueryWrapper(genTable)); |
| | | } |
| | | |
| | | private Wrapper<Object> buildDbTableQueryWrapper(GenTable genTable) { |
| | | Map<String, Object> params = genTable.getParams(); |
| | | QueryWrapper<Object> wrapper = Wrappers.query(); |
| | | wrapper.apply("dt.table_name = dtc.table_name") |
| | | .apply("dt.table_name = uo.object_name") |
| | | .eq("uo.object_type ", "TABLE") |
| | | .notLike("dt.table_name", "XXL_JOB_") |
| | | .notLike("dt.table_name", "GEN_") |
| | | .notInSql("lower(dt.table_name)", "select table_name from gen_table") |
| | | .like(StringUtils.isNotBlank(genTable.getTableName()), "lower(dt.table_name)", StringUtils.lowerCase(genTable.getTableName())) |
| | | .like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(dt.table_comment)", StringUtils.lowerCase(genTable.getTableComment())) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | "create_time", params.get("beginTime"), params.get("endTime")) |
| | | .orderByDesc("create_time"); |
| | | return wrapper; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ®åºå表 |
| | | * |
| | | * @param tableNames 表åç§°ç» |
| | | * @return æ°æ®åºè¡¨éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames) { |
| | | return baseMapper.selectDbTableListByNames(tableNames); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectGenTableAll() { |
| | | return baseMapper.selectGenTableAll(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸å¡ |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public void updateGenTable(GenTable genTable) { |
| | | String options = JsonUtils.toJsonString(genTable.getParams()); |
| | | genTable.setOptions(options); |
| | | int row = baseMapper.updateById(genTable); |
| | | if (row > 0) { |
| | | for (GenTableColumn cenTableColumn : genTable.getColumns()) { |
| | | genTableColumnMapper.updateById(cenTableColumn); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸å¡å¯¹è±¡ |
| | | * |
| | | * @param tableIds éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public void deleteGenTableByIds(Long[] tableIds) { |
| | | List<Long> ids = Arrays.asList(tableIds); |
| | | baseMapper.deleteBatchIds(ids); |
| | | genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids)); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥è¡¨ç»æ |
| | | * |
| | | * @param tableList 导å
¥è¡¨å表 |
| | | */ |
| | | @Override |
| | | public void importGenTable(List<GenTable> tableList) { |
| | | String operName = LoginHelper.getUsername(); |
| | | try { |
| | | for (GenTable table : tableList) { |
| | | String tableName = table.getTableName(); |
| | | GenUtils.initTable(table, operName); |
| | | int row = baseMapper.insert(table); |
| | | if (row > 0) { |
| | | // ä¿ååä¿¡æ¯ |
| | | List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | for (GenTableColumn column : genTableColumns) { |
| | | GenUtils.initColumnField(column, table); |
| | | saveColumns.add(column); |
| | | } |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertBatch(saveColumns); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("导å
¥å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * é¢è§ä»£ç |
| | | * |
| | | * @param tableId 表ç¼å· |
| | | * @return é¢è§æ°æ®å表 |
| | | */ |
| | | @Override |
| | | public Map<String, String> previewCode(Long tableId) { |
| | | Map<String, String> dataMap = new LinkedHashMap<>(); |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = baseMapper.selectGenTableById(tableId); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | | VelocityContext context = VelocityUtils.prepareContext(table); |
| | | |
| | | // è·å模æ¿å表 |
| | | List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); |
| | | for (String template : templates) { |
| | | // æ¸²ææ¨¡æ¿ |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | | tpl.merge(context, sw); |
| | | dataMap.put(template, sw.toString()); |
| | | } |
| | | return dataMap; |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼ |
| | | * |
| | | * @param tableName 表åç§° |
| | | */ |
| | | @Override |
| | | public void generatorCode(String tableName) { |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = baseMapper.selectGenTableByName(tableName); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | | VelocityContext context = VelocityUtils.prepareContext(table); |
| | | |
| | | // è·å模æ¿å表 |
| | | List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); |
| | | for (String template : templates) { |
| | | if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) { |
| | | // æ¸²ææ¨¡æ¿ |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | | tpl.merge(context, sw); |
| | | try { |
| | | String path = getGenPath(table, template); |
| | | FileUtils.writeUtf8String(sw.toString(), path); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("æ¸²ææ¨¡æ¿å¤±è´¥ï¼è¡¨åï¼" + table.getTableName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ¥æ°æ®åº |
| | | * |
| | | * @param tableName 表åç§° |
| | | */ |
| | | @Override |
| | | public void synchDb(String tableName) { |
| | | GenTable table = baseMapper.selectGenTableByName(tableName); |
| | | List<GenTableColumn> tableColumns = table.getColumns(); |
| | | Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity())); |
| | | |
| | | List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | if (CollUtil.isEmpty(dbTableColumns)) { |
| | | throw new ServiceException("åæ¥æ°æ®å¤±è´¥ï¼åè¡¨ç»æä¸åå¨"); |
| | | } |
| | | List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); |
| | | |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | dbTableColumns.forEach(column -> { |
| | | GenUtils.initColumnField(column, table); |
| | | if (tableColumnMap.containsKey(column.getColumnName())) { |
| | | GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName()); |
| | | column.setColumnId(prevColumn.getColumnId()); |
| | | if (column.isList()) { |
| | | // 妿æ¯å表ï¼ç»§ç»ä¿çæ¥è¯¢æ¹å¼/åå
¸ç±»åé项 |
| | | column.setDictType(prevColumn.getDictType()); |
| | | column.setQueryType(prevColumn.getQueryType()); |
| | | } |
| | | if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() |
| | | && (column.isInsert() || column.isEdit()) |
| | | && ((column.isUsableColumn()) || (!column.isSuperColumn()))) |
| | | { |
| | | // 妿æ¯(æ°å¢/ä¿®æ¹&é主é®/é忽ç¥åç¶å±æ§)ï¼ç»§ç»ä¿çå¿
å¡«/æ¾ç¤ºç±»åé项 |
| | | column.setIsRequired(prevColumn.getIsRequired()); |
| | | column.setHtmlType(prevColumn.getHtmlType()); |
| | | } |
| | | genTableColumnMapper.updateById(column); |
| | | } else { |
| | | genTableColumnMapper.insert(column); |
| | | } |
| | | }); |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertBatch(saveColumns); |
| | | } |
| | | |
| | | List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(delColumns)) { |
| | | List<Long> ids = delColumns.stream().map(GenTableColumn::getColumnId).collect(Collectors.toList()); |
| | | genTableColumnMapper.deleteBatchIds(ids); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨ä¿¡æ¯å¹¶çæä»£ç |
| | | */ |
| | | @Override |
| | | public void generatorCode(String tableName, ZipOutputStream zip) { |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = baseMapper.selectGenTableByName(tableName); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | | VelocityContext context = VelocityUtils.prepareContext(table); |
| | | |
| | | // è·å模æ¿å表 |
| | | List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); |
| | | for (String template : templates) { |
| | | // æ¸²ææ¨¡æ¿ |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | | tpl.merge(context, sw); |
| | | try { |
| | | // æ·»å å°zip |
| | | zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); |
| | | IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString()); |
| | | IoUtil.close(sw); |
| | | zip.flush(); |
| | | zip.closeEntry(); |
| | | } catch (IOException e) { |
| | | log.error("æ¸²ææ¨¡æ¿å¤±è´¥ï¼è¡¨åï¼" + table.getTableName(), e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置主åè¡¨ä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | */ |
| | | public void setSubTable(GenTable table) { |
| | | String subTableName = table.getSubTableName(); |
| | | if (StringUtils.isNotEmpty(subTableName)) { |
| | | table.setSubTable(baseMapper.selectGenTableByName(subTableName)); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.generator.mapper.OracleGenTableColumnMapper"> |
| | | |
| | | <resultMap type="GenTableColumn" id="GenTableColumnResult"> |
| | | <id property="columnId" column="column_id" /> |
| | | <result property="tableId" column="table_id" /> |
| | | <result property="columnName" column="column_name" /> |
| | | <result property="columnComment" column="column_comment" /> |
| | | <result property="columnType" column="column_type" /> |
| | | <result property="javaType" column="java_type" /> |
| | | <result property="javaField" column="java_field" /> |
| | | <result property="isPk" column="is_pk" /> |
| | | <result property="isIncrement" column="is_increment" /> |
| | | <result property="isRequired" column="is_required" /> |
| | | <result property="isInsert" column="is_insert" /> |
| | | <result property="isEdit" column="is_edit" /> |
| | | <result property="isList" column="is_list" /> |
| | | <result property="isQuery" column="is_query" /> |
| | | <result property="queryType" column="query_type" /> |
| | | <result property="htmlType" column="html_type" /> |
| | | <result property="dictType" column="dict_type" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> |
| | | select lower(temp.column_name) as column_name, |
| | | (case when (temp.nullable = 'N' and temp.constraint_type != 'P') then '1' else null end) as is_required, |
| | | (case when temp.constraint_type = 'P' then '1' else '0' end) as is_pk, |
| | | temp.column_id as sort, |
| | | temp.comments as column_comment, |
| | | (case when temp.constraint_type = 'P' then '1' else '0' end) as is_increment, |
| | | lower(temp.data_type) as column_type |
| | | from ( |
| | | select col.column_id, col.column_name,col.nullable, col.data_type, colc.comments, uc.constraint_type |
| | | , row_number() over (partition by col.column_name order by uc.constraint_type desc) as row_flg |
| | | from user_tab_columns col |
| | | left join user_col_comments colc on colc.table_name = col.table_name and colc.column_name = col.column_name |
| | | left join user_cons_columns ucc on ucc.table_name = col.table_name and ucc.column_name = col.column_name |
| | | left join user_constraints uc on uc.constraint_name = ucc.constraint_name |
| | | where col.table_name = upper(#{tableName}) |
| | | ) temp |
| | | WHERE temp.row_flg = 1 |
| | | ORDER BY temp.column_id |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.generator.mapper.OracleGenTableMapper"> |
| | | |
| | | <resultMap type="GenTable" id="GenTableResult"> |
| | | <id property="tableId" column="table_id" /> |
| | | <result property="tableName" column="table_name" /> |
| | | <result property="tableComment" column="table_comment" /> |
| | | <result property="subTableName" column="sub_table_name" /> |
| | | <result property="subTableFkName" column="sub_table_fk_name" /> |
| | | <result property="className" column="class_name" /> |
| | | <result property="tplCategory" column="tpl_category" /> |
| | | <result property="packageName" column="package_name" /> |
| | | <result property="moduleName" column="module_name" /> |
| | | <result property="businessName" column="business_name" /> |
| | | <result property="functionName" column="function_name" /> |
| | | <result property="functionAuthor" column="function_author" /> |
| | | <result property="genType" column="gen_type" /> |
| | | <result property="genPath" column="gen_path" /> |
| | | <result property="options" column="options" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" /> |
| | | </resultMap> |
| | | |
| | | <resultMap type="GenTableColumn" id="GenTableColumnResult"> |
| | | <id property="columnId" column="column_id" /> |
| | | <result property="tableId" column="table_id" /> |
| | | <result property="columnName" column="column_name" /> |
| | | <result property="columnComment" column="column_comment" /> |
| | | <result property="columnType" column="column_type" /> |
| | | <result property="javaType" column="java_type" /> |
| | | <result property="javaField" column="java_field" /> |
| | | <result property="isPk" column="is_pk" /> |
| | | <result property="isIncrement" column="is_increment" /> |
| | | <result property="isRequired" column="is_required" /> |
| | | <result property="isInsert" column="is_insert" /> |
| | | <result property="isEdit" column="is_edit" /> |
| | | <result property="isList" column="is_list" /> |
| | | <result property="isQuery" column="is_query" /> |
| | | <result property="queryType" column="query_type" /> |
| | | <result property="htmlType" column="html_type" /> |
| | | <result property="dictType" column="dict_type" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectPageDbTableList" resultMap="GenTableResult"> |
| | | select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time |
| | | from user_tables dt, user_tab_comments dtc, user_objects uo |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="selectDbTableList" resultMap="GenTableResult"> |
| | | select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time |
| | | from user_tables dt, user_tab_comments dtc, user_objects uo |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="selectDbTableListByNames" resultMap="GenTableResult"> |
| | | select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time |
| | | from user_tables dt, user_tab_comments dtc, user_objects uo |
| | | where dt.table_name = dtc.table_name |
| | | and dt.table_name = uo.object_name |
| | | and uo.object_type = 'TABLE' |
| | | AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%' |
| | | AND dt.table_name NOT IN (select table_name from gen_table) |
| | | and lower(dt.table_name) in |
| | | <foreach collection="array" item="name" open="(" separator="," close=")"> |
| | | #{name} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="selectTableByName" parameterType="String" resultMap="GenTableResult"> |
| | | select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time |
| | | from user_tables dt, user_tab_comments dtc, user_objects uo |
| | | where dt.table_name = dtc.table_name |
| | | and dt.table_name = uo.object_name |
| | | and uo.object_type = 'TABLE' |
| | | AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%' |
| | | AND dt.table_name NOT IN (select table_name from gen_table) |
| | | and lower(dt.table_name) = #{tableName} |
| | | </select> |
| | | |
| | | <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | | where t.table_id = #{tableId} order by c.sort |
| | | </select> |
| | | |
| | | <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | | where t.table_name = #{tableName} order by c.sort |
| | | </select> |
| | | |
| | | <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | | order by c.sort |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | const dataName = "master"; |
| | | |
| | | // æ¥è¯¢çæè¡¨æ°æ® |
| | | export function listTable(query) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢dbæ°æ®åºå表 |
| | | export function listDbTable(query) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/db/list', |
| | | method: 'get', |
| | | params: query |
| | |
| | | // æ¥è¯¢è¡¨è¯¦ç»ä¿¡æ¯ |
| | | export function getGenTable(tableId) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/' + tableId, |
| | | method: 'get' |
| | | }) |
| | |
| | | // ä¿®æ¹ä»£ç çæä¿¡æ¯ |
| | | export function updateGenTable(data) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen', |
| | | method: 'put', |
| | | data: data |
| | |
| | | // 导å
¥è¡¨ |
| | | export function importTable(data) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/importTable', |
| | | method: 'post', |
| | | params: data |
| | |
| | | // é¢è§çæä»£ç |
| | | export function previewTable(tableId) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/preview/' + tableId, |
| | | method: 'get' |
| | | }) |
| | |
| | | // å é¤è¡¨æ°æ® |
| | | export function delTable(tableId) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/' + tableId, |
| | | method: 'delete' |
| | | }) |
| | |
| | | // çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼ |
| | | export function genCode(tableName) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/genCode/' + tableName, |
| | | method: 'get' |
| | | }) |
| | |
| | | // åæ¥æ°æ®åº |
| | | export function synchDb(tableName) { |
| | | return request({ |
| | | headers: { datasource: dataName }, |
| | | url: '/tool/gen/synchDb/' + tableName, |
| | | method: 'get' |
| | | }) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | version: '3' |
| | | |
| | | services: |
| | | oracle: |
| | | image: tekintian/oracle12c:latest |
| | | container_name: oracle |
| | | environment: |
| | | # æ¶åºä¸æµ· |
| | | TZ: Asia/Shanghai |
| | | DBCA_TOTAL_MEMORY: 16192 |
| | | ports: |
| | | - "18080:8080" |
| | | - "1521:1521" |
| | | volumes: |
| | | # æ°æ®æè½½ |
| | | - "/docker/oracle/data:/u01/app/oracle" |
| | | restart: always |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ---------------------------- |
| | | -- 1ãé¨é¨è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_dept ( |
| | | dept_id number(20) not null, |
| | | parent_id number(20) default 0, |
| | | ancestors varchar2(50) default '', |
| | | dept_name varchar2(30) default '', |
| | | order_num number(4) default 0, |
| | | leader varchar2(20) default null, |
| | | phone varchar2(11) default null, |
| | | email varchar2(50) default null, |
| | | status char(1) default '0', |
| | | del_flag char(1) default '0', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date |
| | | ); |
| | | |
| | | alter table sys_dept add constraint pk_sys_dept primary key (dept_id); |
| | | |
| | | comment on table sys_dept is 'é¨é¨è¡¨'; |
| | | comment on column sys_dept.dept_id is 'é¨é¨id'; |
| | | comment on column sys_dept.parent_id is 'ç¶é¨é¨id'; |
| | | comment on column sys_dept.ancestors is 'ç¥çº§å表'; |
| | | comment on column sys_dept.dept_name is 'é¨é¨åç§°'; |
| | | comment on column sys_dept.order_num is 'æ¾ç¤ºé¡ºåº'; |
| | | comment on column sys_dept.leader is 'è´è´£äºº'; |
| | | comment on column sys_dept.phone is 'èç³»çµè¯'; |
| | | comment on column sys_dept.email is 'é®ç®±'; |
| | | comment on column sys_dept.status is 'é¨é¨ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_dept.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_dept.create_by is 'å建è
'; |
| | | comment on column sys_dept.create_time is 'å建æ¶é´'; |
| | | comment on column sys_dept.update_by is 'æ´æ°è
'; |
| | | comment on column sys_dept.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-é¨é¨è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_dept values(100, 0, '0', 'è¥ä¾ç§æ', 0, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(101, 100, '0,100', 'æ·±å³æ»å
¬å¸', 1, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(102, 100, '0,100', 'é¿æ²åå
¬å¸', 2, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(103, 101, '0,100,101', 'ç åé¨é¨', 1, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(104, 101, '0,100,101', 'å¸åºé¨é¨', 2, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(105, 101, '0,100,101', 'æµè¯é¨é¨', 3, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(106, 101, '0,100,101', 'è´¢å¡é¨é¨', 4, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(107, 101, '0,100,101', 'è¿ç»´é¨é¨', 5, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(108, 102, '0,100,102', 'å¸åºé¨é¨', 1, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | insert into sys_dept values(109, 102, '0,100,102', 'è´¢å¡é¨é¨', 2, 'è¥ä¾', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate, '', null); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 2ãç¨æ·ä¿¡æ¯è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_user ( |
| | | user_id number(20) not null, |
| | | dept_id number(20) default null, |
| | | user_name varchar2(30) not null, |
| | | nick_name varchar2(30) not null, |
| | | user_type varchar2(10) default 'sys_user', |
| | | email varchar2(50) default '', |
| | | phonenumber varchar2(11) default '', |
| | | sex char(1) default '0', |
| | | avatar varchar2(100) default '', |
| | | password varchar2(100) default '', |
| | | status char(1) default '0', |
| | | del_flag char(1) default '0', |
| | | login_ip varchar2(128) default '', |
| | | login_date date, |
| | | create_by varchar2(64), |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default '' |
| | | ); |
| | | |
| | | alter table sys_user add constraint pk_sys_user primary key (user_id); |
| | | |
| | | comment on table sys_user is 'ç¨æ·ä¿¡æ¯è¡¨'; |
| | | comment on column sys_user.user_id is 'ç¨æ·ID'; |
| | | comment on column sys_user.dept_id is 'é¨é¨ID'; |
| | | comment on column sys_user.user_name is 'ç¨æ·è´¦å·'; |
| | | comment on column sys_user.nick_name is 'ç¨æ·æµç§°'; |
| | | comment on column sys_user.user_type is 'ç¨æ·ç±»åï¼sys_userç³»ç»ç¨æ·ï¼'; |
| | | comment on column sys_user.email is 'ç¨æ·é®ç®±'; |
| | | comment on column sys_user.phonenumber is 'ææºå·ç '; |
| | | comment on column sys_user.sex is 'ç¨æ·æ§å«ï¼0ç· 1女 2æªç¥ï¼'; |
| | | comment on column sys_user.avatar is '头åè·¯å¾'; |
| | | comment on column sys_user.password is 'å¯ç '; |
| | | comment on column sys_user.status is 'å¸å·ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_user.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_user.login_ip is 'æåç»å½IP'; |
| | | comment on column sys_user.login_date is 'æåç»å½æ¶é´'; |
| | | comment on column sys_user.create_by is 'å建è
'; |
| | | comment on column sys_user.create_time is 'å建æ¶é´'; |
| | | comment on column sys_user.update_by is 'æ´æ°è
'; |
| | | comment on column sys_user.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_user.remark is '夿³¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-ç¨æ·ä¿¡æ¯è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_user values(1, 103, 'admin', 'ç¯ççç®åLi', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 'admin', sysdate, '', null, '管çå'); |
| | | insert into sys_user values(2, 105, 'lionli', 'ç¯ççç®åLi', 'sys_user', 'crazyLionLi@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 'admin', sysdate, '', null, 'æµè¯å'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 3ãå²ä½ä¿¡æ¯è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_post ( |
| | | post_id number(20) not null, |
| | | post_code varchar2(64) not null, |
| | | post_name varchar2(50) not null, |
| | | post_sort number(4) not null, |
| | | status char(1) not null, |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) |
| | | ); |
| | | |
| | | alter table sys_post add constraint pk_sys_post primary key (post_id); |
| | | |
| | | comment on table sys_post is 'å²ä½ä¿¡æ¯è¡¨'; |
| | | comment on column sys_post.post_id is 'å²ä½ID'; |
| | | comment on column sys_post.post_code is 'å²ä½ç¼ç '; |
| | | comment on column sys_post.post_name is 'å²ä½åç§°'; |
| | | comment on column sys_post.post_sort is 'æ¾ç¤ºé¡ºåº'; |
| | | comment on column sys_post.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_post.create_by is 'å建è
'; |
| | | comment on column sys_post.create_time is 'å建æ¶é´'; |
| | | comment on column sys_post.update_by is 'æ´æ°è
'; |
| | | comment on column sys_post.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_post.remark is '夿³¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-å²ä½ä¿¡æ¯è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_post values(1, 'ceo', 'è£äºé¿', 1, '0', 'admin', sysdate, '', null, ''); |
| | | insert into sys_post values(2, 'se', '项ç®ç»ç', 2, '0', 'admin', sysdate, '', null, ''); |
| | | insert into sys_post values(3, 'hr', '人åèµæº', 3, '0', 'admin', sysdate, '', null, ''); |
| | | insert into sys_post values(4, 'user', 'æ®éåå·¥', 4, '0', 'admin', sysdate, '', null, ''); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 4ãè§è²ä¿¡æ¯è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_role ( |
| | | role_id number(20) not null, |
| | | role_name varchar2(30) not null, |
| | | role_key varchar2(100) not null, |
| | | role_sort number(4) not null, |
| | | data_scope char(1) default '1', |
| | | menu_check_strictly number(1) default 1, |
| | | dept_check_strictly number(1) default 1, |
| | | status char(1) not null, |
| | | del_flag char(1) default '0', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default null |
| | | ); |
| | | |
| | | alter table sys_role add constraint pk_sys_role primary key (role_id); |
| | | |
| | | comment on table sys_role is 'è§è²ä¿¡æ¯è¡¨'; |
| | | comment on column sys_role.role_id is 'è§è²ID'; |
| | | comment on column sys_role.role_name is 'è§è²åç§°'; |
| | | comment on column sys_role.role_key is 'è§è²æéå符串'; |
| | | comment on column sys_role.role_sort is 'æ¾ç¤ºé¡ºåº'; |
| | | comment on column sys_role.data_scope is 'æ°æ®èå´ï¼1ï¼å
¨é¨æ°æ®æé 2ï¼èªå®æ°æ®æé 3ï¼æ¬é¨é¨æ°æ®æé 4ï¼æ¬é¨é¨å以䏿°æ®æéï¼'; |
| | | comment on column sys_role.menu_check_strictly is 'èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.dept_check_strictly is 'é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.status is 'è§è²ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_role.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_role.create_by is 'å建è
'; |
| | | comment on column sys_role.create_time is 'å建æ¶é´'; |
| | | comment on column sys_role.update_by is 'æ´æ°è
'; |
| | | comment on column sys_role.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_role.remark is '夿³¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-è§è²ä¿¡æ¯è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_role values('1', 'è¶
级管çå', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate, '', null, 'è¶
级管çå'); |
| | | insert into sys_role values('2', 'æ®éè§è²', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate, '', null, 'æ®éè§è²'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 5ãèåæé表 |
| | | -- ---------------------------- |
| | | create table sys_menu ( |
| | | menu_id number(20) not null, |
| | | menu_name varchar2(50) not null, |
| | | parent_id number(20) default 0, |
| | | order_num number(4) default 0, |
| | | path varchar(200) default '', |
| | | component varchar(255) default null, |
| | | query varchar(255) default null, |
| | | is_frame number(1) default 1, |
| | | is_cache number(1) default 0, |
| | | menu_type char(1) default '', |
| | | visible char(1) default 0, |
| | | status char(1) default 0, |
| | | perms varchar2(100) default null, |
| | | icon varchar2(100) default '#', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date , |
| | | remark varchar2(500) default '' |
| | | ); |
| | | |
| | | alter table sys_menu add constraint pk_sys_menu primary key (menu_id); |
| | | |
| | | comment on table sys_menu is 'èåæé表'; |
| | | comment on column sys_menu.menu_id is 'èåID'; |
| | | comment on column sys_menu.menu_name is 'èååç§°'; |
| | | comment on column sys_menu.parent_id is 'ç¶èåID'; |
| | | comment on column sys_menu.order_num is 'æ¾ç¤ºé¡ºåº'; |
| | | comment on column sys_menu.path is '请æ±å°å'; |
| | | comment on column sys_menu.component is 'è·¯ç±å°å'; |
| | | comment on column sys_menu.query is 'è·¯ç±åæ°'; |
| | | comment on column sys_menu.is_frame is 'æ¯å¦ä¸ºå¤é¾ï¼0æ¯ 1å¦ï¼'; |
| | | comment on column sys_menu.is_cache is 'æ¯å¦ç¼åï¼0ç¼å 1ä¸ç¼åï¼'; |
| | | comment on column sys_menu.menu_type is 'èåç±»åï¼Mç®å½ Cèå Fæé®ï¼'; |
| | | comment on column sys_menu.visible is 'èåç¶æï¼0æ¾ç¤º 1éèï¼'; |
| | | comment on column sys_menu.status is 'èåç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_menu.perms is 'æéæ è¯'; |
| | | comment on column sys_menu.icon is 'èå徿 '; |
| | | comment on column sys_menu.create_by is 'å建è
'; |
| | | comment on column sys_menu.create_time is 'å建æ¶é´'; |
| | | comment on column sys_menu.update_by is 'æ´æ°è
'; |
| | | comment on column sys_menu.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_menu.remark is '夿³¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-èåä¿¡æ¯è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | -- ä¸çº§èå |
| | | insert into sys_menu values('1', 'ç³»ç»ç®¡ç', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate, '', null, 'ç³»ç»ç®¡çç®å½'); |
| | | insert into sys_menu values('2', 'ç³»ç»çæ§', '0', '2', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate, '', null, 'ç³»ç»çæ§ç®å½'); |
| | | insert into sys_menu values('3', 'ç³»ç»å·¥å
·', '0', '3', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate, '', null, 'ç³»ç»å·¥å
·ç®å½'); |
| | | insert into sys_menu values('4', 'PLUSå®ç½', '0', '4', 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus', null, '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate, '', null, 'RuoYi-Vue-Pluså®ç½å°å'); |
| | | -- äºçº§èå |
| | | insert into sys_menu values('100', 'ç¨æ·ç®¡ç', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate, '', null, 'ç¨æ·ç®¡çèå'); |
| | | insert into sys_menu values('101', 'è§è²ç®¡ç', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate, '', null, 'è§è²ç®¡çèå'); |
| | | insert into sys_menu values('102', 'èå管ç', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate, '', null, 'èå管çèå'); |
| | | insert into sys_menu values('103', 'é¨é¨ç®¡ç', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate, '', null, 'é¨é¨ç®¡çèå'); |
| | | insert into sys_menu values('104', 'å²ä½ç®¡ç', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate, '', null, 'å²ä½ç®¡çèå'); |
| | | insert into sys_menu values('105', 'åå
¸ç®¡ç', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate, '', null, 'åå
¸ç®¡çèå'); |
| | | insert into sys_menu values('106', 'åæ°è®¾ç½®', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate, '', null, 'åæ°è®¾ç½®èå'); |
| | | insert into sys_menu values('107', 'éç¥å
¬å', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate, '', null, 'éç¥å
¬åèå'); |
| | | insert into sys_menu values('108', 'æ¥å¿ç®¡ç', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate, '', null, 'æ¥å¿ç®¡çèå'); |
| | | insert into sys_menu values('109', 'å¨çº¿ç¨æ·', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate, '', null, 'å¨çº¿ç¨æ·èå'); |
| | | insert into sys_menu values('111', 'æ°æ®çæ§', '2', '3', 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate, '', null, 'æ°æ®çæ§èå'); |
| | | insert into sys_menu values('113', 'ç¼åçæ§', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate, '', null, 'ç¼åçæ§èå'); |
| | | insert into sys_menu values('114', '表åæå»º', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate, '', null, '表åæå»ºèå'); |
| | | insert into sys_menu values('115', '代ç çæ', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate, '', null, '代ç çæèå'); |
| | | insert into sys_menu values('116', 'ç³»ç»æ¥å£', '3', '3', 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate, '', null, 'ç³»ç»æ¥å£èå'); |
| | | -- springboot-adminçæ§ |
| | | insert into sys_menu values('117', 'Adminçæ§', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 'admin', sysdate, '', null, 'Adminçæ§èå'); |
| | | -- ossèå |
| | | insert into sys_menu values('118', 'æä»¶ç®¡ç', '1', '10', 'oss', 'system/oss/index', '', 1, 0, 'C', '0', '0', 'system:oss:list', 'upload', 'admin', sysdate, '', null, 'æä»¶ç®¡çèå'); |
| | | -- xxl-job-adminæ§å¶å° |
| | | insert into sys_menu values('120', 'ä»»å¡è°åº¦ä¸å¿', '2', '5', 'XxlJob', 'monitor/xxljob/index', '', 1, 0, 'C', '0', '0', 'monitor:xxljob:list', 'job', 'admin', sysdate, '', null, 'Xxl-Jobæ§å¶å°èå'); |
| | | |
| | | -- ä¸çº§èå |
| | | insert into sys_menu values('500', 'æä½æ¥å¿', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate, '', null, 'æä½æ¥å¿èå'); |
| | | insert into sys_menu values('501', 'ç»å½æ¥å¿', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate, '', null, 'ç»å½æ¥å¿èå'); |
| | | -- ç¨æ·ç®¡çæé® |
| | | insert into sys_menu values('1001', 'ç¨æ·æ¥è¯¢', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1002', 'ç¨æ·æ°å¢', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1003', 'ç¨æ·ä¿®æ¹', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1004', 'ç¨æ·å é¤', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1005', 'ç¨æ·å¯¼åº', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1006', 'ç¨æ·å¯¼å
¥', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1007', 'éç½®å¯ç ', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate, '', null, ''); |
| | | -- è§è²ç®¡çæé® |
| | | insert into sys_menu values('1008', 'è§è²æ¥è¯¢', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1009', 'è§è²æ°å¢', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1010', 'è§è²ä¿®æ¹', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1011', 'è§è²å é¤', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1012', 'è§è²å¯¼åº', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- èå管çæé® |
| | | insert into sys_menu values('1013', 'èåæ¥è¯¢', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1014', 'èåæ°å¢', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1015', 'èåä¿®æ¹', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1016', 'èåå é¤', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate, '', null, ''); |
| | | -- é¨é¨ç®¡çæé® |
| | | insert into sys_menu values('1017', 'é¨é¨æ¥è¯¢', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1018', 'é¨é¨æ°å¢', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1019', 'é¨é¨ä¿®æ¹', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1020', 'é¨é¨å é¤', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate, '', null, ''); |
| | | -- å²ä½ç®¡çæé® |
| | | insert into sys_menu values('1021', 'å²ä½æ¥è¯¢', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1022', 'å²ä½æ°å¢', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1023', 'å²ä½ä¿®æ¹', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1024', 'å²ä½å é¤', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1025', 'å²ä½å¯¼åº', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- åå
¸ç®¡çæé® |
| | | insert into sys_menu values('1026', 'åå
¸æ¥è¯¢', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1027', 'åå
¸æ°å¢', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1028', 'åå
¸ä¿®æ¹', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1029', 'åå
¸å é¤', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1030', 'åå
¸å¯¼åº', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- åæ°è®¾ç½®æé® |
| | | insert into sys_menu values('1031', 'åæ°æ¥è¯¢', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1032', 'åæ°æ°å¢', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1033', 'åæ°ä¿®æ¹', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1034', 'åæ°å é¤', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1035', '忰坼åº', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- éç¥å
¬åæé® |
| | | insert into sys_menu values('1036', 'å
¬åæ¥è¯¢', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1037', 'å
¬åæ°å¢', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1038', 'å
¬åä¿®æ¹', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1039', 'å
¬åå é¤', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate, '', null, ''); |
| | | -- æä½æ¥å¿æé® |
| | | insert into sys_menu values('1040', 'æä½æ¥è¯¢', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1041', 'æä½å é¤', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1042', 'æ¥å¿å¯¼åº', '500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- ç»å½æ¥å¿æé® |
| | | insert into sys_menu values('1043', 'ç»å½æ¥è¯¢', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1044', 'ç»å½å é¤', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1045', 'æ¥å¿å¯¼åº', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate, '', null, ''); |
| | | -- å¨çº¿ç¨æ·æé® |
| | | insert into sys_menu values('1046', 'å¨çº¿æ¥è¯¢', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1047', 'æ¹é强é', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1048', 'åæ¡å¼ºé', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate, '', null, ''); |
| | | -- 代ç çææé® |
| | | insert into sys_menu values('1055', 'çææ¥è¯¢', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1056', 'çæä¿®æ¹', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1057', 'çæå é¤', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1058', '导å
¥ä»£ç ', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1059', 'é¢è§ä»£ç ', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1060', 'çæä»£ç ', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate, '', null, ''); |
| | | -- ossç¸å
³æé® |
| | | insert into sys_menu values('1600', 'æä»¶æ¥è¯¢', '118', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:query', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1601', 'æä»¶ä¸ä¼ ', '118', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:upload', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1602', 'æä»¶ä¸è½½', '118', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:download', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1603', 'æä»¶å é¤', '118', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:remove', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1604', 'é
置添å ', '118', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:add', '#', 'admin', sysdate, '', null, ''); |
| | | insert into sys_menu values('1605', 'é
ç½®ç¼è¾', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:edit', '#', 'admin', sysdate, '', null, ''); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 6ãç¨æ·åè§è²å
³è表 ç¨æ·N-1è§è² |
| | | -- ---------------------------- |
| | | create table sys_user_role ( |
| | | user_id number(20) not null, |
| | | role_id number(20) not null |
| | | ); |
| | | |
| | | alter table sys_user_role add constraint pk_sys_user_role primary key (user_id, role_id); |
| | | |
| | | comment on table sys_user_role is 'ç¨æ·åè§è²å
³è表'; |
| | | comment on column sys_user_role.user_id is 'ç¨æ·ID'; |
| | | comment on column sys_user_role.role_id is 'è§è²ID'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-ç¨æ·åè§è²å
³èè¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_user_role values ('1', '1'); |
| | | insert into sys_user_role values ('2', '2'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 7ãè§è²åèåå
³è表 è§è²1-Nèå |
| | | -- ---------------------------- |
| | | create table sys_role_menu ( |
| | | role_id number(20) not null, |
| | | menu_id number(20) not null |
| | | ); |
| | | |
| | | alter table sys_role_menu add constraint pk_sys_role_menu primary key (role_id, menu_id); |
| | | |
| | | comment on table sys_role_menu is 'è§è²åèåå
³è表'; |
| | | comment on column sys_role_menu.role_id is 'è§è²ID'; |
| | | comment on column sys_role_menu.menu_id is 'èåID'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-è§è²åèåå
³èè¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_role_menu values ('2', '1'); |
| | | insert into sys_role_menu values ('2', '2'); |
| | | insert into sys_role_menu values ('2', '3'); |
| | | insert into sys_role_menu values ('2', '4'); |
| | | insert into sys_role_menu values ('2', '100'); |
| | | insert into sys_role_menu values ('2', '101'); |
| | | insert into sys_role_menu values ('2', '102'); |
| | | insert into sys_role_menu values ('2', '103'); |
| | | insert into sys_role_menu values ('2', '104'); |
| | | insert into sys_role_menu values ('2', '105'); |
| | | insert into sys_role_menu values ('2', '106'); |
| | | insert into sys_role_menu values ('2', '107'); |
| | | insert into sys_role_menu values ('2', '108'); |
| | | insert into sys_role_menu values ('2', '109'); |
| | | insert into sys_role_menu values ('2', '110'); |
| | | insert into sys_role_menu values ('2', '111'); |
| | | insert into sys_role_menu values ('2', '112'); |
| | | insert into sys_role_menu values ('2', '113'); |
| | | insert into sys_role_menu values ('2', '114'); |
| | | insert into sys_role_menu values ('2', '115'); |
| | | insert into sys_role_menu values ('2', '116'); |
| | | insert into sys_role_menu values ('2', '500'); |
| | | insert into sys_role_menu values ('2', '501'); |
| | | insert into sys_role_menu values ('2', '1000'); |
| | | insert into sys_role_menu values ('2', '1001'); |
| | | insert into sys_role_menu values ('2', '1002'); |
| | | insert into sys_role_menu values ('2', '1003'); |
| | | insert into sys_role_menu values ('2', '1004'); |
| | | insert into sys_role_menu values ('2', '1005'); |
| | | insert into sys_role_menu values ('2', '1006'); |
| | | insert into sys_role_menu values ('2', '1007'); |
| | | insert into sys_role_menu values ('2', '1008'); |
| | | insert into sys_role_menu values ('2', '1009'); |
| | | insert into sys_role_menu values ('2', '1010'); |
| | | insert into sys_role_menu values ('2', '1011'); |
| | | insert into sys_role_menu values ('2', '1012'); |
| | | insert into sys_role_menu values ('2', '1013'); |
| | | insert into sys_role_menu values ('2', '1014'); |
| | | insert into sys_role_menu values ('2', '1015'); |
| | | insert into sys_role_menu values ('2', '1016'); |
| | | insert into sys_role_menu values ('2', '1017'); |
| | | insert into sys_role_menu values ('2', '1018'); |
| | | insert into sys_role_menu values ('2', '1019'); |
| | | insert into sys_role_menu values ('2', '1020'); |
| | | insert into sys_role_menu values ('2', '1021'); |
| | | insert into sys_role_menu values ('2', '1022'); |
| | | insert into sys_role_menu values ('2', '1023'); |
| | | insert into sys_role_menu values ('2', '1024'); |
| | | insert into sys_role_menu values ('2', '1025'); |
| | | insert into sys_role_menu values ('2', '1026'); |
| | | insert into sys_role_menu values ('2', '1027'); |
| | | insert into sys_role_menu values ('2', '1028'); |
| | | insert into sys_role_menu values ('2', '1029'); |
| | | insert into sys_role_menu values ('2', '1030'); |
| | | insert into sys_role_menu values ('2', '1031'); |
| | | insert into sys_role_menu values ('2', '1032'); |
| | | insert into sys_role_menu values ('2', '1033'); |
| | | insert into sys_role_menu values ('2', '1034'); |
| | | insert into sys_role_menu values ('2', '1035'); |
| | | insert into sys_role_menu values ('2', '1036'); |
| | | insert into sys_role_menu values ('2', '1037'); |
| | | insert into sys_role_menu values ('2', '1038'); |
| | | insert into sys_role_menu values ('2', '1039'); |
| | | insert into sys_role_menu values ('2', '1040'); |
| | | insert into sys_role_menu values ('2', '1041'); |
| | | insert into sys_role_menu values ('2', '1042'); |
| | | insert into sys_role_menu values ('2', '1043'); |
| | | insert into sys_role_menu values ('2', '1044'); |
| | | insert into sys_role_menu values ('2', '1045'); |
| | | insert into sys_role_menu values ('2', '1046'); |
| | | insert into sys_role_menu values ('2', '1047'); |
| | | insert into sys_role_menu values ('2', '1048'); |
| | | insert into sys_role_menu values ('2', '1055'); |
| | | insert into sys_role_menu values ('2', '1056'); |
| | | insert into sys_role_menu values ('2', '1057'); |
| | | insert into sys_role_menu values ('2', '1058'); |
| | | insert into sys_role_menu values ('2', '1059'); |
| | | insert into sys_role_menu values ('2', '1060'); |
| | | |
| | | -- ---------------------------- |
| | | -- 8ãè§è²åé¨é¨å
³è表 è§è²1-Né¨é¨ |
| | | -- ---------------------------- |
| | | create table sys_role_dept ( |
| | | role_id number(20) not null, |
| | | dept_id number(20) not null |
| | | ); |
| | | |
| | | alter table sys_role_dept add constraint pk_sys_role_dept primary key (role_id, dept_id); |
| | | |
| | | comment on table sys_role_dept is 'è§è²åé¨é¨å
³è表'; |
| | | comment on column sys_role_dept.role_id is 'è§è²ID'; |
| | | comment on column sys_role_dept.dept_id is 'é¨é¨ID'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-è§è²åé¨é¨å
³èè¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_role_dept values ('2', '100'); |
| | | insert into sys_role_dept values ('2', '101'); |
| | | insert into sys_role_dept values ('2', '105'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 9ãç¨æ·ä¸å²ä½å
³è表 ç¨æ·1-Nå²ä½ |
| | | -- ---------------------------- |
| | | create table sys_user_post ( |
| | | user_id number(20) not null, |
| | | post_id number(20) not null |
| | | ); |
| | | |
| | | alter table sys_user_post add constraint pk_sys_user_post primary key (user_id, post_id); |
| | | |
| | | comment on table sys_user_post is 'ç¨æ·ä¸å²ä½å
³è表'; |
| | | comment on column sys_user_post.user_id is 'ç¨æ·ID'; |
| | | comment on column sys_user_post.post_id is 'å²ä½ID'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-ç¨æ·ä¸å²ä½å
³èè¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_user_post values ('1', '1'); |
| | | insert into sys_user_post values ('2', '2'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 10ãæä½æ¥å¿è®°å½ |
| | | -- ---------------------------- |
| | | create table sys_oper_log ( |
| | | oper_id number(20) not null , |
| | | title varchar2(50) default '', |
| | | business_type number(2) default 0, |
| | | method varchar2(100) default '', |
| | | request_method varchar(10) default '', |
| | | operator_type number(1) default 0, |
| | | oper_name varchar2(50) default '', |
| | | dept_name varchar2(50) default '', |
| | | oper_url varchar2(255) default '', |
| | | oper_ip varchar2(128) default '', |
| | | oper_location varchar2(255) default '', |
| | | oper_param varchar2(2000) default '', |
| | | json_result varchar2(2000) default '', |
| | | status number(1) default 0, |
| | | error_msg varchar2(2000) default '' , |
| | | oper_time date |
| | | ); |
| | | |
| | | alter table sys_oper_log add constraint pk_sys_oper_log primary key (oper_id); |
| | | |
| | | comment on table sys_oper_log is 'æä½æ¥å¿è®°å½'; |
| | | comment on column sys_oper_log.oper_id is 'æ¥å¿ä¸»é®'; |
| | | comment on column sys_oper_log.title is 'æ¨¡åæ é¢'; |
| | | comment on column sys_oper_log.business_type is 'ä¸å¡ç±»åï¼0å
¶å® 1æ°å¢ 2ä¿®æ¹ 3å é¤ï¼'; |
| | | comment on column sys_oper_log.method is 'æ¹æ³åç§°'; |
| | | comment on column sys_oper_log.request_method is 'è¯·æ±æ¹å¼'; |
| | | comment on column sys_oper_log.operator_type is 'æä½ç±»å«ï¼0å
¶å® 1åå°ç¨æ· 2ææºç«¯ç¨æ·ï¼'; |
| | | comment on column sys_oper_log.oper_name is 'æä½äººå'; |
| | | comment on column sys_oper_log.dept_name is 'é¨é¨åç§°'; |
| | | comment on column sys_oper_log.oper_url is '请æ±URL'; |
| | | comment on column sys_oper_log.oper_ip is '主æºå°å'; |
| | | comment on column sys_oper_log.oper_location is 'æä½å°ç¹'; |
| | | comment on column sys_oper_log.oper_param is '请æ±åæ°'; |
| | | comment on column sys_oper_log.json_result is 'è¿ååæ°'; |
| | | comment on column sys_oper_log.status is 'æä½ç¶æï¼0æ£å¸¸ 1å¼å¸¸ï¼'; |
| | | comment on column sys_oper_log.error_msg is 'éè¯¯æ¶æ¯'; |
| | | comment on column sys_oper_log.oper_time is 'æä½æ¶é´'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 11ãåå
¸ç±»å表 |
| | | -- ---------------------------- |
| | | create table sys_dict_type ( |
| | | dict_id number(20) not null, |
| | | dict_name varchar2(100) default '', |
| | | dict_type varchar2(100) default '', |
| | | status char(1) default '0', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default null |
| | | ); |
| | | |
| | | alter table sys_dict_type add constraint pk_sys_dict_type primary key (dict_id); |
| | | create unique index sys_dict_type_index1 on sys_dict_type (dict_type); |
| | | |
| | | comment on table sys_dict_type is 'åå
¸ç±»å表'; |
| | | comment on column sys_dict_type.dict_id is 'åå
¸ä¸»é®'; |
| | | comment on column sys_dict_type.dict_name is 'åå
¸åç§°'; |
| | | comment on column sys_dict_type.dict_type is 'åå
¸ç±»å'; |
| | | comment on column sys_dict_type.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_dict_type.create_by is 'å建è
'; |
| | | comment on column sys_dict_type.create_time is 'å建æ¶é´'; |
| | | comment on column sys_dict_type.update_by is 'æ´æ°è
'; |
| | | comment on column sys_dict_type.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_dict_type.remark is '夿³¨'; |
| | | |
| | | insert into sys_dict_type values(1, 'ç¨æ·æ§å«', 'sys_user_sex', '0', 'admin', sysdate, '', null, 'ç¨æ·æ§å«å表'); |
| | | insert into sys_dict_type values(2, 'èåç¶æ', 'sys_show_hide', '0', 'admin', sysdate, '', null, 'èåç¶æå表'); |
| | | insert into sys_dict_type values(3, 'ç³»ç»å¼å
³', 'sys_normal_disable', '0', 'admin', sysdate, '', null, 'ç³»ç»å¼å
³å表'); |
| | | insert into sys_dict_type values(6, 'ç³»ç»æ¯å¦', 'sys_yes_no', '0', 'admin', sysdate, '', null, 'ç³»ç»æ¯å¦å表'); |
| | | insert into sys_dict_type values(7, 'éç¥ç±»å', 'sys_notice_type', '0', 'admin', sysdate, '', null, 'éç¥ç±»åå表'); |
| | | insert into sys_dict_type values(8, 'éç¥ç¶æ', 'sys_notice_status', '0', 'admin', sysdate, '', null, 'éç¥ç¶æå表'); |
| | | insert into sys_dict_type values(9, 'æä½ç±»å', 'sys_oper_type', '0', 'admin', sysdate, '', null, 'æä½ç±»åå表'); |
| | | insert into sys_dict_type values(10, 'ç³»ç»ç¶æ', 'sys_common_status', '0', 'admin', sysdate, '', null, 'ç»å½ç¶æå表'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 12ãåå
¸æ°æ®è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_dict_data ( |
| | | dict_code number(20) not null, |
| | | dict_sort number(4) default 0, |
| | | dict_label varchar2(100) default '', |
| | | dict_value varchar2(100) default '', |
| | | dict_type varchar2(100) default '', |
| | | css_class varchar2(100) default null, |
| | | list_class varchar2(100) default null, |
| | | is_default char(1) default 'N', |
| | | status char(1) default '0', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default null |
| | | ); |
| | | |
| | | alter table sys_dict_data add constraint pk_sys_dict_data primary key (dict_code); |
| | | |
| | | comment on table sys_dict_data is 'åå
¸æ°æ®è¡¨'; |
| | | comment on column sys_dict_data.dict_code is 'åå
¸ä¸»é®'; |
| | | comment on column sys_dict_data.dict_sort is 'åå
¸æåº'; |
| | | comment on column sys_dict_data.dict_label is 'åå
¸æ ç¾'; |
| | | comment on column sys_dict_data.dict_value is 'åå
¸é®å¼'; |
| | | comment on column sys_dict_data.dict_type is 'åå
¸ç±»å'; |
| | | comment on column sys_dict_data.css_class is 'æ ·å¼å±æ§ï¼å
¶ä»æ ·å¼æ©å±ï¼'; |
| | | comment on column sys_dict_data.list_class is 'è¡¨æ ¼åæ¾æ ·å¼'; |
| | | comment on column sys_dict_data.is_default is 'æ¯å¦é»è®¤ï¼Yæ¯ Nå¦ï¼'; |
| | | comment on column sys_dict_data.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_dict_data.create_by is 'å建è
'; |
| | | comment on column sys_dict_data.create_time is 'å建æ¶é´'; |
| | | comment on column sys_dict_data.update_by is 'æ´æ°è
'; |
| | | comment on column sys_dict_data.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_dict_data.remark is '夿³¨'; |
| | | |
| | | insert into sys_dict_data values(1, 1, 'ç·', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate, '', null, 'æ§å«ç·'); |
| | | insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate, '', null, 'æ§å«å¥³'); |
| | | insert into sys_dict_data values(3, 3, 'æªç¥', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate, '', null, 'æ§å«æªç¥'); |
| | | insert into sys_dict_data values(4, 1, 'æ¾ç¤º', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate, '', null, 'æ¾ç¤ºèå'); |
| | | insert into sys_dict_data values(5, 2, 'éè', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'éèèå'); |
| | | insert into sys_dict_data values(6, 1, 'æ£å¸¸', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate, '', null, 'æ£å¸¸ç¶æ'); |
| | | insert into sys_dict_data values(7, 2, 'åç¨', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'åç¨ç¶æ'); |
| | | insert into sys_dict_data values(12, 1, 'æ¯', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate, '', null, 'ç³»ç»é»è®¤æ¯'); |
| | | insert into sys_dict_data values(13, 2, 'å¦', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'ç³»ç»é»è®¤å¦'); |
| | | insert into sys_dict_data values(14, 1, 'éç¥', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate, '', null, 'éç¥'); |
| | | insert into sys_dict_data values(15, 2, 'å
¬å', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate, '', null, 'å
Œ'); |
| | | insert into sys_dict_data values(16, 1, 'æ£å¸¸', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate, '', null, 'æ£å¸¸ç¶æ'); |
| | | insert into sys_dict_data values(17, 2, 'å
³é', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'å
³éç¶æ'); |
| | | insert into sys_dict_data values(18, 1, 'æ°å¢', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate, '', null, 'æ°å¢æä½'); |
| | | insert into sys_dict_data values(19, 2, 'ä¿®æ¹', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate, '', null, 'ä¿®æ¹æä½'); |
| | | insert into sys_dict_data values(20, 3, 'å é¤', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'å 餿ä½'); |
| | | insert into sys_dict_data values(21, 4, 'ææ', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate, '', null, 'æææä½'); |
| | | insert into sys_dict_data values(22, 5, '导åº', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate, '', null, 'å¯¼åºæä½'); |
| | | insert into sys_dict_data values(23, 6, '导å
¥', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate, '', null, '导å
¥æä½'); |
| | | insert into sys_dict_data values(24, 7, '强é', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate, '', null, '强éæä½'); |
| | | insert into sys_dict_data values(25, 8, 'çæä»£ç ', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate, '', null, 'çææä½'); |
| | | insert into sys_dict_data values(26, 9, 'æ¸
ç©ºæ°æ®', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'æ¸
空æä½'); |
| | | insert into sys_dict_data values(27, 1, 'æå', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate, '', null, 'æ£å¸¸ç¶æ'); |
| | | insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate, '', null, 'åç¨ç¶æ'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 13ãåæ°é
置表 |
| | | -- ---------------------------- |
| | | create table sys_config ( |
| | | config_id number(20) not null, |
| | | config_name varchar2(100) default '', |
| | | config_key varchar2(100) default '', |
| | | config_value varchar2(100) default '', |
| | | config_type char(1) default 'N', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default null |
| | | ); |
| | | alter table sys_config add constraint pk_sys_config primary key (config_id); |
| | | |
| | | comment on table sys_config is 'åæ°é
置表'; |
| | | comment on column sys_config.config_id is '忰䏻é®'; |
| | | comment on column sys_config.config_name is 'åæ°åç§°'; |
| | | comment on column sys_config.config_key is 'åæ°é®å'; |
| | | comment on column sys_config.config_value is 'åæ°é®å¼'; |
| | | comment on column sys_config.config_type is 'ç³»ç»å
ç½®ï¼Yæ¯ Nå¦ï¼'; |
| | | comment on column sys_config.create_by is 'å建è
'; |
| | | comment on column sys_config.create_time is 'å建æ¶é´'; |
| | | comment on column sys_config.update_by is 'æ´æ°è
'; |
| | | comment on column sys_config.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_config.remark is '夿³¨'; |
| | | |
| | | insert into sys_config values(1, 'ä¸»æ¡æ¶é¡µ-é»è®¤ç®è¤æ ·å¼åç§°', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate, '', null, 'èè² skin-blueãç»¿è² skin-greenãç´«è² skin-purpleãçº¢è² skin-redãé»è² skin-yellow' ); |
| | | insert into sys_config values(2, 'ç¨æ·ç®¡ç-è´¦å·åå§å¯ç ', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate, '', null, 'åå§åå¯ç 123456' ); |
| | | insert into sys_config values(3, 'ä¸»æ¡æ¶é¡µ-ä¾§è¾¹æ 主é¢', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate, '', null, 'æ·±è²ä¸»é¢theme-darkï¼æµ
è²ä¸»é¢theme-light' ); |
| | | insert into sys_config values(4, 'è´¦å·èªå©-éªè¯ç å¼å
³', 'sys.account.captchaOnOff', 'true', 'Y', 'admin', sysdate, '', null, 'æ¯å¦å¼å¯éªè¯ç åè½ï¼trueå¼å¯ï¼falseå
³éï¼'); |
| | | insert into sys_config values(5, 'è´¦å·èªå©-æ¯å¦å¼å¯ç¨æ·æ³¨ååè½', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate, '', null, 'æ¯å¦å¼å¯æ³¨åç¨æ·åè½ï¼trueå¼å¯ï¼falseå
³éï¼'); |
| | | insert into sys_config values(11, 'OSSé¢è§åè¡¨èµæºå¼å
³', 'sys.oss.previewListResource', 'true', 'Y', 'admin', sysdate, '', null, 'true:å¼å¯, false:å
³é'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 14ãç³»ç»è®¿é®è®°å½ |
| | | -- ---------------------------- |
| | | create table sys_logininfor ( |
| | | info_id number(20) not null, |
| | | user_name varchar2(50) default '', |
| | | ipaddr varchar2(128) default '', |
| | | login_location varchar2(255) default '', |
| | | browser varchar2(50) default '', |
| | | os varchar2(50) default '', |
| | | status char(1) default '0', |
| | | msg varchar2(255) default '', |
| | | login_time date |
| | | ); |
| | | |
| | | alter table sys_logininfor add constraint pk_sys_logininfor primary key (info_id); |
| | | |
| | | comment on table sys_logininfor is 'ç³»ç»è®¿é®è®°å½'; |
| | | comment on column sys_logininfor.info_id is '访é®ID'; |
| | | comment on column sys_logininfor.user_name is 'ç»å½è´¦å·'; |
| | | comment on column sys_logininfor.ipaddr is 'ç»å½IPå°å'; |
| | | comment on column sys_logininfor.login_location is 'ç»å½å°ç¹'; |
| | | comment on column sys_logininfor.browser is 'æµè§å¨ç±»å'; |
| | | comment on column sys_logininfor.os is 'æä½ç³»ç»'; |
| | | comment on column sys_logininfor.status is 'ç»å½ç¶æï¼0æå 1失败ï¼'; |
| | | comment on column sys_logininfor.msg is 'æç¤ºæ¶æ¯'; |
| | | comment on column sys_logininfor.login_time is 'è®¿é®æ¶é´'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 17ãéç¥å
¬å表 |
| | | -- ---------------------------- |
| | | create table sys_notice ( |
| | | notice_id number(20) not null, |
| | | notice_title varchar2(50) not null, |
| | | notice_type char(1) not null, |
| | | notice_content clob default null, |
| | | status char(1) default '0', |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(255) default null |
| | | ); |
| | | |
| | | alter table sys_notice add constraint pk_sys_notice primary key (notice_id); |
| | | |
| | | comment on table sys_notice is 'éç¥å
¬å表'; |
| | | comment on column sys_notice.notice_id is 'å
¬å主é®'; |
| | | comment on column sys_notice.notice_title is 'å
¬åæ é¢'; |
| | | comment on column sys_notice.notice_type is 'å
¬åç±»åï¼1éç¥ 2å
¬åï¼'; |
| | | comment on column sys_notice.notice_content is 'å
¬åå
容'; |
| | | comment on column sys_notice.status is 'å
¬åç¶æï¼0æ£å¸¸ 1å
³éï¼'; |
| | | comment on column sys_notice.create_by is 'å建è
'; |
| | | comment on column sys_notice.create_time is 'å建æ¶é´'; |
| | | comment on column sys_notice.update_by is 'æ´æ°è
'; |
| | | comment on column sys_notice.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_notice.remark is '夿³¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå§å-å
¬åä¿¡æ¯è¡¨æ°æ® |
| | | -- ---------------------------- |
| | | insert into sys_notice values('1', '温馨æéï¼2018-07-01 æ°çæ¬åå¸å¦', '2', 'æ°çæ¬å
容', '0', 'admin', sysdate, '', null, '管çå'); |
| | | insert into sys_notice values('2', 'ç»´æ¤éç¥ï¼2018-07-01 ç³»ç»åæ¨ç»´æ¤', '1', 'ç»´æ¤å
容', '0', 'admin', sysdate, '', null, '管çå'); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 18ã代ç çæä¸å¡è¡¨ |
| | | -- ---------------------------- |
| | | create table gen_table ( |
| | | table_id number(20) not null, |
| | | table_name varchar2(200) default '', |
| | | table_comment varchar2(500) default '', |
| | | sub_table_name varchar(64) default null, |
| | | sub_table_fk_name varchar(64) default null, |
| | | class_name varchar2(100) default '', |
| | | tpl_category varchar2(200) default 'crud', |
| | | package_name varchar2(100), |
| | | module_name varchar2(30), |
| | | business_name varchar2(30), |
| | | function_name varchar2(50), |
| | | function_author varchar2(50), |
| | | gen_type char(1) default '0', |
| | | gen_path varchar2(200) default '/', |
| | | options varchar2(1000), |
| | | create_by varchar2(64) default '', |
| | | create_time date, |
| | | update_by varchar2(64) default '', |
| | | update_time date, |
| | | remark varchar2(500) default null |
| | | ); |
| | | |
| | | alter table gen_table add constraint pk_gen_table primary key (table_id); |
| | | |
| | | comment on table gen_table is '代ç çæä¸å¡è¡¨'; |
| | | comment on column gen_table.table_id is 'ç¼å·'; |
| | | comment on column gen_table.table_name is '表åç§°'; |
| | | comment on column gen_table.table_comment is '表æè¿°'; |
| | | comment on column gen_table.sub_table_name is 'å
³èå表ç表å'; |
| | | comment on column gen_table.sub_table_fk_name is 'å表å
³èçå¤é®å'; |
| | | comment on column gen_table.class_name is 'å®ä½ç±»åç§°'; |
| | | comment on column gen_table.tpl_category is '使ç¨ç模æ¿ï¼crudå表æä½ treeæ 表æä½ï¼'; |
| | | comment on column gen_table.package_name is 'çæå
è·¯å¾'; |
| | | comment on column gen_table.module_name is 'çææ¨¡åå'; |
| | | comment on column gen_table.business_name is 'çæä¸å¡å'; |
| | | comment on column gen_table.function_name is 'çæåè½å'; |
| | | comment on column gen_table.function_author is 'çæåè½ä½è
'; |
| | | comment on column gen_table.gen_type is 'çæä»£ç æ¹å¼ï¼0zipå缩å
1èªå®ä¹è·¯å¾ï¼'; |
| | | comment on column gen_table.gen_path is 'çæè·¯å¾ï¼ä¸å¡«é»è®¤é¡¹ç®è·¯å¾ï¼'; |
| | | comment on column gen_table.options is 'å
¶å®çæé项'; |
| | | comment on column gen_table.create_by is 'å建è
'; |
| | | comment on column gen_table.create_time is 'å建æ¶é´'; |
| | | comment on column gen_table.update_by is 'æ´æ°è
'; |
| | | comment on column gen_table.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column gen_table.remark is '夿³¨'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 19ã代ç çæä¸å¡è¡¨å段 |
| | | -- ---------------------------- |
| | | create table gen_table_column ( |
| | | column_id number(20) not null, |
| | | table_id varchar2(64), |
| | | column_name varchar2(200), |
| | | column_comment varchar2(500), |
| | | column_type varchar2(100), |
| | | java_type varchar2(500), |
| | | java_field varchar2(200), |
| | | is_pk char(1), |
| | | is_increment char(1), |
| | | is_required char(1), |
| | | is_insert char(1), |
| | | is_edit char(1), |
| | | is_list char(1), |
| | | is_query char(1), |
| | | query_type varchar(200) default 'EQ', |
| | | html_type varchar(200), |
| | | dict_type varchar(200) default '', |
| | | sort number(4), |
| | | create_by varchar(64) default '', |
| | | create_time date , |
| | | update_by varchar(64) default '', |
| | | update_time date |
| | | ); |
| | | |
| | | alter table gen_table_column add constraint pk_gen_table_column primary key (column_id); |
| | | |
| | | comment on table gen_table_column is '代ç çæä¸å¡è¡¨å段'; |
| | | comment on column gen_table_column.column_id is 'ç¼å·'; |
| | | comment on column gen_table_column.table_id is 'å½å±è¡¨ç¼å·'; |
| | | comment on column gen_table_column.column_name is 'ååç§°'; |
| | | comment on column gen_table_column.column_comment is 'åæè¿°'; |
| | | comment on column gen_table_column.column_type is 'åç±»å'; |
| | | comment on column gen_table_column.java_type is 'JAVAç±»å'; |
| | | comment on column gen_table_column.java_field is 'JAVAåæ®µå'; |
| | | comment on column gen_table_column.is_pk is 'æ¯å¦ä¸»é®ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_increment is 'æ¯å¦èªå¢ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_required is 'æ¯å¦å¿
å¡«ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_insert is 'æ¯å¦ä¸ºæå
¥å段ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_edit is 'æ¯å¦ç¼è¾å段ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_list is 'æ¯å¦åè¡¨åæ®µï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.is_query is 'æ¯å¦æ¥è¯¢å段ï¼1æ¯ï¼'; |
| | | comment on column gen_table_column.query_type is 'æ¥è¯¢æ¹å¼ï¼çäºãä¸çäºã大äºãå°äºãèå´ï¼'; |
| | | comment on column gen_table_column.html_type is 'æ¾ç¤ºç±»åï¼ææ¬æ¡ãææ¬åã䏿æ¡ãå¤éæ¡ãåéæ¡ãæ¥ææ§ä»¶ï¼'; |
| | | comment on column gen_table_column.dict_type is 'åå
¸ç±»å'; |
| | | comment on column gen_table_column.sort is 'æåº'; |
| | | comment on column gen_table_column.create_by is 'å建è
'; |
| | | comment on column gen_table_column.create_time is 'å建æ¶é´'; |
| | | comment on column gen_table_column.update_by is 'æ´æ°è
'; |
| | | comment on column gen_table_column.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- OSS对象åå¨è¡¨ |
| | | -- ---------------------------- |
| | | create table sys_oss ( |
| | | oss_id number(20) not null, |
| | | file_name varchar(255) not null, |
| | | original_name varchar(255) not null, |
| | | file_suffix varchar(10) not null, |
| | | url varchar(500) not null, |
| | | service varchar(10) default 'minio' not null, |
| | | create_by varchar(64) default '', |
| | | create_time date, |
| | | update_by varchar(64) default '', |
| | | update_time date |
| | | ); |
| | | |
| | | alter table sys_oss add constraint pk_sys_oss primary key (oss_id); |
| | | |
| | | comment on table sys_oss is 'OSS对象åå¨è¡¨'; |
| | | comment on column sys_oss.oss_id is '对象åå¨ä¸»é®'; |
| | | comment on column sys_oss.file_name is 'æä»¶å'; |
| | | comment on column sys_oss.original_name is 'åå'; |
| | | comment on column sys_oss.file_suffix is 'æä»¶åç¼å'; |
| | | comment on column sys_oss.url is 'URLå°å'; |
| | | comment on column sys_oss.service is 'æå¡å'; |
| | | comment on column sys_oss.create_time is 'å建æ¶é´'; |
| | | comment on column sys_oss.create_by is 'ä¸ä¼ è
'; |
| | | comment on column sys_oss.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_oss.update_by is 'æ´æ°è
'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- OSS对象åå¨å¨æé
置表 |
| | | -- ---------------------------- |
| | | create table sys_oss_config ( |
| | | oss_config_id number(20) not null, |
| | | config_key varchar(255) not null, |
| | | access_key varchar(255) default '', |
| | | secret_key varchar(255) default '', |
| | | bucket_name varchar(255) default '', |
| | | prefix varchar(255) default '', |
| | | endpoint varchar(255) default '', |
| | | is_https char(1) default 'N', |
| | | region varchar(255) default '', |
| | | status char(1) default '1', |
| | | ext1 varchar(255) default '', |
| | | create_by varchar(64) default '', |
| | | remark varchar(500) default null, |
| | | create_time date, |
| | | update_by varchar(64) default '', |
| | | update_time date |
| | | ); |
| | | |
| | | alter table sys_oss_config add constraint pk_sys_oss_config primary key (oss_config_id); |
| | | |
| | | comment on table sys_oss_config is '对象åå¨é
置表'; |
| | | comment on column sys_oss_config.oss_config_id is '主建'; |
| | | comment on column sys_oss_config.config_key is 'é
ç½®key'; |
| | | comment on column sys_oss_config.access_key is 'accesskey'; |
| | | comment on column sys_oss_config.secret_key is 'ç§é¥'; |
| | | comment on column sys_oss_config.bucket_name is 'æ¡¶åç§°'; |
| | | comment on column sys_oss_config.prefix is 'åç¼'; |
| | | comment on column sys_oss_config.endpoint is '访é®ç«ç¹'; |
| | | comment on column sys_oss_config.is_https is 'æ¯å¦httpsï¼Y=æ¯,N=å¦ï¼'; |
| | | comment on column sys_oss_config.region is 'å'; |
| | | comment on column sys_oss_config.status is 'ç¶æï¼0=æ£å¸¸,1=åç¨ï¼'; |
| | | comment on column sys_oss_config.ext1 is 'æ©å±å段'; |
| | | comment on column sys_oss_config.remark is '夿³¨'; |
| | | comment on column sys_oss_config.create_by is 'å建è
'; |
| | | comment on column sys_oss_config.create_time is 'å建æ¶é´'; |
| | | comment on column sys_oss_config.update_by is 'æ´æ°è
'; |
| | | comment on column sys_oss_config.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'http://localhost:9000', 'N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate); |
| | | insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://XXX.XXXX.com', 'N', 'z0', '1', '', NULL, 'admin', sysdate, 'admin', sysdate); |
| | | insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://oss-cn-beijing.aliyuncs.com', 'N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate); |
| | | insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'http://cos.ap-beijing.myqcloud.com', 'N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 彿° ï¼ä»£æ¿mysqlçfind_in_set |
| | | -- ä¾å¦ï¼ select * from sys_dept where FIND_IN_SET (101,ancestors) <> 0 |
| | | -- mysql坿¥å0æå
¶å®numberå为where æ¡ä»¶ï¼oracleåªæ¥å表达å¼å为where æ¡ä»¶ |
| | | -- ---------------------------- |
| | | create or replace function find_in_set(arg1 in varchar2,arg2 in varchar) |
| | | return number is Result number; |
| | | begin |
| | | select instr(','||arg2||',' , ','||arg1||',') into Result from dual; |
| | | return(Result); |
| | | end find_in_set; |