文章目录
- 一、图片浏览
- 二、bookMapper.xml文件代码
一、图片浏览
二、bookMapper.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标签下的路径是dao层的路径,因为dao层原本是用于书写SQL语句的 -->
<mapper namespace="com.demo.ssm.dao.BookDao">
<select id="search" resultType="book">
select * from book
<where>
<if test="bookName != null and bookName != '' ">
and bname = #{bookName}
</if>
<if test="bookAuthor != null and bookAuthor != '' ">
and author = #{bookAuthor}
</if>
<if test="lowPrice != null and lowPrice != '' ">
and price >= #{lowPrice}
</if>
<if test="highPrice != null and highPrice != '' ">
and price <= #{highPrice}
</if>
</where>
</select>
</mapper>