提交 f5e5565f 作者: panda 提交者: 余乾开

行业新闻校验去除,新增删除接口

上级 690a7f7c
......@@ -50,6 +50,13 @@ public class IndustryNewsController extends BaseController {
return industryNewsService.details(id);
}
@ApiOperation(value = "删除-行业新闻")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@GetMapping("deleteIndustryNews")
public ResultBody deleteIndustryNews(@RequestParam Integer id){
return industryNewsService.deleteIndustryNews(id);
}
@ApiOperation(value = "后台-新闻列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = IndustryNewsDTO.class) })
@PostMapping("backgroundListNewsPage")
......
......@@ -31,6 +31,7 @@ public class IndustryNewsDO implements Serializable {
private Date updateTime;
@ApiModelProperty(value = "来源")
private String origin;
private Integer isDeleted;
public IndustryNewsDTO buildIndustryNewsDTO(){
return IndustryNewsDTO.builder().id(id).newsTitle(newsTitle).newsAuthor(newsAuthor).userAccountId(userAccountId).surfaceImg(surfaceImg).
......
......@@ -38,7 +38,14 @@ public interface IndustryNewsService {
ResultBody upDateIndustryNews(IndustryNewsVO industryNewsVO, Integer userAccountId);
/**
* 新闻删除
*/
ResultBody deleteIndustryNews(Integer id);
/**
* 新闻列表-后台
*/
ResultBody<IndustryNewsDTO> backgroundListNewsPage(IndustryNewsQO industryNewsQO, HttpServletRequest request);
}
......@@ -72,12 +72,14 @@ public class IndustryNewsServiceImpl implements IndustryNewsService {
@Override
public ResultBody upDateIndustryNews(IndustryNewsVO param, Integer userAccountId) {
IndustryNewsDO industryNewsDO = IndustryNewsDO.builder().newsTitle(param.getNewsTitle()).build();
Integer count = industryNewsDao.count(industryNewsDO);
if(count>0){
return ResultBody.error(ResultEnum.INDUSTRY_NEWS_TITLE_EXISTS);
}
industryNewsDO = new IndustryNewsDO(param.getId(), param.getNewsTitle(), param.getNewsAuthor(), userAccountId, param.getSurfaceImg(), param.getNewsContents(), param.getOrigin());
IndustryNewsDO industryNewsDO = new IndustryNewsDO(param.getId(), param.getNewsTitle(), param.getNewsAuthor(), userAccountId, param.getSurfaceImg(), param.getNewsContents(), param.getOrigin());
industryNewsDao.update(industryNewsDO);
return ResultBody.success();
}
@Override
public ResultBody deleteIndustryNews(Integer id) {
IndustryNewsDO industryNewsDO = IndustryNewsDO.builder().id(id).isDeleted(1).build();
industryNewsDao.update(industryNewsDO);
return ResultBody.success();
}
......
......@@ -112,6 +112,9 @@
<if test="origin != null and origin != ''">
origin = #{origin},
</if>
<if test="isDeleted !=null">
is_deleted = #{isDeleted},
</if>
</set>
where is_deleted = 0 and id = #{id}
</update>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论