if

    @Select({"<script>",
"SELECT " +
" mu.id userId, " +
" eui.id userInfoId, " +
" mu.user_name userName, " +
" com.company_id AS comId, " +
" com.company_name comName, " +
" eui.talent_type talentType, " +
" eui.self_introduction selfIntroduction, " +
" eui.working_years workingYears, " +
" eui.education education, " +
" mu.icon_url iconUrl " +
" FROM " +
" mky_user mu, " +
" em_company c, " +
" em_company_record com, " +
" em_user_info eui, " +
" em_aptitude_maintain_approve ea " +
" WHERE 1=1 ",
" <when test='searchStr!=null'> ",
" AND ( mu.user_name LIKE #{searchStr} OR com.company_name LIKE #{searchStr} ) ",
" </when> ",
" <when test='firstId!=null'> ",
" AND ea.first_id = #{firstId} ",
" </when> ", " <when test='secondId!=null'> ",
" AND ea.second_id = #{secondId} ",
" </when> ", " <when test='threeId!=null'> ",
" AND ea.three_id = #{threeId} ",
" </when> ",
" <when test='startDate!=null'> ",
" AND ea.end_date &gt; #{startDate} ",
" </when> ",
" <when test='endDate!=null'> ",
" AND ea.end_date &lt; #{endDate} ",
" </when> ",
" AND c.id = com.company_id " +
" AND mu.com_id = c.id " +
" AND mu.id = eui.user_id " +
" AND eui.page_display_flag = 1 " +
" AND ea.user_info_id = eui.id " +
" AND ea.end_date &gt; DATE_FORMAT( now( ), '%Y-%m-%d' ) " + " AND mu.del_flag = 0 " +
" AND ea.del_flag = 0 " +
" AND eui.del_flag = 0 " +
" AND c.del_flag = 0 " +
" AND com.del_flag = 0 " + " GROUP BY eui.id " +
" ORDER BY " +
" eui.update_date DESC " + " </script> "})
List<TalentsResultVo> selectAllTalentsByParams(@Param("firstId") String firstId, @Param("secondId") String secondId, @Param("threeId") String threeId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("searchStr") String searchStr);

循环

    @Select({
" <script> ",
" select ",
" id ,stream_id 'streamId' , project_id 'projectId' ,push_stream_addr 'pushStreamAddr' , rtmp_play_addr 'rtmpPlayAddr' , flv_play_addr 'flvPlayAddr' , hls_play_addr 'hlsPlayAddr' , monitor_state 'monitorState', monitor_name 'monitorName' , note, state_reason 'stateReason' , ip_addr 'ipAddr' ",
" from bi_real_time_monitoring ",
" where project_id in ",
" <foreach collection='projectIds' item='id' open='(' separator=',' close=')'> ",
" #{id} ",
" </foreach> ",
" and delFlag =0 and monitor_state != 2 ",
" </script> "
}) List<BiRealTimeMonitoring> selectBiRealTimeMonitoringByProjectIds(@Param("projectIds") List<String> projectIds);

注意一个报错

注意一个报错

 

