小知识点1

(1)在springMvc中,使用@Controller注解表示控制器时,在请求处理的方法返回值是String时,String字符串与spring的配置文件applicationContext.xml中的配置的视图视图解析器一起构建出跳转的路径。

  这个路径一般是据对路径,直接是在在项目名之后开始构建跳转的访问路径,http://localhost:8080/hk(项目名)/customInfo/toRegister.do

  例如:视图解析器是配置的

  

  那么return register;  跳转的页面路劲就是:http://localhost:8080/hk/register.jsp

 

(2)Mybatis配置文件中构建模糊查询,where条件之一

<if test="name!=null and !''.equals(name)">
    and name like concat(concat('%',#{name}),'%')
</if>

(3)Mybatis的sql语句的传入值是list或者array时,书写sql语句

<!-- 批量删除信息 -->
<delete id="deleteCustomInfoList" parameterType="java.util.List">
	delete from customInfo where openId in
	<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
		#{item.openId}
	</foreach>
</delete>

  

 

原文地址:https://www.cnblogs.com/gangbalei/p/6184904.html