zoukankan      html  css  js  c++  java
  • 多条件查询判断

    /// <summary>
    /// 查询条件
    /// </summary>
    /// <param name="name"></param>
    /// <param name="xiaoqu"></param>
    /// <param name="donghao"></param>
    /// <param name="huxing"></param>
    /// <param name="zhuangtai"></param>
    /// <returns></returns>
    public ActionResult Select(string name = "", string xiaoqu = "", string donghao = "", string huxing = "", string zhuangtai = "")
    {
    XiaoQu();
    DongHao();
    HuXing();
    ZhuangTai();
    string where = "";
    if (!string.IsNullOrWhiteSpace(name))
    {
    where += "a.ZuoLuo like '%" + name + "%'";
    }

    if (!string.IsNullOrEmpty(xiaoqu))
    {
    where += "and a.XiaoQuID = " + xiaoqu + "";
    }

    if (!string.IsNullOrWhiteSpace(donghao))
    {
    where += "and a.DongHao = " + donghao + "";
    }

    if (!string.IsNullOrWhiteSpace(huxing))
    {
    where += "and a.HuXingID = " + huxing + "";
    }

    if (!string.IsNullOrWhiteSpace(zhuangtai))
    {
    where += "and a.ZhuangTaiID = " + zhuangtai + "";
    }
    Where = where;
    List<UserInfoModel> list = ShowPage();
    return View("Index", list);

    }

  • 相关阅读:
    与客服聊天功能测试点
    京东优惠券如何测试
    Linux笔试题
    线程与线程池原理
    PyCharm 介绍、安装、入门使用
    银行APP测试用户体验性方面
    python的闭包
    列表解析2
    深入函数
    再谈装饰器@@@
  • 原文地址:https://www.cnblogs.com/MenBe/p/9521714.html
Copyright © 2011-2022 走看看