<!--审核展示列表-->
<select id="auditResList" resultType="java.util.HashMap">
<include refid="auditRes"/>
</select>
<!--审核展示 一条-->
<select id="auditResInfo" resultType="java.util.HashMap">
<include refid="auditRes"/>
</select>
<sql id="auditRes">
SELECT
r.id AS resId,
r.res_desc,
r.res_type,
r.res_state,
r.expires_date,
r.res_pic_path,
ra.id as applyId,
ra.reason,
ra.apply_note,
ra.company_id,
ra.state,
r.res_name,
c.companyName,
c.shopName
FROM resource r
inner JOIN resource_apply ra
ON r.id = ra.res_id
left JOIN company c
on ra.company_id = c.companyId
<where>
r.res_state = 1
<if test="resType != null">
and r.res_type = #{resType}
</if>
<if test="_parameter.containsKey('applyId') and applyId != null">
and ra.id = #{applyId}
</if>
<if test=" _parameter.containsKey('state') and state != null">
and ra.state = #{state}
</if>
<if test=" _parameter.containsKey('resName') and resName != null and resName != ''">
and r.res_name like CONCAT('%', #{resName}, '%')
</if>
<if test=" _parameter.containsKey('companyName') and companyName != null and companyName != ''">
and c.companyName like CONCAT('%', #{companyName}, '%')
</if>
<if test=" _parameter.containsKey('shopName') and shopName != null and shopName != ''">
and c.shopName like CONCAT('%', #{shopName}, '%')
</if>
</where>
</sql> /**
* 审核展示列表
*
* @param resType
* @return
*/
List<HashMap> auditResList(@Param("resType") Integer resType,
@Param("companyName") String companyName,
@Param("shopName") String shopName,
@Param("state") Integer state,
@Param("resName") String resName); /**
* 审核展示 一条
*
* @param resType
* @param applyId
* @return
*/
HashMap auditResInfo(@Param("resType") Integer resType, @Param("applyId") Integer applyId);

  

mybatis 判断参数有没有传入的更多相关文章

  1. MyBatis的参数,不能传入null

    今天在调试的过程中发现一个bug,把传入的参数写到查询分析器中执行没有问题,但是在程序中执行就报错:org.springframework.jdbc.UncategorizedSQLException ...

  2. mybatis mapper文件sql语句传入hashmap参数

    1.怎样在mybatis mapper文件sql语句传入hashmap参数? 答:直接这样写map就可以 <select id="selectTeacher" paramet ...

  3. mybatis 传递参数的方法总结

    有三种mybatis传递参数的方式: 第一种 mybatis传入参数是有序号的,可以直接用序号取得参数 User selectUser(String name,String area); 可以在xml ...

  4. mybatis中参数为list集合时使用 mybatis in查询

    mybatis中参数为list集合时使用 mybatis in查询 一.问题描述mybatis sql查询时,若遇到多个条件匹配一个字段,sql 如: select * from user where ...

  5. 【mybatis源码学习】mybatis的参数处理

    一.mybatis的参数处理以及参数取值 1.单个参数 mybatis不做任何处理 取值方式: ​ #{参数名/任意名} <!-- Employee getEmpById(Integer id) ...

  6. MyBatis 判断条件为等于的问题

    在用MyBatis操作数据库的时候相信很多人都用到,当在判断null, 大于,大于等于,小于,小于等于,不等于时估计很多都用到,比较容易实现了,这里就省略了,但唯独判断条件为等于时估计蛮多人遇到坑了, ...

  7. 【转载】Mybatis多参数查询映射

    转载地址:http://www.07net01.com/zhishi/402787.html 最近在做一个Mybatis的项目,由于是接触不久,虽然看了一下资料,但在实际开发中还是暴 露了很多问题,其 ...

  8. mybatis判断集合为空或者元素个数为零

    mybatis判断集合为空或者元素个数为零: <if test="mlhs != null and mlhs.size() != 0"> and t.mlh_name ...

  9. MyBatis传递参数

    MyBatis传递参数 一.使用 map 接口传递参数 在 MyBatis 中允许 map 接口通过键值对传递多个参数,把接口方法定义为 : public List<Role> findR ...

随机推荐

  1. mui的选项卡js选中指定项

    dom结构:在一定条件下想默认选中第二个选项卡 <div id="segmentedControl" class="mui-segmented-control mu ...

  2. Python_day01_作业笔记

    内容大纲: 1. python的出生与应用以及历史, python2x: 源码冗余,源码重复,源码不规范. python3x: 源码清晰优美简单.   2. python的种类. Cpython: 官 ...

  3. OAuth2.0 social_django微博第三方登录

    python网站第三方登录,social-auth-app-django模块, social-auth-app-django模块是专门用于Django的第三方登录OAuth2协议模块 目前流行的第三方 ...

  4. Spring---浅谈AOP

    概念 AOP是Aspect Oriented Programming的缩写,即面向切面的编程.是一种比较新颖的编程思想,也是Spring框架中一个重要的领域. AOP将应用系统分为两个部分:核心业务逻 ...

  5. HDU1042 A * B Problem Plus

    A * B Problem Plus Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other ...

  6. LINUX下实现按秒执行计划任务

    由于linux最小单位为分,但是很多需求上需要按秒执行,如30秒请求一个URL地址之类的,思路很简单就是修改计划任务脚本用循环控制,代码如下: #!/bin/bash PATH=/bin:/sbin: ...

  7. Nodejs-非阻塞I/O&事件驱动

    1.关于es6变量 const 定义常量,不会发生改变的就用这个 let 定义局部变量 如: const fs=require('fs');//require()表示载入这个模块 function a ...

  8. WCF,WebServices,WebApi区别

    http://www.cnblogs.com/hetring/p/4493137.html

  9. linux命令之grep、cut

    输入: ifconfig eth0 eth0表示主机的第一块网卡. 输出: eth0: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu inet 19 ...

  10. sqlserver操作各种文件方法

    ******* 导出到excelEXEC master..xp_cmdshell ''bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"G ...