posts - 12,  comments - 2,  trackbacks - 0
     /**
     * 根据commutype,epId查询分期项目下拉列框的值(LabelValueEx对象)按indexNo升序排列,lable对应typeName,value对应commTypeId
     *  
@param   epId
     *             开发商Id
     * 
@param   commutype 
     *             通讯方法String类型,分别为tysms,tyemail,tyfax
     * 
@return  List
     * 
@throws  BusinessProcessException
     
*/
      如果在查询的SQL中,用到left join fetch 查询出来的只能是一个对象,而不能是某些列 
     否则会出现没有取到延迟加载的列的错误
 

    
public  List getCrmCommuInfoTyFms(String epId,String commutype)  throws  BusinessProcessException {
        List dicList 
=   new  ArrayList();
        
if ( ! BlankUtil.isBlank(commutype))
        {        
        
try  {
            String query
= " select info.constValueId from SysConstValue info "
                
+ "  where info.constValue=' " + commutype + " ' " ;
            Long scv
= (Long)cDao.execute(query);
            String sql 
=   " from CrmCommInfoType info left join fetch info.communicationTy "
                
+   "  where info.epId=' " + epId + " ' "  
                
+ "  and info.communicationTy.constValueId= " + Long.parseLong(scv.toString());
            dicList 
=  cDao.queryObjects(sql);
         } 
catch  (Exception ex) {
            
throw   new  BusinessProcessException( " getDictData_search_001 " );
         }
        }
        
return  dicList;
    }

/**
     * 根据commutype,epId查询分期项目下拉列框的值(LabelValueEx对象),lable对应typeName,value对应commTypeId
     * 
     * 
@param  epId
     *            开发商Id
     * 
@param  commutype
     *            通讯方法String类型,分别为tysms,tyemail,tyfax
     * 
@return  List
     * 
@throws  BusinessProcessException
     
*/
    @SuppressWarnings(
" unchecked " )
    
public  DicSelectionModel getCrmCommuInfoTyFms(String epId, String commutype)
            
throws  BusinessProcessException {
        
try  {
            
if  (DictionaryServ  ==   null ) {
                System.out.println(
" DictionaryServ is null. " );
            }
            System.out.println(
" get dicList:------>begin " );
            List dicList 
=  DictionaryServ.getCrmCommuInfoTyFms(epId, commutype);
            System.out.println(
" get dicList:------>end " );
            List
< LabelValueEx >  labelValueList  =   new  ArrayList();
            Iterator it 
=  dicList.iterator();
            
//  System.out.println("*************** Iterator begin");
            labelValueList.add( new  LabelValueEx( " 请选择 " 0 ));
            
while  (it.hasNext()) {
                CrmCommInfoType result 
=
 (CrmCommInfoType) it.next();
                String label 
=  result.getTypeName();                                      //根据对象取到响应的列的值
                
long  value  =  result.getCommTypeId();
                LabelValueEx labelValue 
=   new  LabelValueEx(label, value);
                labelValueList.add(labelValue);
            }

            DicSelectionModel dicSelectionModel 
=   new  DicSelectionModel(
                    labelValueList);
            
return  dicSelectionModel;
        } 
catch  (Exception ex) {
            
throw   new  BusinessProcessException( " getCrmCommuInfoTyFms() " );
        }
    }

 



如果没有用到延迟加载 可以返回 已知的列
    
    
/**
     * 根据epId查询分析项下拉列框的值(LabelValue对象),lable对应constNameChs,value对应constName
     *  
@param  epId
     *             开发商Id
     * 
@return List
     * 
@throws BusinessProcessException
     
*/
    
public List getAnalyseItem(String epId) throws BusinessProcessException {
        String sql 
= "select info.constNameChs,info.constName from SysConst info"
            
+ " where info.epId='"+epId+"'"
            
+ " and flag='2'";
        List dicList 
= new ArrayList();

        
try {
            dicList 
= cDao.queryObjects(sql);
        } 
catch (Exception ex) {
            
throw new BusinessProcessException("getAnalyseItem()");
        }
        
return dicList;
    }

posted on 2006-09-23 11:58 doodoosun 阅读(263) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2006年9月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(1)

随笔分类(6)

随笔档案(11)

文章分类(30)

文章档案(34)

搜索

  •  

最新评论

阅读排行榜

评论排行榜