class QuMultiFillblankManagerImpl extends BaseServiceImpl<QuMultiFillblank, String> implements QuMultiFillblankManager {
	@Autowired
	private QuMultiFillblankDao quMultiFillblankDao;

	@Override
	public void setBaseDao() {
		this.baseDao=quMultiFillblankDao;
	}

	public List<QuMultiFillblank> findByQuId(String quId){<FILL_FUNCTION_BODY>}

	public int getOrderById(String quId){
		Criterion criterion=Restrictions.eq("quId", quId);
		QuMultiFillblank quMultiFillblank=quMultiFillblankDao.findFirst("orderById", false, criterion);
		if(quMultiFillblank!=null){
			return quMultiFillblank.getOrderById();
		}
		return 0;
	}



	/*******************************************************************8
	 * 更新操作
	 */

	@Override
	@Transactional
	public QuMultiFillblank upOptionName(String quId,String quItemId, String optionName) {
		if(quItemId!=null && !"".equals(quItemId)){
			QuMultiFillblank quMultiFillblank=quMultiFillblankDao.get(quItemId);
			quMultiFillblank.setOptionName(optionName);
			quMultiFillblankDao.save(quMultiFillblank);
			return quMultiFillblank;
		}else{
			//取orderById
			int orderById=getOrderById(quId);
			//新加选项
			QuMultiFillblank quMultiFillblank=new QuMultiFillblank();
			quMultiFillblank.setQuId(quId);
			quMultiFillblank.setOptionName(optionName);
			//title
			quMultiFillblank.setOrderById(++orderById);
			quMultiFillblank.setOptionTitle(orderById+"");
			quMultiFillblankDao.save(quMultiFillblank);
			return quMultiFillblank;
		}
	}

	@Override
	@Transactional
	public List<QuMultiFillblank> saveManyOptions(String quId,List<QuMultiFillblank> quMultiFillblanks) {
		//取orderById
		int orderById=getOrderById(quId);
		for (QuMultiFillblank quMultiFillblank : quMultiFillblanks) {
			//新加选项
			quMultiFillblank.setOrderById(++orderById);
			quMultiFillblank.setOptionTitle(orderById+"");
			quMultiFillblankDao.save(quMultiFillblank);
		}
		return quMultiFillblanks;
	}

	@Override
	@Transactional
	public void ajaxDelete(String quItemId) {
		QuMultiFillblank quMultiFillblank=get(quItemId);
		quMultiFillblank.setVisibility(0);
		quMultiFillblankDao.save(quMultiFillblank);
	}

	@Override
	@Transactional
	public void saveAttr(String quItemId) {
		QuMultiFillblank quMultiFillblank=get(quItemId);
		quMultiFillblankDao.save(quMultiFillblank);
	}
}

		/*Page<QuMultiFillblank> page=new Page<QuMultiFillblank>();
		page.setOrderBy("orderById");
		page.setOrderDir("asc");

		List<PropertyFilter> filters=new ArrayList<PropertyFilter>();
		filters.add(new PropertyFilter("EQS_quId", quId));
		filters.add(new PropertyFilter("EQI_visibility", "1"));
		return findAll(page, filters);
		*/
		CriteriaBuilder criteriaBuilder=quMultiFillblankDao.getSession().getCriteriaBuilder();
		CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(QuMultiFillblank.class);
		Root root = criteriaQuery.from(QuMultiFillblank.class);
		criteriaQuery.select(root);
		Predicate eqQuId = criteriaBuilder.equal(root.get("quId"),quId);
		Predicate eqVisibility = criteriaBuilder.equal(root.get("visibility"),1);
		criteriaQuery.where(eqQuId,eqVisibility);
		criteriaQuery.orderBy(criteriaBuilder.asc(root.get("orderById")));
		return quMultiFillblankDao.findAll(criteriaQuery);
	
<methods>public non-sealed void <init>() ,public void delete(net.diaowen.dwsurvey.entity.QuMultiFillblank) ,public void delete(java.lang.String) ,public net.diaowen.dwsurvey.entity.QuMultiFillblank findById(java.lang.String) ,public transient List<net.diaowen.dwsurvey.entity.QuMultiFillblank> findList(org.hibernate.criterion.Criterion[]) ,public transient Page<net.diaowen.dwsurvey.entity.QuMultiFillblank> findPage(Page<net.diaowen.dwsurvey.entity.QuMultiFillblank>, org.hibernate.criterion.Criterion[]) ,public Page<net.diaowen.dwsurvey.entity.QuMultiFillblank> findPageByCri(Page<net.diaowen.dwsurvey.entity.QuMultiFillblank>, List<org.hibernate.criterion.Criterion>) ,public net.diaowen.dwsurvey.entity.QuMultiFillblank get(java.lang.String) ,public net.diaowen.dwsurvey.entity.QuMultiFillblank getModel(java.lang.String) ,public void save(net.diaowen.dwsurvey.entity.QuMultiFillblank) <variables>protected BaseDao<net.diaowen.dwsurvey.entity.QuMultiFillblank,java.lang.String> baseDao