using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.hnshituo.core.webapp.vo;

namespace Common
{
    public class MeterBaseMatterInfoService
    {
        public RESTfulResult<List<MeterBaseMatterInfo>> doQueryListLike(MeterBaseMatterInfo info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterBaseMatterInfo>>> rm = db.doOption<PageList<List<MeterBaseMatterInfo>>>("meterbasematterinfos", "/listLike", new object[] { info }, 1);
            
            RESTfulResult<List<MeterBaseMatterInfo>> result = new RESTfulResult<List<MeterBaseMatterInfo>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Data != null && rm.Data.list != null && rm.Data.list.Count > 0)
            {
                result.Data = rm.Data.list;
            }
            return result;
        }

        public RESTfulResult<int> doUpdateType(List<MeterBaseMatterInfo> list)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<int> result = db.doOption<int>("meterbasematterinfos", "/doUpdateBeltType", new object[] { list},1);
            return result;
        }

        /// <summary>
        /// 按主键查询数据
        /// </summary>
        /// <param name="matterNo"></param>
        /// <returns></returns>
        public RESTfulResult<MeterBaseMatterInfo> doQueryId(string matterNo)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<MeterBaseMatterInfo> result = db.doOption<MeterBaseMatterInfo>("meterbasematterinfos", $"/{matterNo}", new object[] { }, 0);
            return result;
        }
    }
}
