NPE_ 2021-09-09 18:08 采纳率: 77.4%
浏览 43
已结题

代码里有很多if怎么办

img


这种结构的代码如何处理


 if(id != null){
            whereSQL.append("id = "+id).append(" and ");
        }else  if(mobile != null){
            whereSQL.append("mobile = "+mobile).append(" and ");
        }else  if(agentsName != null){
            whereSQL.append("agentsName = "+agentsName).append(" and ");
        }else  if(id != null){
            whereSQL.append("userId = "+userId).append(" and ");
        }else  if(id != null){
            whereSQL.append("invitationCode = "+invitationCode).append(" and ");
        }else  if(id != null){
            whereSQL.append("agentType = "+agentType).append(" and ");
        }else  if(id != null){
            whereSQL.append("del = "+del).append(" and ");
        }else  if(id != null){
            whereSQL.append("areaIds = "+areaIds).append(" and ");
        }

  • 写回答

4条回答 默认 最新

  • class_cat 2021-09-09 18:11
    关注

    你是不是写错了 一堆id != null

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月17日
  • 已采纳回答 9月9日
  • 创建了问题 9月9日

悬赏问题

  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM