|
@@ -3,15 +3,12 @@ package com.sooka.jnb.information.service.impl;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
-import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.sooka.jnb.highServer.domain.JnbHighServerImg;
|
|
|
import com.sooka.jnb.highServer.mapper.JnbHighServerImgMapper;
|
|
|
import com.sooka.jnb.information.domain.Information;
|
|
|
-import com.sooka.jnb.information.domain.InformationVo;
|
|
|
import com.sooka.jnb.information.mapper.InformationMapper;
|
|
|
import com.sooka.jnb.information.service.InformationService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -35,13 +32,11 @@ public class InformationServiceImpl implements InformationService
|
|
|
private JnbHighServerImgMapper jnbHighServerImgMapper;
|
|
|
|
|
|
@Override
|
|
|
- public InformationVo selectInformationById(Long id)
|
|
|
+ public Information selectInformationById(Long id)
|
|
|
{
|
|
|
Information information = informationMapper.selectInformationById(id);
|
|
|
- InformationVo vo = new InformationVo();
|
|
|
- vo.setImgUrlList(StringUtils.join(jnbHighServerImgMapper.selectAll(id)));
|
|
|
- BeanUtils.copyProperties(information,vo);
|
|
|
- return vo;
|
|
|
+ information.setImgUrlList(jnbHighServerImgMapper.selectAll(id));
|
|
|
+ return information;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -54,22 +49,20 @@ public class InformationServiceImpl implements InformationService
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int insertInformationServer(InformationVo information)
|
|
|
+ public int insertInformationServer(Information entity)
|
|
|
{
|
|
|
- Information entity = new Information();
|
|
|
- BeanUtils.copyProperties(information,entity);
|
|
|
entity.setCreateTime(DateUtils.getNowDate());
|
|
|
entity.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
int i = informationMapper.insertInformation(entity);
|
|
|
if (i>0){
|
|
|
- List<String> imgUrlList = Arrays.asList(information.getImgUrlList().split(","));
|
|
|
+ List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
|
if (!ObjectUtils.isEmpty(imgUrlList)){
|
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
|
imgUrlList.forEach(a->{
|
|
|
JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
|
serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
serverImg.setCreateTime(DateUtils.getNowDate());
|
|
|
- serverImg.setServerId(information.getId());
|
|
|
+ serverImg.setServerId(entity.getId());
|
|
|
serverImg.setImgUrl(a);
|
|
|
imgList.add(serverImg);
|
|
|
});
|
|
@@ -82,22 +75,21 @@ public class InformationServiceImpl implements InformationService
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int updateInformation(InformationVo information)
|
|
|
+ public int updateInformation(Information entity)
|
|
|
{
|
|
|
- Information entity = new Information();
|
|
|
- BeanUtils.copyProperties(information,entity);
|
|
|
+ BeanUtils.copyProperties(entity,entity);
|
|
|
entity.setUpdateTime(DateUtils.getNowDate());
|
|
|
entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
int i = informationMapper.updateInformation(entity);
|
|
|
- List<String> imgUrlList = Arrays.asList(information.getImgUrlList().split(","));
|
|
|
+ List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
|
if (!ObjectUtils.isEmpty(imgUrlList)){
|
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
|
- jnbHighServerImgMapper.deleteJnbHighServerByServerId(information.getId());
|
|
|
+ jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId());
|
|
|
imgUrlList.forEach(a->{
|
|
|
JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
|
serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
serverImg.setCreateTime(DateUtils.getNowDate());
|
|
|
- serverImg.setServerId(information.getId());
|
|
|
+ serverImg.setServerId(entity.getId());
|
|
|
serverImg.setImgUrl(a);
|
|
|
imgList.add(serverImg);
|
|
|
});
|