<!--审核展示列表-->
<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. thinkphp 3.2.3 - Route.class.php 解析(路由匹配)

    class Route { public static function check(){ $depr = C('URL_PATHINFO_DEPR'); // '/' $regx = preg_re ...

  2. 自动发现项目中的URL,django1版本和django2版本

    一.django 1 版本 routers.py import re from collections import OrderedDict from django.conf import setti ...

  3. Charles Babbage【查尔斯·巴贝奇】

    Charles Babbage When Babbage was working at Cambridge, a new idea occurred to him. 巴贝奇在剑桥工作的时候,脑海中有了 ...

  4. A * B Problem Plus HDU - 1402 (FFT)

    A * B Problem Plus HDU - 1402 (FFT) Calculate A * B.  InputEach line will contain two integers A and ...

  5. shell脚本中的交互式输入自动化

    shell中有时我们需要交互,但是呢我们又不想每次从stdin输入,想让其自动化,这时我们就要使shell交互输入自动化了. 1    利用重定向     重定向的方法应该是最简单的 例: 以下的te ...

  6. Android Shader渲染器:BitmapShader图片渲染

    public class BitmapShader extends Shader BitmapShader,  Shader家族的 专门处理图片渲染的 构造方法: public BitmapShade ...

  7. Detecting iOS

    Detecting iOS I am not a fan of User Agent sniffing, but here is how you would do it: var iOS = /iPa ...

  8. [转载]在Robotium中使用ID

    原文地址:在Robotium中使用ID作者:逍遥云翳 在Robotium的API中不提供使用ID的方式. 如果我们想在Robotium中使用ID就需要自己通过ID来找到控件的实例,然后通过Roboti ...

  9. icpc南昌邀请赛 比赛总结

    上周末,我参加了icpc南昌区域赛邀请赛,这也是我的第一次外出参赛. 星期五晚上,在6个小时的火车和1个小时的公交后,我们终于抵达了江西师范大学,这次的比赛场地.江西师范大学周围的设施很齐全,各种烧烤 ...

  10. Python面向对象之常用的特殊方法(5)

    Python面向对象里面有很多特殊方法,例如__init__(构造方法),__del__(析构方法),这些方法对于面向对象编程非常重要,下面列出一些常用的特殊方法 (1)__call__ class ...