zoukankan      html  css  js  c++  java
  • SQL语句(jiancai)

     
    /*
             * 保证金退款查询:包括招标方和投标方。通过status状态来区分,具体如下
             * 招标使用表中的status(2、4、10、11) ,投标使用自定义的status(-1、-3、-5)
             */
            String sql = "select t.id,t.projectId ,t.manageCompanyId ,t.tenderCautionMoney, t.tenderName,t.status "
                    + "from tender_document t  where (t.isRemove =1 or t.isRemove is null) and (t.isReturn is null or t.isReturn = 0) and t.tenderCautionMoney > 0 and t.`status` in (2,4,11) "
                    + " union all select t.id,t.projectId ,t.manageCompanyId ,t.tenderCautionMoney ,t.tenderName,t.status  from "
                    + "tender_document t  where (t.isRemove =1 or t.isRemove is null) and (t.isReturn is null or t.isReturn = 0) "
                    + "and t.tenderCautionMoney > 0 and t.`status` = 10  and NOT EXISTS (select d.id from tender_bid_document d where d.tenderId = t.id and d.signState !=1) "
                    + "union all select t.id,d.id as projectId ,d.companyId manageCompanyId ,t.bidCautionMoney tenderCautionMoney,t.tenderName,-1 as status "
                    + "from tender_document t ,tender_bid_document d where t.id = d.tenderId and (t.isRemove =1 or t.isRemove is null) and (d.isReturn is null or d.isReturn = 0) "
                    + "and t.bidCautionMoney > 0 and  t.status = 11 and (select count(*) from tender_bid_document d where d.tenderId = t.id and d.status = 2) = 0 "
                    + "union all select t.id,d.id as projectId ,d.companyId manageCompanyId ,t.bidCautionMoney tenderCautionMoney,t.tenderName, "
                    + " -3 as status  from tender_document t,tender_bid_document d  where t.id = d.tenderId and (t.isRemove =1 or t.isRemove is null)"
                    + " and (d.isReturn is null or d.isReturn = 0) and t.bidCautionMoney > 0  and   t.endDate < NOW() and d.`status` =1 and "
                    + "(select count(*) from tender_bid_document d where d.tenderId = t.id and d.status = 2) = 0 union all "
                    + "select t.id,d.id as projectId ,d.companyId manageCompanyId ,t.bidCautionMoney tenderCautionMoney,t.tenderName, "
                    + "-5 as status   from tender_document t,tender_bid_document d where  t.id = d.tenderId and (t.isRemove =1 or t.isRemove is null) "
                    + "and (d.isReturn is null or d.isReturn = 0) and t.bidCautionMoney > 0 and  d.signState = 1 and "
                    + "(select count(*) from tender_bid_document d where d.tenderId = t.id and d.status = 2) = 0 ";
    
            return find(sql);
        }
  • 相关阅读:
    ZOJ3209 Treasure Map —— Danc Links 精确覆盖
    HUST1017 Exact cover —— Dancing Links 精确覆盖 模板题
    FZU1686 神龙的难题 —— Dancing Links 可重复覆盖
    POJ3074 Sudoku —— Dancing Links 精确覆盖
    HDU3085 Nightmare Ⅱ —— 双向BFS + 曼哈顿距离
    HDU3533 Escape —— BFS / A*算法 + 预处理
    HDU3567 Eight II —— IDA*算法
    HDU1560 DNA sequence —— IDA*算法
    FZU2150 Fire Game —— BFS
    POJ3087 Shuffle'm Up —— 打表找规律 / map判重
  • 原文地址:https://www.cnblogs.com/wuaili/p/8565766.html
Copyright © 2011-2022 走看看