mybatis sql参考
参考mybatis sql:
<select id="xxx" resultType="com.xxxx.xxx.vo.xx.xx" parameterType="com.xxx.xx.req.xxx">
SELECT
apply.apply_no,
apply.loan_apply_code,
cust.cust_name,
cust.id_no,
cust.mobile,
apply.loan_amount,
CONCAT(apply.init_period, CASE WHEN (apply.period_unit_code='1') then '天' WHEN (apply.period_unit_code='2') then '月' END) as init_period_str,
apply.contract_rate,
apply.apply_status,
(SELECT dict_value FROM aim_t_sys_dict_data WHERE dict_code = apply.apply_status AND dict_type = 'APPLY_STATUS' AND deleted='0' LIMIT 1) as apply_status_str,
apply.assets_code,
<!-- apply.assets_platform_code, -->
platform.platform_name,
<!-- apply.product_code, -->
product.product_name,
account.create_time,
apply.agreement_confirm_time
FROM aim_t_loan_apply apply
LEFT JOIN aim_t_cust_base cust ON apply.cust_code = cust.cust_code
LEFT JOIN aim_t_loan_assets assets ON apply.apply_no = assets.apply_no
LEFT JOIN aim_t_assets_platform platform on apply.assets_platform_code = platform.platform_code
LEFT JOIN aim_t_product product on apply.product_code = product.product_code
LEFT JOIN aim_t_cust_sub_account account on cust.id_no=account.id_no and cust.id_type=account.id_type
<where>
<if test="userPlatformCodeList != null and userPlatformCodeList.size > 0">
AND apply.assets_platform_code in
<foreach collection="userPlatformCodeList" index="userPlatformCode" item="userPlatformCode"
open="(" separator="," close=")">
#{userPlatformCode,jdbcType=VARCHAR}
</foreach>
</if>
<if test="custName != null and custName != ''">
AND cust.cust_name = #{custName,jdbcType=VARCHAR}
</if>
<if test="mobile != null and mobile != ''">
AND cust.mobile = #{mobile,jdbcType=VARCHAR}
</if>
<if test="idNo != null and idNo !=''">
AND cust.id_no = #{idNo,jdbcType=VARCHAR}
</if>
<if test="loanApplyCode != null and loanApplyCode != ''">
AND apply.loan_apply_code = #{loanApplyCode,jdbcType=VARCHAR}
</if>
<if test="assetsPlatformCode != null and assetsPlatformCode !=''">
AND apply.assets_platform_code = #{assetsPlatformCode,jdbcType=VARCHAR}
</if>
<if test="productCode != null and productCode != ''">
AND apply.product_code = #{productCode,jdbcType=VARCHAR}
</if>
<if test="initPeriod != null">
AND apply.init_period = #{initPeriod,jdbcType=INTEGER}
</if>
<if test="periodUnitCode != null and periodUnitCode != ''">
AND apply.period_unit_code = #{periodUnitCode,jdbcType=VARCHAR}
</if>
<if test="loanApplyStartTime != null and loanApplyStartTime != '' and loanApplyEndTime != null and loanApplyEndTime != ''">
AND apply.loan_apply_time BETWEEN #{loanApplyStartTime,jdbcType=VARCHAR} and #{loanApplyEndTime,jdbcType=VARCHAR}
</if>
<if test="applyStatus != null and applyStatus != ''">
AND apply.apply_status = #{applyStatus,jdbcType=VARCHAR}
</if>
<if test="approveStatus != null and approveStatus != ''">
AND apply.approve_status = #{approveStatus,jdbcType=VARCHAR}
</if>
<if test="isOpen != null and isOpen !=''">
AND apply.is_open = #{isOpen,jdbcType=VARCHAR}
</if>
<if test='agreementConfirmStatus != null and agreementConfirmStatus=="0"'>
AND (apply.agreement_confirm_time IS NULL or apply.agreement_confirm_time = '')
</if>
<if test='agreementConfirmStatus != null and agreementConfirmStatus=="1"'>
AND apply.agreement_confirm_time IS NOT NULL
</if>
<if test="loanStartTime != null and loanStartTime != ''">
AND assets.loan_time <![CDATA[>=]]> #{loanStartTime,jdbcType=VARCHAR}
</if>
<if test="loanEndTime != null and loanEndTime !=''">
AND assets.loan_time <![CDATA[<=]]> #{loanEndTime,jdbcType=VARCHAR}
</if>
AND apply.deleted = '0'
mybatis sql参考的更多相关文章
- Mybatis sql映射文件浅析 Mybatis简介(三)
简介 除了配置相关之外,另一个核心就是SQL映射,MyBatis 的真正强大也在于它的映射语句. Mybatis创建了一套规则以XML为载体映射SQL 之前提到过,各项配置信息将Mybatis应用的整 ...
- Mybatis sql映射文件浅析 Mybatis简介(三) 简介
Mybatis sql映射文件浅析 Mybatis简介(三) 简介 除了配置相关之外,另一个核心就是SQL映射,MyBatis 的真正强大也在于它的映射语句. Mybatis创建了一套规则以XML ...
- Mybatis SQL映射文件详解
Mybatis SQL映射文件详解 mybatis除了有全局配置文件,还有映射文件,在映射文件中可以编写以下的顶级元素标签: cache – 该命名空间的缓存配置. cache-ref – 引用其它命 ...
- ibatis mybatis sql语句配置 符号不兼容 大于号 小于号<!CDATA[ ]>
ibatis mybatis sql语句配置 符号不兼容 大于号 小于号<!CDATA[ ]> 因为这个是xml格式的,所以不允许出现类似">"这样的字符,但是都 ...
- MyBatis SQL xml处理小于号与大于号
MyBatis SQL xml处理小于号与大于号 当我们需要通过xml格式处理sql语句时,经常会用到< ,<=,>,>=等符号,但是很容易引起xml格式的错误,这样会导致后台 ...
- mybatis 参数为list时,校验list是否为空, mybatis ${}与#{}的区别,Mybatis sql in
1.mybatis 参数为list时,校验list是否为空 2. mybatis ${}与#{}的区别 简单来说#{} 解析的是占位符?可以防止SQL注入, 比如打印出来的语句 select * fr ...
- SpringMVC4+MyBatis+SQL Server2014 基于SqlSession实现读写分离(也可以实现主从分离)
前言 上篇文章我觉的使用拦截器虽然方便快捷,但是在使用读串还是写串上你无法控制,我更希望我们像jdbc那样可以手动控制我使用读写串,那么这篇则在sqlsession的基础上实现读写分离, 这种方式则需 ...
- SQL 参考
本主题将介绍 ArcGIS 中的选择表达式所用的常规查询的各个元素.ArcGIS 中的查询表达式使用常规 SQL 语法. 警告: SQL 语法不适用于使用字段计算器计算字段. 字段 在 SQL 表达式 ...
- mybatis 学习笔记(二):mybatis SQL注入问题
mybatis 学习笔记(二):mybatis SQL注入问题 SQL 注入攻击 首先了解下概念,什么叫SQL 注入: SQL注入攻击,简称SQL攻击或注入攻击,是发生于应用程序之数据库层的安全漏洞. ...
随机推荐
- vs2015和Oracle在一起时的Shit问题
VS2015在连接Oracle时,必须要安装到一个不含有空格的目录中去,否则连接不上Oracle,至于为什么,不知道,鬼知道,日的. 如果你不幸以前安装过VS2015,安装到它的默认的什么“progr ...
- net start/stop mysql access denied.拒绝访问
转载:Mysql net start mysql启动,提示发生系统错误 5 拒绝访问 解决之道 为什么会出现这个问题呢?经过一番思考找到原因了,是因为当前用户的操作权限太低了,出了问题 出错问题截屏如 ...
- apk签名的流程
最后总结一下apk签名的整个流程: 一.对Apk中的每个文件做一次算法(数据SHA1摘要+Base64编码),保存到MANIFEST.MF文件中 二.对MANIFEST.MF整个文件做一次算法(数据S ...
- A Language Modeling Approach to Predicting Reading Difficulty-paer
Volume:Proceedings of the Human Language Technology Conference of the North American Chapter of the ...
- JUnit4测试报错:class not found XXX
初学java框架,最近用eclipse跟着视频坐淘淘商城这个项目,其中使用了JUnit4做单元测试.当运行测试代码时,项目报错:class not found xxx. 借助了其他大神的博客,论坛等 ...
- day02python 整型 布尔
今日内容 int bool 详细内容 1.整型(int) Py2 32位电脑 64位电脑 超出范围后python将自动转换成long(长整型) /运算不能显示小数-> (整形除法只能保留整数位) ...
- web-msg-send 学习 http://www.workerman.net/web-sender
WEB消息推送框架 web-msg-sender是一款web长连接推送框架,采用PHPSocket.IO开发,基于WebSocket长连接通讯,如果浏览器不支持WebSocket则自动转用comet推 ...
- xen虚拟化平台虚拟机在线新加一块磁盘无法识别
截图 报错:you need to shutdown and then restart the vm before it can access the new disk 添加好磁盘后按照提示重启虚拟机 ...
- JS 点击复制
一.原理分析 浏览器提供了 copy 命令 ,可以复制选中的内容 document.execCommand("copy") 如果是输入框,可以通过 select() 方法,选中输入 ...
- 1.1.17 Word在表格中插入竖排文字,显示一半
隐藏效果如下所示: 这是因为文字的[段落行距]设置为[固定值],将文字选中,设置为[单倍行距]即可.