mybatisz中一个可以替代between..and 的技巧
用mybatis进行时间段筛选时,如果,查询本日,本月的信息量,我们可以使用like concat()函数来替换between..and
<select id="queryMyStaffByShopId" parameterType="map" resultType="com.qlyd.shop.entity.out.SpreadUserOut">
select a.id staffid, b.avatar_url avatarUrl,b.nick_name name,(
select count(1) from shop_fans c
where c.promoter=a.uuid and a.shop_id=c.shop_id
<if test="createTime != null">
and c.create_time like concat ('%','${createTime}','%')
</if>
) totalCount
from user_staff a join user_info b
on a.uuid = b.unionid
where a.shop_id =#{shopId} and a.is_delete=0
<if test="name !=null">
and b.nick_name like concat ('%','${name}','%')
</if>
order by totalCount desc
</select> like这个地方需要用${}来取值,不能使用#{}来取值
mybatisz中一个可以替代between..and 的技巧的更多相关文章
- 在Wcf中应用ProtoBuf替代默认的序列化器
Google的ProtoBuf序列化器性能的牛逼已经有目共睹了,可以把它应用到Socket通讯,队列,Wcf中,身为dotnet程序员一边期待着不久后Grpc对dotnet core的支持更期待着Wc ...
- Sql Server 中一个非常强大的日期格式化函数
Sql Server 中一个非常强大的日期格式化函数Select CONVERT(varchar(100), GETDATE(), 0)-- 05 16 2006 10:57AMSelect CONV ...
- oracle 编译中一个关于clntsh 库的一个 帖子 ,收藏!
oracle 编译中一个关于clntsh 库的一个 帖子 ,收藏! ------------------------------------------------------------------ ...
- php中一个"异类"语法: $a && $b = $c;
php中一个"异类"语法: $a && $b = $c; $a = 1;$b = 2;$c = 3;$a && $b = $c;echo & ...
- oracle中一个字符串包含另一个字符串中的所有字符
oracle中一个字符串包含另一个字符串中的所有字符 --解决监理报告中所勾选的标段信息,与该用户所管理的标段字符串不匹配的问题. select * from a where instr(a,b)&g ...
- Spark小课堂Week7 从Spark中一个例子看面向对象设计
Spark小课堂Week7 从Spark中一个例子看面向对象设计 今天我们讨论了个问题,来设计一个Spark中的常用功能. 功能描述:数据源是一切处理的源头,这次要实现下加载数据源的方法load() ...
- Android中一个类实现的接口数不能超过七个
近期一段时间,在开发Android应用程序的过程中,发现Android中一个类实现的接口数超过七个的时候,常常会出现超过第7个之后的接口不能正常使用.
- Linux中一个文件10行内容,如何输出5-8内容到屏幕
题目是这样的,Linux中一个文件10行内容,如何输出5-8内容到屏幕首先我们模拟一下这样的环境: [root@localhost question]# pwd /root/question [roo ...
- [20180904]工作中一个错误.txt
[20180904]工作中一个错误.txt --//昨天看我提交一份修改建议,发现自己写的sql语句存在错误.--//链接:http://blog.itpub.net/267265/viewspace ...
随机推荐
- loopback 代码解析
loopback-boot boot(app, __dirname);//server.js var instructions = compile(options); execute(app, ins ...
- python与系统做交互常用的模块和使用方法
1.使用os模块与系统做简单命令的交互 >>>import os >>>os.popen('pwd') <open file 'pwd', mode 'r' ...
- initrd in linux 2.6.32.27
2.6.32.27可以不指定initrd选项 如果指定initrd选项,则自动调用initrd内的linuxrc或init进行一切必要的初始化.Kernel启动参数全部会作为变量传递给这两个脚本.如r ...
- scala学习笔记-面向对象编程之Trait
将trait作为接口使用 1 // Scala中的Triat是一种特殊的概念 2 // 首先我们可以将Trait作为接口来使用,此时的Triat就与Java中的接口非常类似 3 // 在triat中可 ...
- Hasura GraphQL schema 生成是如何工作的
不像大部分的graphql 引擎,使用标准的graphql 规范的处理模型,Hasura graphql 不存在resolver 的概念(实际上是有的,只是转换为了sql语法) 以下是Hasura g ...
- C# to IL 8 Methods(方法)
The code of a data type is implemented by a method, which is executed by the ExecutionEngine. The CL ...
- Restaurant & Cooking Starter Kit v1.2.1 学习
项目: using UnityEngine; using System.Collections; namespace VoidGame { public class Constant : MonoBe ...
- oracle-srvctl-output
############################## [grid@rac01 ~]$ crsctl query crs administratorCRS Administrator List: ...
- c166 -div
unsigned short a=10; unsigned short b; unsigned short c;unsigned long d; b = (unsigned short)(d/2400 ...
- mysql 主从复制参数slave_net_timeout
slave_net_timeout slave_net_timeout表示slave在slave_net_timeout时间之内没有收到master的任何数据(包括binlog,heartbeat), ...