字典项 添加上移下移功能,修复样式

This commit is contained in:
吕金泽
2022-04-05 23:07:50 +08:00
parent f85efa67d0
commit 25fada4674
12 changed files with 150 additions and 59 deletions
@@ -0,0 +1,46 @@
{
"properties" : { },
"id" : "08f29d784ed94b318ea2209997b6d426",
"script" : null,
"groupId" : "376f26eb43a44a3daeafd27020a96f48",
"name" : "上移",
"createTime" : null,
"updateTime" : 1649170147768,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/sort/up",
"method" : "GET",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
var top = db.selectOne("""
SELECT
id,
sort
FROM
sys_dict_items
WHERE
is_del = 0
and dict_id = #{dictId}
AND sort < ( SELECT sort FROM sys_dict_items WHERE is_del = 0 AND id = #{id} )
ORDER BY
sort DESC
LIMIT 1
""")
if(top){
db.update("""
update sys_dict_items set sort = #{top.sort} where id = #{id}
""")
db.update("""
update sys_dict_items set sort = #{sort} where id = #{top.id}
""")
}
@@ -0,0 +1,46 @@
{
"properties" : { },
"id" : "3cc33992bf1b4ad38223da5ae302ce79",
"script" : null,
"groupId" : "376f26eb43a44a3daeafd27020a96f48",
"name" : "下移",
"createTime" : null,
"updateTime" : 1649170144718,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/sort/down",
"method" : "GET",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
var top = db.selectOne("""
SELECT
id,
sort
FROM
sys_dict_items
WHERE
is_del = 0
and dict_id = #{dictId}
AND sort > ( SELECT sort FROM sys_dict_items WHERE is_del = 0 AND id = #{id} )
ORDER BY
sort
LIMIT 1
""")
if(top){
db.update("""
update sys_dict_items set sort = #{top.sort} where id = #{id}
""")
db.update("""
update sys_dict_items set sort = #{sort} where id = #{top.id}
""")
}
@@ -5,7 +5,7 @@
"groupId" : "376f26eb43a44a3daeafd27020a96f48",
"name" : "列表",
"createTime" : null,
"updateTime" : 1646552463663,
"updateTime" : 1649169185265,
"lock" : "0",
"createBy" : null,
"updateBy" : null,
@@ -232,5 +232,5 @@ return db.page("""
?{label, and label like concat('%',#{label},'%')}
?{dictId, and dict_id = #{dictId}}
?{value, and value like concat('%',#{value},'%')}
order by create_date desc
order by sort
""")