97 lines
2.7 KiB
Java
97 lines
2.7 KiB
Java
|
|
package com.nis.web.service.specific;
|
||
|
|
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
import org.apache.commons.lang.StringUtils;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
import com.nis.domain.Page;
|
||
|
|
import com.nis.domain.SysUser;
|
||
|
|
import com.nis.domain.specific.SpecificServiceHostCfg;
|
||
|
|
import com.nis.web.dao.specific.SpecificServiceHostCfgDao;
|
||
|
|
import com.nis.web.security.UserUtils;
|
||
|
|
import com.nis.web.service.BaseService;
|
||
|
|
|
||
|
|
@Service
|
||
|
|
public class SpecificServiceHostCfgService extends BaseService{
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private SpecificServiceHostCfgDao specificServiceHostCfgDao;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 根据主键查询数据对象
|
||
|
|
* @param hostId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public SpecificServiceHostCfg getDictByHostId(Integer hostId) {
|
||
|
|
return specificServiceHostCfgDao.getByHostId(hostId);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查出分页
|
||
|
|
* @param page
|
||
|
|
* @param specificServiceHostCfg
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Page<SpecificServiceHostCfg> findSpecHostList(Page<SpecificServiceHostCfg> page,
|
||
|
|
SpecificServiceHostCfg specificServiceHostCfg) {
|
||
|
|
specificServiceHostCfg.setPage(page);
|
||
|
|
page.setList(specificServiceHostCfgDao.findSpecHostList(specificServiceHostCfg));
|
||
|
|
return page;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增或修改
|
||
|
|
* @param specificServiceHostCfg
|
||
|
|
*/
|
||
|
|
public void saveOrUpdate(SpecificServiceHostCfg specificServiceHostCfg) {
|
||
|
|
SysUser user = UserUtils.getUser();
|
||
|
|
Date date = new Date();
|
||
|
|
if(specificServiceHostCfg.getHostId()==null){//新增
|
||
|
|
specificServiceHostCfg.setIsValid(1);
|
||
|
|
specificServiceHostCfg.setCreator(user);
|
||
|
|
specificServiceHostCfg.setCreateTime(date);
|
||
|
|
specificServiceHostCfg.setEditor(user);
|
||
|
|
specificServiceHostCfg.setEditTime(date);
|
||
|
|
specificServiceHostCfgDao.insert(specificServiceHostCfg);
|
||
|
|
}else{//修改
|
||
|
|
//是否进行了审核操作
|
||
|
|
SpecificServiceHostCfg ssh = specificServiceHostCfgDao.getByHostId(specificServiceHostCfg.getHostId());
|
||
|
|
if(ssh.getIsAudit()!=specificServiceHostCfg.getIsAudit()){
|
||
|
|
specificServiceHostCfg.setAuditor(user);
|
||
|
|
specificServiceHostCfg.setAuditTime(date);
|
||
|
|
}
|
||
|
|
specificServiceHostCfg.setEditor(user);
|
||
|
|
specificServiceHostCfg.setEditTime(date);
|
||
|
|
specificServiceHostCfgDao.update(specificServiceHostCfg);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查出所有
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<SpecificServiceHostCfg> getAll() {
|
||
|
|
|
||
|
|
return specificServiceHostCfgDao.getAll();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除
|
||
|
|
* @param mulitId
|
||
|
|
*/
|
||
|
|
public void delete(String mulitId) {
|
||
|
|
String[] ids = mulitId.split(",");
|
||
|
|
for(String hostId:ids){
|
||
|
|
if (!StringUtils.isEmpty(hostId)) {
|
||
|
|
specificServiceHostCfgDao.delete(Integer.valueOf(hostId));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|