public List<ProductStatusHistoryCustom> HistoryQuery(ProductStatusHistoryCustom query) { StringBuilder sql = new StringBuilder(); if (query.create_channel == 2)//當product.create_channel為2時,鏈接vendor表 xiangwang0413w 2014/09/10 { sql.AppendFormat(@"select h.product_id,h.create_time,h.remark,u.vendor_name_full as user_username,s1.parametername as type , s2.parametername as product_status from product_status_history h left join vendor u on h.user_id = u.vendor_id left join (select parametercode,parametername from t_parametersrc where parametertype='verify_operate_type') s1 on s1.parametercode = h.type left join (select parametercode,parametername from t_parametersrc where parametertype='product_status') s2 on s2.parametercode = h.product_status inner join product p on h.product_id = p.product_id where h.product_id = {0} order by h.create_time", query.product_id); } else { sql.Append("select h.product_id,h.create_time,h.remark,u.user_username,s1.parametername as type ,s2.parametername as product_status"); sql.Append(" from product_status_history h"); sql.Append(" left join manage_user u on h.user_id = u.user_id"); sql.Append(" left join (select parametercode,parametername from t_parametersrc where parametertype='verify_operate_type') s1 on s1.parametercode = h.type"); sql.Append(" left join (select parametercode,parametername from t_parametersrc where parametertype='product_status') s2 on s2.parametercode = h.product_status"); sql.Append(" inner join product p on h.product_id = p.product_id "); sql.AppendFormat(" where h.product_id = {0} order by h.create_time", query.product_id); } return _access.getDataTableForObj<ProductStatusHistoryCustom>(sql.ToString()); }
public List<ProductStatusHistoryCustom> HistoryQuery(ProductStatusHistoryCustom query) { try { return _historyDao.HistoryQuery(query); } catch (Exception ex) { throw new Exception("ProductStatusHistoryMgr-->HistoryQuery" + ex.Message, ex); } }