chenjiahe
2024-09-23 826b66207dafbce24f441cb83fed1b241a6fba27
提交 | 用户 | age
826b66 1 <?xml version="1.0" encoding="UTF-8" ?>
C 2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <!-- namespace:该mapper.xml映射文件的 唯一标识 -->
6 <mapper namespace="${DAOPackageName}.${entityName}Mapper">
7
8     <!-- 整个实体类修改,表字段=实体类字段-->
9     <sql id="Update_Column_All">
10         <trim prefixOverrides=",">
11             <#list fieldData.fields as item>,${item.tableName} = ${item.mybatisName}</#list>
12         </trim>
13     </sql>
14      
15     <!--  后续通过  namespace.id-->
16     <!--parameterType:输入参数的类型
17     resultType:查询返回结果值的类型  ,返回类型  -->
18     <insert id="insert" parameterType="${packageEntityName}.${entityName}">
19         <selectKey keyProperty="id" resultType="String" order="BEFORE">
20             select replace(uuid(),'-','') from dual
21         </selectKey>
22         insert into ${fieldData.tableName} (${fieldData.tableIdName}<#list fieldData.fields as item>,${item.tableName}</#list>)
23         values (${fieldData.entityIdData}<#list fieldData.fields as item>,${item.mybatisName}</#list>)
24     </insert>
25
26     <select id="selectList" resultType="${packageEntityName}.${entityName}" parameterType="com.hx.mybatisTool.SqlSentence" >
27         ${sqlSentence}
28     </select>
29
30     <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
31             ${sqlSentence}
32     </select>
33
34     <select id="selectOne" resultType="${packageEntityName}.${entityName}" parameterType="com.hx.mybatisTool.SqlSentence" >
35         ${sqlSentence}
36     </select>
37
38     <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
39             ${sqlSentence}
40     </select>
41
42     <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
43             select
44                 COUNT(*)
45             from ${fieldData.tableName}
46                 WHERE ${sqlSentence}
47     </select>
48
49     <select id="selectOneByKey" resultType="${packageEntityName}.${entityName}" parameterType="java.lang.Object" >
50         select 
51             ${fieldData.tableIdName}<#list fieldData.fields as item>,${item.tableName}</#list>
52         from ${fieldData.tableName}
53         WHERE ${fieldData.tableIdName} = ${fieldData.valueData}
54     </select>
55
56     <select id="selectOneByKeyBlob" resultType="${packageEntityName}.${entityName}" parameterType="java.lang.Object" >
57         select 
58             ${fieldData.tableIdName}<#list fieldData.fields as item>,${item.tableName}</#list>
59         from ${fieldData.tableName}
60         WHERE ${fieldData.tableIdName} = ${fieldData.valueData}
61     </select>
62
63     <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
64         update
65             ${fieldData.tableName}
66         SET ${sqlSentence}
67     </update>
68
69     <update id="updateAll" parameterType="${packageEntityName}.${entityName}">
70         update ${fieldData.tableName}
71             SET <include refid="Update_Column_All"/>
72         WHERE ${fieldData.tableIdName} = ${fieldData.entityIdData}
73     </update>
74
75     <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
76         delete from ${fieldData.tableName} WHERE ${sqlSentence}
77     </delete>
78
79     <delete id="deleteById"  parameterType="java.lang.Object">
80         delete from ${fieldData.tableName} WHERE ${fieldData.tableIdName} = ${fieldData.valueData}
81     </delete>
82     ${customData}
83 </mapper>