where的使用

public Record getAutoAssignOffline(String processName, String bizUuid, String activityName) throws ActiveRecordException {
        //查询是否是首次
        String  statusSql="SELECT receive_no FROM biz_factoring_reception WHERE uuid = ?";
        //获取是否是首次的状态
        String  receiveNo=Db.findFirst(statusSql,bizUuid).getStr("receiveNo");
         String   where="";
        if ("1".equals(receiveNo)) {
            where +=" and  c.first_reception_flag =1" ;
            
        }else if ( !"1".equals(receiveNo)  ) {
            where +=" and  c.first_reception_flag = 0 " ;
        }
        // 查询自动分配状态的SQL
        String sql = String.format(
                " SELECT " +
                "    c.task_name , " +
                "    c.auto_assign , " +
                "    c.uuid " +
                " FROM " +
                "    biz_pay_comfirm_info a, " +
                "    biz_document_task_info c ," +
                "   biz_factoring_reception b  "+
                " WHERE " +
                "    a.core_enterprise_id = c.core_enterprise_id " +
                " and a.financial_institutions_id = c.financial_institutions_id " +
                " and a.signing_body_id = c.signing_body_id " +
                " and b.biz_id =a.uuid  " + 
                " and b.uuid = ? " +
                " and c.process_name = ? " +
                " and a.sys_status =1    " +
                " and b.sys_status =1    " +
                " and c.sys_status =1    " +
                " and c.activity_name = ?  "
                + " %s  " ,where);
        Record record=Db.findFirst(sql, bizUuid, processName, activityName );
        return record;
    }
原文地址:https://www.cnblogs.com/xiaoniuniu886/p/9679290.html