动态管理
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.content.ContentAddDto;
|
||||
import com.cool.store.dto.content.ContentQueryListDto;
|
||||
import com.cool.store.dto.content.ContentUpdateDto;
|
||||
import com.cool.store.entity.HyContentInfoDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ContentService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto
|
||||
* @return contentId 新增动态id
|
||||
*/
|
||||
String addNews(ContentAddDto dto);
|
||||
|
||||
/**
|
||||
* 删除动态
|
||||
* @param contentId
|
||||
*/
|
||||
void deleteContent(String contentId);
|
||||
|
||||
/**
|
||||
* 更新动态信息
|
||||
* @param dto
|
||||
*/
|
||||
void updateContent(ContentUpdateDto dto);
|
||||
|
||||
/**
|
||||
* 查询动态列表
|
||||
*/
|
||||
List<HyContentInfoDO> queryContentList(ContentQueryListDto dto);
|
||||
|
||||
/**
|
||||
* 查询动态详情
|
||||
* @param contentId
|
||||
* @return
|
||||
*/
|
||||
HyContentInfoDO queryContentInfo(String contentId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.cool.store.dao.ContentDAO;
|
||||
import com.cool.store.dto.content.ContentAddDto;
|
||||
import com.cool.store.dto.content.ContentQueryListDto;
|
||||
import com.cool.store.dto.content.ContentUpdateDto;
|
||||
import com.cool.store.entity.HyContentInfoDO;
|
||||
import com.cool.store.mapper.HyContentInfoMapper;
|
||||
import com.cool.store.service.ContentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ContentServiceImpl implements ContentService {
|
||||
|
||||
@Autowired
|
||||
private ContentDAO contentDAO;
|
||||
|
||||
@Autowired
|
||||
private HyContentInfoMapper contentInfoMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto
|
||||
* @return contentId 新增动态id
|
||||
*/
|
||||
@Override
|
||||
public String addNews(ContentAddDto dto) {
|
||||
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
|
||||
BeanUtil.copyProperties(dto, hyContentInfoDO);
|
||||
hyContentInfoDO.setUpdateUserId(dto.getCreateUserId());
|
||||
return Integer.toString(contentInfoMapper.insertSelective(hyContentInfoDO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除动态
|
||||
* @param contentId
|
||||
*/
|
||||
@Override
|
||||
public void deleteContent(String contentId) {
|
||||
contentInfoMapper.deleteSelective(contentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新动态信息
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void updateContent(ContentUpdateDto dto) {
|
||||
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
|
||||
BeanUtil.copyProperties(dto, hyContentInfoDO);
|
||||
hyContentInfoDO.setId(Long.parseLong(dto.getContentId()));
|
||||
contentInfoMapper.updateByPrimaryKeySelective(hyContentInfoDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询动态列表
|
||||
*/
|
||||
@Override
|
||||
public List<HyContentInfoDO> queryContentList(ContentQueryListDto dto) {
|
||||
return contentInfoMapper.queryContentList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询动态详情
|
||||
* @param contentId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HyContentInfoDO queryContentInfo(String contentId) {
|
||||
return contentInfoMapper.queryContentInfo(contentId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user