IP类配置提交
This commit is contained in:
@@ -2,7 +2,9 @@ package com.nis.web.service.configuration;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
@@ -27,13 +29,19 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
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);
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -45,11 +53,67 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg){
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditIpCfg(审核IP类配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int auditIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("aduit "+tableName);
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* deleteIpCfg(删除IP类配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int deleteIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("delete "+tableName);
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -64,6 +128,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
*/
|
||||
public BaseIpCfg getIpCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.getById(tableName, id);
|
||||
}
|
||||
@@ -79,10 +145,46 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @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);
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.get(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.get(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsValid(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.getIsValid(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
return ipCfgDao.getIsValid(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsValid(String tableName, long id){
|
||||
return ipCfgDao.getIsValid(tableName,id);
|
||||
}
|
||||
public Integer getIsAudit(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.getIsAudit(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
return ipCfgDao.getIsAudit(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return ipCfgDao.getIsAudit(tableName,id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
@@ -9,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.RequestInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -69,4 +72,13 @@ public class RequestInfoService extends BaseService{
|
||||
requestInfo.setIsValid(-1);
|
||||
requestInfoDao.delete(requestInfo);//删除
|
||||
}
|
||||
public List<RequestInfo> getValidRequestInfo(){
|
||||
RequestInfo requestInfo=new RequestInfo();
|
||||
requestInfo.setIsValid(Constants.VALID_YES);
|
||||
return requestInfoDao.findRequestInfo(requestInfo);
|
||||
}
|
||||
public List<RequestInfo> getAllRequestInfo(){
|
||||
RequestInfo requestInfo=new RequestInfo();
|
||||
return requestInfoDao.findAllList(requestInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ServiceDictInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -114,7 +112,78 @@ public class ServiceDictInfoService extends BaseService{
|
||||
serviceDictInfo.setIsValid(0);
|
||||
serviceDictInfoDao.delete(serviceDictInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的分类)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findFlDict() {
|
||||
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_FL,Constants.VALID_YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的分类)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllFlDict() {
|
||||
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_FL);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的性质)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findXzDict() {
|
||||
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_XZ,Constants.VALID_YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的性质)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllXzDict() {
|
||||
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_XZ);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的标签)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findLableDict() {
|
||||
return serviceDictInfoDao.findItemDict(Constants.ITEM_TYPE_LABEL,Constants.VALID_YES);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* findFlDict(查找所有有效的标签)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*List<ServiceDictInfo>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllLableDict() {
|
||||
return serviceDictInfoDao.findAllItemDict(Constants.ITEM_TYPE_LABEL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user