Exemplo n.º 1
0
        public async Task <DocumentPageView> GetPageList(DocumentParm parm)
        {
            return(await WithConnection(async c =>
            {
                StringBuilder sql = new StringBuilder();
                sql.Append($@"  SELECT 
                id,
                doc_name,
                doc_version,
                doc_num,
                doc_type,
                doc_type2,
                eqp_type_id,
                active_time,
                dead_time,
                created_time,
                created_by,
                updated_time,
                updated_by,is_del FROM document
                 ");
                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 <Document>(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 <Document>(sql.ToString());

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

            try
            {
                ret = await _service.GetPageList(parm);
            }
            catch (System.Exception ex)
            {
                ret.msg = string.Format(
                    "获取分页数据Document失败, 异常信息:{0}",
                    ex.Message);
            }
            return(ret);
        }
Exemplo n.º 3
0
        public async Task <ApiResult> GetPageList(DocumentParm 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);
        }