/* * 查询某层次下的所有专业 * @see net.cedu.biz.enrollment.AcademyMajorBiz#findAcademyMajorByLevel(int) */ public List<AcademyMajor> findAcademyMajorByLevel(int academyLevelId) throws Exception { List<AcademyMajor> academyMajorlst = null; PageParame p = new PageParame(); String hqlparam = ""; String params = ""; if (academyLevelId != 0) { hqlparam += " and academyLevelId=" + Constants.PLACEHOLDER; params += academyLevelId + ","; } else { return null; } hqlparam += " and deleteFlag = " + Constants.PLACEHOLDER; params += Constants.DELETE_FALSE; if (!params.equals("")) { p.setHqlConditionExpression(hqlparam); p.setValues(params.split(",")); } Long[] academyMajorits = academyMajorDao.getIDs(p); if (academyMajorits != null && academyMajorits.length != 0) { academyMajorlst = new ArrayList<AcademyMajor>(); for (int i = 0; i < academyMajorits.length; i++) { AcademyMajor am = this.findById(Integer.valueOf(academyMajorits[i].toString())); AcademyMajor academymajor = am; Major major = majorBiz.findMajorById(academymajor.getMajorId()); if (major != null) { academymajor.setMajorName(major.getName()); academymajor.setMajorCode(major.getCode()); } academyMajorlst.add(academymajor); } } return academyMajorlst; }
/** * 查询某层次下的所有基础专业(返回的是基础专业集合) * * @param levelId * @return * @throws Exception */ public List<Major> findMajorListByLevelId(int levelId) throws Exception { List<AcademyMajor> list = this.findByLevel(levelId); if (list == null) return null; List<Major> majorlist = new ArrayList<Major>(); for (AcademyMajor acamajor : list) { Major major = this.majorBiz.findMajorById(acamajor.getMajorId()); majorlist.add(major); } return majorlist; }
/*批量添加院校专业 * (non-Javadoc) * @see net.cedu.biz.enrollment.AcademyMajorBiz#addSeveralAcademyMajor(net.cedu.entity.enrollment.AcademyMajor, int[]) */ public void addSeveralAcademyMajor(AcademyMajor academyMajor, int[] allmajorids) throws Exception { if (academyMajor != null && allmajorids != null && allmajorids.length > 0) { for (int i = 0, len = allmajorids.length; i < len; i++) { AcademyMajor schmajor = new AcademyMajor(); schmajor.setAcademyLevelId(academyMajor.getAcademyLevelId()); schmajor.setDeleteFlag(Constants.DELETE_FALSE); schmajor.setMajorId(allmajorids[i]); schmajor.setCreatedTime(new Date()); schmajor.setUpdatedTime(new Date()); schmajor.setCreatorId(academyMajor.getCreatorId()); schmajor.setUpdaterId(academyMajor.getUpdaterId()); this.addAcademyMajor(schmajor); } } }