123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Long.Common.System;
- using Long.Dapper;
- namespace Long.DAO.System
- {
-
-
-
- public class NextValueDatabase : Database<NextValue>, INextValueDatabase
- {
- #region 获取编码
-
-
-
-
-
-
-
-
-
- public async Task<string> GetCodeAsync(string prefix, string tableName, string fieldName, int defaultValue = 1, int length = 5)
- {
- var value = await GetNextValueAsync(tableName, fieldName, defaultValue);
- string result = string.Format("{{0}}{{1:d" + length.ToString() + "}}", prefix, value);
- return result;
- }
- #endregion
- #region 获取日期编码
-
-
-
-
-
-
-
-
-
- public async Task<string> ExcuteGetCodeFromDateAsync(string prefix, string tableName, string fieldName, long defaultValue = 1, int length = 5)
- {
- var value = await GetNextValueAsync(tableName, fieldName, defaultValue);
- string result = string.Format("{{0}}{{1}}{{2:d" + length.ToString() + "}}", prefix, new DateTime().ToString("yyyyMMdd"), value);
- return result;
- }
- #endregion
- }
- }
|