feat: 生成编号和删除限制等

This commit is contained in:
caiyuchao
2025-09-25 20:12:03 +08:00
parent 7faa891554
commit 7dc8906da7
6 changed files with 36 additions and 4 deletions

View File

@@ -3,7 +3,14 @@
<mapper namespace="org.agt.module.license.dal.mysql.project.ProjectMapper">
<select id="selectMaxCode" resultType="Integer">
SELECT max(`code` + 0) from crm_project;
SELECT
MIN( t1.num + 1 ) AS next_num
FROM
( SELECT CAST( `code` AS UNSIGNED ) AS num FROM crm_project ) t1
LEFT JOIN ( SELECT CAST( `code` AS UNSIGNED ) AS num FROM crm_project ) t2 ON t2.num = t1.num + 1
WHERE
t2.num IS NULL
AND t1.num >= 2000
</select>
<select id="selectOldMaxCode" resultType="Integer">