yangys
2024-03-27 44028c2d1a7f21da831cb07ecb1b4a7873d8627b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.qianwen.smartman.modules.system.handler.field.provider;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.DbType;
import org.springframework.stereotype.Component;
 
@Component
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/handler/field/provider/OracleSqlParseProvider.class */
public class OracleSqlParseProvider extends AbstractSqlParseProvider {
    @Override // org.springblade.modules.system.handler.field.provider.AbstractSqlParseProvider
    public Boolean support(DbType dbType) {
        return Boolean.valueOf(DbType.ORACLE.equals(dbType));
    }
 
    @Override // org.springblade.modules.system.handler.field.provider.AbstractSqlParseProvider
    protected String equalsTemplate() {
        return "JSON_VALUE({}, '$.{}') = {} ";
    }
 
    @Override // org.springblade.modules.system.handler.field.provider.AbstractSqlParseProvider
    protected String likeTemplate() {
        return "JSON_VALUE({}, '$.{}') LIKE '%{}%' ";
    }
 
    @Override // org.springblade.modules.system.handler.field.provider.AbstractSqlParseProvider
    protected String dateTemplate() {
        return unixTimestamp("JSON_VALUE({}, '$.{}')") + " BETWEEN " + unixTimestamp("{}") + "AND " + unixTimestamp("{}");
    }
 
    private String unixTimestamp(String value) {
        return StrUtil.format("(to_date({},'yyyy-mm-dd hh24:mi:ss')-to_date('1970-01-01 08:00:00', 'yyyy-mm-dd hh24:mi:ss')) * 86400000", new Object[]{value});
    }
}