(1)数值类配置dao,service,controller提交
(2)增强字符串类配置dao,service,controller,页面提交
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
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.ComplexkeywordCfg;
|
||||
import com.nis.web.dao.configuration.ComplexStringCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* String相关配置事务类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,ComplexkeywordCfg> {
|
||||
@Autowired
|
||||
protected ComplexStringCfgDao complexStringCfgDao;
|
||||
/**
|
||||
*
|
||||
* addStringCfg(新增IP类配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int addStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateStringCfg(更新IP类配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int updateStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return complexStringCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditStringCfg(审核IP类配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int auditStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.audit(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("aduit "+tableName);
|
||||
return complexStringCfgDao.audit(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* deleteStringCfg(删除IP类配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int deleteStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("delete "+tableName);
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*ComplexkeywordCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ComplexkeywordCfg getStringCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
logger.info("get "+tableName);
|
||||
return complexStringCfgDao.getById(tableName, id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*ComplexkeywordCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ComplexkeywordCfg getStringCfgById(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.get(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return complexStringCfgDao.get(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsValid(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsValid(String tableName, long id){
|
||||
return complexStringCfgDao.getIsValid(tableName,id);
|
||||
}
|
||||
public Integer getIsAudit(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.getIsAudit(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
return complexStringCfgDao.getIsAudit(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return complexStringCfgDao.getIsAudit(tableName,id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
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.NumBoundaryCfg;
|
||||
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
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int addNumCfg(NumBoundaryCfg cfg){
|
||||
return numCfgDao.insert(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateNumCfg(更新IP类配置)
|
||||
* (继承NumBoundaryCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int updateNumCfg(NumBoundaryCfg cfg){
|
||||
return numCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditNumCfg(审核IP类配置)
|
||||
* (继承NumBoundaryCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
public int auditNumCfg(NumBoundaryCfg cfg){
|
||||
return numCfgDao.audit(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* deleteNumCfg(删除IP类配置)
|
||||
* (继承NumBoundaryCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=DataAccessException.class)
|
||||
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){
|
||||
return numCfgDao.get(cfg);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user