码迷,mamicode.com
首页 > 其他好文 > 详细

columnPropertyUnsame

时间:2018-11-06 00:53:22      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:mes   sel   val   pac   resultmap   date   com   style   span   

<mapper namespace="com.abc.dao.IStudentDao">
    <insert id="insertStudent">
        insert into student(tname,tage,score) values(#{name}, #{age}, #{score})
    </insert>
    
    <delete id="deleteById">
        delete from student where tid=#{xxx}
    </delete>
    
    <update id="updateStudent">
        update student set tname=#{name}, tage=#{age}, score=#{score} where tid=#{id}
    </update>
    
    <select id="selectStudentById" resultType="Student">
        <!-- 给与属性名称不同的字段别名,让别名与属性名称相同 -->
        select tid id,tname name,tage age,score from student where tid=#{ooo}
    </select>
    
</mapper>

 

<mapper namespace="com.abc.dao.IStudentDao">
    <insert id="insertStudent">
        insert into student(tname,tage,score) values(#{name}, #{age}, #{score})
    </insert>
    
    <delete id="deleteById">
        delete from student where tid=#{xxx}
    </delete>
    
    <update id="updateStudent">
        update student set tname=#{name}, tage=#{age}, score=#{score} where tid=#{id}
    </update>
    
    <resultMap type="Student" id="studentMap">
        <id column="tid" property="id"/>
        <result column="tname" property="name"/>
        <result column="tage" property="age"/>
    </resultMap>
    
    <select id="selectStudentById" resultMap="studentMap">
        select tid,tname,tage,score from student where tid=#{ooo}
    </select>
    
</mapper>

 

columnPropertyUnsame

标签:mes   sel   val   pac   resultmap   date   com   style   span   

原文地址:https://www.cnblogs.com/csslcww/p/9912392.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!