mapper.java:

 /**
* @Description: 根据摄像机Id查询出入记录
* @Param:
* name 姓名
* monitorId 布控ID
* starttime 开始时间
* endtime 结束时间
* begin 页码
* pageSize 查询数量
* @return:
* @throws Exception
* @author: hw
* @date: 2019/6/11 14:28
*/
List<OutInRecords> queryOutInRecords(@Param("name") String name,@Param("monitorId") String monitorId,
@Param("starttime") String starttime, @Param("endtime") String endtime,
@Param("begin") Integer begin, @Param("pageSize") Integer pageSize);

mapper.xml

<select id="queryOutInRecords" resultMap="OutInRecords" parameterType="map">
select
a_oir.similarity,a_oir.`status`,a_oir.`timestamp`,a_ci.in_out,a_mi.monitor_name,a_si.person_type,a_si.address,a_si.`name`
from aiapp_out_in_record a_oir
LEFT JOIN aiapp_camera_info a_ci ON a_ci.camera_id = a_oir.camera_id
LEFT JOIN aiapp_staff_info a_si ON a_oir.faceimage_id = a_si.faceimage_id <if test="monitorId != null ">
LEFT JOIN aiapp_monitor_info a_mi ON a_mi.monitor_id = ${monitorId}
</if>
<if test="monitorId == null ">
LEFT JOIN aiapp_monitor_info a_mi ON a_mi.monitor_id = (SELECT a_cm.monitor_id FROM aiapp_camera_monitor a_cm WHERE a_cm.camera_id = a_oir.camera_id)
</if> <trim prefix="where" prefixOverrides="and">
<if test="monitorId != null ">
AND a_oir.camera_id in (SELECT a_cm.camera_id FROM aiapp_camera_monitor a_cm WHERE a_cm.monitor_id = ${monitorId})
</if> <if test="name != null ">
AND a_oir.faceimage_id = (SELECT a_si.faceimage_id FROM aiapp_staff_info a_si WHERE a_si.`name` = '${name}')
</if> <if test="starttime != null and endtime != null">
AND a_oir.`timestamp` BETWEEN ${starttime} and ${endtime}
</if>
<if test="starttime != null and endtime == null">
AND a_oir.`timestamp` > ${starttime}
</if>
<if test="starttime == null and endtime != null">
AND ${starttime} > a_oir.`timestamp`
</if>
</trim> order by a_oir.`timestamp` desc
<if test="begin != null and pageSize != null">
limit ${begin}, ${pageSize}
</if>
</select>

  

最新文章

  1. Axure 资料搜集
  2. Ubuntu下忘记MySQL密码重设方法
  3. 子类重载父类的方法“parent::方法名”转于 恩聪PHP学习教程
  4. Jquery自定义扩展方法(二)--HTML日历控件
  5. RequestContextListener作用
  6. 关于listview的一些属性
  7. Highcharts选项配置详细说明文档(zz)
  8. sql server 跨库操作
  9. 解决rhel相关系统下yum找不到安装包的解决方法
  10. opencv保存选择图像中的区域
  11. LeetCode——Restore IP Addresses
  12. SearchBox( 搜索框) 组件
  13. ecshop代码详解之init.php
  14. getch()、getche()和getchar()函数
  15. 源码安装xadmin及使用
  16. C#委托、事件、线程
  17. Redis基础一(Linux)
  18. BZOJ2028: [SHOI2009]会场预约(set)
  19. Android--根据子控件的大小自动换行的ViewGroup
  20. chrome 开发并使用油猴 Tampermonkey 插件

热门文章

  1. mysql查看数据库表数量
  2. 迁移mysql数据位置
  3. transition 滑动动画
  4. C++中操作符——学习笔记
  5. PHP 浮点型运算相关问题
  6. yii2 下的redis常用命令集合
  7. percona-mysql5.7.24使用xtrabackup工具配置主从同步
  8. java获取当前路径的方法
  9. Qt编写气体安全管理系统20-控制器管理
  10. Python 初级 5 判断再判断(四)