示例#1
0
        /// <summary>
        /// 获取单条
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static async Task <int> GetNextID <T>() where T : new()
        {
            string tableName = new ModelHelper <T> ().GetTableName();
            var    single    = await dbHelper.SingleByKey(tableName);

            if (single == null)
            {
                single               = new SysSequenceEntity();
                single.seq_name      = tableName;
                single.current_val   = 1;
                single.increment_val = 1;
                await dbHelper.Save(new DtoSave <SysSequenceEntity> {
                    data            = single,
                    ignoreFieldList = new List <string>()
                });
            }
            else
            {
                single.current_val += single.increment_val;
                await dbHelper.Update(new DtoSave <SysSequenceEntity>
                {
                    data             = single,
                    saveFieldListExp = x => new object[] { x.current_val },
                });
            }
            return(single.current_val);
        }
示例#2
0
        /// <summary>
        /// 获取单条
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public async Task <SysRoleEntity> SingleByKey(int key)
        {
            var ent = await dbHelper.SingleByKey(key);

            DapperHelper <FaRoleModuleEntityView> roleModule = new DapperHelper <FaRoleModuleEntityView>();

            ent.moduleIdStr = (await roleModule.FindAll(i => i.roleId == key)).Select(i => i.id).ToArray();
            return(ent);
        }
示例#3
0
        /// <summary>
        /// 获取单条
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public async Task <SysUserEntity> SingleByKey(int key)
        {
            var ent = await dbHelper.SingleByKey(key);

            ent.roleIdList = (await new DapperHelper <FaUserRoleEntityView>().FindAll(i => i.userId == key)).Select(x => x.roleId).ToList();
            DapperHelper <FaUserRoleEntityView> dapperUserRole = new DapperHelper <FaUserRoleEntityView>();
            var role = await dapperUserRole.FindAll(i => i.userId == ent.id);

            ent.isAdmin  = role.Count(i => i.roleId == 1) > 0;
            ent.isLeader = role.Count(i => i.roleId == 2) > 0;
            return(ent);
        }
 /// <summary>
 /// 获取单条
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public Task <SysLoginHistoryEntity> SingleByKey(int key)
 {
     return(dbHelper.SingleByKey(key));
 }
示例#5
0
 /// <summary>
 /// 获取单条
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public Task <SysModuleEntity> SingleByKey(int key)
 {
     return(dbHelper.SingleByKey(key));
 }
        /// <summary>
        /// 获取单条
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public Task <SysLoginEntity> SingleByKey(int key)
        {
            DapperHelper <SysLoginEntity> dbHelper = new DapperHelper <SysLoginEntity>();

            return(dbHelper.SingleByKey(key));
        }