public static IList <GoodsCheckEntity> Get(string hospitalId) { var sql = string.Format("select {0} from goods_check where hospital_id = @p_hospital_id and status = @p_status order by created_time desc", COLUMNS); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_hospital_id", DbType.String, hospitalId); db.AddInParameter(dc, "p_status", DbType.String, GoodsCheckStatus.ACTIVE); var list = new List <GoodsCheckEntity>(); using (var reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new GoodsCheckEntity(); entity.Init(reader); list.Add(entity); } } return(list); }
public static IList <GoodsCheckEntity> GetByHospitals(IList <string> hospitalIds) { var sql = string.Format("select {0} from goods_check where hospital_id in ('{1}') and status = @p_status order by hospital_id, name", COLUMNS, string.Join("','", hospitalIds)); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_status", DbType.String, GoodsCheckStatus.ACTIVE); var list = new List <GoodsCheckEntity>(); using (var reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new GoodsCheckEntity(); entity.Init(reader); list.Add(entity); } } return(list); }