mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-24 11:58:04 +08:00
代码生成器
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
package com.hxkj.common.constant;
|
||||
|
||||
public class GenConstants {
|
||||
|
||||
/** 单表(增删改查) */
|
||||
public static final String TPL_CRUD = "crud";
|
||||
|
||||
/** 树表(增删改查) */
|
||||
public static final String TPL_TREE = "tree";
|
||||
|
||||
/** 主子表(增删改查) */
|
||||
public static final String TPL_SUB = "sub";
|
||||
|
||||
/** 树编码字段 */
|
||||
public static final String TREE_CODE = "treeCode";
|
||||
|
||||
/** 树父编码字段 */
|
||||
public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||
|
||||
/** 树名称字段 */
|
||||
public static final String TREE_NAME = "treeName";
|
||||
|
||||
/** 数据库字符串类型 */
|
||||
public static final String[] COLUMN_TYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
|
||||
|
||||
/** 数据库文本类型 */
|
||||
public static final String[] COLUMN_TYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
|
||||
|
||||
/** 数据库时间类型 */
|
||||
public static final String[] COLUMN_TYPE_TIME = {"datetime", "time", "date", "timestamp"};
|
||||
|
||||
/** 数据库数字类型 */
|
||||
public static final String[] COLUMN_TYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int",
|
||||
"number", "integer", "bit", "bigint", "float", "double", "decimal"};
|
||||
|
||||
/** 页面不需要编辑字段 */
|
||||
public static final String[] COLUMN_NAME_NOT_EDIT = {"id", "create_time", "update_time", "delete_time"};
|
||||
|
||||
/** 页面不需要列表字段 */
|
||||
public static final String[] COLUMN_NAME_NOT_LIST = {"id", "create_time", "update_time", "delete_time"};
|
||||
|
||||
/** 页面不需要查询字段 */
|
||||
public static final String[] COLUMN_NAME_NOT_QUERY = {"id", "create_time", "update_time", "delete_time"};
|
||||
|
||||
/** 文本框 */
|
||||
public static final String HTML_INPUT = "input";
|
||||
|
||||
/** 文本域 */
|
||||
public static final String HTML_TEXTAREA = "textarea";
|
||||
|
||||
/** 下拉框 */
|
||||
public static final String HTML_SELECT = "select";
|
||||
|
||||
/** 单选框 */
|
||||
public static final String HTML_RADIO = "radio";
|
||||
|
||||
/** 复选框 */
|
||||
public static final String HTML_CHECKBOX = "checkbox";
|
||||
|
||||
/** 日期控件 */
|
||||
public static final String HTML_DATETIME = "datetime";
|
||||
|
||||
/** 图片上传控件 */
|
||||
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||
|
||||
/** 文件上传控件 */
|
||||
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||
|
||||
/** 富文本控件 */
|
||||
public static final String HTML_EDITOR = "editor";
|
||||
|
||||
/** 字符串类型 */
|
||||
public static final String TYPE_STRING = "String";
|
||||
|
||||
/** 整型 */
|
||||
public static final String TYPE_INTEGER = "Integer";
|
||||
|
||||
/** 长整型 */
|
||||
public static final String TYPE_LONG = "Long";
|
||||
|
||||
/** 高精度计算类型 */
|
||||
public static final String TYPE_BIG_DECIMAL = "BigDecimal";
|
||||
|
||||
/** 时间类型 */
|
||||
public static final String TYPE_DATE = "Date";
|
||||
|
||||
/** 模糊查询 */
|
||||
public static final String QUERY_LIKE = "LIKE";
|
||||
|
||||
/** 相等查询 */
|
||||
public static final String QUERY_EQ = "EQ";
|
||||
|
||||
/** 需要 */
|
||||
public static final Integer REQUIRE = 1;
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.hxkj.common.entity.generate;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 代码生成业务实体
|
||||
*/
|
||||
@Data
|
||||
public class GenTable implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.hxkj.common.mapper.generate;
|
||||
|
||||
import com.hxkj.common.core.basics.IBaseMapper;
|
||||
import com.hxkj.common.entity.generate.GenTable;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GenTableMapper extends IBaseMapper<GenTable> {
|
||||
|
||||
/**
|
||||
* 查询库中的数据表
|
||||
*
|
||||
* @author fzr
|
||||
* @param params 参数
|
||||
* @return List<Map<String, String>>
|
||||
*/
|
||||
@Select({"<script>",
|
||||
"SELECT table_name, table_comment, create_time, update_time " +
|
||||
"FROM information_schema.tables " +
|
||||
"WHERE table_schema = (SELECT database()) " +
|
||||
"AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%' " +
|
||||
"AND table_name NOT IN (select table_name from ls_gen_table)",
|
||||
"<if test=\"tableName != null and tableName != ''\">" +
|
||||
"AND lower(table_name) like lower(concat('%', #{tableName}, '%'))" +
|
||||
"</if>",
|
||||
"<if test=\"tableComment != null and tableComment != ''\">" +
|
||||
"AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))" +
|
||||
"</if>",
|
||||
"</script>"})
|
||||
List<Map<String, String>> selectDbTableList(Map<String, String> params);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user