public ResGetGoods GetGoods([FromHeader] ReqGetGoods req)
        {
            ResGetGoods retValue = new ResGetGoods();

            using (var db = DbContext.GetInstance("T_ANNEX"))
            {
                try
                {
                    //如果有信息被设置为置顶并且根据创建时间降序
                    var annexList = db.Queryable <ANNEXBASE>()
                                    .Where(s => s.fileTag.Contains(req.articleType))
                                    .OrderBy(s => s.likeNum, OrderByType.desc)
                                    .ToList();
                    List <goods> goods    = new List <goods>();
                    var          userList = db.Queryable <T_USERS>().ToList();
                    foreach (var item in annexList)
                    {
                        goods good = new goods();
                        ReqToDBGenericClass <ANNEXBASE, goods> .ReqToDBInstance(item, good);

                        var user = userList.Where(s => s.u_code == item.createUserCode).FirstOrDefault();
                        if (user != null)
                        {
                            good.avatar = user.avatar;
                        }
                        goods.Add(good);
                    }


                    //分页 0是第一页
                    var reList = goods.Skip((req.currentPage - 1) * req.pageSize)
                                 .Take(req.pageSize).ToList();

                    retValue.SuccessDefalut(reList, annexList.Count);
                }
                catch (Exception ex)
                {
                    retValue.FailDefalut(ex);
                }
            }
            return(retValue);
        }
Esempio n. 2
0
 public CalcAccountsPayableResult CalcAccountsPayable(ReqGetGoods reqMth)
 {
     return(service.PosService.CalcAccountsPayable(reqMth));
 }