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. php 5.6.36 安装mcrypt

    相关扩展安装步骤 libmcrypt downloadUrl:https://sourceforge.net/projects/mcrypt/files/MCrypt/ versionCode:2.5 ...

  2. Go net/http 发送常见的 http 请求

    使用 golang 中的 net/http 包来发送和接收 http 请求 开启 web server 先实现一个简单的 http server,用来接收请求 package main import ...

  3. 移动端隐藏滚动条,css方法

    小白第一次发文记录自己遇到的问题. 关于隐藏移动端滚动条方法很多,这里只说本人用到的. 在PC端隐藏html右侧默认滚动条 html { /*隐藏滚动条,当IE下溢出,仍然可以滚动*/ -ms-ove ...

  4. BHD钱包部署【生态池/合作池】

    前序 BHD网址:https://btchd.org/#wallet 注:我这里是centos7, 所以我选linuxPC 部署 解压与配置 tar -zxf bhd-v1.3.4.0-d909c0e ...

  5. Oracle加密解密

    Oracle内部有专门的加密包,可以很方便的对内部数据进行加密(encrypt)和解密(decrypt). 介绍加密包之前,先简单说一下Oracle基本数据类型——RAW类型. RAW,用于保存位串的 ...

  6. 运行 jcontrol 报 libXext.so.6: cannot open shared object file 错误

    需要安装额外库: yum install libXext.x86_64 yum install libXrender.x86_64 yum install libXtst.x86_64

  7. OF框架使用指导系列索引

    一.项目搭建指导 [OF框架]搭建标准工作环境 [OF框架]使用OF框架创建应用项目 [OF框架]在Visual Studio中启用Docker支持,编译生成,并在容器运行项目 [OF框架]在Visu ...

  8. clamscan-Linux查毒工具

    转载:https://www.cnblogs.com/tdcqma/p/7576183.html clamscan命令用于扫描文件和目录,一发现其中包含的计算机病毒,clamscan命令除了扫描lin ...

  9. Nginx.conf配置文件默认配置块略解

    #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #erro ...

  10. python函数式编程-装饰器

    在代码运行期间动态增加功能的方式,称之为“装饰器”(Decorator). 由于函数也是一个对象,而且函数对象可以赋值给变量,所以通过变量也能调用该函数. >>> def now() ...