@Param("")

dao


//根据区域id获取对应的 楼宇、楼层、房间数据范围
List<DbAread> findBuildingListByAreaId(@Param("dbAread")DbAread dbAread,@Param("type")Integer type);



xml


<!-- 根据区域id获取对应的 楼宇、楼层、房间数据范围 -->
<select id="findBuildingListByAreaId" resultType="DbAread" >
SELECT
<include refid="dbAreadColumns"/>
FROM db_aread a
<include refid="dbAreadJoins"/>
<where>
area_id  =#{dbAread.dbArea.id}
</where>
GROUP BY 
<choose>
<when test="type !=null and type == 1 ">
a.building_id
</when>
<when test="type !=null and type == 2 ">
a.storey_id
</when>
<when test="type !=null and type == 3 ">
a.room_id
</when>
<otherwise>
</otherwise>
</choose>
</select>




不加
@Param("")   不用写 dbAread参数


//根据 楼宇楼层房间  获取区域明细 (找对应的区域)
List<DbAread> findDbAreadByBBR(DbAread dbAread);

<!-- 根据 楼宇楼层房间  获取区域明细 (找对应的区域) -->
<select id="findDbAreadByBBR" resultType="DbAread" >
SELECT
<include refid="dbAreadColumns"/>
FROM db_aread a
<include refid="dbAreadJoins"/>
<where> 1=1 
<if test="dbBuilding !=null and dbBuilding.id !=null and dbBuilding.id != ''">
and a.building_id  =#{dbBuilding.id}
</if>
<if test="dbBuildingStorey !=null and dbBuildingStorey.id !=null and dbBuildingStorey.id != '' ">
and a.storey_id  =#{dbBuildingStorey.id}
</if>
<if test="dbBsRoom !=null and dbBsRoom.id !=null and dbBsRoom.id != '' ">
and a.room_id  =#{dbBsRoom.id}
</if>
</where>
</select>


mybatis xml 参数 使用相关推荐

  1. MyBatis-06 MyBatis XML方式之多个接口参数用法

    概述 模拟场景:根据用户ID和角色的enable状态来查询用户的所有角色 工程结构 多个基本类型参数的场景 1.UserRoleMapper接口增加接口方法 2.UserRoleMapper.xml配 ...

  2. MyBatis-04 MyBatis XML方式之insert元素

    insert概述 简单的insert用法 1. UserMapper中添加接口方法 2. UserMapper.xml 添加节点 3. 编写单元测试 使用JDCB方式返回主键自增的值 1.UserMa ...

  3. MyBatis-03 MyBatis XML方式之select元素

    概述 select用法 根据用户id查询用户信息 1.UserMapper接口中添加接口方法 2. UserMapper.xml中配置resultMap和select元素 查询全部的SysUser 添 ...

  4. MyBatis-02 MyBatis XML方式概述及配置步骤

    概述 一个简单的权限控制需求 创建数据库表 创建实体类 XML方式概述及步骤 1. 首先在src/main/resources下com.artisan.mybatis.xml.mapper目录下创建5 ...

  5. spring boot 转xml格式报错解决方法_芋道 Spring Boot MyBatis 入门(一)之 MyBatis + XML...

    摘要: 原创出处 http://www.iocoder.cn/Spring-Boot/MyBatis/「芋道源码」欢迎转载,保留摘要,谢谢! 1. 概述 2. MyBatis + XML 2.1 引入 ...

  6. MyBatis传入参数为list、数组、map写法

    1.foreach简单介绍: foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合. foreach元素的属性主要有item,index,collection,open,sep ...

  7. Mybatis传入参数类型为ListIntergert作为条件进行查询

    Mybatis传入参数类型为List作为条件进行查询 higher2017关注 2017.02.07 10:23:16字数 130阅读 5,658 表结构: 表名称为constant 需求: 现在想查 ...

  8. MyBatis框架 mybatis.xml与Mapper.xml基本架构

    mybatis.xml 该文件一般位于src同级目录下,便于加载 DTD <!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Conf ...

  9. 第 3-2 课:SpringBoot如何优雅地使⽤ MyBatis XML 配置版

    MyBatis 是现如今最流⾏的 ORM 框架之⼀,我们先来了解⼀下什么是 ORM 框架. ORM 框架 对象关系映射(Object Relational Mapping,ORM)模式是⼀种为了解决⾯ ...

最新文章

  1. 【重磅】Google元老Eric Schmidt发布《深度学习2020大综述》,深度学习集大成者
  2. spring整合redis缓存
  3. 一个提高SQL Server操作效率的软件
  4. mapreduce编程规范_大数据之MapReduce详解
  5. STM32 - 定时器高级应用说明 - 多触波的实现 (N-pulse waveform generation using timer synchronization)- 02
  6. “我在苹果商店下载了一个诈骗App,损失60万美金!”
  7. Python异常处理总结
  8. ubuntu上 grafana + influxdb + telegraf 安装配置
  9. mediacodec surfaceview解码失败
  10. 简单总结.NET中的各% %用法及区别
  11. Eclipse导入MySQL驱动包
  12. 4、RH850 F1 定时器OSTM功能和配置
  13. java中类图概念_UML类图详细介绍
  14. torch.optim优化算法理解之optim.Adam()
  15. 大数据文本相似去重方案
  16. 简明扼要说浏览器环境
  17. SCTF 2021 | 冰天雪地 极限比拼
  18. 知物由学 | AI与黑产的攻守之道,详解攻击类文字图像的检测
  19. 基于JAVA竞赛信息发布及组队系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署
  20. 计算机会计实务好学吗,会计电算化难吗

热门文章

  1. Tomcat提示“XDB 的服务器 localhost 要求用户名和密码”
  2. confluence创建页面加载缓慢_树莓派4B使用docker安装confluence
  3. python 图标题上移_Python-Matplotlib将图形标题移动到y轴
  4. c语言int a什么意思,问一下吧里大神 int a = a; 这么定义是什么意思?
  5. tps 交易量_交易处理系统(TPS)
  6. java 根据类名示例化类_Java类类的requiredAssertionStatus()方法和示例
  7. python名称空间与运用域_Python名称空间和作用域讲座,命名,Namespaces,Scopes
  8. js中的转译_JavaScript中的填充和转译
  9. 单位矩阵属性(I ^ k = I)| 使用Python的线性代数
  10. frexp 中文_带有Python示例的math.frexp()方法