src/com/sxt/sys/controller/NewsController.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.sxt.sys.controller;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sxt.sys.domain.News;
import com.sxt.sys.domain.User;
import com.sxt.sys.service.NewsService;
import com.sxt.sys.utils.DataGridView;
import com.sxt.sys.utils.ResultObj;
import com.sxt.sys.utils.WebUtils;
import com.sxt.sys.vo.NewsVo;
/**
* 公告管理控制器
*
* @author LJH
*
*/
@RestController
@RequestMapping("news")
public class NewsController {
@Autowired
private NewsService newsService;
/**
* 加载公告列表返回DataGridView
*/
@RequestMapping("loadAllNews")
public DataGridView loadAllNews(NewsVo newsVo) {
return this.newsService.queryAllNews(newsVo);
}
/**
* 添加公告
*/
@RequestMapping("addNews")
public ResultObj addNews(NewsVo newsVo) {
try {
newsVo.setCreatetime(new Date());
User user=(User) WebUtils.getHttpSession().getAttribute("user");
newsVo.setOpername(user.getRealname());
this.newsService.addNews(newsVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 修改公告
*/
@RequestMapping("updateNews")
public ResultObj updateNews(NewsVo newsVo) {
try {
this.newsService.updateNews(newsVo);
后面还有 44 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。