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

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

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