e87d14337525abf2c863f4e1f22da0126e49e76c.svn-base 3.43 KB
package com.thinkgem.jeesite.modules.reg.service.bus;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.reg.dao.base.RegBaseHisZbinfoDao;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusHisBdcqzsdjxxDao;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusHisHouseBdcqzsdjxxDao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseHisZbinfo;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseBdcqzsdjxx;

@Service
@Transactional(readOnly = true)
public class RegBusHisBdcqzsdjxxService  extends CrudService<RegBusHisBdcqzsdjxxDao,RegBusHisBdcqzsdjxx>{
	
	@Autowired
	private RegBaseHisZbinfoDao regBaseHisZbinfoDao;
	@Autowired
	private RegBusHisBdcqzsdjxxDao regBusHisBdcqzsdjxxDao;
	
	public RegBusHisBdcqzsdjxx get(String id) {
		RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx = super.get(id);
		regBusHisBdcqzsdjxx.setRegBaseHisZbinfoList(regBaseHisZbinfoDao.findList(new RegBaseHisZbinfo(regBusHisBdcqzsdjxx)));
		return regBusHisBdcqzsdjxx;
	}
	
	public RegBusHisBdcqzsdjxx getdjxx(String id) {
		return dao.getdjxx(id);
	}
	
	public List<RegBusHisBdcqzsdjxx> findList(RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		return super.findList(regBusHisBdcqzsdjxx);
	}
	
	public List<RegBusHisBdcqzsdjxx> findhisdyhcflist(RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		return dao.findhisdyhcflist(regBusHisBdcqzsdjxx);
	}
	
	public List<RegBusHisBdcqzsdjxx> findauditList(RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		return dao.findauditList(regBusHisBdcqzsdjxx);
	}
	
	public Page<RegBusHisBdcqzsdjxx> findPage(Page<RegBusHisBdcqzsdjxx> page, RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		return super.findPage(page, regBusHisBdcqzsdjxx);
	}
	
	@Transactional(readOnly = false)
	public void save(RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		super.save(regBusHisBdcqzsdjxx);
		for (RegBaseHisZbinfo regBaseHisZbinfo : regBusHisBdcqzsdjxx.getRegBaseHisZbinfoList()){
			if (regBaseHisZbinfo.getId() == null){
				continue;
			}
			if (RegBaseHisZbinfo.DEL_FLAG_NORMAL.equals(regBaseHisZbinfo.getDelFlag())){
				if (StringUtils.isBlank(regBaseHisZbinfo.getId())){
					regBaseHisZbinfo.setMainId(regBusHisBdcqzsdjxx);
					regBaseHisZbinfo.preInsert();
					regBaseHisZbinfoDao.insert(regBaseHisZbinfo);
				}else{
					regBaseHisZbinfo.preUpdate();
					regBaseHisZbinfoDao.update(regBaseHisZbinfo);
				}
			}else{
				regBaseHisZbinfoDao.delete(regBaseHisZbinfo);
			}
		}
	}
	
	@Transactional(readOnly = false)
	public void delete(RegBusHisBdcqzsdjxx regBusHisBdcqzsdjxx) {
		super.delete(regBusHisBdcqzsdjxx);
	}
	
	public String findMaxYwhLs(){
		return dao.findMaxYwhLs();
	} 
	
	@Transactional(readOnly = false)
	public Map<Object,Object> getBsst(Map<String,Object> map) {
		return regBusHisBdcqzsdjxxDao.getBsst(map);
	}
	@Transactional(readOnly = false)
	public List<RegBusHisBdcqzsdjxx> getBsst1(Map<String,Object> map) {
		if("oracle".equals(Global.getDbName())){
			return regBusHisBdcqzsdjxxDao.OracleGetBsst1(map);
		}else {
			return regBusHisBdcqzsdjxxDao.getBsst1(map);
		}
	}
}