0
点赞
收藏
分享

微信扫一扫

201124:用postman测Searchable-Searchable拼接sql-数据库业务常用字段-nginx启动及配置-Long与Integer转换

E_topia 2021-09-28 阅读 9
每日复盘

一. Searchable传参数

用postman测试一key-value的形式

page: 0
size: 8
searchCondition: [{"name":"fixedTime","op":"=","value":""}]

二. Searchable拼接sql

当使用sql去查询并且用Searchable分页时,如果要用searchable拼接查询条件,属性名为数据库对应的字段名不是实体类的属性名

例:消息列表中时间参数为前端传来的固定值,后台createTime<=这个时间

Condition createTime = searchable.getSearchFilter("createTime", SearchOperator.eq);
if(!StringUtils.isEmpty(createTime)){
    searchable.removeSearchFilter("createTime",SearchOperator.eq);
    try {
        searchable.addSearchFilter("CREATE_TIME", SearchOperator.le,DateUtils.getDate(createTime.getValue().toString(), DateConst.DB_STORE_TIME.getLabel()));
    } catch (ParseException e) {
        e.printStackTrace();
    }
}

三. 数据库业务常用字段

CREATE_USER CREATE_TIME CREATE_DEPT DELETED DELETE_TIME UPDATE_TIME UPDATE_USER UPDATE_DEPT DELETE_USER DELETE_DEPT

数据类型都为varchar2, CREATE_TIME 可以为null

1. 实体类继承CurdEntity<String>

不用写常用的那几个属性了

2. 实体类上加注解@EntityListeners({JpaAuditingEntityListener.class})

当有登陆时,进行增删改查时,把相应的业务值填入,不用手动赋值,删除为逻辑删除

四. nginx启动及配置

start nginx         -启动命令
nginx -s stop       -停止
nginx -s reload     -重新加载配置文件

1. nginx.conf配置

server {
    listen       8077;
    server_name  20.20.32.132;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
    root   html/dist;
}
location /bmxft {
    proxy_pass http://20.20.32.132:8088/bmxft;
}

}

与后端的dids配置对应

......
duceap.security.dids2.SSOServiceUrl=http://20.20.32.132:8077/bmxft/login
server.port=8088
.....

五. Long与Integer转换

1. 将long型转化为int型,这里的long型是基础类型:

long   a = 10;     
int b = (int)a;  

2. 将Long型转换为int型,这里的Long型是包装类型:

Long a = 10;
int b=a.intValue();

3. 将int型转化为long型,这里的int型是基础类型:

int a = 10;
long b = (int)a;

4. 将Integer型转化为long型,这里的Integer型是包装类型:

int a = 10;
Long b = a.longValue();
举报

相关推荐

0 条评论