Add front project draft model
This commit is contained in:
@@ -0,0 +1,53 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontProject extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
|
private Long userId;
|
||||||
|
private String projectName;
|
||||||
|
private String projectFileName;
|
||||||
|
private String packageName;
|
||||||
|
private String version;
|
||||||
|
private String projectDesc;
|
||||||
|
private String industryTemplate;
|
||||||
|
private String frontFramework;
|
||||||
|
private String backFramework;
|
||||||
|
private String generateStatus;
|
||||||
|
private String previewStatus;
|
||||||
|
private String status;
|
||||||
|
private List<FrontProjectTable> tables;
|
||||||
|
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public Long getUserId() { return userId; }
|
||||||
|
public void setUserId(Long userId) { this.userId = userId; }
|
||||||
|
public String getProjectName() { return projectName; }
|
||||||
|
public void setProjectName(String projectName) { this.projectName = projectName; }
|
||||||
|
public String getProjectFileName() { return projectFileName; }
|
||||||
|
public void setProjectFileName(String projectFileName) { this.projectFileName = projectFileName; }
|
||||||
|
public String getPackageName() { return packageName; }
|
||||||
|
public void setPackageName(String packageName) { this.packageName = packageName; }
|
||||||
|
public String getVersion() { return version; }
|
||||||
|
public void setVersion(String version) { this.version = version; }
|
||||||
|
public String getProjectDesc() { return projectDesc; }
|
||||||
|
public void setProjectDesc(String projectDesc) { this.projectDesc = projectDesc; }
|
||||||
|
public String getIndustryTemplate() { return industryTemplate; }
|
||||||
|
public void setIndustryTemplate(String industryTemplate) { this.industryTemplate = industryTemplate; }
|
||||||
|
public String getFrontFramework() { return frontFramework; }
|
||||||
|
public void setFrontFramework(String frontFramework) { this.frontFramework = frontFramework; }
|
||||||
|
public String getBackFramework() { return backFramework; }
|
||||||
|
public void setBackFramework(String backFramework) { this.backFramework = backFramework; }
|
||||||
|
public String getGenerateStatus() { return generateStatus; }
|
||||||
|
public void setGenerateStatus(String generateStatus) { this.generateStatus = generateStatus; }
|
||||||
|
public String getPreviewStatus() { return previewStatus; }
|
||||||
|
public void setPreviewStatus(String previewStatus) { this.previewStatus = previewStatus; }
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
public List<FrontProjectTable> getTables() { return tables; }
|
||||||
|
public void setTables(List<FrontProjectTable> tables) { this.tables = tables; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontProjectColumn extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long columnId;
|
||||||
|
private Long tableId;
|
||||||
|
private Long projectId;
|
||||||
|
private String columnName;
|
||||||
|
private String columnComment;
|
||||||
|
private String columnType;
|
||||||
|
private String javaType;
|
||||||
|
private String javaField;
|
||||||
|
private String isPk;
|
||||||
|
private String isIncrement;
|
||||||
|
private String isRequired;
|
||||||
|
private String isInsert;
|
||||||
|
private String isEdit;
|
||||||
|
private String isList;
|
||||||
|
private String isQuery;
|
||||||
|
private String queryType;
|
||||||
|
private String htmlType;
|
||||||
|
private String dictType;
|
||||||
|
private String defaultValue;
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
public Long getColumnId() { return columnId; }
|
||||||
|
public void setColumnId(Long columnId) { this.columnId = columnId; }
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public String getColumnName() { return columnName; }
|
||||||
|
public void setColumnName(String columnName) { this.columnName = columnName; }
|
||||||
|
public String getColumnComment() { return columnComment; }
|
||||||
|
public void setColumnComment(String columnComment) { this.columnComment = columnComment; }
|
||||||
|
public String getColumnType() { return columnType; }
|
||||||
|
public void setColumnType(String columnType) { this.columnType = columnType; }
|
||||||
|
public String getJavaType() { return javaType; }
|
||||||
|
public void setJavaType(String javaType) { this.javaType = javaType; }
|
||||||
|
public String getJavaField() { return javaField; }
|
||||||
|
public void setJavaField(String javaField) { this.javaField = javaField; }
|
||||||
|
public String getIsPk() { return isPk; }
|
||||||
|
public void setIsPk(String isPk) { this.isPk = isPk; }
|
||||||
|
public String getIsIncrement() { return isIncrement; }
|
||||||
|
public void setIsIncrement(String isIncrement) { this.isIncrement = isIncrement; }
|
||||||
|
public String getIsRequired() { return isRequired; }
|
||||||
|
public void setIsRequired(String isRequired) { this.isRequired = isRequired; }
|
||||||
|
public String getIsInsert() { return isInsert; }
|
||||||
|
public void setIsInsert(String isInsert) { this.isInsert = isInsert; }
|
||||||
|
public String getIsEdit() { return isEdit; }
|
||||||
|
public void setIsEdit(String isEdit) { this.isEdit = isEdit; }
|
||||||
|
public String getIsList() { return isList; }
|
||||||
|
public void setIsList(String isList) { this.isList = isList; }
|
||||||
|
public String getIsQuery() { return isQuery; }
|
||||||
|
public void setIsQuery(String isQuery) { this.isQuery = isQuery; }
|
||||||
|
public String getQueryType() { return queryType; }
|
||||||
|
public void setQueryType(String queryType) { this.queryType = queryType; }
|
||||||
|
public String getHtmlType() { return htmlType; }
|
||||||
|
public void setHtmlType(String htmlType) { this.htmlType = htmlType; }
|
||||||
|
public String getDictType() { return dictType; }
|
||||||
|
public void setDictType(String dictType) { this.dictType = dictType; }
|
||||||
|
public String getDefaultValue() { return defaultValue; }
|
||||||
|
public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; }
|
||||||
|
public Integer getSort() { return sort; }
|
||||||
|
public void setSort(Integer sort) { this.sort = sort; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontProjectFile extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long fileId;
|
||||||
|
private Long projectId;
|
||||||
|
private String templateType;
|
||||||
|
private String nodeId;
|
||||||
|
private Long tableId;
|
||||||
|
private String fileName;
|
||||||
|
private String filePath;
|
||||||
|
private String fileContent;
|
||||||
|
private String contentHash;
|
||||||
|
|
||||||
|
public Long getFileId() { return fileId; }
|
||||||
|
public void setFileId(Long fileId) { this.fileId = fileId; }
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public String getTemplateType() { return templateType; }
|
||||||
|
public void setTemplateType(String templateType) { this.templateType = templateType; }
|
||||||
|
public String getNodeId() { return nodeId; }
|
||||||
|
public void setNodeId(String nodeId) { this.nodeId = nodeId; }
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public String getFileName() { return fileName; }
|
||||||
|
public void setFileName(String fileName) { this.fileName = fileName; }
|
||||||
|
public String getFilePath() { return filePath; }
|
||||||
|
public void setFilePath(String filePath) { this.filePath = filePath; }
|
||||||
|
public String getFileContent() { return fileContent; }
|
||||||
|
public void setFileContent(String fileContent) { this.fileContent = fileContent; }
|
||||||
|
public String getContentHash() { return contentHash; }
|
||||||
|
public void setContentHash(String contentHash) { this.contentHash = contentHash; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontProjectGeneration extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long generationId;
|
||||||
|
private Long projectId;
|
||||||
|
private Long userId;
|
||||||
|
private String generateType;
|
||||||
|
private String provider;
|
||||||
|
private String promptSummary;
|
||||||
|
private String requestPayload;
|
||||||
|
private String responsePayload;
|
||||||
|
private String success;
|
||||||
|
private String errorMessage;
|
||||||
|
private Integer tokenUsage;
|
||||||
|
private Long elapsedMs;
|
||||||
|
|
||||||
|
public Long getGenerationId() { return generationId; }
|
||||||
|
public void setGenerationId(Long generationId) { this.generationId = generationId; }
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public Long getUserId() { return userId; }
|
||||||
|
public void setUserId(Long userId) { this.userId = userId; }
|
||||||
|
public String getGenerateType() { return generateType; }
|
||||||
|
public void setGenerateType(String generateType) { this.generateType = generateType; }
|
||||||
|
public String getProvider() { return provider; }
|
||||||
|
public void setProvider(String provider) { this.provider = provider; }
|
||||||
|
public String getPromptSummary() { return promptSummary; }
|
||||||
|
public void setPromptSummary(String promptSummary) { this.promptSummary = promptSummary; }
|
||||||
|
public String getRequestPayload() { return requestPayload; }
|
||||||
|
public void setRequestPayload(String requestPayload) { this.requestPayload = requestPayload; }
|
||||||
|
public String getResponsePayload() { return responsePayload; }
|
||||||
|
public void setResponsePayload(String responsePayload) { this.responsePayload = responsePayload; }
|
||||||
|
public String getSuccess() { return success; }
|
||||||
|
public void setSuccess(String success) { this.success = success; }
|
||||||
|
public String getErrorMessage() { return errorMessage; }
|
||||||
|
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
|
||||||
|
public Integer getTokenUsage() { return tokenUsage; }
|
||||||
|
public void setTokenUsage(Integer tokenUsage) { this.tokenUsage = tokenUsage; }
|
||||||
|
public Long getElapsedMs() { return elapsedMs; }
|
||||||
|
public void setElapsedMs(Long elapsedMs) { this.elapsedMs = elapsedMs; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontProjectTable extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long tableId;
|
||||||
|
private Long projectId;
|
||||||
|
private Long userId;
|
||||||
|
private String tableName;
|
||||||
|
private String tableComment;
|
||||||
|
private String className;
|
||||||
|
private String moduleName;
|
||||||
|
private String businessName;
|
||||||
|
private String functionName;
|
||||||
|
private String tplCategory;
|
||||||
|
private String tplWebType;
|
||||||
|
private String options;
|
||||||
|
private String createTableSql;
|
||||||
|
private Integer sort;
|
||||||
|
private String status;
|
||||||
|
private List<FrontProjectColumn> columns;
|
||||||
|
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public Long getUserId() { return userId; }
|
||||||
|
public void setUserId(Long userId) { this.userId = userId; }
|
||||||
|
public String getTableName() { return tableName; }
|
||||||
|
public void setTableName(String tableName) { this.tableName = tableName; }
|
||||||
|
public String getTableComment() { return tableComment; }
|
||||||
|
public void setTableComment(String tableComment) { this.tableComment = tableComment; }
|
||||||
|
public String getClassName() { return className; }
|
||||||
|
public void setClassName(String className) { this.className = className; }
|
||||||
|
public String getModuleName() { return moduleName; }
|
||||||
|
public void setModuleName(String moduleName) { this.moduleName = moduleName; }
|
||||||
|
public String getBusinessName() { return businessName; }
|
||||||
|
public void setBusinessName(String businessName) { this.businessName = businessName; }
|
||||||
|
public String getFunctionName() { return functionName; }
|
||||||
|
public void setFunctionName(String functionName) { this.functionName = functionName; }
|
||||||
|
public String getTplCategory() { return tplCategory; }
|
||||||
|
public void setTplCategory(String tplCategory) { this.tplCategory = tplCategory; }
|
||||||
|
public String getTplWebType() { return tplWebType; }
|
||||||
|
public void setTplWebType(String tplWebType) { this.tplWebType = tplWebType; }
|
||||||
|
public String getOptions() { return options; }
|
||||||
|
public void setOptions(String options) { this.options = options; }
|
||||||
|
public String getCreateTableSql() { return createTableSql; }
|
||||||
|
public void setCreateTableSql(String createTableSql) { this.createTableSql = createTableSql; }
|
||||||
|
public Integer getSort() { return sort; }
|
||||||
|
public void setSort(Integer sort) { this.sort = sort; }
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
public List<FrontProjectColumn> getColumns() { return columns; }
|
||||||
|
public void setColumns(List<FrontProjectColumn> columns) { this.columns = columns; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.ruoyi.generator.domain.front;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class FrontUser extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String nickname;
|
||||||
|
private String email;
|
||||||
|
private String phone;
|
||||||
|
private String status;
|
||||||
|
private String delFlag;
|
||||||
|
private Date lastLoginTime;
|
||||||
|
|
||||||
|
public Long getUserId() { return userId; }
|
||||||
|
public void setUserId(Long userId) { this.userId = userId; }
|
||||||
|
public String getUsername() { return username; }
|
||||||
|
public void setUsername(String username) { this.username = username; }
|
||||||
|
public String getPassword() { return password; }
|
||||||
|
public void setPassword(String password) { this.password = password; }
|
||||||
|
public String getNickname() { return nickname; }
|
||||||
|
public void setNickname(String nickname) { this.nickname = nickname; }
|
||||||
|
public String getEmail() { return email; }
|
||||||
|
public void setEmail(String email) { this.email = email; }
|
||||||
|
public String getPhone() { return phone; }
|
||||||
|
public void setPhone(String phone) { this.phone = phone; }
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
public String getDelFlag() { return delFlag; }
|
||||||
|
public void setDelFlag(String delFlag) { this.delFlag = delFlag; }
|
||||||
|
public Date getLastLoginTime() { return lastLoginTime; }
|
||||||
|
public void setLastLoginTime(Date lastLoginTime) { this.lastLoginTime = lastLoginTime; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class DatabaseColumnDesign
|
||||||
|
{
|
||||||
|
private Long columnId;
|
||||||
|
private Long tableId;
|
||||||
|
private String columnName;
|
||||||
|
private String columnComment;
|
||||||
|
private String columnType;
|
||||||
|
private String javaType;
|
||||||
|
private String javaField;
|
||||||
|
private String isPk;
|
||||||
|
private String isIncrement;
|
||||||
|
private String isRequired;
|
||||||
|
private String isInsert;
|
||||||
|
private String isEdit;
|
||||||
|
private String isList;
|
||||||
|
private String isQuery;
|
||||||
|
private String queryType;
|
||||||
|
private String htmlType;
|
||||||
|
private String dictType;
|
||||||
|
private String defaultValue;
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
public Long getColumnId() { return columnId; }
|
||||||
|
public void setColumnId(Long columnId) { this.columnId = columnId; }
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public String getColumnName() { return columnName; }
|
||||||
|
public void setColumnName(String columnName) { this.columnName = columnName; }
|
||||||
|
public String getColumnComment() { return columnComment; }
|
||||||
|
public void setColumnComment(String columnComment) { this.columnComment = columnComment; }
|
||||||
|
public String getColumnType() { return columnType; }
|
||||||
|
public void setColumnType(String columnType) { this.columnType = columnType; }
|
||||||
|
public String getJavaType() { return javaType; }
|
||||||
|
public void setJavaType(String javaType) { this.javaType = javaType; }
|
||||||
|
public String getJavaField() { return javaField; }
|
||||||
|
public void setJavaField(String javaField) { this.javaField = javaField; }
|
||||||
|
public String getIsPk() { return isPk; }
|
||||||
|
public void setIsPk(String isPk) { this.isPk = isPk; }
|
||||||
|
public String getIsIncrement() { return isIncrement; }
|
||||||
|
public void setIsIncrement(String isIncrement) { this.isIncrement = isIncrement; }
|
||||||
|
public String getIsRequired() { return isRequired; }
|
||||||
|
public void setIsRequired(String isRequired) { this.isRequired = isRequired; }
|
||||||
|
public String getIsInsert() { return isInsert; }
|
||||||
|
public void setIsInsert(String isInsert) { this.isInsert = isInsert; }
|
||||||
|
public String getIsEdit() { return isEdit; }
|
||||||
|
public void setIsEdit(String isEdit) { this.isEdit = isEdit; }
|
||||||
|
public String getIsList() { return isList; }
|
||||||
|
public void setIsList(String isList) { this.isList = isList; }
|
||||||
|
public String getIsQuery() { return isQuery; }
|
||||||
|
public void setIsQuery(String isQuery) { this.isQuery = isQuery; }
|
||||||
|
public String getQueryType() { return queryType; }
|
||||||
|
public void setQueryType(String queryType) { this.queryType = queryType; }
|
||||||
|
public String getHtmlType() { return htmlType; }
|
||||||
|
public void setHtmlType(String htmlType) { this.htmlType = htmlType; }
|
||||||
|
public String getDictType() { return dictType; }
|
||||||
|
public void setDictType(String dictType) { this.dictType = dictType; }
|
||||||
|
public String getDefaultValue() { return defaultValue; }
|
||||||
|
public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; }
|
||||||
|
public Integer getSort() { return sort; }
|
||||||
|
public void setSort(Integer sort) { this.sort = sort; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DatabaseDesignResponse
|
||||||
|
{
|
||||||
|
private Long projectId;
|
||||||
|
private List<DatabaseTableDesign> tables;
|
||||||
|
private String sql;
|
||||||
|
|
||||||
|
public Long getProjectId() { return projectId; }
|
||||||
|
public void setProjectId(Long projectId) { this.projectId = projectId; }
|
||||||
|
public List<DatabaseTableDesign> getTables() { return tables; }
|
||||||
|
public void setTables(List<DatabaseTableDesign> tables) { this.tables = tables; }
|
||||||
|
public String getSql() { return sql; }
|
||||||
|
public void setSql(String sql) { this.sql = sql; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DatabaseTableDesign
|
||||||
|
{
|
||||||
|
private Long tableId;
|
||||||
|
private String tableName;
|
||||||
|
private String tableComment;
|
||||||
|
private String className;
|
||||||
|
private String moduleName;
|
||||||
|
private String businessName;
|
||||||
|
private String functionName;
|
||||||
|
private String tplCategory;
|
||||||
|
private String tplWebType;
|
||||||
|
private String options;
|
||||||
|
private String createTableSql;
|
||||||
|
private Integer sort;
|
||||||
|
private List<DatabaseColumnDesign> columns;
|
||||||
|
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public String getTableName() { return tableName; }
|
||||||
|
public void setTableName(String tableName) { this.tableName = tableName; }
|
||||||
|
public String getTableComment() { return tableComment; }
|
||||||
|
public void setTableComment(String tableComment) { this.tableComment = tableComment; }
|
||||||
|
public String getClassName() { return className; }
|
||||||
|
public void setClassName(String className) { this.className = className; }
|
||||||
|
public String getModuleName() { return moduleName; }
|
||||||
|
public void setModuleName(String moduleName) { this.moduleName = moduleName; }
|
||||||
|
public String getBusinessName() { return businessName; }
|
||||||
|
public void setBusinessName(String businessName) { this.businessName = businessName; }
|
||||||
|
public String getFunctionName() { return functionName; }
|
||||||
|
public void setFunctionName(String functionName) { this.functionName = functionName; }
|
||||||
|
public String getTplCategory() { return tplCategory; }
|
||||||
|
public void setTplCategory(String tplCategory) { this.tplCategory = tplCategory; }
|
||||||
|
public String getTplWebType() { return tplWebType; }
|
||||||
|
public void setTplWebType(String tplWebType) { this.tplWebType = tplWebType; }
|
||||||
|
public String getOptions() { return options; }
|
||||||
|
public void setOptions(String options) { this.options = options; }
|
||||||
|
public String getCreateTableSql() { return createTableSql; }
|
||||||
|
public void setCreateTableSql(String createTableSql) { this.createTableSql = createTableSql; }
|
||||||
|
public Integer getSort() { return sort; }
|
||||||
|
public void setSort(Integer sort) { this.sort = sort; }
|
||||||
|
public List<DatabaseColumnDesign> getColumns() { return columns; }
|
||||||
|
public void setColumns(List<DatabaseColumnDesign> columns) { this.columns = columns; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class FrontLoginBody
|
||||||
|
{
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getUsername() { return username; }
|
||||||
|
public void setUsername(String username) { this.username = username; }
|
||||||
|
public String getPassword() { return password; }
|
||||||
|
public void setPassword(String password) { this.password = password; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class FrontProjectCreateRequest
|
||||||
|
{
|
||||||
|
private String projectName;
|
||||||
|
private String projectDesc;
|
||||||
|
private String industryTemplate;
|
||||||
|
private String packageName;
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public String getProjectName() { return projectName; }
|
||||||
|
public void setProjectName(String projectName) { this.projectName = projectName; }
|
||||||
|
public String getProjectDesc() { return projectDesc; }
|
||||||
|
public void setProjectDesc(String projectDesc) { this.projectDesc = projectDesc; }
|
||||||
|
public String getIndustryTemplate() { return industryTemplate; }
|
||||||
|
public void setIndustryTemplate(String industryTemplate) { this.industryTemplate = industryTemplate; }
|
||||||
|
public String getPackageName() { return packageName; }
|
||||||
|
public void setPackageName(String packageName) { this.packageName = packageName; }
|
||||||
|
public String getVersion() { return version; }
|
||||||
|
public void setVersion(String version) { this.version = version; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class FrontProjectUpdateRequest
|
||||||
|
{
|
||||||
|
private String projectName;
|
||||||
|
private String projectDesc;
|
||||||
|
private String industryTemplate;
|
||||||
|
private String packageName;
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public String getProjectName() { return projectName; }
|
||||||
|
public void setProjectName(String projectName) { this.projectName = projectName; }
|
||||||
|
public String getProjectDesc() { return projectDesc; }
|
||||||
|
public void setProjectDesc(String projectDesc) { this.projectDesc = projectDesc; }
|
||||||
|
public String getIndustryTemplate() { return industryTemplate; }
|
||||||
|
public void setIndustryTemplate(String industryTemplate) { this.industryTemplate = industryTemplate; }
|
||||||
|
public String getPackageName() { return packageName; }
|
||||||
|
public void setPackageName(String packageName) { this.packageName = packageName; }
|
||||||
|
public String getVersion() { return version; }
|
||||||
|
public void setVersion(String version) { this.version = version; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class FrontRegisterBody
|
||||||
|
{
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String nickname;
|
||||||
|
private String email;
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
public String getUsername() { return username; }
|
||||||
|
public void setUsername(String username) { this.username = username; }
|
||||||
|
public String getPassword() { return password; }
|
||||||
|
public void setPassword(String password) { this.password = password; }
|
||||||
|
public String getNickname() { return nickname; }
|
||||||
|
public void setNickname(String nickname) { this.nickname = nickname; }
|
||||||
|
public String getEmail() { return email; }
|
||||||
|
public void setEmail(String email) { this.email = email; }
|
||||||
|
public String getPhone() { return phone; }
|
||||||
|
public void setPhone(String phone) { this.phone = phone; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class GenerateDatabaseRequest
|
||||||
|
{
|
||||||
|
private String projectName;
|
||||||
|
private String projectDesc;
|
||||||
|
private String industryTemplate;
|
||||||
|
private String extraRequirements;
|
||||||
|
|
||||||
|
public String getProjectName() { return projectName; }
|
||||||
|
public void setProjectName(String projectName) { this.projectName = projectName; }
|
||||||
|
public String getProjectDesc() { return projectDesc; }
|
||||||
|
public void setProjectDesc(String projectDesc) { this.projectDesc = projectDesc; }
|
||||||
|
public String getIndustryTemplate() { return industryTemplate; }
|
||||||
|
public void setIndustryTemplate(String industryTemplate) { this.industryTemplate = industryTemplate; }
|
||||||
|
public String getExtraRequirements() { return extraRequirements; }
|
||||||
|
public void setExtraRequirements(String extraRequirements) { this.extraRequirements = extraRequirements; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
public class PreviewFileRequest
|
||||||
|
{
|
||||||
|
private String templateType;
|
||||||
|
private String nodeId;
|
||||||
|
private Long tableId;
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
public String getTemplateType() { return templateType; }
|
||||||
|
public void setTemplateType(String templateType) { this.templateType = templateType; }
|
||||||
|
public String getNodeId() { return nodeId; }
|
||||||
|
public void setNodeId(String nodeId) { this.nodeId = nodeId; }
|
||||||
|
public Long getTableId() { return tableId; }
|
||||||
|
public void setTableId(Long tableId) { this.tableId = tableId; }
|
||||||
|
public String getCategory() { return category; }
|
||||||
|
public void setCategory(String category) { this.category = category; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.generator.domain.front.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ProjectStructureResponse
|
||||||
|
{
|
||||||
|
private String templateType;
|
||||||
|
private List<Map<String, Object>> structure;
|
||||||
|
|
||||||
|
public String getTemplateType() { return templateType; }
|
||||||
|
public void setTemplateType(String templateType) { this.templateType = templateType; }
|
||||||
|
public List<Map<String, Object>> getStructure() { return structure; }
|
||||||
|
public void setStructure(List<Map<String, Object>> structure) { this.structure = structure; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectColumn;
|
||||||
|
|
||||||
|
public interface FrontProjectColumnMapper
|
||||||
|
{
|
||||||
|
public FrontProjectColumn selectFrontProjectColumnById(Long columnId);
|
||||||
|
public List<FrontProjectColumn> selectFrontProjectColumnList(FrontProjectColumn frontProjectColumn);
|
||||||
|
public List<FrontProjectColumn> selectColumnsByTableId(Long tableId);
|
||||||
|
public int insertFrontProjectColumn(FrontProjectColumn frontProjectColumn);
|
||||||
|
public int updateFrontProjectColumn(FrontProjectColumn frontProjectColumn);
|
||||||
|
public int deleteFrontProjectColumnById(Long columnId);
|
||||||
|
public int deleteColumnsByProjectId(Long projectId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectFile;
|
||||||
|
|
||||||
|
public interface FrontProjectFileMapper
|
||||||
|
{
|
||||||
|
public FrontProjectFile selectFrontProjectFileById(Long fileId);
|
||||||
|
public List<FrontProjectFile> selectFrontProjectFileList(FrontProjectFile frontProjectFile);
|
||||||
|
public FrontProjectFile selectFrontProjectFileByLookup(@Param("projectId") Long projectId,
|
||||||
|
@Param("templateType") String templateType, @Param("tableId") Long tableId, @Param("nodeId") String nodeId);
|
||||||
|
public int insertFrontProjectFile(FrontProjectFile frontProjectFile);
|
||||||
|
public int updateFrontProjectFile(FrontProjectFile frontProjectFile);
|
||||||
|
public int deleteFrontProjectFileById(Long fileId);
|
||||||
|
public int deleteFilesByProjectId(Long projectId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectGeneration;
|
||||||
|
|
||||||
|
public interface FrontProjectGenerationMapper
|
||||||
|
{
|
||||||
|
public FrontProjectGeneration selectFrontProjectGenerationById(Long generationId);
|
||||||
|
public List<FrontProjectGeneration> selectFrontProjectGenerationList(FrontProjectGeneration frontProjectGeneration);
|
||||||
|
public List<FrontProjectGeneration> selectGenerationsByProjectId(Long projectId);
|
||||||
|
public int insertFrontProjectGeneration(FrontProjectGeneration frontProjectGeneration);
|
||||||
|
public int updateFrontProjectGeneration(FrontProjectGeneration frontProjectGeneration);
|
||||||
|
public int deleteFrontProjectGenerationById(Long generationId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProject;
|
||||||
|
|
||||||
|
public interface FrontProjectMapper
|
||||||
|
{
|
||||||
|
public FrontProject selectFrontProjectById(Long projectId);
|
||||||
|
public List<FrontProject> selectFrontProjectList(FrontProject frontProject);
|
||||||
|
public int insertFrontProject(FrontProject frontProject);
|
||||||
|
public int updateFrontProject(FrontProject frontProject);
|
||||||
|
public int deleteFrontProjectById(Long projectId);
|
||||||
|
public FrontProject selectFrontProjectByUserAndId(@Param("userId") Long userId, @Param("projectId") Long projectId);
|
||||||
|
public int deleteFrontProjectByUserAndId(@Param("userId") Long userId, @Param("projectId") Long projectId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectTable;
|
||||||
|
|
||||||
|
public interface FrontProjectTableMapper
|
||||||
|
{
|
||||||
|
public FrontProjectTable selectFrontProjectTableById(Long tableId);
|
||||||
|
public List<FrontProjectTable> selectFrontProjectTableList(FrontProjectTable frontProjectTable);
|
||||||
|
public List<FrontProjectTable> selectTablesByProjectId(Long projectId);
|
||||||
|
public int insertFrontProjectTable(FrontProjectTable frontProjectTable);
|
||||||
|
public int updateFrontProjectTable(FrontProjectTable frontProjectTable);
|
||||||
|
public int deleteFrontProjectTableById(Long tableId);
|
||||||
|
public int deleteTablesByProjectId(Long projectId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.generator.mapper.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontUser;
|
||||||
|
|
||||||
|
public interface FrontUserMapper
|
||||||
|
{
|
||||||
|
public FrontUser selectFrontUserById(Long userId);
|
||||||
|
public FrontUser selectFrontUserByUsername(String username);
|
||||||
|
public List<FrontUser> selectFrontUserList(FrontUser frontUser);
|
||||||
|
public int insertFrontUser(FrontUser frontUser);
|
||||||
|
public int updateFrontUser(FrontUser frontUser);
|
||||||
|
public int deleteFrontUserById(Long userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.GenProject;
|
||||||
|
import com.ruoyi.generator.domain.GenTable;
|
||||||
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProject;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectColumn;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectTable;
|
||||||
|
|
||||||
|
public class FrontProjectConverter
|
||||||
|
{
|
||||||
|
public static GenProject toGenProject(FrontProject project)
|
||||||
|
{
|
||||||
|
if (project == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
GenProject genProject = new GenProject();
|
||||||
|
genProject.setProjectId(project.getProjectId());
|
||||||
|
genProject.setProjectName(project.getProjectName());
|
||||||
|
genProject.setProjectFileName(project.getProjectFileName());
|
||||||
|
genProject.setPackageName(project.getPackageName());
|
||||||
|
genProject.setVersion(project.getVersion());
|
||||||
|
genProject.setProjectDesc(project.getProjectDesc());
|
||||||
|
genProject.setFrontFramework(project.getFrontFramework());
|
||||||
|
genProject.setBackFramework(project.getBackFramework());
|
||||||
|
genProject.setStatus(project.getStatus());
|
||||||
|
genProject.setTables(toGenTables(project.getTables()));
|
||||||
|
return genProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<GenTable> toGenTables(List<FrontProjectTable> tables)
|
||||||
|
{
|
||||||
|
List<GenTable> genTables = new ArrayList<GenTable>();
|
||||||
|
if (tables == null)
|
||||||
|
{
|
||||||
|
return genTables;
|
||||||
|
}
|
||||||
|
for (FrontProjectTable table : tables)
|
||||||
|
{
|
||||||
|
genTables.add(toGenTable(table));
|
||||||
|
}
|
||||||
|
return genTables;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static GenTable toGenTable(FrontProjectTable table)
|
||||||
|
{
|
||||||
|
GenTable genTable = new GenTable();
|
||||||
|
genTable.setTableId(table.getTableId());
|
||||||
|
genTable.setTableName(table.getTableName());
|
||||||
|
genTable.setTableComment(table.getTableComment());
|
||||||
|
genTable.setClassName(table.getClassName());
|
||||||
|
genTable.setModuleName(table.getModuleName());
|
||||||
|
genTable.setBusinessName(table.getBusinessName());
|
||||||
|
genTable.setFunctionName(table.getFunctionName());
|
||||||
|
genTable.setTplCategory(table.getTplCategory());
|
||||||
|
genTable.setTplWebType(table.getTplWebType());
|
||||||
|
genTable.setOptions(table.getOptions());
|
||||||
|
genTable.setCreateTableSql(table.getCreateTableSql());
|
||||||
|
genTable.setColumns(toGenColumns(table.getColumns()));
|
||||||
|
return genTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<GenTableColumn> toGenColumns(List<FrontProjectColumn> columns)
|
||||||
|
{
|
||||||
|
List<GenTableColumn> genColumns = new ArrayList<GenTableColumn>();
|
||||||
|
if (columns == null)
|
||||||
|
{
|
||||||
|
return genColumns;
|
||||||
|
}
|
||||||
|
for (FrontProjectColumn column : columns)
|
||||||
|
{
|
||||||
|
GenTableColumn genColumn = new GenTableColumn();
|
||||||
|
genColumn.setColumnId(column.getColumnId());
|
||||||
|
genColumn.setTableId(column.getTableId());
|
||||||
|
genColumn.setColumnName(column.getColumnName());
|
||||||
|
genColumn.setColumnComment(column.getColumnComment());
|
||||||
|
genColumn.setColumnType(column.getColumnType());
|
||||||
|
genColumn.setJavaType(column.getJavaType());
|
||||||
|
genColumn.setJavaField(column.getJavaField());
|
||||||
|
genColumn.setIsPk(column.getIsPk());
|
||||||
|
genColumn.setIsIncrement(column.getIsIncrement());
|
||||||
|
genColumn.setIsRequired(column.getIsRequired());
|
||||||
|
genColumn.setIsInsert(column.getIsInsert());
|
||||||
|
genColumn.setIsEdit(column.getIsEdit());
|
||||||
|
genColumn.setIsList(column.getIsList());
|
||||||
|
genColumn.setIsQuery(column.getIsQuery());
|
||||||
|
genColumn.setQueryType(column.getQueryType());
|
||||||
|
genColumn.setHtmlType(column.getHtmlType());
|
||||||
|
genColumn.setDictType(column.getDictType());
|
||||||
|
genColumn.setSort(column.getSort());
|
||||||
|
genColumns.add(genColumn);
|
||||||
|
}
|
||||||
|
return genColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProject;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectColumn;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectTable;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.DatabaseColumnDesign;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.DatabaseDesignResponse;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.DatabaseTableDesign;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontProjectCreateRequest;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontProjectUpdateRequest;
|
||||||
|
import com.ruoyi.generator.mapper.front.FrontProjectColumnMapper;
|
||||||
|
import com.ruoyi.generator.mapper.front.FrontProjectMapper;
|
||||||
|
import com.ruoyi.generator.mapper.front.FrontProjectTableMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FrontProjectServiceImpl implements IFrontProjectService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private FrontProjectMapper frontProjectMapper;
|
||||||
|
@Autowired
|
||||||
|
private FrontProjectTableMapper frontProjectTableMapper;
|
||||||
|
@Autowired
|
||||||
|
private FrontProjectColumnMapper frontProjectColumnMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontProject createProject(Long userId, FrontProjectCreateRequest request)
|
||||||
|
{
|
||||||
|
if (userId == null || request == null || StringUtils.isEmpty(request.getProjectName()))
|
||||||
|
{
|
||||||
|
throw new ServiceException("项目名称不能为空");
|
||||||
|
}
|
||||||
|
FrontProject project = new FrontProject();
|
||||||
|
project.setUserId(userId);
|
||||||
|
project.setProjectName(request.getProjectName());
|
||||||
|
project.setProjectDesc(request.getProjectDesc());
|
||||||
|
project.setIndustryTemplate(request.getIndustryTemplate());
|
||||||
|
project.setPackageName(StringUtils.defaultIfEmpty(request.getPackageName(), "com.easycode.generated"));
|
||||||
|
project.setVersion(StringUtils.defaultIfEmpty(request.getVersion(), "1.0.0"));
|
||||||
|
project.setProjectFileName(toProjectFileName(request.getProjectName()));
|
||||||
|
project.setFrontFramework("Vue3 + Element Plus");
|
||||||
|
project.setBackFramework("Spring Boot + MyBatis");
|
||||||
|
project.setGenerateStatus("0");
|
||||||
|
project.setPreviewStatus("0");
|
||||||
|
project.setStatus("0");
|
||||||
|
frontProjectMapper.insertFrontProject(project);
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FrontProject> listProjects(Long userId)
|
||||||
|
{
|
||||||
|
FrontProject query = new FrontProject();
|
||||||
|
query.setUserId(userId);
|
||||||
|
return frontProjectMapper.selectFrontProjectList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontProject getProject(Long userId, Long projectId)
|
||||||
|
{
|
||||||
|
FrontProject project = frontProjectMapper.selectFrontProjectByUserAndId(userId, projectId);
|
||||||
|
if (project == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("项目不存在");
|
||||||
|
}
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateProject(Long userId, Long projectId, FrontProjectUpdateRequest request)
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("项目参数不能为空");
|
||||||
|
}
|
||||||
|
getProject(userId, projectId);
|
||||||
|
FrontProject project = new FrontProject();
|
||||||
|
project.setProjectId(projectId);
|
||||||
|
project.setUserId(userId);
|
||||||
|
project.setProjectName(request.getProjectName());
|
||||||
|
project.setProjectDesc(request.getProjectDesc());
|
||||||
|
project.setIndustryTemplate(request.getIndustryTemplate());
|
||||||
|
project.setPackageName(request.getPackageName());
|
||||||
|
project.setVersion(request.getVersion());
|
||||||
|
return frontProjectMapper.updateFrontProject(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int deleteProject(Long userId, Long projectId)
|
||||||
|
{
|
||||||
|
getProject(userId, projectId);
|
||||||
|
frontProjectColumnMapper.deleteColumnsByProjectId(projectId);
|
||||||
|
frontProjectTableMapper.deleteTablesByProjectId(projectId);
|
||||||
|
return frontProjectMapper.deleteFrontProjectByUserAndId(userId, projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseDesignResponse getDatabase(Long userId, Long projectId)
|
||||||
|
{
|
||||||
|
getProject(userId, projectId);
|
||||||
|
DatabaseDesignResponse response = new DatabaseDesignResponse();
|
||||||
|
response.setProjectId(projectId);
|
||||||
|
List<DatabaseTableDesign> tables = new ArrayList<DatabaseTableDesign>();
|
||||||
|
List<FrontProjectTable> projectTables = frontProjectTableMapper.selectTablesByProjectId(projectId);
|
||||||
|
if (projectTables == null)
|
||||||
|
{
|
||||||
|
projectTables = new ArrayList<FrontProjectTable>();
|
||||||
|
}
|
||||||
|
for (FrontProjectTable table : projectTables)
|
||||||
|
{
|
||||||
|
List<FrontProjectColumn> columns = frontProjectColumnMapper.selectColumnsByTableId(table.getTableId());
|
||||||
|
table.setColumns(columns);
|
||||||
|
tables.add(toTableDesign(table));
|
||||||
|
}
|
||||||
|
response.setTables(tables);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public DatabaseDesignResponse saveDatabase(Long userId, Long projectId, DatabaseDesignResponse request)
|
||||||
|
{
|
||||||
|
getProject(userId, projectId);
|
||||||
|
frontProjectColumnMapper.deleteColumnsByProjectId(projectId);
|
||||||
|
frontProjectTableMapper.deleteTablesByProjectId(projectId);
|
||||||
|
if (request != null && request.getTables() != null)
|
||||||
|
{
|
||||||
|
for (DatabaseTableDesign tableDesign : request.getTables())
|
||||||
|
{
|
||||||
|
if (tableDesign == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
FrontProjectTable table = toFrontProjectTable(projectId, userId, tableDesign);
|
||||||
|
frontProjectTableMapper.insertFrontProjectTable(table);
|
||||||
|
if (tableDesign.getColumns() != null)
|
||||||
|
{
|
||||||
|
for (DatabaseColumnDesign columnDesign : tableDesign.getColumns())
|
||||||
|
{
|
||||||
|
FrontProjectColumn column = toFrontProjectColumn(projectId, table.getTableId(), columnDesign);
|
||||||
|
frontProjectColumnMapper.insertFrontProjectColumn(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getDatabase(userId, projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toProjectFileName(String projectName)
|
||||||
|
{
|
||||||
|
return StringUtils.defaultString(projectName).trim().replaceAll("\\s+", "-").toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
private FrontProjectTable toFrontProjectTable(Long projectId, Long userId, DatabaseTableDesign source)
|
||||||
|
{
|
||||||
|
FrontProjectTable table = new FrontProjectTable();
|
||||||
|
table.setProjectId(projectId);
|
||||||
|
table.setUserId(userId);
|
||||||
|
table.setTableName(source.getTableName());
|
||||||
|
table.setTableComment(source.getTableComment());
|
||||||
|
table.setClassName(source.getClassName());
|
||||||
|
table.setModuleName(source.getModuleName());
|
||||||
|
table.setBusinessName(source.getBusinessName());
|
||||||
|
table.setFunctionName(source.getFunctionName());
|
||||||
|
table.setTplCategory(StringUtils.defaultIfEmpty(source.getTplCategory(), "crud"));
|
||||||
|
table.setTplWebType(StringUtils.defaultIfEmpty(source.getTplWebType(), "element-plus"));
|
||||||
|
table.setOptions(source.getOptions());
|
||||||
|
table.setCreateTableSql(source.getCreateTableSql());
|
||||||
|
table.setSort(source.getSort());
|
||||||
|
table.setStatus("0");
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FrontProjectColumn toFrontProjectColumn(Long projectId, Long tableId, DatabaseColumnDesign source)
|
||||||
|
{
|
||||||
|
FrontProjectColumn column = new FrontProjectColumn();
|
||||||
|
column.setProjectId(projectId);
|
||||||
|
column.setTableId(tableId);
|
||||||
|
column.setColumnName(source.getColumnName());
|
||||||
|
column.setColumnComment(source.getColumnComment());
|
||||||
|
column.setColumnType(source.getColumnType());
|
||||||
|
column.setJavaType(source.getJavaType());
|
||||||
|
column.setJavaField(source.getJavaField());
|
||||||
|
column.setIsPk(source.getIsPk());
|
||||||
|
column.setIsIncrement(source.getIsIncrement());
|
||||||
|
column.setIsRequired(source.getIsRequired());
|
||||||
|
column.setIsInsert(source.getIsInsert());
|
||||||
|
column.setIsEdit(source.getIsEdit());
|
||||||
|
column.setIsList(source.getIsList());
|
||||||
|
column.setIsQuery(source.getIsQuery());
|
||||||
|
column.setQueryType(source.getQueryType());
|
||||||
|
column.setHtmlType(source.getHtmlType());
|
||||||
|
column.setDictType(source.getDictType());
|
||||||
|
column.setDefaultValue(source.getDefaultValue());
|
||||||
|
column.setSort(source.getSort());
|
||||||
|
return column;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DatabaseTableDesign toTableDesign(FrontProjectTable source)
|
||||||
|
{
|
||||||
|
DatabaseTableDesign table = new DatabaseTableDesign();
|
||||||
|
table.setTableId(source.getTableId());
|
||||||
|
table.setTableName(source.getTableName());
|
||||||
|
table.setTableComment(source.getTableComment());
|
||||||
|
table.setClassName(source.getClassName());
|
||||||
|
table.setModuleName(source.getModuleName());
|
||||||
|
table.setBusinessName(source.getBusinessName());
|
||||||
|
table.setFunctionName(source.getFunctionName());
|
||||||
|
table.setTplCategory(source.getTplCategory());
|
||||||
|
table.setTplWebType(source.getTplWebType());
|
||||||
|
table.setOptions(source.getOptions());
|
||||||
|
table.setCreateTableSql(source.getCreateTableSql());
|
||||||
|
table.setSort(source.getSort());
|
||||||
|
List<DatabaseColumnDesign> columns = new ArrayList<DatabaseColumnDesign>();
|
||||||
|
if (source.getColumns() != null)
|
||||||
|
{
|
||||||
|
for (FrontProjectColumn column : source.getColumns())
|
||||||
|
{
|
||||||
|
columns.add(toColumnDesign(column));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.setColumns(columns);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DatabaseColumnDesign toColumnDesign(FrontProjectColumn source)
|
||||||
|
{
|
||||||
|
DatabaseColumnDesign column = new DatabaseColumnDesign();
|
||||||
|
column.setColumnId(source.getColumnId());
|
||||||
|
column.setTableId(source.getTableId());
|
||||||
|
column.setColumnName(source.getColumnName());
|
||||||
|
column.setColumnComment(source.getColumnComment());
|
||||||
|
column.setColumnType(source.getColumnType());
|
||||||
|
column.setJavaType(source.getJavaType());
|
||||||
|
column.setJavaField(source.getJavaField());
|
||||||
|
column.setIsPk(source.getIsPk());
|
||||||
|
column.setIsIncrement(source.getIsIncrement());
|
||||||
|
column.setIsRequired(source.getIsRequired());
|
||||||
|
column.setIsInsert(source.getIsInsert());
|
||||||
|
column.setIsEdit(source.getIsEdit());
|
||||||
|
column.setIsList(source.getIsList());
|
||||||
|
column.setIsQuery(source.getIsQuery());
|
||||||
|
column.setQueryType(source.getQueryType());
|
||||||
|
column.setHtmlType(source.getHtmlType());
|
||||||
|
column.setDictType(source.getDictType());
|
||||||
|
column.setDefaultValue(source.getDefaultValue());
|
||||||
|
column.setSort(source.getSort());
|
||||||
|
return column;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontUser;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontLoginBody;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontRegisterBody;
|
||||||
|
import com.ruoyi.generator.mapper.front.FrontUserMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FrontUserServiceImpl implements IFrontUserService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private FrontUserMapper frontUserMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontUser login(FrontLoginBody loginBody)
|
||||||
|
{
|
||||||
|
if (loginBody == null || StringUtils.isEmpty(loginBody.getUsername()) || StringUtils.isEmpty(loginBody.getPassword()))
|
||||||
|
{
|
||||||
|
throw new ServiceException("用户名或密码不能为空");
|
||||||
|
}
|
||||||
|
FrontUser user = frontUserMapper.selectFrontUserByUsername(loginBody.getUsername());
|
||||||
|
if (user == null || !StringUtils.equals(user.getPassword(), loginBody.getPassword()))
|
||||||
|
{
|
||||||
|
throw new ServiceException("用户名或密码错误");
|
||||||
|
}
|
||||||
|
user.setLastLoginTime(new Date());
|
||||||
|
frontUserMapper.updateFrontUser(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontUser register(FrontRegisterBody registerBody)
|
||||||
|
{
|
||||||
|
if (registerBody == null || StringUtils.isEmpty(registerBody.getUsername()) || StringUtils.isEmpty(registerBody.getPassword()))
|
||||||
|
{
|
||||||
|
throw new ServiceException("用户名或密码不能为空");
|
||||||
|
}
|
||||||
|
if (frontUserMapper.selectFrontUserByUsername(registerBody.getUsername()) != null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("用户名已存在");
|
||||||
|
}
|
||||||
|
FrontUser user = new FrontUser();
|
||||||
|
user.setUsername(registerBody.getUsername());
|
||||||
|
user.setPassword(registerBody.getPassword());
|
||||||
|
user.setNickname(registerBody.getNickname());
|
||||||
|
user.setEmail(registerBody.getEmail());
|
||||||
|
user.setPhone(registerBody.getPhone());
|
||||||
|
user.setStatus("0");
|
||||||
|
user.setDelFlag("0");
|
||||||
|
frontUserMapper.insertFrontUser(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontUser selectFrontUserById(Long userId)
|
||||||
|
{
|
||||||
|
return frontUserMapper.selectFrontUserById(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FrontUser selectFrontUserByUsername(String username)
|
||||||
|
{
|
||||||
|
return frontUserMapper.selectFrontUserByUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FrontUser> selectFrontUserList(FrontUser frontUser)
|
||||||
|
{
|
||||||
|
return frontUserMapper.selectFrontUserList(frontUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProject;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.DatabaseDesignResponse;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontProjectCreateRequest;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontProjectUpdateRequest;
|
||||||
|
|
||||||
|
public interface IFrontProjectService
|
||||||
|
{
|
||||||
|
public FrontProject createProject(Long userId, FrontProjectCreateRequest request);
|
||||||
|
public List<FrontProject> listProjects(Long userId);
|
||||||
|
public FrontProject getProject(Long userId, Long projectId);
|
||||||
|
public int updateProject(Long userId, Long projectId, FrontProjectUpdateRequest request);
|
||||||
|
public int deleteProject(Long userId, Long projectId);
|
||||||
|
public DatabaseDesignResponse getDatabase(Long userId, Long projectId);
|
||||||
|
public DatabaseDesignResponse saveDatabase(Long userId, Long projectId, DatabaseDesignResponse request);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontUser;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontLoginBody;
|
||||||
|
import com.ruoyi.generator.domain.front.dto.FrontRegisterBody;
|
||||||
|
|
||||||
|
public interface IFrontUserService
|
||||||
|
{
|
||||||
|
public FrontUser login(FrontLoginBody loginBody);
|
||||||
|
public FrontUser register(FrontRegisterBody registerBody);
|
||||||
|
public FrontUser selectFrontUserById(Long userId);
|
||||||
|
public FrontUser selectFrontUserByUsername(String username);
|
||||||
|
public List<FrontUser> selectFrontUserList(FrontUser frontUser);
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<?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.front.FrontProjectColumnMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontProjectColumn" id="FrontProjectColumnResult">
|
||||||
|
<id property="columnId" column="column_id" />
|
||||||
|
<result property="tableId" column="table_id" />
|
||||||
|
<result property="projectId" column="project_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="defaultValue" column="default_value" />
|
||||||
|
<result property="sort" column="sort" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontProjectColumnVo">
|
||||||
|
select column_id, table_id, project_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, default_value, sort, create_time, update_time from front_project_column
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectColumnById" parameterType="Long" resultMap="FrontProjectColumnResult">
|
||||||
|
<include refid="selectFrontProjectColumnVo"/>
|
||||||
|
where column_id = #{columnId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectColumnsByTableId" parameterType="Long" resultMap="FrontProjectColumnResult">
|
||||||
|
<include refid="selectFrontProjectColumnVo"/>
|
||||||
|
where table_id = #{tableId}
|
||||||
|
order by sort, column_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectColumnList" parameterType="FrontProjectColumn" resultMap="FrontProjectColumnResult">
|
||||||
|
<include refid="selectFrontProjectColumnVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="tableId != null"> and table_id = #{tableId}</if>
|
||||||
|
<if test="projectId != null"> and project_id = #{projectId}</if>
|
||||||
|
<if test="columnName != null and columnName != ''"> and column_name like concat('%', #{columnName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontProjectColumn" parameterType="FrontProjectColumn" useGeneratedKeys="true" keyProperty="columnId">
|
||||||
|
insert into front_project_column
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="tableId != null">table_id,</if>
|
||||||
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="columnName != null">column_name,</if>
|
||||||
|
<if test="columnComment != null">column_comment,</if>
|
||||||
|
<if test="columnType != null">column_type,</if>
|
||||||
|
<if test="javaType != null">java_type,</if>
|
||||||
|
<if test="javaField != null">java_field,</if>
|
||||||
|
<if test="isPk != null">is_pk,</if>
|
||||||
|
<if test="isIncrement != null">is_increment,</if>
|
||||||
|
<if test="isRequired != null">is_required,</if>
|
||||||
|
<if test="isInsert != null">is_insert,</if>
|
||||||
|
<if test="isEdit != null">is_edit,</if>
|
||||||
|
<if test="isList != null">is_list,</if>
|
||||||
|
<if test="isQuery != null">is_query,</if>
|
||||||
|
<if test="queryType != null">query_type,</if>
|
||||||
|
<if test="htmlType != null">html_type,</if>
|
||||||
|
<if test="dictType != null">dict_type,</if>
|
||||||
|
<if test="defaultValue != null">default_value,</if>
|
||||||
|
<if test="sort != null">sort,</if>
|
||||||
|
create_time,
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="tableId != null">#{tableId},</if>
|
||||||
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="columnName != null">#{columnName},</if>
|
||||||
|
<if test="columnComment != null">#{columnComment},</if>
|
||||||
|
<if test="columnType != null">#{columnType},</if>
|
||||||
|
<if test="javaType != null">#{javaType},</if>
|
||||||
|
<if test="javaField != null">#{javaField},</if>
|
||||||
|
<if test="isPk != null">#{isPk},</if>
|
||||||
|
<if test="isIncrement != null">#{isIncrement},</if>
|
||||||
|
<if test="isRequired != null">#{isRequired},</if>
|
||||||
|
<if test="isInsert != null">#{isInsert},</if>
|
||||||
|
<if test="isEdit != null">#{isEdit},</if>
|
||||||
|
<if test="isList != null">#{isList},</if>
|
||||||
|
<if test="isQuery != null">#{isQuery},</if>
|
||||||
|
<if test="queryType != null">#{queryType},</if>
|
||||||
|
<if test="htmlType != null">#{htmlType},</if>
|
||||||
|
<if test="dictType != null">#{dictType},</if>
|
||||||
|
<if test="defaultValue != null">#{defaultValue},</if>
|
||||||
|
<if test="sort != null">#{sort},</if>
|
||||||
|
sysdate(),
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontProjectColumn" parameterType="FrontProjectColumn">
|
||||||
|
update front_project_column
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="columnName != null">column_name = #{columnName},</if>
|
||||||
|
<if test="columnComment != null">column_comment = #{columnComment},</if>
|
||||||
|
<if test="columnType != null">column_type = #{columnType},</if>
|
||||||
|
<if test="javaType != null">java_type = #{javaType},</if>
|
||||||
|
<if test="javaField != null">java_field = #{javaField},</if>
|
||||||
|
<if test="isPk != null">is_pk = #{isPk},</if>
|
||||||
|
<if test="isIncrement != null">is_increment = #{isIncrement},</if>
|
||||||
|
<if test="isRequired != null">is_required = #{isRequired},</if>
|
||||||
|
<if test="isInsert != null">is_insert = #{isInsert},</if>
|
||||||
|
<if test="isEdit != null">is_edit = #{isEdit},</if>
|
||||||
|
<if test="isList != null">is_list = #{isList},</if>
|
||||||
|
<if test="isQuery != null">is_query = #{isQuery},</if>
|
||||||
|
<if test="queryType != null">query_type = #{queryType},</if>
|
||||||
|
<if test="htmlType != null">html_type = #{htmlType},</if>
|
||||||
|
<if test="dictType != null">dict_type = #{dictType},</if>
|
||||||
|
<if test="defaultValue != null">default_value = #{defaultValue},</if>
|
||||||
|
<if test="sort != null">sort = #{sort},</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
</trim>
|
||||||
|
where column_id = #{columnId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectColumnById" parameterType="Long">
|
||||||
|
delete from front_project_column where column_id = #{columnId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteColumnsByProjectId" parameterType="Long">
|
||||||
|
delete from front_project_column where project_id = #{projectId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<?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.front.FrontProjectFileMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontProjectFile" id="FrontProjectFileResult">
|
||||||
|
<id property="fileId" column="file_id" />
|
||||||
|
<result property="projectId" column="project_id" />
|
||||||
|
<result property="templateType" column="template_type" />
|
||||||
|
<result property="nodeId" column="node_id" />
|
||||||
|
<result property="tableId" column="table_id" />
|
||||||
|
<result property="fileName" column="file_name" />
|
||||||
|
<result property="filePath" column="file_path" />
|
||||||
|
<result property="fileContent" column="file_content" />
|
||||||
|
<result property="contentHash" column="content_hash" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontProjectFileVo">
|
||||||
|
select file_id, project_id, template_type, node_id, table_id, file_name, file_path, file_content, content_hash, create_time, update_time from front_project_file
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectFileById" parameterType="Long" resultMap="FrontProjectFileResult">
|
||||||
|
<include refid="selectFrontProjectFileVo"/>
|
||||||
|
where file_id = #{fileId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectFileByLookup" resultMap="FrontProjectFileResult">
|
||||||
|
<include refid="selectFrontProjectFileVo"/>
|
||||||
|
where project_id = #{projectId}
|
||||||
|
and template_type = #{templateType}
|
||||||
|
and node_id = #{nodeId}
|
||||||
|
<if test="tableId == null"> and table_id is null</if>
|
||||||
|
<if test="tableId != null"> and table_id = #{tableId}</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectFileList" parameterType="FrontProjectFile" resultMap="FrontProjectFileResult">
|
||||||
|
<include refid="selectFrontProjectFileVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="projectId != null"> and project_id = #{projectId}</if>
|
||||||
|
<if test="templateType != null and templateType != ''"> and template_type = #{templateType}</if>
|
||||||
|
<if test="tableId != null"> and table_id = #{tableId}</if>
|
||||||
|
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontProjectFile" parameterType="FrontProjectFile" useGeneratedKeys="true" keyProperty="fileId">
|
||||||
|
insert into front_project_file
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="templateType != null">template_type,</if>
|
||||||
|
<if test="nodeId != null">node_id,</if>
|
||||||
|
<if test="tableId != null">table_id,</if>
|
||||||
|
<if test="fileName != null">file_name,</if>
|
||||||
|
<if test="filePath != null">file_path,</if>
|
||||||
|
<if test="fileContent != null">file_content,</if>
|
||||||
|
<if test="contentHash != null">content_hash,</if>
|
||||||
|
create_time,
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="templateType != null">#{templateType},</if>
|
||||||
|
<if test="nodeId != null">#{nodeId},</if>
|
||||||
|
<if test="tableId != null">#{tableId},</if>
|
||||||
|
<if test="fileName != null">#{fileName},</if>
|
||||||
|
<if test="filePath != null">#{filePath},</if>
|
||||||
|
<if test="fileContent != null">#{fileContent},</if>
|
||||||
|
<if test="contentHash != null">#{contentHash},</if>
|
||||||
|
sysdate(),
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontProjectFile" parameterType="FrontProjectFile">
|
||||||
|
update front_project_file
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="fileName != null">file_name = #{fileName},</if>
|
||||||
|
<if test="filePath != null">file_path = #{filePath},</if>
|
||||||
|
<if test="fileContent != null">file_content = #{fileContent},</if>
|
||||||
|
<if test="contentHash != null">content_hash = #{contentHash},</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
</trim>
|
||||||
|
where file_id = #{fileId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectFileById" parameterType="Long">
|
||||||
|
delete from front_project_file where file_id = #{fileId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteFilesByProjectId" parameterType="Long">
|
||||||
|
delete from front_project_file where project_id = #{projectId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<?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.front.FrontProjectGenerationMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontProjectGeneration" id="FrontProjectGenerationResult">
|
||||||
|
<id property="generationId" column="generation_id" />
|
||||||
|
<result property="projectId" column="project_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="generateType" column="generate_type" />
|
||||||
|
<result property="provider" column="provider" />
|
||||||
|
<result property="promptSummary" column="prompt_summary" />
|
||||||
|
<result property="requestPayload" column="request_payload" />
|
||||||
|
<result property="responsePayload" column="response_payload" />
|
||||||
|
<result property="success" column="success" />
|
||||||
|
<result property="errorMessage" column="error_message" />
|
||||||
|
<result property="tokenUsage" column="token_usage" />
|
||||||
|
<result property="elapsedMs" column="elapsed_ms" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontProjectGenerationVo">
|
||||||
|
select generation_id, project_id, user_id, generate_type, provider, prompt_summary, request_payload, response_payload, success, error_message, token_usage, elapsed_ms, create_time from front_project_generation
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectGenerationById" parameterType="Long" resultMap="FrontProjectGenerationResult">
|
||||||
|
<include refid="selectFrontProjectGenerationVo"/>
|
||||||
|
where generation_id = #{generationId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectGenerationsByProjectId" parameterType="Long" resultMap="FrontProjectGenerationResult">
|
||||||
|
<include refid="selectFrontProjectGenerationVo"/>
|
||||||
|
where project_id = #{projectId}
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectGenerationList" parameterType="FrontProjectGeneration" resultMap="FrontProjectGenerationResult">
|
||||||
|
<include refid="selectFrontProjectGenerationVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="projectId != null"> and project_id = #{projectId}</if>
|
||||||
|
<if test="userId != null"> and user_id = #{userId}</if>
|
||||||
|
<if test="generateType != null and generateType != ''"> and generate_type = #{generateType}</if>
|
||||||
|
<if test="success != null and success != ''"> and success = #{success}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontProjectGeneration" parameterType="FrontProjectGeneration" useGeneratedKeys="true" keyProperty="generationId">
|
||||||
|
insert into front_project_generation
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="generateType != null">generate_type,</if>
|
||||||
|
<if test="provider != null">provider,</if>
|
||||||
|
<if test="promptSummary != null">prompt_summary,</if>
|
||||||
|
<if test="requestPayload != null">request_payload,</if>
|
||||||
|
<if test="responsePayload != null">response_payload,</if>
|
||||||
|
<if test="success != null">success,</if>
|
||||||
|
<if test="errorMessage != null">error_message,</if>
|
||||||
|
<if test="tokenUsage != null">token_usage,</if>
|
||||||
|
<if test="elapsedMs != null">elapsed_ms,</if>
|
||||||
|
create_time,
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="generateType != null">#{generateType},</if>
|
||||||
|
<if test="provider != null">#{provider},</if>
|
||||||
|
<if test="promptSummary != null">#{promptSummary},</if>
|
||||||
|
<if test="requestPayload != null">#{requestPayload},</if>
|
||||||
|
<if test="responsePayload != null">#{responsePayload},</if>
|
||||||
|
<if test="success != null">#{success},</if>
|
||||||
|
<if test="errorMessage != null">#{errorMessage},</if>
|
||||||
|
<if test="tokenUsage != null">#{tokenUsage},</if>
|
||||||
|
<if test="elapsedMs != null">#{elapsedMs},</if>
|
||||||
|
sysdate(),
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontProjectGeneration" parameterType="FrontProjectGeneration">
|
||||||
|
update front_project_generation
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="responsePayload != null">response_payload = #{responsePayload},</if>
|
||||||
|
<if test="success != null">success = #{success},</if>
|
||||||
|
<if test="errorMessage != null">error_message = #{errorMessage},</if>
|
||||||
|
<if test="tokenUsage != null">token_usage = #{tokenUsage},</if>
|
||||||
|
<if test="elapsedMs != null">elapsed_ms = #{elapsedMs},</if>
|
||||||
|
</trim>
|
||||||
|
where generation_id = #{generationId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectGenerationById" parameterType="Long">
|
||||||
|
delete from front_project_generation where generation_id = #{generationId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
<?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.front.FrontProjectMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontProject" id="FrontProjectResult">
|
||||||
|
<id property="projectId" column="project_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="projectName" column="project_name" />
|
||||||
|
<result property="projectFileName" column="project_file_name" />
|
||||||
|
<result property="packageName" column="package_name" />
|
||||||
|
<result property="version" column="version" />
|
||||||
|
<result property="projectDesc" column="project_desc" />
|
||||||
|
<result property="industryTemplate" column="industry_template" />
|
||||||
|
<result property="frontFramework" column="front_framework" />
|
||||||
|
<result property="backFramework" column="back_framework" />
|
||||||
|
<result property="generateStatus" column="generate_status" />
|
||||||
|
<result property="previewStatus" column="preview_status" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontProjectVo">
|
||||||
|
select project_id, user_id, project_name, project_file_name, package_name, version, project_desc, industry_template, front_framework, back_framework, generate_status, preview_status, status, create_time, update_time, remark from front_project
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectById" parameterType="Long" resultMap="FrontProjectResult">
|
||||||
|
<include refid="selectFrontProjectVo"/>
|
||||||
|
where project_id = #{projectId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectByUserAndId" resultMap="FrontProjectResult">
|
||||||
|
<include refid="selectFrontProjectVo"/>
|
||||||
|
where user_id = #{userId} and project_id = #{projectId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectList" parameterType="FrontProject" resultMap="FrontProjectResult">
|
||||||
|
<include refid="selectFrontProjectVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="userId != null"> and user_id = #{userId}</if>
|
||||||
|
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
|
||||||
|
<if test="industryTemplate != null and industryTemplate != ''"> and industry_template = #{industryTemplate}</if>
|
||||||
|
<if test="generateStatus != null and generateStatus != ''"> and generate_status = #{generateStatus}</if>
|
||||||
|
<if test="previewStatus != null and previewStatus != ''"> and preview_status = #{previewStatus}</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontProject" parameterType="FrontProject" useGeneratedKeys="true" keyProperty="projectId">
|
||||||
|
insert into front_project
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="projectName != null">project_name,</if>
|
||||||
|
<if test="projectFileName != null">project_file_name,</if>
|
||||||
|
<if test="packageName != null">package_name,</if>
|
||||||
|
<if test="version != null">version,</if>
|
||||||
|
<if test="projectDesc != null">project_desc,</if>
|
||||||
|
<if test="industryTemplate != null">industry_template,</if>
|
||||||
|
<if test="frontFramework != null">front_framework,</if>
|
||||||
|
<if test="backFramework != null">back_framework,</if>
|
||||||
|
<if test="generateStatus != null">generate_status,</if>
|
||||||
|
<if test="previewStatus != null">preview_status,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
create_time,
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="projectName != null">#{projectName},</if>
|
||||||
|
<if test="projectFileName != null">#{projectFileName},</if>
|
||||||
|
<if test="packageName != null">#{packageName},</if>
|
||||||
|
<if test="version != null">#{version},</if>
|
||||||
|
<if test="projectDesc != null">#{projectDesc},</if>
|
||||||
|
<if test="industryTemplate != null">#{industryTemplate},</if>
|
||||||
|
<if test="frontFramework != null">#{frontFramework},</if>
|
||||||
|
<if test="backFramework != null">#{backFramework},</if>
|
||||||
|
<if test="generateStatus != null">#{generateStatus},</if>
|
||||||
|
<if test="previewStatus != null">#{previewStatus},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
sysdate(),
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontProject" parameterType="FrontProject">
|
||||||
|
update front_project
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="projectName != null">project_name = #{projectName},</if>
|
||||||
|
<if test="projectFileName != null">project_file_name = #{projectFileName},</if>
|
||||||
|
<if test="packageName != null">package_name = #{packageName},</if>
|
||||||
|
<if test="version != null">version = #{version},</if>
|
||||||
|
<if test="projectDesc != null">project_desc = #{projectDesc},</if>
|
||||||
|
<if test="industryTemplate != null">industry_template = #{industryTemplate},</if>
|
||||||
|
<if test="frontFramework != null">front_framework = #{frontFramework},</if>
|
||||||
|
<if test="backFramework != null">back_framework = #{backFramework},</if>
|
||||||
|
<if test="generateStatus != null">generate_status = #{generateStatus},</if>
|
||||||
|
<if test="previewStatus != null">preview_status = #{previewStatus},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where project_id = #{projectId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectById" parameterType="Long">
|
||||||
|
delete from front_project where project_id = #{projectId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectByUserAndId">
|
||||||
|
delete from front_project where user_id = #{userId} and project_id = #{projectId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?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.front.FrontProjectTableMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontProjectTable" id="FrontProjectTableResult">
|
||||||
|
<id property="tableId" column="table_id" />
|
||||||
|
<result property="projectId" column="project_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="tableName" column="table_name" />
|
||||||
|
<result property="tableComment" column="table_comment" />
|
||||||
|
<result property="className" column="class_name" />
|
||||||
|
<result property="moduleName" column="module_name" />
|
||||||
|
<result property="businessName" column="business_name" />
|
||||||
|
<result property="functionName" column="function_name" />
|
||||||
|
<result property="tplCategory" column="tpl_category" />
|
||||||
|
<result property="tplWebType" column="tpl_web_type" />
|
||||||
|
<result property="options" column="options" />
|
||||||
|
<result property="createTableSql" column="create_table_sql" />
|
||||||
|
<result property="sort" column="sort" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontProjectTableVo">
|
||||||
|
select table_id, project_id, user_id, table_name, table_comment, class_name, module_name, business_name, function_name, tpl_category, tpl_web_type, options, create_table_sql, sort, status, create_time, update_time from front_project_table
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectTableById" parameterType="Long" resultMap="FrontProjectTableResult">
|
||||||
|
<include refid="selectFrontProjectTableVo"/>
|
||||||
|
where table_id = #{tableId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTablesByProjectId" parameterType="Long" resultMap="FrontProjectTableResult">
|
||||||
|
<include refid="selectFrontProjectTableVo"/>
|
||||||
|
where project_id = #{projectId}
|
||||||
|
order by sort, table_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontProjectTableList" parameterType="FrontProjectTable" resultMap="FrontProjectTableResult">
|
||||||
|
<include refid="selectFrontProjectTableVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="projectId != null"> and project_id = #{projectId}</if>
|
||||||
|
<if test="userId != null"> and user_id = #{userId}</if>
|
||||||
|
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontProjectTable" parameterType="FrontProjectTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||||
|
insert into front_project_table
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="tableName != null">table_name,</if>
|
||||||
|
<if test="tableComment != null">table_comment,</if>
|
||||||
|
<if test="className != null">class_name,</if>
|
||||||
|
<if test="moduleName != null">module_name,</if>
|
||||||
|
<if test="businessName != null">business_name,</if>
|
||||||
|
<if test="functionName != null">function_name,</if>
|
||||||
|
<if test="tplCategory != null">tpl_category,</if>
|
||||||
|
<if test="tplWebType != null">tpl_web_type,</if>
|
||||||
|
<if test="options != null">options,</if>
|
||||||
|
<if test="createTableSql != null">create_table_sql,</if>
|
||||||
|
<if test="sort != null">sort,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
create_time,
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="tableName != null">#{tableName},</if>
|
||||||
|
<if test="tableComment != null">#{tableComment},</if>
|
||||||
|
<if test="className != null">#{className},</if>
|
||||||
|
<if test="moduleName != null">#{moduleName},</if>
|
||||||
|
<if test="businessName != null">#{businessName},</if>
|
||||||
|
<if test="functionName != null">#{functionName},</if>
|
||||||
|
<if test="tplCategory != null">#{tplCategory},</if>
|
||||||
|
<if test="tplWebType != null">#{tplWebType},</if>
|
||||||
|
<if test="options != null">#{options},</if>
|
||||||
|
<if test="createTableSql != null">#{createTableSql},</if>
|
||||||
|
<if test="sort != null">#{sort},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
sysdate(),
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontProjectTable" parameterType="FrontProjectTable">
|
||||||
|
update front_project_table
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="tableName != null">table_name = #{tableName},</if>
|
||||||
|
<if test="tableComment != null">table_comment = #{tableComment},</if>
|
||||||
|
<if test="className != null">class_name = #{className},</if>
|
||||||
|
<if test="moduleName != null">module_name = #{moduleName},</if>
|
||||||
|
<if test="businessName != null">business_name = #{businessName},</if>
|
||||||
|
<if test="functionName != null">function_name = #{functionName},</if>
|
||||||
|
<if test="tplCategory != null">tpl_category = #{tplCategory},</if>
|
||||||
|
<if test="tplWebType != null">tpl_web_type = #{tplWebType},</if>
|
||||||
|
<if test="options != null">options = #{options},</if>
|
||||||
|
<if test="createTableSql != null">create_table_sql = #{createTableSql},</if>
|
||||||
|
<if test="sort != null">sort = #{sort},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
</trim>
|
||||||
|
where table_id = #{tableId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontProjectTableById" parameterType="Long">
|
||||||
|
delete from front_project_table where table_id = #{tableId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTablesByProjectId" parameterType="Long">
|
||||||
|
delete from front_project_table where project_id = #{projectId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<?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.front.FrontUserMapper">
|
||||||
|
|
||||||
|
<resultMap type="FrontUser" id="FrontUserResult">
|
||||||
|
<id property="userId" column="user_id" />
|
||||||
|
<result property="username" column="username" />
|
||||||
|
<result property="password" column="password" />
|
||||||
|
<result property="nickname" column="nickname" />
|
||||||
|
<result property="email" column="email" />
|
||||||
|
<result property="phone" column="phone" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="lastLoginTime" column="last_login_time" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFrontUserVo">
|
||||||
|
select user_id, username, password, nickname, email, phone, status, del_flag, last_login_time, create_time, update_time, remark from front_user
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFrontUserById" parameterType="Long" resultMap="FrontUserResult">
|
||||||
|
<include refid="selectFrontUserVo"/>
|
||||||
|
where user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontUserByUsername" parameterType="String" resultMap="FrontUserResult">
|
||||||
|
<include refid="selectFrontUserVo"/>
|
||||||
|
where username = #{username} and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFrontUserList" parameterType="FrontUser" resultMap="FrontUserResult">
|
||||||
|
<include refid="selectFrontUserVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
||||||
|
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
|
||||||
|
<if test="email != null and email != ''"> and email = #{email}</if>
|
||||||
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFrontUser" parameterType="FrontUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
|
insert into front_user
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="username != null">username,</if>
|
||||||
|
<if test="password != null">password,</if>
|
||||||
|
<if test="nickname != null">nickname,</if>
|
||||||
|
<if test="email != null">email,</if>
|
||||||
|
<if test="phone != null">phone,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
<if test="lastLoginTime != null">last_login_time,</if>
|
||||||
|
create_time,
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="username != null">#{username},</if>
|
||||||
|
<if test="password != null">#{password},</if>
|
||||||
|
<if test="nickname != null">#{nickname},</if>
|
||||||
|
<if test="email != null">#{email},</if>
|
||||||
|
<if test="phone != null">#{phone},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
<if test="lastLoginTime != null">#{lastLoginTime},</if>
|
||||||
|
sysdate(),
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFrontUser" parameterType="FrontUser">
|
||||||
|
update front_user
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="password != null">password = #{password},</if>
|
||||||
|
<if test="nickname != null">nickname = #{nickname},</if>
|
||||||
|
<if test="email != null">email = #{email},</if>
|
||||||
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
<if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFrontUserById" parameterType="Long">
|
||||||
|
delete from front_user where user_id = #{userId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.ruoyi.generator.service.front;
|
||||||
|
|
||||||
|
import com.ruoyi.generator.domain.GenProject;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProject;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectColumn;
|
||||||
|
import com.ruoyi.generator.domain.front.FrontProjectTable;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class FrontProjectConverterTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void convertsFrontDraftToGenProject()
|
||||||
|
{
|
||||||
|
FrontProject project = new FrontProject();
|
||||||
|
project.setProjectId(10L);
|
||||||
|
project.setProjectName("车辆管理系统");
|
||||||
|
project.setProjectFileName("vehicle-system");
|
||||||
|
project.setPackageName("com.easycode.vehicle");
|
||||||
|
project.setVersion("1.0.0");
|
||||||
|
project.setFrontFramework("Vue3 + Element Plus");
|
||||||
|
project.setBackFramework("Spring Boot + MyBatis");
|
||||||
|
|
||||||
|
FrontProjectTable table = new FrontProjectTable();
|
||||||
|
table.setTableId(20L);
|
||||||
|
table.setTableName("car_info");
|
||||||
|
table.setTableComment("车辆信息表");
|
||||||
|
table.setClassName("CarInfo");
|
||||||
|
table.setModuleName("vehicle");
|
||||||
|
table.setBusinessName("car");
|
||||||
|
table.setFunctionName("车辆信息");
|
||||||
|
|
||||||
|
FrontProjectColumn column = new FrontProjectColumn();
|
||||||
|
column.setColumnId(30L);
|
||||||
|
column.setColumnName("car_id");
|
||||||
|
column.setColumnComment("车辆ID");
|
||||||
|
column.setColumnType("bigint(20)");
|
||||||
|
column.setJavaType("Long");
|
||||||
|
column.setJavaField("carId");
|
||||||
|
column.setIsPk("1");
|
||||||
|
column.setIsIncrement("1");
|
||||||
|
table.setColumns(Collections.singletonList(column));
|
||||||
|
project.setTables(Collections.singletonList(table));
|
||||||
|
|
||||||
|
GenProject genProject = FrontProjectConverter.toGenProject(project);
|
||||||
|
|
||||||
|
assertEquals("车辆管理系统", genProject.getProjectName());
|
||||||
|
assertEquals("com.easycode.vehicle", genProject.getPackageName());
|
||||||
|
assertEquals(1, genProject.getTables().size());
|
||||||
|
assertEquals("car_info", genProject.getTables().get(0).getTableName());
|
||||||
|
assertEquals("carId", genProject.getTables().get(0).getColumns().get(0).getJavaField());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user