派生自 projectDept/qhighschool

胡仁荣
2022-10-31 fe7381d6e8ec1f427408de0297ac7f41533202f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/******************************************************************************
 * Copyright (C) 2015 Shenzhen Penguin Network Technology Co., Ltd
 * All Rights Reserved.
 * ±¾Èí¼þΪÉîÛÚÊÐÆó¶ìÍøÂç¿Æ¼¼ÓÐÏÞ¹«Ë¾¿ª·¢ÑÐÖÆ¡£Î´¾­±¾¹«Ë¾ÕýʽÊéÃæÍ¬Ò⣬ÆäËûÈκθöÈË¡¢ÍÅÌå
 * ²»µÃʹÓᢸ´ÖÆ¡¢Ð޸Ļò·¢²¼±¾Èí¼þ.
 *****************************************************************************/
 
package com.qxueyou.scc.org.dao;
 
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
 
import org.springframework.stereotype.Repository;
 
import com.qxueyou.scc.admin.classes.model.ClsClass;
import com.qxueyou.scc.base.dao.BaseDAO;
import com.qxueyou.scc.base.model.Pager;
import com.qxueyou.scc.org.model.OrgCollegeCourse;
import com.qxueyou.scc.org.model.OrgCourseCategory;
 
@Repository(value="orgDAO")
/**
 * ×Ô¶¯×¢ÈësessionFactory
 *
 * @author Ïĵ»¢
 * @since JDK1.6
 * @history 2010-07-28 Ïĵ»¢ Ð½¨
 */
public class OrgDAO extends BaseDAO {
    
    /**
     * ¸ù¾Ýhql²éѯ,²¢·µ»ØÖ´ÐÐÀàÐ͵ÄÁбí½á¹û
     *
     * @param hql ²éѯÓï¾ä
     * @param args ²ÎÊý
     * @param cls ·µ»ØÀàÐÍ
     * @return
     */
    public  List<OrgCollegeCourse> queryOrgCourseList(String hql, List<Object> args) {
        return  this.queryOrgCourseListNew(hql, args);
    }
    
    /**
     * ¸ù¾Ýhql²éѯ,²¢·µ»ØÖ´ÐÐÀàÐ͵ÄÁбí½á¹û
     *
     * @param hql ²éѯÓï¾ä
     * @param args ²ÎÊý
     * @param cls ·µ»ØÀàÐÍ
     * @return
     */
    @SuppressWarnings("unchecked")
    public  List<OrgCollegeCourse> queryOrgCourseListNew(String hql, List<Object> args) {
        List<OrgCollegeCourse> lstCourse = new ArrayList<OrgCollegeCourse>();
        // Ìí¼Ó²»ÏÞ
        OrgCollegeCourse course = null;
        List<Object[]> lst = (List<Object[]>) this.getHibernateTemplate().find(hql, args.toArray());
        for (Object[] obj : lst) {
            course = new OrgCollegeCourse();
            course.setCourseId(String.valueOf(obj[0]));
            course.setName(String.valueOf(obj[1]));
            course.setPrice(new BigDecimal(String.valueOf(obj[2])));
            course.setImgPath(String.valueOf(obj[3]));
            course.setCourseCategoryId(String.valueOf(obj[4]));
            lstCourse.add(course);
        }
        
        return lstCourse;
    }
    
     
    /**
     * ¸ù¾Ýhql²éѯ,²¢·µ»ØÖ´ÐÐÀàÐ͵ÄÁбí½á¹û
     *
     * @param hql ²éѯÓï¾ä
     * @param args ²ÎÊý
     * @param cls ·µ»ØÀàÐÍ
     * @return
     */
    @SuppressWarnings("unchecked")
    public List<OrgCourseCategory> queryOrgCourseCategoryList(String hql,
            List<Object> args) {
        List<OrgCourseCategory> lstCategory = new ArrayList<OrgCourseCategory>();
        OrgCourseCategory category = null;
        
        List<Object[]> lst = (List<Object[]>) this.getHibernateTemplate().find(hql, args.toArray());
        for (Object[] obj : lst) {
            category = new OrgCourseCategory();
            category.setCategoryId(String.valueOf(obj[0]));
            category.setCategoryName(String.valueOf(obj[1]));
            lstCategory.add(category);
        }
        
        return lstCategory;
    }
    
    /**
        * ×é×°²éѯ°à¼¶
        * @param hql
        * @param page
        * @param args
        * @return
        */
    public List<ClsClass> queryRegClassList(final String hql, final Pager page, final List<Object> args) {
       
           List<ClsClass> lstitems = new ArrayList<ClsClass>(20);
           ClsClass item;
        List<Object[]> lst  =  this.findList(hql, page, args, Object[].class);
        
        for (Object obj : lst) {
            item = (ClsClass) obj;
               lstitems.add(item);
         }
         return lstitems;
 
    }
}