Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yichengstreet-be
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yichengstreet
yichengstreet-be
Commits
9e37f45c
Commit
9e37f45c
authored
Apr 27, 2025
by
luben
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-lb' into 'dev'
fix See merge request
!204
parents
305d24c8
8801a5fd
Pipeline
#144365
failed with stages
in 6 minutes and 22 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
5 deletions
+45
-5
RegionController.java
.../java/com/ruoyi/web/controller/grid/RegionController.java
+14
-5
GridRegionMapper.java
...n/java/com/ruoyi/system/mapper/grid/GridRegionMapper.java
+8
-0
GridRegionMapper.xml
...ystem/src/main/resources/mapper/grid/GridRegionMapper.xml
+23
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/grid/RegionController.java
View file @
9e37f45c
...
...
@@ -876,6 +876,9 @@ public class RegionController extends BaseController {
if
(
count
>
0
){
throw
new
RuntimeException
(
"当前菜单存在下级菜单,无法删除"
);
}
if
(
gridRegionMapper
.
countByFourthCode
(
wgCode
)>
0
){
throw
new
RuntimeException
(
"当前菜单存在房源,无法删除"
);
}
GridRegionExample
example
=
new
GridRegionExample
();
GridRegionExample
.
Criteria
criteria
=
example
.
createCriteria
();
...
...
@@ -990,10 +993,16 @@ public class RegionController extends BaseController {
return
AjaxResult
.
success
();
}
// @RequestMapping(value = "/exchangePosition", method = RequestMethod.GET)
// @ResponseBody
// public AjaxResult exchangePosition(@RequestParam("first") String first,@RequestParam("second") String second) {
// return AjaxResult.success(gridRegionMapper.getFourRegionList(wgCode));
// }
@RequestMapping
(
value
=
"/exchangePosition"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
void
exchangePosition
()
{
// 用来更新position的接口,重置所有排序
List
<
String
>
wgCode
=
gridRegionMapper
.
getAllWgCode
();
// List<String> wgCode = Arrays.asList("320282001001DL005");
for
(
String
code
:
wgCode
){
gridRegionMapper
.
initPositionVariable
();
gridRegionMapper
.
updatePositionByWgCodes
(
code
);
}
}
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/grid/GridRegionMapper.java
View file @
9e37f45c
...
...
@@ -84,4 +84,12 @@ public interface GridRegionMapper {
int
position
(
@Param
(
"id"
)
String
id
,
@Param
(
"position"
)
int
position
);
void
exchangePosition
(
@Param
(
"first"
)
String
first
,
@Param
(
"second"
)
String
second
);
List
<
String
>
getAllWgCode
();
void
initPositionVariable
();
int
updatePositionByWgCodes
(
@Param
(
"wgCode"
)
String
wgCode
);
int
countByFourthCode
(
String
code
);
}
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/grid/GridRegionMapper.xml
View file @
9e37f45c
...
...
@@ -760,5 +760,28 @@
SET position = #{position} where id = #{id}
</update>
<select
id=
"getAllWgCode"
resultType=
"String"
>
select wg_code from grid_region
where is_valid = '1' and level = 3
</select>
<!-- 初始化变量 -->
<update
id=
"initPositionVariable"
>
SET @pos := 0;
</update>
<!-- 更新表中符合条件的数据,将 position 字段从 1 开始递增赋值 -->
<update
id=
"updatePositionByWgCodes"
parameterType=
"String"
>
UPDATE grid_region
SET position = (@pos := @pos + 1)
WHERE wg_parent_id = #{wgCode}
order by wg_code asc
</update>
<select
id=
"countByFourthCode"
resultType=
"Integer"
>
select count(*) from house_resource
where four = #{code}
</select>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment