mysql mybatis 日期区间查询

<select id="selectUsers" resultType="map">
        select
        <include refid="Base_Column_List"/>
        from sys_user
        where status != 'DELETED'
        <if test="name != null and name != ''">
            and (phone like CONCAT('%',#{name},'%')
            or account like CONCAT('%',#{name},'%')
            or name like CONCAT('%',#{name},'%'))
        </if>
        <if test="deptId != null and deptId != 0">
            and (dept_id = #{deptId} or dept_id in ( select dept_id from sys_dept where pids like CONCAT('%$[', #{deptId}, '$]%') escape '$' ))
        </if>
        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
            and (create_time between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
    </select>

猜你喜欢

转载自blog.csdn.net/weixin_40816738/article/details/124935700