08 2016 档案
摘要:1、 @responseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据或者是XML 数据,需要注意的呢,在使用此注解之后不会再走试图处理器,而是直接将数据写入到输入流中,他的效果等同于通
阅读全文
摘要:1、@requestBody注解常用来处理content-type不是默认的application/x-www-form-urlcoded编码的内容,比如说:application/json或者是application/xml等。一般情况下来说常用其来处理application/json类型。 2、
阅读全文
摘要:foreach标签主要用于构建in条件,他可以在sql中对集合进行迭代。如下: <delete id="deleteBatch"> delete from user where id in <foreach collection="array" item="id" index="index" ope
阅读全文
摘要:在mybatis中通过使用SQL片段可以提高代码的重用性,如下情景: 1、创建动态SQL <sql id="sql_count">select count(*)</sql> 2、使用 <select id="selectListCountByParam" parameterType="map" re
阅读全文
摘要:where标记的作用类似于动态sql中的set标记,他的作用主要是用来简化sql语句中where条件判断的书写的,如下所示: <select id="selectByParams" parameterType="map" resultType="user"> select * from user <
阅读全文
摘要:trim标记是一个格式化的标记,可以完成set或者是where标记的功能,如下代码: 1、 select * from user <trim prefix="WHERE" prefixoverride="AND |OR"> <if test="name != null and name.length
阅读全文
摘要:set标记是mybatis提供的一个智能标记,我一般将其用在修改的sql中,例如以下情况: <update> update user <set> <if test="name != null and name.length()>0">name = #{name},</if> <if test="ge
阅读全文

浙公网安备 33010602011771号