①通过sql语句来获取
select to_char(sysdate, 'yyyy') || '-' || #{type} || '-' ||
lpad(count(*), 6, 0)
from table1 t
where t.type_id = #{type}
and (t.first_audit_time is not null or t.final_audit_time is not null)
本文介绍了一种使用SQL语句生成特定格式序列号的方法。该方法通过组合当前年份、类型标识与计数器实现,适用于需对记录进行唯一编号的场景。文中SQL语句考虑了不同类型ID及审核时间的存在。
①通过sql语句来获取
select to_char(sysdate, 'yyyy') || '-' || #{type} || '-' ||
lpad(count(*), 6, 0)
from table1 t
where t.type_id = #{type}
and (t.first_audit_time is not null or t.final_audit_time is not null)
5867

被折叠的 条评论
为什么被折叠?