⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 secondquestionbiz.java

📁 人力资源管理系统
💻 JAVA
字号:
package com.accphr.biz.impl;

import java.io.Serializable;
import java.util.List;


import com.accphr.biz.ISecondQuestionBiz;
import com.accphr.dao.ICommonDao;
import com.accphr.entity.FirstQuestion;
import com.accphr.entity.SecondQuestion;
import com.accphr.page.PageResult;


/**
 * 客户化设置=》题库管理设置=》二级试题
 * 二级试题数据操作类
 * 映射表`config_question_second_kind`
 * @author Administrator
 *
 */
public class SecondQuestionBiz implements ISecondQuestionBiz  {

	private ICommonDao commonDao=null;

	public void setCommonDao(ICommonDao commonDao) {
		this.commonDao = commonDao;
	}
	
	//保存
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#add(com.accphr.entity.SecondQuestion)
	 */
	public void add(SecondQuestion secondQuestion){
		this.commonDao.add(secondQuestion);
	}
	
	//删除
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#del(java.io.Serializable)
	 */
	public void del(Serializable sqid){
		this.commonDao.del(SecondQuestion.class, sqid);
	}

	
	//查询所有
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#findAll(com.accphr.entity.SecondQuestion)
	 */
	public List findAll(SecondQuestion secondQuestion){
		String hql="from SecondQuestion where 1=1";
		if(secondQuestion!=null){
			if(secondQuestion.getFirstKindName()!=null){
				hql+=(" and firstKindName like '%"+secondQuestion.getFirstKindName()+"%'");
			}
			if(secondQuestion.getSecondKindName()!=null){
				hql+=(" and secondKindName like '%"+secondQuestion.getSecondKindName()+"%'");
			}
			if(secondQuestion.getFirstKindId()!=null){
				hql+=(" and firstKindId = '"+secondQuestion.getFirstKindId()+"'");
			}
			if(secondQuestion.getSecondKindId()!=null){
				hql+=(" and secondKindId = '"+secondQuestion.getSecondKindId()+"'");
			}
		}
		return this.commonDao.findByHql(hql);
	}
	
	//分页查询

	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#setPageResult(com.accphr.entity.SecondQuestion, com.accphr.page.PageResult)
	 */
	public void setPageResult(SecondQuestion secondQuestion,PageResult pageResult){
		String hql="from SecondQuestion where 1=1";
		if(secondQuestion!=null){
			if(secondQuestion.getFirstKindName()!=null){
				hql+=(" and firstKindName like '%"+secondQuestion.getFirstKindName()+"%'");
			}
			if(secondQuestion.getSecondKindName()!=null){
				hql+=(" and secondKindName like '%"+secondQuestion.getSecondKindName()+"%'");
			}
		}
		pageResult.setHql(hql);
		this.commonDao.pageList(pageResult);
	}

	//根据ID查询
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#findById(java.io.Serializable)
	 */
	public SecondQuestion findById(Serializable id) {
		return (SecondQuestion)this.commonDao.findById(SecondQuestion.class, id);
	}

	//根据FID查询
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#findById(java.io.Serializable)
	 */
	public List findByFId(String sid) {
		String hql=" from SecondQuestion where firstKindId=?";
		List list=this.commonDao.findByHql(hql, new Object[]{sid});
		return list;
	}

	//获取新的编号
	/* (non-Javadoc)
	 * @see com.accphr.biz.impl.ISecondQuestionBiz#findNewId(java.io.Serializable)
	 */
	public String findNewId(Serializable serializable) {
		String hql="select max(secondKindId) from SecondQuestion where firstKindId="+serializable;
		List list=this.commonDao.findByHql(hql);
		if(list.get(0)!=null){
			Integer newid= Integer.parseInt(list.get(0).toString());
			return (newid<10?"0":"")+(newid+1);
		}
		else{
			return "01";
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -