IP类Dao,Service,Controller提交,后续会调整

This commit is contained in:
wangxin
2018-02-23 09:54:28 +08:00
parent e81eee50d6
commit 138d39b8aa
9 changed files with 541 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.Configurations;
import com.nis.util.StringUtils;
/**
@@ -142,8 +143,32 @@ public abstract class BaseService {
return scopeSql.toString();
}
/**
*
* getTableName(获取Class对应的表名)
* (这里描述这个方法适用条件 可选)
* @param clazz
* @return
*String
* @exception
* @since 1.0.0
*/
public String getTableName(String clazz){
return Configurations.getStringProperty(clazz, null);
}
/**
*
* getTableName(获取表名对应的Class)
* (这里描述这个方法适用条件 可选)
* @param clazz
* @return
*String
* @exception
* @since 1.0.0
*/
public String getClassName(String tableName){
return Configurations.getStringProperty(tableName, null);
}

View File

@@ -3,7 +3,6 @@
*/
package com.nis.web.service;
import java.lang.reflect.Field;
import java.util.List;
import org.apache.ibatis.session.ExecutorType;
@@ -13,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.nis.domain.BaseEntity;
import com.nis.domain.Page;
import com.nis.util.Constants;
import com.nis.web.dao.CrudDao;
/**

View File

@@ -1,13 +1,88 @@
package com.nis.web.service.configuration;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.service.CrudService;
/**
* IP相关配置事务类
* @author dell
*
*/
@Service
public class IpCfgService {
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);
}
}

View File

@@ -0,0 +1,16 @@
package com.nis.web.service.systemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.ServiceConfigInfo;
import com.nis.web.dao.systemService.ServiceConfigInfoDao;
@Service
public class ServiceConfigInfoService {
@Autowired
protected ServiceConfigInfoDao serviceConfigInfoDao;
public ServiceConfigInfo findSysServiceConfigInfo(int serviceId){
return serviceConfigInfoDao.findSysServiceConfigInfo(serviceId);
}
}