Esempio n. 1
0
 public IEnumerable <zxjc_djgw> Search(CheckPointQueryParm parm, out int resultcount)
 {
     try
     {
         OracleDynamicParameters p   = new OracleDynamicParameters();
         StringBuilder           sql = new StringBuilder();
         sql.Append("select ta.gcdm, ta.scx, ta.gwh,(select work_name from zxjc_gxzd where work_no = ta.gwh) as gwmc,ta.jx_no, ta.status_no, ta.djno, ta.djxx, ta.scbz, ta.lrr, ta.lrsj, ta.djlx ");
         sql.Append(" from zxjc_djgw ta where 1 = 1 ");
         if (!string.IsNullOrEmpty(parm.keyword))
         {
             sql.Append(" and (ta.gwh like :key or lower(ta.jx_no) like :key or lower(ta.djxx) like :key )");
             p.Add(":key", "%" + parm.keyword + "%", OracleMappingType.Varchar2, System.Data.ParameterDirection.Input);
         }
         if (parm.explist.Count > 0)
         {
             sql.Append(" and ");
             sql.Append(Util.Tool.ComQueryExp(parm.explist));
         }
         using (var conn = new OraDBHelper(constr).Conn)
         {
             var q = conn.Query <zxjc_djgw>(sql.ToString(), p)
                     .OrderByDescending(t => t.djno)
                     .ToPagedList(parm.pageindex, parm.pagesize);
             resultcount = q.TotalItemCount;
             return(q);
         }
     }
     catch (Exception e)
     {
         log.Error(e.Message);
         throw;
     }
 }
 public IHttpActionResult List(CheckPointQueryParm parm)
 {
     try
     {
         int resultcount       = 0;
         PointCheckService pcs = new PointCheckService();
         var list = pcs.Search(parm, out resultcount);
         return(Json(new sys_response_list <zxjc_djgw> {
             code = 1, msg = "ok", list = list, resultcount = resultcount
         }));
     }
     catch (Exception)
     {
         throw;
     }
 }