columnPropertyUnsame

<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>

 

posted @ 2018-11-05 23:47  深沉有点事  阅读(226)  评论(0编辑  收藏  举报