mapper @Select()注解开发,使用模板 if 和循环的更多相关文章

  1. Spring笔记04_AOP注解开发_模板_事务

    目录 1. Spring基于AspectJ的注解的AOP开发 1. 1 SpringAOP的注解入门 1.2 Spring的AOP的注解通知类型 1.2.1 @Before:前置通知 1.2.2 @A ...

  2. Spring---AOP注解开发&jdbc模板&Spring事务管理

    一.AOP注解开发 此处需要回忆一遍AOP的概念.简单的来说,AOP就是利用动态代理技术,做到不触动源代码但却扩展了功能.那么就需要一个被扩展的对象和一个“新的功能”,例如说给某类的saveUser方 ...

  3. Spring_AOP基于AspectJ的注解开发&JDBC的模板使用&事务管理(学习笔记3)

    一:AOP基于AspectJ的注解开发 1,简单的实例: 1)引入相应的jar包 ​ 2)在配置文件里引入相关约束 <beans xmlns="http://www.springfra ...

  4. spring boot纯注解开发模板

    简介 spring boot纯注解开发模板 创建项目 pom.xml导入所需依赖 点击查看源码 <dependencies> <dependency> <groupId& ...

  5. Spring入门(三)— AOP注解、jdbc模板、事务

    一.AOP注解开发 导入jar包 aop联盟包. aspectJ实现包 . spring-aop-xxx.jar . spring-aspect-xxx.jar 导入约束 aop约束 托管扩展类和被扩 ...

  6. Mybatis注解开发

    mybatis 的常用注解: @Insert:实现新增 @Update:实现更新 @Delete:实现删除 @Select:实现查询 @Result:实现结果集封装 @Results:可以与 @Res ...

  7. Struts2------拦截器和标签库和注解开发

    一.解析Struts2源码中拦截器的执行 客户端请求Action,执行前端控制器,在前端控制器内部创建了Action的代理类,调用代理类的execute方法,在execute方法内部执行ActionI ...

  8. SpringMVC-Mybatis整合和注解开发

    SpringMVC-Mybatis整合和注解开发SpringMVC-Mybatis整合整合的思路在mybatis和spring整合的基础上 添加springmvc.spring要管理springmvc ...

  9. MyBatis框架之注解开发

    MyBatis注解开发 @Insert注解注解属性value:写入SQL语句 @Options注解实现添加新数据的主键封装注解属性useGeneratedKeys:使用生成的主键,配置为truekey ...

随机推荐

  1. navicate的使用及用Python操作数据额库

    Navicat使用 下载地址:<https://pan.baidu.com/s/1bpo5mqj> Navicat是基于mysql操作的,所以能否自主完成一些练习,就能够运用Navicat ...

  2. React Native 开发豆瓣评分(一)环境搭建&配置模拟器

    详细可参考 官方文档,这里进记录一些重要过程. 安装环境 下载 Android Studio 选择 Custom 进行安装: Android SDK Android SDK Platform Perf ...

  3. Vue-filter指令全局过滤和稀有过滤

    简单介绍一下过滤器,顾名思义,过滤就是一个数据经过了这个过滤之后出来另一样东西,可以是从中取得你想要的,或者给那个数据添加点什么装饰,那么过滤器则是过滤的工具.例如,从['abc','abd','ad ...

  4. springboot 打包发布(war包)

    版本关系: 软件名称 版本号 软件名称 版本号 spring boot 2.x jdk 1.8 tomcat 9.x springboot中的pom.xml文件 打包:右键点击项目,选择如下图: 填写 ...

  5. ubuntu18.04 下启动Android Studio报错KVM is required to run this AVD. /dev/kvm device: permission denied.

    在ubuntu18.04下安装Android Studio,安装了模拟器后运行报错 KVM is required to run this AVD. /dev/kvm device: permissi ...

  6. python之csv操作

    在使用python爬虫时或者其他情况,都会用到csv存储与读取的相关操作,我们在这里就浅谈一下: CSV(Comma-Separated Values)逗号分隔符,也就是每条记录中的值与值之间是用分号 ...

  7. hexo Yelee 主题的busuanzi网站统计没数字显示问题解决

    j进入你的Yelee主题路径: themes\yelee\source\css\_partial 修改该路径下的: footer.styl 修改文件内容: 将内容改为: 然后你的站点就可以了

  8. npm的安装,升级与卸载

    npm查询版本 npm -v npm安装模块 [npm install xxx]利用 npm 安装xxx模块到当前命令行所在目录: [npm install -g xxx]利用npm安装全局模块xxx ...

  9. jQuery隐藏和显示从上往下的实现方法

    jquery 显示隐藏方法实现动画效果 方向 显示 隐藏 左上角到右下角 show() hide() 垂直向下 slideDown() slideUp() 水平与垂直两个方向 toggle() 垂直向 ...

  10. uni-app之导航配置pages.json

    1.基础配置,各个页面都要在这里边引入. 2.基础配置,头部导航左右上脚的buttons设置. 3.如果没有权限展示底部导航的需求,可以直接在此文件配置底部导航.