Ejemplo n.º 1
0
        public async Task <UserCredPageView> GetPageList(UserCredParm parm)
        {
            return(await WithConnection(async c =>
            {
                StringBuilder sql = new StringBuilder();
                sql.Append($@"  SELECT 
                id,
                user_id,
                endowment,
                endowment_type,
                endowment_level,
                active_time,
                dead_time,
                created_time,
                created_by,
                updated_time,
                updated_by,
                is_del,is_super FROM user_cred
                 ");
                StringBuilder whereSql = new StringBuilder();
                //whereSql.Append(" WHERE ai.ProcessInstanceID = '" + parm.ProcessInstanceID + "'");

                //if (parm.AppName != null)
                //{
                //    whereSql.Append(" and ai.AppName like '%" + parm.AppName.Trim() + "%'");
                //}

                sql.Append(whereSql);
                //验证是否有参与到流程中
                //string sqlcheck = sql.ToString();
                //sqlcheck += ("AND ai.CreatedByUserID = '" + parm.UserID + "'");
                //var checkdata = await c.QueryFirstOrDefaultAsync<TaskViewModel>(sqlcheck);
                //if (checkdata == null)
                //{
                //    return null;
                //}

                var data = await c.QueryAsync <UserCred>(sql.ToString());
                var total = data.ToList().Count;
                sql.Append(" order by " + parm.sort + " " + parm.order)
                .Append(" limit " + (parm.page - 1) * parm.rows + "," + parm.rows);
                var ets = await c.QueryAsync <UserCred>(sql.ToString());

                UserCredPageView ret = new UserCredPageView();
                ret.rows = ets.ToList();
                ret.total = total;
                return ret;
            }));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <ApiResult> > GetPageList([FromQuery] UserCredParm parm)
        {
            ApiResult ret = new ApiResult {
                code = Code.Failure
            };

            try
            {
                ret = await _service.GetPageList(parm);
            }
            catch (System.Exception ex)
            {
                ret.msg = string.Format(
                    "获取分页数据UserCred失败, 异常信息:{0}",
                    ex.Message);
            }
            return(ret);
        }
Ejemplo n.º 3
0
        public async Task <ApiResult> GetPageList(UserCredParm parm)
        {
            ApiResult ret = new ApiResult();

            try
            {
                //parm.UserID = _userID;
                //parm.UserID = 40;
                var data = await _repo.GetPageList(parm);

                ret.code = Code.Success;
                ret.data = data;
            }
            catch (Exception ex)
            {
                ret.code = Code.Failure;
                ret.msg  = ex.Message;
            }

            return(ret);
        }