常用SQL语句写法(一)
<resultMap id="userResult" type="com.cloudwalk.shark.model.User">
<id property="id" column="ID" jdbcType="INTEGER"></id>
<result property="userName" column="user_name" jdbcType="VARCHAR"></result>
</resultMap> <insert id="insertUser" parameterType="com.cloudwalk.shark.model.User">
INSERT INTO
t_shark_user(ID,USER_NAME)
VALUES
(
#{id},#{userName}
)
</insert> <select id="findUserByName" parameterType="java.lang.String" resultMap="userResult">
select id,user_name as userName from t_shark_user
where 1=1
<if test=" _parameter !=null and _parameter !='' " >
and user_name = #{name,jdbcType=VARCHAR}
</if>
</select> <select id="queryUserByName" parameterType="java.util.ArrayList" resultMap="userResult">
select id,user_name as userName from t_shark_user
where user_name in
<if test=" list !=null and list.size>0 !='' " >
<foreach collection="list" item="userName" index="index" open="(" close=")" separator=",">
#{userName}
</foreach>
</if>
</select>
常用SQL语句写法(一)的更多相关文章
- oracle常用SQL语句(汇总版)
Oracle数据库常用sql语句 ORACLE 常用的SQL语法和数据对象一.数据控制语句 (DML) 部分 1.INSERT (往数据表里插入记录的语句) INSERT INTO 表名(字段名1, ...
- Oracle数据库常用Sql语句大全
一,数据控制语句 (DML) 部分 1.INSERT (往数据表里插入记录的语句) INSERT INTO 表名(字段名1, 字段名2, ……) VALUES ( 值1, 值2, ……); INSE ...
- php面试专题---MySQL常用SQL语句优化
php面试专题---MySQL常用SQL语句优化 一.总结 一句话总结: 原理,万变不离其宗:其实SQL语句优化的过程中,无非就是对mysql的执行计划理解,以及B+树索引的理解,其实只要我们理解执行 ...
- Mysql常用sql语句(二)- 操作数据表
21篇测试必备的Mysql常用sql语句,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1683347.html ...
- Mysql常用sql语句(16)- inner join 内连接
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 利用条件表达式来消除交叉连接(cross joi ...
- Mysql常用sql语句(20)- 子查询重点知识
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 子查询语句可以嵌套在 sql 语句中任何表达式出现的位 ...
- Mysql常用sql语句(21)- regexp 正则表达式查询
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 正则的强大不言而喻,Mysql中也提供了 reg ...
- Mysql常用sql语句(22)- insert 插入数据
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 终于讲完基础的查询语句了...这篇讲的就是插入数 ...
- Mysql常用sql语句(3)- select 查询语句基础使用
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 针对数据表里面的每条记录,select查询语句叫 ...
随机推荐
- HttpURLConnection访问网络
HttpURLConnection是一个抽象类,获取HttpURLConnection对象HttpURLConnection urlConnection=new URL(http://www.baid ...
- Anroid事件分发
因为最近因个人原因离职,面试的时候,有人问到了Android中事件分发机制的过程,因为忘得差不多了,没答好,所以回来后,想写了个Demo,重新复习一遍. 一般来说,Android的组件其实可以分为两类 ...
- HDU4850 Wow! Such String! —— 字符串构造
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4850 代码如下: #include <iostream> #include <cst ...
- 分布式锁(Redis实现)
1.分布式锁解决方案 1.采用数据库 不建议 性能不好 jdbc 2.基于Redis实现分布式锁(setnx)setnx也可以存入key,如果存入key成功返回1,如果存入的key已经存在了,返回 ...
- iOS 两个tableview的 瀑布流
iOS 两个tableview的 瀑布流1. [代码]Objective-C //// DocViewController.m// getrightbutton//// Created ...
- hdu 1106 排序 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1106 这个题目一开始以为是水题,就想着用来轻松轻松,谁知道改得我想吐!! 除了discuss 中的数据 ...
- java 基于百度地图API GPS经纬度解析地址
首先这是百度地图api 的接口地址,基于接口的参数,不过多介绍,其中都提供相应的介绍: http://lbsyun.baidu.com/index.php?title=webapi/guide/web ...
- hdu-4991 Ordered Subsequence(dp+树状数组)
题目链接: Ordered Subsequence Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- python中的不可变类型和可变类型
在python中整形,字符串,元组是不可变类型,而列表和字典都是可变类型. 对于不可变类型进行重新赋值,相当于是用以前的变量名重新指向了新的地址,这个地址中存的变量值就是重新的赋值 通过python中 ...
- Can't locate Log/Dispatch.pm in @INC /Makefile out-of-date with respect to Makefile.PL
mha check的时候报错问题解决: # masterha_check_ssh --conf=/data/mha/app1.cnf Can't locate Log/Dispatch.pm in ...