首页>代码>基于Spring Boot+Spring Data Jpa+apache shiro+easyui+bootstrap开发的电影推酷网站源码>/src/main/java/com/java1234/controller/admin/WebSiteInfoAdminController.java
package com.java1234.controller.admin;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.java1234.entity.WebSiteInfo;
import com.java1234.init.InitSystem;
import com.java1234.service.WebSiteInfoService;

/**
 * 电影动态信息Controller类
 * @author Administrator
 *
 */
@RestController
@RequestMapping(value = "/admin/webSiteInfo")
public class WebSiteInfoAdminController {

	@Resource
	private WebSiteInfoService webSiteInfoService;
	
	@Resource
	private InitSystem initSystem;
	
	/**
	 * 分页查询电影动态信息
	 * @param page
	 * @param rows
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping("/list")
	public Map<String,Object> list(WebSiteInfo webSiteInfo,@RequestParam(value="page",required=false)Integer page,@RequestParam(value="rows",required=false)Integer rows)throws Exception{
		List<WebSiteInfo> webSiteInfoList=webSiteInfoService.list(webSiteInfo,page,rows);
		Long total=webSiteInfoService.getCount(webSiteInfo);
		Map<String, Object> resultMap = new HashMap<>();
		resultMap.put("rows", webSiteInfoList);
		resultMap.put("total", total);
		return resultMap;
	}
	
	/**
	 * 添加网站动态信息
	 * @param link
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping("/save")
	public Map<String,Object> save(WebSiteInfo webSiteInfo,HttpServletRequest request)throws Exception{
		webSiteInfo.setPublishDate(new Date());
		Map<String, Object> resultMap = new HashMap<>();
		webSiteInfoService.save(webSiteInfo);
		initSystem.loadData(request.getServletContext());
		resultMap.put("success", true);
		return resultMap;
	}
	
	
	/**
	 * 删除电影动态信息
	 * @param ids
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping("/delete")
	public Map<String,Object> delete(@RequestParam(value="ids")String ids,HttpServletRequest request)throws Exception{
		String []idsStr=ids.split(",");
		Map<String, Object> resultMap = new HashMap<>();
		for(int i=0;i<idsStr.length;i++){
			webSiteInfoService.delete(Integer.parseInt(idsStr[i]));				
		}
		initSystem.loadData(request.getServletContext());
		resultMap.put("success", true);
		return resultMap;
	}
}
最近下载更多
admin_z  LV22 2023年12月26日
huyuxin  LV3 2023年12月10日
chj173  LV1 2023年5月30日
qiangmin1223  LV11 2023年4月22日
计算机暴龙战士  LV16 2023年4月2日
admin115  LV6 2022年11月19日
1025490081  LV2 2022年11月7日
testuser1234567  LV24 2022年6月30日
877549024  LV8 2022年4月21日
AlanLi  LV18 2022年4月8日
最近浏览更多
wyyz5211314  LV4 昨天
暂无贡献等级
Denck1111 3月27日
暂无贡献等级
zolscy  LV12 3月24日
ming_123_9715  LV23 3月8日
暂无贡献等级
fzlzxc  LV10 1月23日
小草12345 2023年12月26日
暂无贡献等级
pangzhihui  LV12 2023年12月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友