@Controller 将当前修饰的类注入SpringBoot IOC容器,使得从该类所在的项目跑起来的过程中,这个类就被实例化。
@Override
public JSONObject insert(ArticlePO articlePO) {
if (ObjectUtil.isNotEmpty(articlePO)){
// 如果用户没上传封面图,则使用默认封面图
if (Objects.equals(articlePO.getArticle_img(), ""))
articlePO.setArticle_img("/frontSystem/article/img/77c6a7efce1b9d1619f2ea1b055cdb848c546425.jpg");
Integer res = articleMapper.insert(articlePO);
if (res>0)
return ResponseUtil.getResponse(ResponseType.INSERT_SUCCESS_ID,ResponseType.INSERT_SUCCESS_MESSAGES,articlePO.getId());
else return ResponseUtil.getResponse(ResponseType.INSERT_FAIL_ID,ResponseType.INSERT_FAIL_MESSAGES);
}
return ResponseUtil.getResponse(ResponseType.NULL_POINT_ERROR_ID,ResponseType.NULL_POINT_ERROR_MESSAGES);
}