<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    從制造到創(chuàng)造
    軟件工程師成長之路
    posts - 292,  comments - 96,  trackbacks - 0

    在再保系統(tǒng)中,我們有時候會以某個日期作為查詢條件,如在“參數(shù)維護”的某個模塊中,需要將“生效日期”作為查詢條件。

    我們在JSP中使用JS插件輸入“yyyy-mm-dd”格式的日期,但是數(shù)據(jù)庫(DB2)中的字段是“TimeStamp”,而我們在DBean中用VO接這個字段是用“Date”類型,這樣在做查詢的Dao類的方法中,我們要對這個字段進行處理。

    首先定義一種格式變量:
    SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd");

    然后將Date類型的變量進行格式化:
    myFmt.format(reCededRateVO.getBoundDate())

    這樣會得到“yyyy-MM-dd”格式的日期,然后就可以放到Sql語句中作為條件進行查詢了。

    /**
     * description: 根據(jù)公司別、再保類別查詢與之相符合的紀錄
     * 
     * 
    @param reCededRateVO
     *            ReCededRateVO
     * 
    @param startRow
     *            起始行
     * 
    @param numberOfRows
     *            讀取行數(shù)
     * 
    @return List 結(jié)果集
     * 
    @throws DbAccessException
     *             數(shù)據(jù)庫訪問異常
     
    */
    public List selectListByCode(ReCededRateVO reCededRateVO,
            
    int startRow, int numberOfRows) throws DbAccessException {
        
    if (DEBUGLOG.isDebugEnabled()) {
            DEBUGLOG.debug(
    "[ReCededRateDataDao.selectListByCode()]"
                    
    + "[begin]");
        }
        SimpleDateFormat myFmt 
    = new SimpleDateFormat("yyyy-MM-dd");
        StringBuffer hqlBuff 
    = new StringBuffer(
                
    "from ReCededRateData as t where 1=1");
        
        
    // 公司別
        if (!"".equals(reCededRateVO.getCompanyFlag())
                
    && reCededRateVO.getCompanyFlag() != null) {
            hqlBuff.append(
    " and t.id.companyFlag = '"
                    
    + reCededRateVO.getCompanyFlag() + "'");
        }
        
        
    // 再保類別
        if (!"".equals(reCededRateVO.getReinsuranceClass())
                
    && reCededRateVO.getReinsuranceClass() != null) {
            hqlBuff.append(
    " and t.id.reinsuranceClass = '"
                    
    + reCededRateVO.getReinsuranceClass() + "'");
        }
        
        
    // 再保層次
        if (!"".equals(reCededRateVO.getReinsuranceLevel())
                
    && reCededRateVO.getReinsuranceLevel() != null) {
            hqlBuff.append(
    " and t.id.reinsuranceLevel = '"
                    
    + reCededRateVO.getReinsuranceLevel() + "'");
        }
        
        
    // 生效日期
        if (!"".equals(reCededRateVO.getBoundDate())
                
    && reCededRateVO.getBoundDate() != null) {
            hqlBuff.append(
    " and t.endDate >= '"
                    
    + myFmt.format(reCededRateVO.getBoundDate())
                    
    + "' and t.id.boundDate <= '"
                    
    + myFmt.format(reCededRateVO.getBoundDate()) + "'");
        }        
        
        hqlBuff.append(
    " order by t.id.companyFlag asc, t.id.boundDate asc,"
                
    + "t.id.reinsuranceClass asc, t.id.reinsuranceLevel asc,"
                
    + "t.id.reCompanyCode asc, t.id.bodyFlag asc");
        
    // 以公司別+生效日期+再保類別排序+再保層次+再保公司+體位別");
        
        List list 
    = this.hQueryByPage(hqlBuff.toString(), startRow,
                numberOfRows);
        
    if (list != null && list.size() > 0) {
            
    if (DEBUGLOG.isDebugEnabled()) {
                DEBUGLOG.debug(
    "[selectListByCode()]select list success![end]");
            }
            
    return list;
        } 
    else {
            
    if (DEBUGLOG.isDebugEnabled()) {
                DEBUGLOG.debug(
    "[selectListByCode()]select list return null!"
                        
    + "[end]");
            }
            
    return null;
        }
    }
    posted on 2007-10-09 15:41 CoderDream 閱讀(718) 評論(0)  編輯  收藏 所屬分類: 再保系統(tǒng)

    <2007年10月>
    30123456
    78910111213
    14151617181920
    21222324252627
    28293031123
    45678910

    常用鏈接

    留言簿(9)

    我參與的團隊

    隨筆分類(245)

    隨筆檔案(239)

    文章分類(3)

    文章檔案(3)

    收藏夾(576)

    友情鏈接

    搜索

    •  

    積分與排名

    • 積分 - 458130
    • 排名 - 114

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 中国人免费观看高清在线观看二区| 无码人妻一区二区三区免费n鬼沢| 亚洲一区视频在线播放 | 成年网在线观看免费观看网址 | 亚洲精品GV天堂无码男同| 亚洲情侣偷拍精品| 最近在线2018视频免费观看| 久久精品亚洲日本波多野结衣| 亚洲精品无码mv在线观看网站| 国拍在线精品视频免费观看| 五月天婷婷免费视频| 亚洲视频在线免费播放| 四虎亚洲国产成人久久精品| 最近2019中文字幕免费大全5| 狠狠入ady亚洲精品| 亚洲AV日韩AV鸥美在线观看| 国产成人免费片在线观看| 久久精品一区二区免费看| 在线观看免费亚洲| 亚洲性猛交xx乱| 国产亚洲精品自在线观看| 毛片免费观看网站| 免费国产黄网站在线观看 | 国产成人精品免费大全| 97se亚洲国产综合自在线| 亚洲AV无码专区国产乱码4SE | 亚洲AV无码久久精品蜜桃| 免费国产高清视频| 国产福利在线观看免费第一福利| 中文字幕手机在线免费看电影 | 手机永久免费的AV在线电影网| 亚洲午夜电影一区二区三区| 中文字幕亚洲电影| 国产成人免费高清在线观看 | 卡一卡二卡三在线入口免费| 无码精品国产一区二区三区免费 | 免费A级毛片无码A∨| 成在线人免费无码高潮喷水| 国产精品亚洲AV三区| 国产精品亚洲精品| 亚洲午夜精品国产电影在线观看|