查询条件不确定,需要根据情况产生SQL语法,这种情况叫动态SQL,即根据不同的情况生成不同的sql语句。
模拟一个场景,在做多条件搜索的时候,
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbwAAAEGCAIAAACRg7ebAAAgAElEQVR4nO2deVMbV9roGWfiqqmaqqmpmXu/QPKRUvkWN7Gxx/VOXPN6TLAnNgaHkERm7NgxiyVsQMImtjCrQIAAiRiEFtACUqPW2lq6W6slzv3jMW1ZG5IMWlrPr1Qu3JJarafP+ensp40gCIIgZdNW7wtAEARpJlCaCIIgFYDSRBAEqQCUJoIgSAWgNBEEQSoApYkgCFIBKE0EQZAKQGkiCIJUAEoTQRCkAlCaCIIgFYDSFCdHzUC9g1Qx9Q5Y80VMlDSENDHlfTwFv2mmUWmW+9I4UW2WiLUC9ZFmvdKiKFNedvTSx7xtBoSrzb479Q7nOxozqo0csdah1tJshLQompQnBFOIYSqVSiaTyWQy0QzApaZSKeG+NMLtaOSoNmbEWo3aSbNx0qI4Ul5OPJPJZDwej0ajPM9zHMeyLMuykUYFLo/jOJ7no9FoPB5PJpONcC8aNqoNG7EWpEbSbJC0KKaUB/GE3554PM7zfCQSCQaDfr/f6/W6j6EbD+HavF6v3+8PBoORSITn+Xg8Dr9kcC8wqk0RsRakdtKse1oUU8oTfoEgnizLMgzjdrudTqfdbrdYLGaz2WQyGRsVk8lkNpstFovdbnc6nW63m2EYlmXhXgi/YRjVBo9Ya1ILaTZOWhRHyhOK7W/fvoV4tjUzer3eYrFQFOX3++FeCD9gtbwXTRTVBolYy3Lm0mzYtNi8KU/4EUomkzzPMwxT71h+FCqVSqfTmc1miqIYhuF5PplM1v4HrImi2iARa1lqIc3GTItNmvJyfoTC4bDb7YZvVO9Lqxi4bLlcPjs7q9VqLRaL2+0Oh8O1/wFrlqg2TsRambNNE42ZFps65cG1QVtHNBoNBoMURdU9pNUBl/3gwQO5XK5SqfR6PUVRwWAwGo1Ca0mNpdn4UW2ciLUytZBmo6XFpk552Q3EHM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RNR0dHT09/crFAqNRmOxWLxeL8dxUHJMp9OZTCaTyaTT6beFgBeIWJfACdJMp9OpVIrjOL/fb7fb631DEQQ5W3p6egYHB5VKpU6ns9vtfr9f6AEXqttHxamhu+pGKWkeHR2BNKPRaDAYpChKr9erVCq5XP7gwYOenp5vv/326tWrV65cuXz58qVLl9rb2y8iCNIktLe3X7p06fLly1euXLl69eq3337b09Pz4MEDuVyuUqn0ej1FUcFgMBqNCsOGWkSLpTlBmlBDj8fj4XDY7XZbLBatVjs7OyuXywcGBvr7+/v6+u7evdvd3d3d3X0HQZCmAnLu3bt3+/r6+vv7BwYG5HL57OysVqu1WCxut1voB2+FeneZlOrVEWroyWSS53mGYWCMq06nU6lUSqVyYmJidHR0ZGREJpNJpVKpVPoEQZAmAfKsTCYbGRkZHR2dmJhQKpUqlUqn05nNZoqiGIYRxlqKtSu8Ck6QZnZhk2VZv99PUZTFYtHr9TBKS61WLy4uqlSqBQRBmhCVSrW4uKhWq2G4pV6vt1gsMKadZVksZuZzwvih7O4g8CbDMG632+l02u12i8ViNptNJpMRQZCmxWQymc1mi8Vit9udTqfb7WYYBoyZ0wWEkBOlSbLGHoE3eZ6PRCLBYNDv93u9XvcxNIIgTYiQhb1er9/vDwaDkUiE5/mcQZc1kFGzUJY0hfImDNuEiQEwtJVlWZZlIwiCNC2Qi2GMejQajcfj2QMzsWKeQ1nTe3K8CaXOZDKZTCYTCIKIAsjRULpEY5aggjmRgjrBnkDBiQEIgjQdQqaGPI66LEbFE8kLTgPIIAjStLTs3J7q+NjVN0pMqEIQpIk4FaG0ArhkEYIgSAWgNBEEQSoApYkgCFIBKE0EQZAKQGkiCIJUAEoTQRCkAlCaCIIgFfD/AcYCwCjKL4fKAAAAAElFTkSuQmCC" alt="" />
对于以上四种情况,sql语句分别是:
1.select * from student
2.select * from student where name='zhangsan'
3.select * from student where sal=1000
4.select * from student where name='zhangsan' and sal = 1000
原来在拼接的时候是这样做的(电力项目的时候就是这样拼接的。。)
select * from student where 1=1 and name='zhangsan'
select * from student where 1=1 and sal=1000
select * from student where 1=1 and name='zhangsan' and sal = 1000
mybatis可以在xml文件中判断
SELECT * FROM student
<where>
<if test="pid!=null">
AND id = #{pid}
</if>
<if test="pname!=null">
AND name = #{pname}
</if>
<if test="psal!=null">
AND sal = #{psal}
</if>
</where>
StudentMapper.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"> <!--
namespace的取值可以是实体的全限定名,这样有好处!
-->
<mapper namespace="com.winner.entity.Student">
<resultMap id="studentMap" type="Student">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="sal" column="sal"/>
</resultMap>
<select id="findAll" parameterType="map" resultMap="studentMap">
SELECT * FROM student
<!--可以认为<where>标签等价于where 1=1-->
<where>
<!--pid是map中的key,自动去取map中的value,像后面的#{}中也是map的key,不要写value-->
<if test="pid!=null">
AND id = #{pid}
</if>
<if test="pname!=null">
AND name = #{pname}
</if>
<if test="psal!=null">
AND sal = #{psal}
</if>
</where>
</select>
</mapper>
public class StudentDao {
/**
* 有条件的查询所有学生
*/
public List<Student> findAll(Integer id,String name,Double sal) throws Exception{
SqlSession sqlSession = null;
try{
sqlSession = MybatisUtil.getSqlSession();
//方法的参数使用map进行接收
Map<String,Object> map = new LinkedHashMap<String,Object>();
map.put("pid",id);
map.put("pname",name);//模糊查询的话加%+name+%
map.put("psal",sal);
return sqlSession.selectList(Student.class.getName()+".findAll",map);
}catch(Exception e){
e.printStackTrace();
throw e;
}finally{
MybatisUtil.closeSqlSession();
}
} public static void main(String[] args) throws Exception { StudentDao dao = new StudentDao();
//查询所有
//List<Student> studentList = dao.findAll(null,null,null);
//List<Student> studentList = dao.findAll(5,null,null);
List<Student> studentList = dao.findAll(null,null,1000d);
for(Student s : studentList){
System.out.println(s.getId()+":"+s.getName()+":"+s.getSal());
}
}
}
MyBatis的动态SQL操作--查询的更多相关文章
-
mybatis之动态SQL操作之查询
1) 查询条件不确定,需要根据情况产生SQL语法,这种情况叫动态SQL /** * 持久层 * @author AdminTC */ public class StudentDao { /** * ...
-
MyBatis 实践 -动态SQL/关联查询
MyBatis 实践 标签: Java与存储 动态SQL 动态SQL提供了对SQL语句的灵活操作,通过表达式进行判断,对SQL进行拼接/组装. if 对查询条件进行判断,如果输入参数不为空才进行查询条 ...
-
mybatis之动态SQL操作之更新
1) 更新条件不确定,需要根据情况产生SQL语法,这种情况叫动态SQL /** * 持久层*/ public class StudentDao { /** * 动态SQL--更新 */ public ...
-
mybatis之动态SQL操作之插入
1) 根据条件,插入一个学生 /** * 持久层*/ public class StudentDao { /** * 动态SQL--插入 */ public void dynaSQLwithInse ...
-
MyBatis的动态SQL操作--插入
需求:向数据库中插入一条数据 //id,name,sal非空,三个字段都插入 insert into student(id,name,sal) values (?,?,?) //id,name非空,只 ...
-
MyBatis的动态SQL操作--删除
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAC/CAIAAAANX+LCAAAYvElEQVR4nO2dWWycV9nHDyC6UEGBGy
-
MyBatis的动态SQL操作--更新
更新条件不确定,需要根据具体的情况生成sql语句. id是主键,一般不会去更新. 1.只更新name的值 update student set name = ? where id = ? 2.只更新s ...
-
mybatis之动态SQL操作之删除
/** * 持久层 */ public class StudentDao { /** * 动态SQL--删除 */ public void dynaSQLwithDelete(int... ids) ...
-
MyBatis中动态SQL语句完成多条件查询
一看这标题,我都感觉到是mybatis在动态SQL语句中的多条件查询是多么的强大,不仅让我们用SQL语句完成了对数据库的操作:还通过一些条件选择语句让我们SQL的多条件.动态查询更加容易.简洁.直观. ...
随机推荐
-
阻止事件冒泡,阻止默认事件,event.stopPropagation()和event.preventDefault(),return fal的区别
今天来看看前端的冒泡和事件默认事件如何处理 1.event.stopPropagation()方法 这是阻止事件的冒泡方法,不让事件向documen上蔓延,但是默认事件任然会执行,当你掉用这个方法的时 ...
-
Android -- Properties使用
import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Properties; public ...
-
cache设计,以及多核造成的不一致性以及解决方案
http://www.360doc.com/content/11/1013/00/1317564_155625188.shtml http://blog.csdn.net/muxiqingyang/a ...
-
正确看待HTML5的语法变化
也许会有人问:“HTML4已经很普及了,如果改变基础语法,会不会有什么影响?” 我们都知道,在HMTL5之前几乎没有符合标准规范的Webu浏览器!在这种情况下,各个浏览器之间的互相兼容性和互操作性在很 ...
-
Oracle的大数据类型,BIG DATA TYPE
1.CLOB 字符LOB类型,主要用于存储大型英文字符 2.NCLOB 国际语言字符LOB类型,主要用于存储大型非英文字符 3.BLOB 二进制LOB类型,主要用于存储二进制数据 4.BFILE 二进 ...
-
javascript学习-对象与原型
javascript学习-对象与原型 Javascript语言是符合面向对象思想的.一般来说,面向对象思想需要满足以下三个基本要求: 封装,Javascript的对象可以*的扩充成员变量和方法,自然 ...
-
二:mysql安装配置、主从复制配置详解
作者:NiceCui 本文谢绝转载,如需转载需征得作者本人同意,谢谢. 本文链接:http://www.cnblogs.com/NiceCui/p/8213723.html 邮箱:moyi@moyib ...
-
CROS跨域请求处理
1.什么是跨域? 跨域是指从一个域名的网页去请求另一个域名的资源.比如从www.baidu.com 页面去请求 www.google.com 的资源.跨域的严格一点的定义是:只要 协议,域名,端口有任 ...
-
AFNetworking的简单使用
AFNetworking的下载地址: https://github.com/AFNetworking/AFNetworking AFNetworking的使用非常简单,创建一个类,调用一个方法就可以达 ...
-
netty ChannelOption
项目中用到很多netty,配置了各种不同的ChannelOption优化项,不同的配置对于在高并发情况下的性能有不小的影响 首先看下全部项目,参考下这篇文章,虽然不全 https://www.cnbl ...