|
| 1 | +<!--This file was generated by xfali/gobatis-cmd at --> |
| 2 | +<!--2020-02-07 17:33:24.9580053 +0800 CST m=+0.099005701--> |
| 3 | + |
| 4 | +<mapper namespace="test_package.TestTable"> |
| 5 | + <sql id="columns_id">"id","username","password","createtime"</sql> |
| 6 | + |
| 7 | + <select id="selectTestTable"> |
| 8 | + SELECT <include refid="columns_id"> </include> FROM "test_table" |
| 9 | + <where> |
| 10 | + <if test="{TestTable.id} != nil and {TestTable.id} != 0">AND "id" = #{TestTable.id} </if> |
| 11 | + <if test="{TestTable.username} != nil">AND "username" = #{TestTable.username} </if> |
| 12 | + <if test="{TestTable.password} != nil">AND "password" = #{TestTable.password} </if> |
| 13 | + <if test="{TestTable.createtime} != nil">AND "createtime" = #{TestTable.createtime} </if> |
| 14 | + </where> |
| 15 | + </select> |
| 16 | + |
| 17 | + <select id="selectTestTableCount"> |
| 18 | + SELECT COUNT(*) FROM "test_table" |
| 19 | + <where> |
| 20 | + <if test="{TestTable.id} != nil and {TestTable.id} != 0">AND "id" = #{TestTable.id} </if> |
| 21 | + <if test="{TestTable.username} != nil">AND "username" = #{TestTable.username} </if> |
| 22 | + <if test="{TestTable.password} != nil">AND "password" = #{TestTable.password} </if> |
| 23 | + <if test="{TestTable.createtime} != nil">AND "createtime" = #{TestTable.createtime} </if> |
| 24 | + </where> |
| 25 | + </select> |
| 26 | + |
| 27 | + <insert id="insertTestTable"> |
| 28 | + INSERT INTO "test_table" ("id","username","password","createtime") |
| 29 | + VALUES( |
| 30 | + #{TestTable.id}, |
| 31 | + #{TestTable.username}, |
| 32 | + #{TestTable.password}, |
| 33 | + #{TestTable.createtime} |
| 34 | + ) |
| 35 | + </insert> |
| 36 | + |
| 37 | + <insert id="insertBatchTestTable"> |
| 38 | + INSERT INTO "test_table" ("id","username","password","createtime") |
| 39 | + VALUES |
| 40 | + <foreach item="item" index="index" collection="{0}" open="" separator="," close=""> |
| 41 | + (#{item.TestTable.id},#{item.TestTable.username},#{item.TestTable.password},#{item.TestTable.createtime}) |
| 42 | + </foreach> |
| 43 | + </insert> |
| 44 | + |
| 45 | + <update id="updateTestTable"> |
| 46 | + UPDATE "test_table" |
| 47 | + <set> |
| 48 | + <if test="{TestTable.username} != nil"> "username" = #{TestTable.username} </if> |
| 49 | + <if test="{TestTable.password} != nil"> "password" = #{TestTable.password} </if> |
| 50 | + <if test="{TestTable.createtime} != nil"> "createtime" = #{TestTable.createtime} </if> |
| 51 | + </set> |
| 52 | + WHERE "id" = #{TestTable.id} |
| 53 | + </update> |
| 54 | + |
| 55 | + <delete id="deleteTestTable"> |
| 56 | + DELETE FROM "test_table" |
| 57 | + <where> |
| 58 | + <if test="{TestTable.id} != nil and {TestTable.id} != 0">AND "id" = #{TestTable.id} </if> |
| 59 | + <if test="{TestTable.username} != nil">AND "username" = #{TestTable.username} </if> |
| 60 | + <if test="{TestTable.password} != nil">AND "password" = #{TestTable.password} </if> |
| 61 | + <if test="{TestTable.createtime} != nil">AND "createtime" = #{TestTable.createtime} </if> |
| 62 | + </where> |
| 63 | + </delete> |
| 64 | +</mapper> |
0 commit comments