Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
9b1166f7
Commit
9b1166f7
authored
Aug 04, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ymt): 修复电梯代码生成逻辑
- 在查询电梯代码时增加纯数字校验,确保代码格式正确 - 修改电梯代码排序方式,使用数值排序替代字符串排序 - 优化电梯代码生成逻辑,提高效率并避免潜在的错误
parent
80d9fa3d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
CategoryOtherInfoMapper.xml
...api/src/main/resources/mapper/CategoryOtherInfoMapper.xml
+13
-8
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+17
-6
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/CategoryOtherInfoMapper.xml
View file @
9b1166f7
...
@@ -26,21 +26,24 @@
...
@@ -26,21 +26,24 @@
SELECT CODE96333 code
SELECT CODE96333 code
FROM biz_jg_supervisory_code bjsc
FROM biz_jg_supervisory_code bjsc
WHERE CODE96333 LIKE CONCAT(#{elevatorCode}, '%')
WHERE CODE96333 LIKE CONCAT(#{elevatorCode}, '%')
AND CODE96333 ~ '^\d+$' -- 确保是纯数字
<if
test=
"status != null and status != ''"
>
<if
test=
"status != null and status != ''"
>
and status = #{status}
and status = #{status}
</if>
</if>
<if
test=
"status != 2 "
>
ORDER BY C
AST(CODE96333 AS UNSIGNED)
DESC LIMIT 1
</if>
<if
test=
"status != 2 "
>
ORDER BY C
ODE96333::BIGINT
DESC LIMIT 1
</if>
<if
test=
"status == 2 "
>
ORDER BY C
AST(CODE96333 AS UNSIGNED)
ASC LIMIT 1
</if>
<if
test=
"status == 2 "
>
ORDER BY C
ODE96333::BIGINT
ASC LIMIT 1
</if>
</select>
</select>
<select
id=
"selectElevatorCodeMaxValue"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.dto.KV"
>
<select
id=
"selectElevatorCodeMaxValue"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.dto.KV"
>
WITH ElevatorResults AS (
WITH ElevatorResults AS (
SELECT ROW_NUMBER() OVER (PARTITION BY SUBSTRING (CODE96333 FROM 1 FOR 2) ORDER BY CODE96333 DESC) AS row_num,
SELECT ROW_NUMBER() OVER (PARTITION BY SUBSTRING (CODE96333 FROM 1 FOR 2) ORDER BY CODE96333
::BIGINT
DESC) AS row_num,
CODE96333
CODE96333
FROM biz_jg_supervisory_code
FROM biz_jg_supervisory_code
WHERE CREATE_STATUS = 1
WHERE CREATE_STATUS = 1
AND CODE96333 IS NOT NULL
AND CODE96333 IS NOT NULL
AND CODE96333
<![CDATA[<> '']]>
)
AND CODE96333
<![CDATA[<> '']]>
AND CODE96333 ~ '^\d+$' -- 确保是纯数字
)
SELECT '96333_' || SUBSTRING(CODE96333 FROM 1 FOR 2) AS name,
SELECT '96333_' || SUBSTRING(CODE96333 FROM 1 FOR 2) AS name,
CODE96333 AS value
CODE96333 AS value
FROM ElevatorResults WHERE row_num = 1
FROM ElevatorResults WHERE row_num = 1
...
@@ -174,11 +177,13 @@
...
@@ -174,11 +177,13 @@
<select
id=
"selectExceedElevatorCodeList"
resultType=
"java.lang.Integer"
>
<select
id=
"selectExceedElevatorCodeList"
resultType=
"java.lang.Integer"
>
SELECT CODE96333 code
SELECT CODE96333 code
FROM biz_jg_supervisory_code bjsc
FROM biz_jg_supervisory_code bjsc
WHERE code LIKE CONCAT(#{prefix}, '%')
WHERE
code ~ '^\d+$' -- 确保是纯数字
AND code LIKE CONCAT(#{prefix}, '%')
<if
test=
"start != null and start != ''"
>
<if
test=
"start != null and start != ''"
>
AND code
<![CDATA[ >= ]]>
#{start}
AND code
::BIGINT
<![CDATA[ >= ]]>
#{start}::BIGINT -- 数值比较
</if>
</if>
ORDER BY code
ORDER BY code
::BIGINT -- 数值排序
</select>
</select>
<select
id=
"selectCode"
resultType=
"java.lang.Integer"
>
<select
id=
"selectCode"
resultType=
"java.lang.Integer"
>
...
@@ -198,6 +203,6 @@
...
@@ -198,6 +203,6 @@
SELECT CODE96333 code
SELECT CODE96333 code
FROM biz_jg_supervisory_code
FROM biz_jg_supervisory_code
WHERE CODE96333 = #{elevatorCode}
WHERE CODE96333 = #{elevatorCode}
ORDER BY code
ORDER BY code
::BIGINT;
</select>
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
9b1166f7
...
@@ -884,14 +884,25 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -884,14 +884,25 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
stopWatch
.
start
();
stopWatch
.
start
();
Integer
start
=
Integer
.
valueOf
(
prefix
+
EquipmentCategoryEnum
.
getCode
.
get
(
prefix
));
Integer
start
=
Integer
.
valueOf
(
prefix
+
EquipmentCategoryEnum
.
getCode
.
get
(
prefix
));
Integer
end
=
Integer
.
valueOf
(
elevatorOtherInfo
.
getCode
());
Integer
end
=
Integer
.
valueOf
(
elevatorOtherInfo
.
getCode
());
List
<
Integer
>
allCodeList
=
IntStream
.
rangeClosed
(
start
,
end
)
//
List<Integer> allCodeList = IntStream.rangeClosed(start, end)
.
boxed
()
//
.boxed()
.
collect
(
Collectors
.
toList
());
//
.collect(Collectors.toList());
List
<
Integer
>
codeList
=
categoryOtherInfoMapper
.
selectExceedElevatorCodeList
(
start
,
prefix
);
List
<
Integer
>
codeList
=
categoryOtherInfoMapper
.
selectExceedElevatorCodeList
(
start
,
prefix
);
List
<
Integer
>
resultList
=
getDiffrent
(
allCodeList
,
codeList
);
// 使用TreeSet便于快速查找和排序
if
(!
ObjectUtils
.
isEmpty
(
resultList
))
{
TreeSet
<
Integer
>
usedCodes
=
new
TreeSet
<>(
codeList
);
Integer
firstAvailableCode
=
null
;
// 从start开始查找第一个未使用的编码
for
(
int
i
=
start
;
i
<=
end
;
i
++)
{
if
(!
usedCodes
.
contains
(
i
))
{
firstAvailableCode
=
i
;
break
;
}
}
if
(
firstAvailableCode
!=
null
)
{
elevatorCode
.
setLength
(
0
);
elevatorCode
.
setLength
(
0
);
elevatorCode
.
append
(
resultList
.
get
(
0
)
);
elevatorCode
.
append
(
firstAvailableCode
);
}
else
{
}
else
{
//// 获取补零位长度
//// 获取补零位长度
//String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
//String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
...
...
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