技术标签: # 持久层MyBatis Mybatis
在SQL中,经常有查询某个create_date大于orderCreateTimeStr,小于orderCreateTimeEndStr的业务。可用下面这种方法,格式化类别可以为:yyyy-MM-dd E HH:mm:ss 或者:yyyy-MM-dd 等等
表达式:
<if test="orderCreateTimeStr != null and orderCreateTimeStr != ''">
AND DATE_FORMAT(a.create_date,'%Y-%m-%d') >= #{orderCreateTimeStr}
</if>
<if test="orderCreateTimeEndStr != null and orderCreateTimeEndStr != ''">
AND DATE_FORMAT(a.create_date,'%Y-%m-%d') <= #{orderCreateTimeEndStr}
</if>
SQL案例:
<select id="findListForJsonList" resultType="MainOrder">
SELECT
<include refid="mainOrderColumns"/> ,(case when a.order_type in ('1','2','0','6') then ru.name
when a.order_type='5' then b.station_waiter_name end ) AS "receiveUser.name"
FROM t_main_order a
left join t_recycler_shipment_order b on a.order_no = b.order_no and b.del_flag = '0'
<include refid="mainOrderJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<!-- <if test="orderNo != null and orderNo != ''">
AND a.order_no like concat('%',#{orderNo},'%')
</if> -->
<if test="orderNos!=null and orderNos!=''">
and a.order_no in
<foreach item="orderNos" index="index" collection="orderNos" open="(" separator="," close=")">
#{orderNos}
</foreach>
</if>
<if test="createUserNames!=null and createUserNames!=''">
and cu.name in
<foreach item="createUserNames" index="index" collection="createUserNames" open="(" separator="," close=")">
#{createUserNames}
</foreach>
</if>
<if test="receiveUserNames!=null and receiveUserNames!=''">
and (case when a.order_type in ('1','2','0','6') then ru.name
when a.order_type='5' then b.station_waiter_name end ) AS "receiveUser.name" in
<foreach item="receiveUserNames" index="index" collection="receiveUserNames" open="(" separator="," close=")">
#{receiveUserNames}
</foreach>
</if>
<if test="orderType != null and orderType != ''">
AND a.order_type = #{orderType}
</if>
<if test="orderStatus != null and orderStatus != ''">
AND a.order_status = #{orderStatus}
</if>
<!-- <if test="orderCreateUser != null and orderCreateUser != ''">
AND a.order_create_user = #{orderCreateUser}
</if> -->
<if test="orderCreateTime != null and orderCreateTime != ''">
AND a.order_create_time = #{orderCreateTime}
</if>
<if test="payMethod != null and payMethod != ''">
AND a.pay_method = #{payMethod}
</if>
<!-- <if test="orderReceiveUser != null and orderReceiveUser != ''">
AND a.order_receive_user = #{orderReceiveUser}
</if> -->
<if test="orderReceiveTime != null and orderReceiveTime != ''">
AND a.order_receive_time = #{orderReceiveTime}
</if>
<if test="orderCannelTime != null and orderCannelTime != ''">
AND a.order_cannel_time = #{orderCannelTime}
</if>
<if test="orderComplaintsTime != null and orderComplaintsTime != ''">
AND a.order_complaints_time = #{orderComplaintsTime}
</if>
<if test="orderFinishTimeStr != null and orderFinishTimeStr != ''">
AND DATE_FORMAT(a.order_finish_time,'%Y-%m-%d') >= #{orderFinishTimeStr}
</if>
<if test="orderFinishTimeEndStr != null and orderFinishTimeEndStr != ''">
AND DATE_FORMAT(a.order_finish_time,'%Y-%m-%d') <= #{orderFinishTimeEndStr}
</if>
<if test="orderCreateTimeStr != null and orderCreateTimeStr != ''">
AND DATE_FORMAT(a.create_date,'%Y-%m-%d') >= #{orderCreateTimeStr}
</if>
<if test="orderCreateTimeEndStr != null and orderCreateTimeEndStr != ''">
AND DATE_FORMAT(a.create_date,'%Y-%m-%d') <= #{orderCreateTimeEndStr}
</if>
<if test="orderReceiveTimeStr != null and orderReceiveTimeStr != ''">
AND DATE_FORMAT(a.order_receive_time,'%Y-%m-%d') >= #{orderReceiveTimeStr}
</if>
<if test="orderReceiveTimeEndStr != null and orderReceiveTimeEndStr != ''">
AND DATE_FORMAT(a.order_receive_time,'%Y-%m-%d') <= #{orderReceiveTimeEndStr}
</if>
<!-- <if test="createUser.name != null and createUser.name != ''">
AND cu.name like concat('%',#{createUser.name},'%')
</if> -->
<!-- <if test="receiveUser.name != null and receiveUser.name != ''">
AND ru.name like concat('%',#{receiveUser.name},'%')
</if> -->
<if test="communityCode != null and communityCode != ''">
AND a.community_code = #{communityCode}
</if>
<!-- <if test="receiveUser.name != null and receiveUser.name != ''">
AND ru.name concat('%',#{receiveUser.name},'%')
</if> -->
<if test="orderTypes!=null and orderTypes!=''">
and a.order_type in
<foreach item="orderTypes" index="index" collection="orderTypes" open="(" separator="," close=")">
#{orderTypes}
</foreach>
</if>
<if test="orderStatuses!=null and orderStatuses!=''" >
and a.order_status in
<foreach item="orderStatuses" index="index" collection="orderStatuses" open="(" separator="," close=")">
#{orderStatuses}
</foreach>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="selectValidChanceByCondition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_activity_lottery_chance
<where>
<if test="activityId != null">
and activity_id = #{activityId,jdbcType=BIGINT}
</if>
<if test="userId != null">
and user_id = #{userId,jdbcType=BIGINT}
</if>
<if test="status != null">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="validStartTime != null">
and <![CDATA[unix_timestamp(valid_start_time) > unix_timestamp(#{validStartTime})]]>
</if>
<if test="validEndTime != null">
and <![CDATA[unix_timestamp(valid_end_time) < unix_timestamp(#{validEndTime})]]>
</if>
and isactive = 1
</where>
</select>
本地实现 Elasticsearch、kibana 管理工具、IK 分词器 的安装部署以及初步使用(以及填坑策略)
创建一个新的 Office 插件项目:在 Visual Studio 中,选择"文件" -> “新建项目”,然后在模板中选择"Office/SharePoint",选择适当的 Office 插件项目模板,如 Word 插件、Excel 插件或 PowerPoint 插件。设计用户界面:在解决方案资源管理器中,打开你的插件项目,并在其中打开相应的 Office 文件(如 Word 文件、Excel 文件或 PowerPoint 文件)。你可以在 Office 应用中测试插件的功能,并在开发过程中进行调试。
在应用场景方面,便携式IV功率测试仪广泛应用于光伏电站的日常运维、光伏组件生产过程中的质量控制以及光伏项目的前期评估等环节。在光伏电站运维中,定期对光伏组件进行IV测试,可以及时发现性能下降或损坏的组件,为电站的运维提供有力支持。首先,从工作原理来看,光伏电站便携式IV功率测试仪通过模拟太阳光照射光伏组件,并测量组件在不同电压下的电流输出,从而绘制出IV曲线。此外,测试仪还可以计算光伏组件的功率输出、转换效率等参数,为用户提供全面的性能评估。
文章浏览阅读3.6k次。os: ubuntu 16.04postgresql: 9.6.8ip 规划192.168.56.102 node2 postgresqlhelp create indexpostgres=# \h create indexCommand: CREATE INDEXDescription: define a new indexSyntax:CREATE [ UNIQUE ..._load_categories_hash postgres
文章浏览阅读4.8k次。使用face++,先获取key和secret下方是人脸识别,还添加了画出人脸轮廓的正方形下方是人脸识别,还添加了画出人脸轮廓的正方形 import requests#网络访问控件 from json import JSONDecoder#互联网数据交换标准格式 import cv2 as cv#图像处理控件 http_url =&amp;amp;quot;https://a..._face++人脸识别 html5
文章浏览阅读322次。很多时候要对秘要进行持久化加密,此时的加密采用md5。采用对称加密的时候就采用DES方法了import java.io.IOException;import java.security.MessageDigest;import java.security.SecureRandom;import javax.crypto.Cipher;import javax.crypto.SecretKey;im..._java desencrypt.encrypt(pass)
文章浏览阅读5.7w次,点赞50次,收藏276次。FRP搭建内网穿透1.概述:frp可以通过有公网IP的的服务器将内网的主机暴露给互联网,从而实现通过外网能直接访问到内网主机;frp有服务端和客户端,服务端需要装在有公网ip的服务器上,客户端装在内网主机上。2.简单的图解:3.准备工作:1.一个域名(www.test.xyz)2.一台有公网IP的服务器(阿里云、腾讯云等都行)3.一台内网主机4.下载frp,选择适合的版本下载解压如下:我这里服务器端和客户端都放在了/usr/local/frp/目录下4.执行命令# 服务器端给执_locyanfrp
文章浏览阅读687次。题目:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93745#problem/A题意:给出r*c的01矩阵,可以翻转格子使得0表成1,1变成0,求出最小的步数使得每一行中1的个数相等,每一列中1的个数相等。思路:网络流。容量可以保证每一行和每一列的1的个数相等,费用可以算出最小步数。行向列建边,如果该格子是_uva12534
文章浏览阅读504次。1、Let's Encrypt 90天,支持泛域名2、Buypass:https://www.buypass.com/ssl/resources/go-ssl-technical-specification6个月,单域名3、AlwaysOnSLL:https://alwaysonssl.com/ 1年,单域名 可参考蜗牛(wn789)4、TrustAsia5、Alpha..._csdn alphassl免费申请
文章浏览阅读1.6k次。测试算法的性能 很多时候我们需要对算法的性能进行测试,最简单的方式是看算法在特定的数据集上的执行时间,简单的测试算法性能的函数实现见testSort()。【思想】:用clock_t计算某排序算法所需的时间,(endTime - startTime)/ CLOCKS_PER_SEC来表示执行了多少秒。【关于宏CLOCKS_PER_SEC】:以下摘自百度百科,“CLOCKS_PE_算法性能测试
文章浏览阅读1.2k次。fromhttps://towardsdatascience.com/finding-lane-lines-simple-pipeline-for-lane-detection-d02b62e7572bIdentifying lanes of the road is very common task that human driver performs. This is important ..._lanedetectionlite
文章浏览阅读4.1k次,点赞8次,收藏23次。通过一定的方法找出与给定关键字相同的数据元素的过程叫做查找。也就是根据给定的某个值,在查找表中确定一个关键字等于给定值的记录或数据元素。_读取表元是什么意思