代码:
/// <summary>
/// 分类检索 查询selectname
/// </summary>
public static DataTable GetSelectName_FLJS(string thing_type_id, string men_id, string gang_id, string mu_id, string ke_id, string shu_id)
{
StringBuilder sb = new StringBuilder(string.Format(@"
select sn.Sel_chiname as 中文名, sn.Sel_engname as 英文名, sn.Sel_latname as 学名,
sn.Thing_id, sn.Sel_type, sn.Thing_shu_id, sn.Thing_pro_id, sn.Thing_area_id
from (((((selectname sn
left join shu s on sn.thing_shu_id=s.shu_id)
left join ke k on s.ke_id=k.ke_id)
left join mu m on m.mu_id=k.mu_id)
left join gang g on g.gang_id=m.gang_id)
left join men me on me.men_id=g.men_id)
left join thing_type tt on tt.thing_type_id=me.thing_type_id
where 1=1"));
if (!string.IsNullOrWhiteSpace(thing_type_id)
&& int.Parse(thing_type_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and tt.thing_type_id={0}", strUtil.SqlClean(thing_type_id)));
}
if (!string.IsNullOrWhiteSpace(men_id)
&& int.Parse(men_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and me.men_id={0}", strUtil.SqlClean(men_id)));
}
if (!string.IsNullOrWhiteSpace(gang_id)
&& int.Parse(gang_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and g.gang_id={0}", strUtil.SqlClean(gang_id)));
}
if (!string.IsNullOrWhiteSpace(mu_id)
&& int.Parse(mu_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and m.mu_id={0}", strUtil.SqlClean(mu_id)));
}
if (!string.IsNullOrWhiteSpace(ke_id)
&& int.Parse(ke_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and k.ke_id={0}", strUtil.SqlClean(ke_id)));
}
if (!string.IsNullOrWhiteSpace(shu_id)
&& int.Parse(shu_id) != Common.OptionAllVal)
{
sb.Append(string.Format(@"
and s.shu_id={0}", strUtil.SqlClean(shu_id)));
}
sb.Append(" order by sn.Sel_chiname");
return AccessHelper.DataTable(sb.ToString());
}
View Code