diff --git a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.java b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.java index cc42353ba..00c727664 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.java @@ -39,6 +39,7 @@ public interface IpCfgDao extends CrudDao{ public CfgIndexInfo getCfgIndexInfo(Long id); public List getIpPortList(CfgIndexInfo entity); public void saveCfgIndex(CfgIndexInfo entity); + public void saveCfgIndexForBatch(CfgIndexInfo entity); public void saveIpPortCfg(IpPortCfg entity); public void updateCfgIndex(CfgIndexInfo entity); public void deleteIpCfg(CfgIndexInfo entity); diff --git a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml index 65c364bfa..5bc7e6ec0 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml @@ -831,6 +831,63 @@ #{doLog,jdbcType=INTEGER} ) + + insert into cfg_index_info( + CFG_DESC, + ACTION, + IS_VALID, + IS_AUDIT, + CREATOR_ID, + CREATE_TIME, + EDITOR_ID, + EDIT_TIME, + AUDITOR_ID, + AUDIT_TIME, + SERVICE_ID, + REQUEST_ID, + COMPILE_ID, + IS_AREA_EFFECTIVE, + CLASSIFY, + ATTRIBUTE, + LABLE, + AREA_EFFECTIVE_IDS, + function_id, + dns_strategy_id, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5, + do_log + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{dnsStrategyId,jdbcType=INTEGER}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR}, + #{doLog,jdbcType=INTEGER} + ) + diff --git a/src/main/java/com/nis/web/service/configuration/IpCfgService.java b/src/main/java/com/nis/web/service/configuration/IpCfgService.java index 3f357e171..e4032eea2 100644 --- a/src/main/java/com/nis/web/service/configuration/IpCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/IpCfgService.java @@ -7,6 +7,9 @@ import java.util.Map; import java.util.Properties; import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; @@ -44,6 +47,7 @@ import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.dao.specific.ConfigGroupInfoDao; import com.nis.web.security.UserUtils; import com.nis.web.service.CrudService; +import com.nis.web.service.SpringContextHolder; /** * IP相关配置事务类 @@ -108,8 +112,19 @@ public class IpCfgService extends CrudService { } @Transactional(readOnly=false,rollbackFor=RuntimeException.class) public void saveCfgIndexOf(List cfgIndexInfos){ - for (CfgIndexInfo cfgIndexInfo : cfgIndexInfos) { - ipCfgDao.saveCfgIndex(cfgIndexInfo); + SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); + SqlSession batchSqlSession = null; + try{ + batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); + for(int index = 0; index < cfgIndexInfos.size();index++){ + CfgIndexInfo cfgIndexInfo = cfgIndexInfos.get(index); + ((IpCfgDao) batchSqlSession.getMapper(IpCfgDao.class)).saveCfgIndex(cfgIndexInfo); + } + batchSqlSession.commit(); + }finally { + if(batchSqlSession != null){ + batchSqlSession.close(); + } } } @Transactional(readOnly=false,rollbackFor=RuntimeException.class)