package cn.com.usky.iot.company.dao;

import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
//import cn.com.usky.iot.order.dao.YtiotTOrderDao;
import cn.com.usky.iot.entity.YtiotTCompanyVer;
import cn.com.usky.utils.DaoQuery;
import cn.com.usky.utils.DaoResult;

public class YtiotTCompanyVerDaoImpl extends HibernateDaoSupport implements YtiotTCompanyVerDao {
//	private YtiotTOrderDao ytiotTOrderDao;
	private DaoQuery daoQuery;
	public DaoQuery getDaoQuery() {
		return daoQuery;
	}

	public void setDaoQuery(DaoQuery daoQuery) {
		this.daoQuery = daoQuery;
	}

	@Override
	public DaoResult add(YtiotTCompanyVer ytiotTCompanyVer) {
		// TODO Auto-generated method stub
		if(ytiotTCompanyVer.getVCompanyName()==null)
			return new DaoResult("单位名称不能为空",false);
		if(ytiotTCompanyVer.getVComment()==null)
			return new DaoResult("更新说明不能为空",false);
		if(ytiotTCompanyVer.getUqAdminId()==null)
			return new DaoResult("录入人不能为空",false);
//		long idx = ytiotTOrderDao.getMaxOrderIdx("ytiot_t_Company_ver");
//		ytiotTCompanyVer.setIOrderIdx(idx);
		this.getHibernateTemplate().save(ytiotTCompanyVer);
		return new DaoResult(ytiotTCompanyVer.getUqCompanyId().toString(),true);
	}

	@Override
	public DaoResult update(YtiotTCompanyVer ytiotTCompanyVer) {
		// TODO Auto-generated method stub
		return new DaoResult("日志记录内容不能修改",false);
	}

	@Override
	public DaoResult delect(YtiotTCompanyVer ytiotTCompanyVer) {
		// TODO Auto-generated method stub
		return new DaoResult("日志记录内容不能删除",false);
	}

	@Override
	public int getCount(String sqlwhere) {
		// TODO Auto-generated method stub
		
		return daoQuery.getCount("YtiotTCompanyVer", sqlwhere);
	}

	@Override
	public List query(String sqlwhere, String order, String dir, String start, String limit) {
		// TODO Auto-generated method stub
		return daoQuery.query("YtiotTCompanyVer", sqlwhere, order, dir, start, limit);
	}


}
