1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.bosshand.virgo.api.test.dao.ProtocolDao">
- <resultMap type="com.bosshand.virgo.api.test.model.Protocol" id="setAResult" >
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="comment" property="comment"/>
- <result column="delState" property="delState"/>
- </resultMap>
- <select id="get" resultMap="setAResult">
- SELECT * FROM test_set_a
- <where>
- <if test="data.id != 0">
- and id = #{data.id}
- </if>
- <if test="data.name != null">
- and name = #{data.name}
- </if>
- <if test="data.delState != 1">
- and delState = #{data.delState}
- </if>
- </where>
- limit #{currIndex}, #{pageSize}
- </select>
- <select id="count" parameterType="map" resultType="Integer">
- SELECT count(*) FROM test_set_a
- <where>
- <if test="id != 0">
- and id = #{id}
- </if>
- <if test="name != null">
- and name = #{name}
- </if>
- <if test="delState != 1">
- and delState = #{delState}
- </if>
- </where>
- </select>
- <insert id="save" parameterType="com.bosshand.virgo.api.test.model.Protocol" useGeneratedKeys="true" keyProperty="id">
- INSERT into test_set_a(name, comment) values (#{name}, #{comment})
- </insert>
- <update id="update" parameterType="com.bosshand.virgo.api.test.model.Protocol">
- UPDATE test_set_a
- <trim prefix="set" suffixOverrides=",">
- <if test="name!=null">name=#{name},</if>
- <if test="comment!=null">comment=#{comment},</if>
- <if test="delState!=0">delState=#{delState},</if>
- </trim>
- WHERE id=#{id}
- </update>
- </mapper>
|