首页 > 其他分享 >前端项目实战79-postgrest的增删改查简单文档

前端项目实战79-postgrest的增删改查简单文档

时间:2022-12-12 22:34:02浏览次数:59  
标签:127.0 http 0.1 改查 wms 3000 postgrest id 79

Postgrest使用手册


1 过滤出 is_delete = 0 的数据 分页查询并按照 id 倒叙排列


2 GET http: // 127.0.0.1 : 3000 / t_wms_location?is_delete = eq .0 & limit = 10 & offset = 2


3 & order = id.desc


仓库管理


postgrest返回总页数:


1 过滤出 is_delete = 0 的数据 分页查询并按照 id 倒叙排列


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?is_delete = eq .0 & limit = 10 & offset = 2


3 & order = id.desc


1 分页查询 ( 需要计算 offset )


2 第一页:


3 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name & limit = 1


0 & offset = 0 & order = id.asc


4


5 第二页:


6 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name & limit = 1


0 & offset = 10 & order = id.asc


7


8 第三页:


9 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name & limit = 1


0 & offset = 20 & order = id.asc


10


11 模糊查询分页:


12 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name &% 22 code


% 22 = like. * code *& limit = 3 & offset = 3 & order = id.asc 1 时间范围分页查询 ( 大于 2022-09-01 小于 2022-09-10 )


2 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name & registe


r_date = te .2022-09-01 & register_date = lt .2022-09-10 & limit = 3 & offset = 0 & order = i


d.asc


3


4 时间范围分页查询 ( 大于等于 2022-09-01 小于等于 2022-09-10 )


5 http: // 127.0.0.1 : 3000 / t_base_measure_unit? select = id,code,name & registe


r_date = gte .2022-09-01 & register_date = lte .2022-09-10 & limit = 3 & offset = 0 & order =


id.asc


1 查询指定字段,分页多条件查询


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? select = id,code,name & is_delete = eq


.0 & limit = 10 & offset = 2 & order = id.desc


1 精准查询


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?code = eq. 半成品仓库


3 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?code = eq. 半成品仓库 & is_delete = eq .0


1 查询 id < 2 并且 is_delete = 0 的数据


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = lt .2 & is_delete = eq .0


1 查询 id > 2 并且 is_delete = 0 的数据


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = gt .2 & is_delete = eq .0


1 查询 id >= 2 并且 is_delete = 0 的数据


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = gte .2 & is_delete = eq .0


1 查询 id <= 2 并且 is_delete = 0 的数据


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = lte .2 & is_delete = eq .0


1 查询 id != 2 并且 is_delete = 0 的数据


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = not.eq .2 & is_delete = eq .0


3


4 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = neq .2 & is_delete = eq .0


1 in 查询


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = in.( 1 , 2 , 3 )


1 模糊查询 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?code = in.( % 22 测试 % 22 ) & is_delete = e


q .1


2


3


GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? % 22 code % 22 = like. * 测试 *& is_delete


= eq .1


4


1 and 运算


GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? select = id,code,name,is_delete & an


d = (id.lt .10 ,id.gt .8 ) & is_delete = eq .0


2


1 or 运算 ( 有问题 )


GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? select = id,code,name,is_delete & or


= (id.lt .10 ,id.gt .8 ) & is_delete = eq .0


2


1 转化字段数据类型


GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? select = id,code,name,is_delete::t


ext &% 22 code % 22 = like. * 测试 *& is_delete = eq .1


2


1 重命名列


GET http: // 127.0.0.1 : 3000 / t_wms_warehouse? select = wms_id:id,wms_code:code,w


ms_name:name & is_delete = eq .0 & limit = 10 & offset = 1 & order = id.desc


2


3


4 返回数据:


5 [


{


6


"wms_id": 1 ,


7


"wms_code": " 原材料仓库 ",


8


"wms_name": " 原材料仓库 "


9


}


10


11 ]


1 新增数据


2 POST http: // 127.0.0.1 : 3000 / t_wms_warehouse


3 {


4 "code" : " 原材料仓库 ",


5 "name" : " 原材料仓库 ",


6 "address" : " 原材料仓库 ",


7 "type" : " 原材料仓库 ",


8 "is_delete" : 0 ,


9 "register_date" : '2022-09-22 18:14:00'


10 }


1 根据 ID 删除数据


2 DELETE http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = eq .3 1 根据 ID 逻辑删除数据


2 PATCH http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = eq .4


3 {


4 "is_delete" : 1


5 }


1 根据 ID 获取详情


2 GET http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = eq .4


1 根据 ID 修改数据 ( 修改什么数据就在 json 对象放什么数据 )


2 PATCH http: // 127.0.0.1 : 3000 / t_wms_warehouse?id = eq .4


3 {


4 "code" : " 成品仓库 ",


5 "name" : " 成品仓库 ",


6 "address" : " 成品仓库 ",


7 "type" : " 成品仓库 ",


8 "is_delete" : 0 ,


9 "update_date" : '2022-09-22 18:25:00'


10 }



标签:127.0,http,0.1,改查,wms,3000,postgrest,id,79
From: https://blog.51cto.com/u_14476028/5932066

相关文章