13693261870
2022-10-20 93b9a4bd47bfec774894928392d52a61fca07c38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?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="{mapperNS}.{mapperName}">
    <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String">
        select count(*) from {tabName}
        <where>
            <if test="{testExpr}">
                {testWhere}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="{entityNS}.{entityName}">
        select * from {tabName}
        <where>
            <if test="{testExpr}">
                {testWhere}
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAll" resultType="{entityNS}.{entityName}">
        select * from {tabName} order by id;
    </select>
 
    <select id="selectById" resultType="{entityNS}.{entityName}">
        select * from {tabName} where id = #{id}
    </select>
 
    <insert id="insert" parameterType="{entityNS}.{entityName}">
       insert into {tabName}
       ({insertCols})
       values
       ({insertVal})
    </insert>
 
    <insert id="inserts">
        insert into {tabName}
        ({insertCols})
        values
        <foreach collection="list" item="item" index="index" separator=",">
            ({insertVals})
        </foreach>
    </insert>
 
    <delete id="delete">
        delete from {tabName} where id = #{id}
    </delete>
 
    <delete id="deletes">
        delete from {tabName} where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="update">
        update {tabName}
        set {updateVal}
        where id=#{id}
    </update>
 
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update {tabName}
            <set>
                {updateVals}
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>