2025-12-02 13:21:18 +08:00
|
|
|
{
|
|
|
|
|
"MyBatis Mapper XML Template": {
|
|
|
|
|
"prefix": "mybatis-mapper",
|
|
|
|
|
"body": [
|
|
|
|
|
"<?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=\"${1:org.xyzh.system.mapper.${2:module}.${3:EntityName}Mapper}\">",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 结果映射 -->",
|
|
|
|
|
" <resultMap id=\"BaseResultMap\" type=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
|
|
|
|
" <!-- BaseDTO 字段 -->",
|
|
|
|
|
" <result column=\"optsn\" property=\"optsn\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"creator\" property=\"creator\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"updater\" property=\"updater\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"dept_path\" property=\"deptPath\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"remark\" property=\"remark\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"create_time\" property=\"createTime\" jdbcType=\"TIMESTAMP\"/>",
|
|
|
|
|
" <result column=\"update_time\" property=\"updateTime\" jdbcType=\"TIMESTAMP\"/>",
|
|
|
|
|
" <result column=\"delete_time\" property=\"deleteTime\" jdbcType=\"TIMESTAMP\"/>",
|
2025-12-02 16:13:28 +08:00
|
|
|
" <result column=\"deleted\" property=\"deleted\" jdbcType=\"Boolean\"/>",
|
2025-12-02 13:21:18 +08:00
|
|
|
" </resultMap>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 基础列 -->",
|
|
|
|
|
" <sql id=\"Base_Column_List\">",
|
|
|
|
|
" ${5:entity_id}, ${7:field_name},",
|
|
|
|
|
" optsn, creator, updater, dept_path, remark, create_time, update_time, delete_time, deleted",
|
|
|
|
|
" </sql>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 插入${9:实体名称} -->",
|
|
|
|
|
" <insert id=\"insert${3:EntityName}\" parameterType=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
|
|
|
|
" INSERT INTO ${10:tb_entity_name} (",
|
|
|
|
|
" ${5:entity_id}, ${7:field_name},",
|
|
|
|
|
" optsn, creator, updater, dept_path, remark, create_time, update_time, deleted",
|
|
|
|
|
" ) VALUES (",
|
|
|
|
|
" #{${6:entityId}}, #{${8:fieldName}},",
|
|
|
|
|
" #{optsn}, #{creator}, #{updater}, #{deptPath}, #{remark}, #{createTime}, #{updateTime}, #{deleted}",
|
|
|
|
|
" )",
|
|
|
|
|
" </insert>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 更新${9:实体名称} -->",
|
|
|
|
|
" <update id=\"update${3:EntityName}\" parameterType=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
|
|
|
|
" UPDATE ${10:tb_entity_name}",
|
|
|
|
|
" <set>",
|
|
|
|
|
" <if test=\"${8:fieldName} != null and ${8:fieldName} != ''\">",
|
|
|
|
|
" ${7:field_name} = #{${8:fieldName}},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"updater != null and updater != ''\">",
|
|
|
|
|
" updater = #{updater},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"deptPath != null and deptPath != ''\">",
|
|
|
|
|
" dept_path = #{deptPath},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"remark != null\">",
|
|
|
|
|
" remark = #{remark},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"updateTime != null\">",
|
|
|
|
|
" update_time = #{updateTime},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" </set>",
|
|
|
|
|
" WHERE ${5:entity_id} = #{${6:entityId}}",
|
|
|
|
|
" <if test=\"deleted != null\">",
|
|
|
|
|
" AND deleted = #{deleted}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" </update>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 删除${9:实体名称}(逻辑删除) -->",
|
|
|
|
|
" <update id=\"delete${3:EntityName}\" parameterType=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
|
|
|
|
" UPDATE ${10:tb_entity_name}",
|
|
|
|
|
" SET deleted = true,",
|
|
|
|
|
" delete_time = NOW()",
|
|
|
|
|
" WHERE ${5:entity_id} = #{${6:entityId}}",
|
|
|
|
|
" </update>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 根据ID查询${9:实体名称} -->",
|
|
|
|
|
" <select id=\"get${3:EntityName}ById\" resultMap=\"BaseResultMap\" parameterType=\"java.lang.String\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${10:tb_entity_name}",
|
|
|
|
|
" WHERE ${5:entity_id} = #{${6:entityId}}",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </select>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 根据条件查询${9:实体名称}列表 -->",
|
|
|
|
|
" <select id=\"get${3:EntityName}ByFilter\" resultMap=\"BaseResultMap\" parameterType=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${10:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${6:entityId} != null and filter.${6:entityId} != ''\">",
|
|
|
|
|
" AND ${5:entity_id} = #{filter.${6:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${8:fieldName} != null and filter.${8:fieldName} != ''\">",
|
|
|
|
|
" AND ${7:field_name} LIKE CONCAT('%', #{filter.${8:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" ORDER BY create_time DESC",
|
|
|
|
|
" </select>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 根据条件查询${9:实体名称}分页列表 -->",
|
|
|
|
|
" <select id=\"get${3:EntityName}PageByFilter\" resultMap=\"BaseResultMap\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${10:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${6:entityId} != null and filter.${6:entityId} != ''\">",
|
|
|
|
|
" AND ${5:entity_id} = #{filter.${6:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${8:fieldName} != null and filter.${8:fieldName} != ''\">",
|
|
|
|
|
" AND ${7:field_name} LIKE CONCAT('%', #{filter.${8:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" ORDER BY create_time DESC",
|
|
|
|
|
" LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}",
|
|
|
|
|
" </select>",
|
|
|
|
|
"",
|
|
|
|
|
" <!-- 根据条件查询${9:实体名称}数量 -->",
|
2025-12-02 16:13:28 +08:00
|
|
|
" <select id=\"get${3:EntityName}CountByFilter\" resultType=\"java.lang.Integer\" parameterType=\"${4:org.xyzh.common.dto.sys.${3:EntityName}DTO}\">",
|
2025-12-02 13:21:18 +08:00
|
|
|
" SELECT COUNT(1)",
|
|
|
|
|
" FROM ${10:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${6:entityId} != null and filter.${6:entityId} != ''\">",
|
|
|
|
|
" AND ${5:entity_id} = #{filter.${6:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${8:fieldName} != null and filter.${8:fieldName} != ''\">",
|
|
|
|
|
" AND ${7:field_name} LIKE CONCAT('%', #{filter.${8:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" </select>",
|
|
|
|
|
"",
|
|
|
|
|
"</mapper>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Mapper XML 完整模板"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis ResultMap": {
|
|
|
|
|
"prefix": "mybatis-resultmap",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 结果映射 -->",
|
|
|
|
|
" <resultMap id=\"BaseResultMap\" type=\"${1:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
|
|
|
|
" <!-- 主键 -->",
|
|
|
|
|
" <id column=\"${3:entity_id}\" property=\"${4:entityId}\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" ",
|
|
|
|
|
" <!-- 业务字段 -->",
|
|
|
|
|
" <result column=\"${5:field_name}\" property=\"${6:fieldName}\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" ",
|
|
|
|
|
" <!-- BaseDTO 字段 -->",
|
|
|
|
|
" <result column=\"optsn\" property=\"optsn\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"creator\" property=\"creator\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"updater\" property=\"updater\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"dept_path\" property=\"deptPath\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"remark\" property=\"remark\" jdbcType=\"VARCHAR\"/>",
|
|
|
|
|
" <result column=\"create_time\" property=\"createTime\" jdbcType=\"TIMESTAMP\"/>",
|
|
|
|
|
" <result column=\"update_time\" property=\"updateTime\" jdbcType=\"TIMESTAMP\"/>",
|
|
|
|
|
" <result column=\"delete_time\" property=\"deleteTime\" jdbcType=\"TIMESTAMP\"/>",
|
2025-12-02 16:13:28 +08:00
|
|
|
" <result column=\"deleted\" property=\"deleted\" jdbcType=\"Boolean\"/>",
|
2025-12-02 13:21:18 +08:00
|
|
|
" </resultMap>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis ResultMap 映射"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Insert": {
|
|
|
|
|
"prefix": "mybatis-insert",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 插入${1:实体名称} -->",
|
|
|
|
|
" <insert id=\"insert${2:EntityName}\" parameterType=\"${3:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
|
|
|
|
" INSERT INTO ${4:tb_entity_name} (",
|
|
|
|
|
" ${5:entity_id}, ${6:field_name},",
|
|
|
|
|
" optsn, creator, updater, dept_path, remark, create_time, update_time, deleted",
|
|
|
|
|
" ) VALUES (",
|
|
|
|
|
" #{${7:entityId}}, #{${8:fieldName}},",
|
|
|
|
|
" #{optsn}, #{creator}, #{updater}, #{deptPath}, #{remark}, #{createTime}, #{updateTime}, #{deleted}",
|
|
|
|
|
" )",
|
|
|
|
|
" </insert>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Insert 语句"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Update": {
|
|
|
|
|
"prefix": "mybatis-update",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 更新${1:实体名称} -->",
|
|
|
|
|
" <update id=\"update${2:EntityName}\" parameterType=\"${3:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
|
|
|
|
" UPDATE ${4:tb_entity_name}",
|
|
|
|
|
" <set>",
|
|
|
|
|
" <if test=\"${5:fieldName} != null and ${5:fieldName} != ''\">",
|
|
|
|
|
" ${6:field_name} = #{${5:fieldName}},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"updater != null and updater != ''\">",
|
|
|
|
|
" updater = #{updater},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"deptPath != null and deptPath != ''\">",
|
|
|
|
|
" dept_path = #{deptPath},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"remark != null\">",
|
|
|
|
|
" remark = #{remark},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"updateTime != null\">",
|
|
|
|
|
" update_time = #{updateTime},",
|
|
|
|
|
" </if>",
|
|
|
|
|
" </set>",
|
|
|
|
|
" WHERE ${7:entity_id} = #{${8:entityId}}",
|
|
|
|
|
" <if test=\"deleted != null\">",
|
|
|
|
|
" AND deleted = #{deleted}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" </update>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Update 语句"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Delete": {
|
|
|
|
|
"prefix": "mybatis-delete",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 删除${1:实体名称}(逻辑删除) -->",
|
|
|
|
|
" <update id=\"delete${2:EntityName}\" parameterType=\"${3:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
|
|
|
|
" UPDATE ${4:tb_entity_name}",
|
|
|
|
|
" SET deleted = true,",
|
|
|
|
|
" delete_time = NOW()",
|
|
|
|
|
" WHERE ${5:entity_id} = #{${6:entityId}}",
|
|
|
|
|
" </update>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Delete 语句(逻辑删除)"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Select ById": {
|
|
|
|
|
"prefix": "mybatis-select-id",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 根据ID查询${1:实体名称} -->",
|
|
|
|
|
" <select id=\"get${2:EntityName}ById\" resultMap=\"BaseResultMap\" parameterType=\"java.lang.String\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${3:tb_entity_name}",
|
|
|
|
|
" WHERE ${4:entity_id} = #{${5:entityId}}",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </select>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Select ById 查询"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Select ByFilter": {
|
|
|
|
|
"prefix": "mybatis-select-filter",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 根据条件查询${1:实体名称}列表 -->",
|
|
|
|
|
" <select id=\"get${2:EntityName}ByFilter\" resultMap=\"BaseResultMap\" parameterType=\"${3:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${4:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${5:entityId} != null and filter.${5:entityId} != ''\">",
|
|
|
|
|
" AND ${6:entity_id} = #{filter.${5:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${7:fieldName} != null and filter.${7:fieldName} != ''\">",
|
|
|
|
|
" AND ${8:field_name} LIKE CONCAT('%', #{filter.${7:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" ORDER BY create_time DESC",
|
|
|
|
|
" </select>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Select ByFilter 查询"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Select Page": {
|
|
|
|
|
"prefix": "mybatis-select-page",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 根据条件查询${1:实体名称}分页列表 -->",
|
|
|
|
|
" <select id=\"get${2:EntityName}PageByFilter\" resultMap=\"BaseResultMap\">",
|
|
|
|
|
" SELECT",
|
|
|
|
|
" <include refid=\"Base_Column_List\"/>",
|
|
|
|
|
" FROM ${3:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${4:entityId} != null and filter.${4:entityId} != ''\">",
|
|
|
|
|
" AND ${5:entity_id} = #{filter.${4:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${6:fieldName} != null and filter.${6:fieldName} != ''\">",
|
|
|
|
|
" AND ${7:field_name} LIKE CONCAT('%', #{filter.${6:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" ORDER BY create_time DESC",
|
|
|
|
|
" LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}",
|
|
|
|
|
" </select>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Select Page 分页查询"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Select Count": {
|
|
|
|
|
"prefix": "mybatis-select-count",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 根据条件查询${1:实体名称}数量 -->",
|
2025-12-02 16:13:28 +08:00
|
|
|
" <select id=\"get${2:EntityName}CountByFilter\" resultType=\"java.lang.Integer\" parameterType=\"${3:org.xyzh.common.dto.sys.${2:EntityName}DTO}\">",
|
2025-12-02 13:21:18 +08:00
|
|
|
" SELECT COUNT(1)",
|
|
|
|
|
" FROM ${4:tb_entity_name}",
|
|
|
|
|
" <where>",
|
|
|
|
|
" <if test=\"filter.${5:entityId} != null and filter.${5:entityId} != ''\">",
|
|
|
|
|
" AND ${6:entity_id} = #{filter.${5:entityId}}",
|
|
|
|
|
" </if>",
|
|
|
|
|
" <if test=\"filter.${7:fieldName} != null and filter.${7:fieldName} != ''\">",
|
|
|
|
|
" AND ${8:field_name} LIKE CONCAT('%', #{filter.${7:fieldName}}, '%')",
|
|
|
|
|
" </if>",
|
|
|
|
|
" AND (deleted IS NULL OR deleted = false)",
|
|
|
|
|
" </where>",
|
|
|
|
|
" </select>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis Select Count 计数查询"
|
|
|
|
|
},
|
|
|
|
|
"MyBatis Base Column List": {
|
|
|
|
|
"prefix": "mybatis-columns",
|
|
|
|
|
"body": [
|
|
|
|
|
" <!-- 基础列 -->",
|
|
|
|
|
" <sql id=\"Base_Column_List\">",
|
|
|
|
|
" ${1:entity_id}, ${2:field_name},",
|
|
|
|
|
" optsn, creator, updater, dept_path, remark, create_time, update_time, delete_time, deleted",
|
|
|
|
|
" </sql>"
|
|
|
|
|
],
|
|
|
|
|
"description": "MyBatis 基础列定义"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|