2018-02-28 12:15:52 +08:00
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
2018-04-09 16:38:45 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
2018-02-28 12:15:52 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
2018-04-09 16:38:45 +08:00
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-04-13 13:50:29 +08:00
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-02-28 12:15:52 +08:00
|
|
|
import com.nis.domain.configuration.NumBoundaryCfg;
|
2018-03-26 14:43:58 +08:00
|
|
|
import com.nis.util.Constants;
|
2018-02-28 12:15:52 +08:00
|
|
|
import com.nis.web.dao.configuration.NumCfgDao;
|
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Num相关配置事务类
|
|
|
|
|
* @author dell
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
|
|
|
|
@Autowired
|
|
|
|
|
protected NumCfgDao numCfgDao;
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* addNumCfg(新增IP类配置)
|
|
|
|
|
* (继承NumBoundaryCfg这个类方可使用)
|
|
|
|
|
* @param cfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
public int addNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
2018-04-09 16:38:45 +08:00
|
|
|
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
2018-06-02 17:40:14 +08:00
|
|
|
// this.saveIpBatch(areaIpCfgs);
|
2018-04-09 16:38:45 +08:00
|
|
|
}
|
2018-02-28 12:15:52 +08:00
|
|
|
return numCfgDao.insert(cfg);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* updateNumCfg(更新IP类配置)
|
|
|
|
|
* (继承NumBoundaryCfg这个类方可使用)
|
|
|
|
|
* @param cfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
public int updateNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
2018-04-09 16:38:45 +08:00
|
|
|
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
2018-06-02 17:40:14 +08:00
|
|
|
// this.saveIpBatch(addAreaCfg);
|
2018-04-09 16:38:45 +08:00
|
|
|
}
|
|
|
|
|
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
|
|
|
|
this.updateIpBatch(updateAreaCfg);
|
|
|
|
|
}
|
|
|
|
|
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
|
|
|
|
this.deleteIpBatch(deleteAreaCfgs);
|
|
|
|
|
}
|
2018-02-28 12:15:52 +08:00
|
|
|
return numCfgDao.updateByPrimaryKeySelective(cfg);
|
|
|
|
|
}
|
2018-06-07 13:27:57 +08:00
|
|
|
|
2018-02-28 12:15:52 +08:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* deleteNumCfg(删除IP类配置)
|
|
|
|
|
* (继承NumBoundaryCfg这个类方可使用)
|
|
|
|
|
* @param cfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-02-28 12:15:52 +08:00
|
|
|
public int deleteNumCfg(NumBoundaryCfg cfg){
|
|
|
|
|
return numCfgDao.updateValid(cfg);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* getNumCfg(根据IP与类名获取IP配置)
|
|
|
|
|
* (继承NumBoundaryCfg这个类方可使用)
|
|
|
|
|
* @param clazz
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*NumBoundaryCfg
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public NumBoundaryCfg getNumCfgById(long id){
|
|
|
|
|
return numCfgDao.getById(id);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* getNumCfg(根据IP与类名获取IP配置)
|
|
|
|
|
* (继承NumBoundaryCfg这个类方可使用)
|
|
|
|
|
* @param clazz
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*NumBoundaryCfg
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public NumBoundaryCfg getNumCfgById(NumBoundaryCfg cfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
return numCfgDao.getById(cfg.getCfgId());
|
2018-02-28 12:15:52 +08:00
|
|
|
}
|
|
|
|
|
public Integer getIsValid(NumBoundaryCfg cfg){
|
|
|
|
|
return numCfgDao.getIsValid(cfg);
|
|
|
|
|
}
|
|
|
|
|
public Integer getIsValid(long id){
|
|
|
|
|
return numCfgDao.getIsValid(id);
|
|
|
|
|
}
|
|
|
|
|
public Integer getIsAudit(NumBoundaryCfg cfg){
|
|
|
|
|
return numCfgDao.getIsAudit(cfg);
|
|
|
|
|
}
|
|
|
|
|
public Integer getIsAudit(long id){
|
|
|
|
|
return numCfgDao.getIsAudit(id);
|
|
|
|
|
}
|
|
|
|
|
}
|