惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
N
Netflix TechBlog - Medium
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
Threat Research - Cisco Blogs
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Hacker News
The Hacker News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
T
Tenable Blog
S
Secure Thoughts
T
Threatpost
V2EX - 技术
V2EX - 技术
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Y
Y Combinator Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
H
Heimdal Security Blog
量子位
B
Blog

博客园 - 007少侠

使用Recaf编辑汇编代码直接修改java的编译代码class Centos Linux 更换源,原官方源已经不再提供服务 如何在Docker容器中的Linux系统(Ubuntu + Centos Linux)里面使用systemctl Centos Linux 7 搭建邮件服务器(postfix + dovecot) Ubuntu Linux 搭建邮件服务器(postfix + dovecot) 【WSL2】在Windows通过自定义域名访问wsl2中的服务 Python pip pip3 源设置成国内源,阿里云源,清华大学源 利用云服务器实现内网穿透(frp),开启个人电脑(windows)可远程桌面访问 使用docker安装centos7并挂载主机目录 Rust交叉编译Mac编译Linux/Windows平台 Linux下安装dart sdk并配置环境变量 Linux下安装JDK-openj9并配置环境变量 centos7 安装 bbr加速 linux环境常用命令和java/jvm常用命令 mybatis plus + druid多数据源(使用dynamic实现) docker将容器打包成镜像并传输至其他服务器部署(可用于容器重新run) .gitignore == git添加忽略不生效解决方案 jenkins自动构建项目源码git pull时出现冲突的终极解决方案(git远程覆盖本地分支) spring boot 使用aop实现拦截器
mysql查询,根据时间查询:几天前、几天内的数据
007少侠 · 2020-04-02 · via 博客园 - 007少侠

示例中 mysql字段类型为 datetime

使用到mysql函数 DATE_SUB() 和 now()

示例1:

    <!--
    更新5天前的订单 审核中-6 改成 审核失败-81
    create_time <= DATE_SUB(now(), INTERVAL 5 DAY) 5天前,精确到秒
    -->
    <update id="updateStatsByTime"  parameterType="java.lang.Integer" >
      UPDATE user_partya_order  SET stat = 81
        WHERE
            id IN(select id from  (
                SELECT
                    id
                FROM
                    user_partya_order
                WHERE
                    loan_id = #{id}
                AND create_time &lt;= DATE_SUB(now(), INTERVAL 5 DAY)
                and  stat = 6
            ) AS a )
    </update>

示例2:

    <!--
    查询用户5天内的订单
    create_time > DATE_SUB(now(), INTERVAL 5 DAY) 5天内,精确到秒
    -->
   <select id="findRemoveOrder" parameterType="java.util.Map"  resultMap="mapUserPartyaOrderDTO">
         SELECT id,create_time,order_no,loan_id, stat,user_id,borrower_id,loan_app_id,bank_no,is_repeat_loan
                FROM user_partya_order
                WHERE 1=1 AND stat='6'
                AND create_time &gt; DATE_SUB(now(), INTERVAL 5 DAY)
                AND loan_id =#{loanId}
                AND user_id=#{userId} ORDER BY create_time DESC  LIMIT 1
   </select>

核心标红!