2018-01-09 16:50:39 +08:00
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
2018-02-23 09:54:28 +08:00
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2018-01-09 16:50:39 +08:00
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
2018-02-23 09:54:28 +08:00
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
|
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
/**
|
|
|
|
|
* IP相关配置事务类
|
|
|
|
|
* @author dell
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
2018-02-23 09:54:28 +08:00
|
|
|
public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|
|
|
|
@Autowired
|
|
|
|
|
protected IpCfgDao ipCfgDao;
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* addIpCfg(新增IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public int addIpCfg(BaseIpCfg baseIpCfg){
|
|
|
|
|
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
|
|
|
|
if(StringUtils.isBlank(tableName))
|
|
|
|
|
return 0;
|
|
|
|
|
baseIpCfg.setTableName(tableName);
|
|
|
|
|
logger.info("save "+tableName);
|
|
|
|
|
return ipCfgDao.insert(baseIpCfg);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* updateIpCfg(更新IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public int updateIpCfg(BaseIpCfg baseIpCfg){
|
|
|
|
|
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
|
|
|
|
baseIpCfg.setTableName(tableName);
|
|
|
|
|
logger.info("update "+tableName);
|
|
|
|
|
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* getIpCfg(根据IP与类名获取IP配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param clazz
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*BaseIpCfg
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public BaseIpCfg getIpCfgById(Class<?> clazz,long id){
|
|
|
|
|
String tableName=getTableName(clazz.getSimpleName());
|
|
|
|
|
logger.info("get "+tableName);
|
|
|
|
|
return ipCfgDao.getById(tableName, id);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* getIpCfg(根据IP与类名获取IP配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param clazz
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*BaseIpCfg
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public BaseIpCfg getIpCfgById(BaseIpCfg baseIpCfg){
|
|
|
|
|
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
|
|
|
|
baseIpCfg.setTableName(tableName);
|
|
|
|
|
logger.info("get "+tableName);
|
|
|
|
|
return ipCfgDao.get(baseIpCfg);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
}
|