参考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'

最新文章

  1. 【已解决】WinPhone模拟器报错:模拟器没法确定来宾虚拟机通信的主机ID地址。某些功能已被禁用
  2. HDU 2509 Be the Winner nim博弈变形
  3. 时间js转换方法Date(&quot;149...&quot;) 转成 2016-7-12 21:23:34 009
  4. 网上找到的一个jquery版网页换肤特效
  5. Monyer.cn黑客小游戏
  6. Spring中AOP原理,源码学习笔记
  7. javascript Date 函数的坑
  8. 通过对源代码的反向工程学习CoreData架构
  9. Visual Studio 2013环境下操作vc6/vc7/vc8等低版本平台项目【编译|生成|调试】
  10. JavaScript Unicode字符操作
  11. linux stat命令
  12. iterm快捷键及操作技巧(附Linux快捷键)
  13. CodeForces 581D Three Logos
  14. 内核初始化优化宏(__init, __devinit)
  15. HTTP权威指南-HTTP报文
  16. 【CJOJ P2110】YL杯超级篮球赛
  17. Spring boot 入门(四):集成 Shiro 实现登陆认证和权限管理
  18. mui---取消掉默认加载框
  19. linux并发服务器设计
  20. python容错

热门文章

  1. 【转载】 TensorflowOnSpark:1)Standalone集群初体验
  2. pycharm中添加PATH变量
  3. 基于SPA的网页授权流程(微信OAuth2)
  4. 02bootstrap_通用标签样式和代码
  5. MYSQL之IFNULL
  6. hdu5007 Post Robot AC自动机
  7. Python2和Python3关于reload()用法的区别
  8. torchvision里densenet代码分析
  9. java多线程同步器
  10. JS 60秒后重发送验证码