<!--审核展示列表-->
<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. JAVA使用JDBC连接,修改MySQL数据库(比较乱)

    原文地址1(连接MySQL图文) : http://www.cnblogs.com/GarfieldEr007/p/5746137.html 原文地址2 (修改MySQL图文): http://www ...

  2. CodeForces 651B

    #include <cstdio> #include <algorithm> using namespace std; int a[1005], n, temp, maxk; ...

  3. web项目中信息显示不全

    如果页面的信息加载不全: 1. 可能是SQL写的不对,查的SQL写错了会导致信息展示问题 2. 或者是分页的初始化设置 过小导致,关于分页xxxPage.java的实体类初始值的pageSize设置的 ...

  4. Head First Python (一)

    建立一个数组: cast = ["Cleese","Palin","Jones","Idle"] 列出数组有多少数据项: ...

  5. mysql sum聚合函数和if()函授的联合使用

    今天去面试遇到一个数据库试题,首先说一下表结构如下: 表结构:mytest 表数据:mytest 要查询的结果如下: 在本题目中,需要用到sum聚合函数和if函数 sql如下: ,)) ,)) AS ...

  6. 【Candy】cpp

    题目: There are N children standing in a line. Each child is assigned a rating value. You are giving c ...

  7. IOS笔记049-UITabBarController

    1.简单实现 效果:在视图底部显示一个工具栏 代码实现 // 创建窗口 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScre ...

  8. IOS笔记047-代理传值和block传值

    在两个不同的控制器之间传递数据,可以使用代理传值或者block传值. 例子是一个简单通讯录. 主界面如下: 添加联系人界面 查看/编辑联系人界面:默认是查看模式,点击编辑后进入编辑模式 编辑模式 数据 ...

  9. Python-S9-Day89_stark总结

    01 Stark总结 02 ORM总结 03 上节作业 04 Stark组件之查看页面表头 05 list_display_links 06 stark组件之添加页面 07 编辑删除页面 01 Sta ...

  10. 导入50G文件到mysql,然后再倒入sqlserver

    --导入大文件50G文件到mysql1.修改配置innodb_flush_log_at_trx_commit=0 2.导入时的注意事项set autocommit=1;show variables l ...