.xml文件

<?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="com.pinganwj.clinic.web.service.TestStudentMapper">
<resultMap id="BaseResultMap" type="com.pinganwj.common.model.db.test.TestStudent">
<id column="ID" property="id" jdbcType="VARCHAR" />
<result column="NAME" property="name" jdbcType="VARCHAR" />
<result column="STUID" property="stuId" jdbcType="VARCHAR" />
<result column="SEX" property="sex" jdbcType="VARCHAR" />
<result column="PHONE" property="phone" jdbcType="VARCHAR" />
<result column="QQ" property="qq" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
ID,NAME,STUID,SEX,PHONE,QQ
</sql>


<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from TEST_STUDENT
where ID = #{id,jdbcType=VARCHAR}
</select>


<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from
TEST_STUDENT
where ID = #{id,jdbcType=VARCHAR}
</delete>


<insert id="insertSelective" parameterType="com.pinganwj.common.model.db.test.TestStudent">
insert into TEST_STUDENT
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="name != null">
NAME,
</if>
<if test="stuId != null">
STUID,
</if>
<if test="sex != null">
SEX,
</if>
<if test="phone != null">
PHONE,
</if>
<if test="qq != null">
QQ,
</if>



</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="stuId != null">
#{stuId,jdbcType=VARCHAR},
</if>

<if test="sex != null">
#{sex,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="qq != null">
#{qq,jdbcType=VARCHAR},
</if>
</trim>
</insert>




<update id="updateSelective" parameterType="com.pinganwj.common.model.db.test.TestStudent">
update TEST_STUDENT
<set>

<if test="name != null">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="stuId != null">
stuId = #{stuId,jdbcType=VARCHAR},
</if>
<if test="sex != null">
SEX = #{sex,jdbcType=VARCHAR},
</if>
<if test="phone != null">
PHONE = #{phone,jdbcType=VARCHAR},
</if>

<if test="qq != null">
QQ = #{qq,jdbcType=VARCHAR},
</if>


</set>
where ID = #{id,jdbcType=VARCHAR}
</update>




</mapper>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值