复制代码

为懒人提供无限可能,生命不息,code不止

人类感性的情绪,让我们知难行难
我思故我在
日拱一卒,功不唐捐
  • 首页
  • 前端
  • 后台
  • 数据库
  • 运维
  • 资源下载
  • 实用工具
  • 接口文档工具
  • 登录
  • 注册

其它

【原创】时间段与数据库已有时间段进行匹配获得交集

作者: whooyun发表于: 2023-06-08 11:02

  <select id="listMmbPointExchSchema" resultType="com.zbw.saas.middle.member.member.vo.MmbPointExchSchemaVO">
        select * from mmb_point_exch_schema
        where corp_id = #{vo.corpId} and is_deleted = 1
        <choose>
            <when test="vo.name!=null and vo.name!=''">
                and (name like CONCAT('%',#{vo.name},'%') or schema_no like CONCAT('%',#{vo.schemaNo},'%'))
            </when>
            <otherwise>
                <if test=" vo.startCreateTime!=null">
                    and (create_dtm between #{vo.startCreateTime} AND #{vo.endCreateTime} )
                </if>
                <if test="vo.statusDic!=null">
                    and status_dic = #{vo.statusDic}
                </if>
                <if test="vo.creatorId!=null">
                    and creator_id = #{vo.creatorId}
                </if>
                <if test="vo.id!=null">
                    and id = #{vo.id}
                </if>
                <if test="vo.startDtm!=null">
                    and (start_dtm <![CDATA[ <= ]]> #{vo.endDtm} and end_dtm <![CDATA[ >= ]]> #{vo.startDtm})
                </if>

            </otherwise>
        </choose>

    </select>