Compare commits
4 Commits
feature-da
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
b2cec49696 | 3 years ago |
|
|
e41bcdd320 | 3 years ago |
|
|
9f431f7138 | 3 years ago |
|
|
79d1778bfb | 3 years ago |
@ -1,279 +0,0 @@
|
||||
# Java
|
||||
package com.czmec.action;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.czmec.bean.FoundGoodsBean;
|
||||
import com.czmec.bean.GoodsByNameBean;
|
||||
import com.czmec.bean.LostGoodsBean;
|
||||
import com.czmec.bean.UserBean;
|
||||
import com.czmec.service.AdminService;
|
||||
import com.czmec.service.FoundService;
|
||||
import com.czmec.service.LostService;
|
||||
import com.czmec.service.UserService;
|
||||
|
||||
//管理员操作
|
||||
@Controller
|
||||
@RequestMapping("AdminAction")
|
||||
public class AdminAction {
|
||||
|
||||
@Resource(name = "adminService")
|
||||
AdminService admiservice;
|
||||
|
||||
@Resource(name = "lostService")
|
||||
LostService lostservice;
|
||||
|
||||
@Resource(name = "foundService")
|
||||
FoundService foundservice;
|
||||
|
||||
@Resource(name = "userService")
|
||||
private UserService userservice;
|
||||
|
||||
@RequestMapping("adminindex")
|
||||
public String Adminindex(HttpServletRequest req) {
|
||||
List<UserBean> list = admiservice.SelectUser();
|
||||
req.setAttribute("listUser", list);
|
||||
return "/admin/UserList";
|
||||
}
|
||||
|
||||
@RequestMapping("test")
|
||||
public String test() {
|
||||
return "/admin/test";
|
||||
}
|
||||
|
||||
// 获取寻物信息列表
|
||||
/*@RequestMapping("lostlist")
|
||||
@ResponseBody
|
||||
public List<LostGoodsBean> LostList() {
|
||||
List<LostGoodsBean> list = lostservice.SelectLostGoods();
|
||||
return list;
|
||||
}*/
|
||||
|
||||
// 管理员添加用户
|
||||
@RequestMapping("AddUser")
|
||||
public String AddUser() {
|
||||
return "/admin/AddUser";
|
||||
}
|
||||
|
||||
// 管理员添加用户具体实现
|
||||
@RequestMapping("AddUserImpl")
|
||||
public String AddUserImpl(UserBean user, HttpServletRequest req) {
|
||||
user.setRole(1);
|
||||
int i = userservice.AddUser(user);
|
||||
if (i > 0) {
|
||||
req.setAttribute("message", "添加成功");
|
||||
} else {
|
||||
req.setAttribute("message", "添加失败");
|
||||
}
|
||||
List<UserBean> list = admiservice.SelectUser();
|
||||
req.setAttribute("listUser", list);
|
||||
|
||||
return "/admin/UserList";
|
||||
}
|
||||
|
||||
// 管理员添加管理具体实现
|
||||
@RequestMapping("AddAdminImpl")
|
||||
public String AddAdminImpl(UserBean user, HttpServletRequest req) {
|
||||
user.setRole(0);
|
||||
int i = userservice.AddUser(user);
|
||||
if (i > 0) {
|
||||
req.setAttribute("message", "添加成功");
|
||||
} else {
|
||||
req.setAttribute("message", "添加失败");
|
||||
}
|
||||
List<UserBean> list = admiservice.SelectUser();
|
||||
req.setAttribute("listUser", list);
|
||||
return "/admin/UserList";
|
||||
}
|
||||
|
||||
// 管理员添加招领
|
||||
@RequestMapping("AddFound")
|
||||
public String AddFound() {
|
||||
return "/admin/AddFound";
|
||||
}
|
||||
|
||||
// 添加拾物列表
|
||||
@RequestMapping("AddFoundImpl")
|
||||
public String AddFoundImpl(FoundGoodsBean foundgoodsbean, HttpServletRequest req) {
|
||||
int i = foundservice.AddFoundGoods(foundgoodsbean);
|
||||
if (i > 0) {
|
||||
req.setAttribute("message", "添加成功");
|
||||
} else {
|
||||
req.setAttribute("message", "添加失败");
|
||||
}
|
||||
List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
|
||||
req.setAttribute("foundList", list);
|
||||
return "/admin/FoundList";
|
||||
}
|
||||
|
||||
// 添加一条丢物信息
|
||||
@RequestMapping("AddLost")
|
||||
public String AddLost() {
|
||||
return "/admin/AddLost";
|
||||
}
|
||||
|
||||
// 添加丢物列表
|
||||
@RequestMapping("AddLostImpl")
|
||||
public String AddLostImpl(LostGoodsBean losetgoodsbean, HttpServletRequest req) {
|
||||
int i = lostservice.AddLostGoods(losetgoodsbean);
|
||||
if (i > 0) {
|
||||
req.setAttribute("message", "添加成功");
|
||||
} else {
|
||||
req.setAttribute("message", "添加失败");
|
||||
}
|
||||
List<LostGoodsBean> list = lostservice.SelectLostGoods();
|
||||
req.setAttribute("lostlist", list);
|
||||
return "/admin/LostList";
|
||||
}
|
||||
|
||||
// 管理员链接到招领列表
|
||||
@RequestMapping("FoundList")
|
||||
public String FoundList(HttpServletRequest req) {
|
||||
List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
|
||||
req.setAttribute("foundList", list);
|
||||
return "/admin/FoundList";
|
||||
}
|
||||
|
||||
// 管理员链接到寻物列表
|
||||
@RequestMapping("LostList")
|
||||
public String LostList(HttpServletRequest req) {
|
||||
List<LostGoodsBean> list = lostservice.SelectLostGoods();
|
||||
req.setAttribute("lostlist", list);
|
||||
return "/admin/LostList";
|
||||
}
|
||||
|
||||
// 个人信息修改
|
||||
@RequestMapping("UpdatUser")
|
||||
public String UpdatUser(HttpSession session) {
|
||||
if (((UserBean)session.getAttribute("user")).getRole()==0) {
|
||||
return "/admin/UpdatUser";
|
||||
}
|
||||
else {
|
||||
return "UpdatUser";
|
||||
}
|
||||
}
|
||||
// 个人信息修改
|
||||
@RequestMapping("UpdatUserImpl")
|
||||
public String UpdatUserImpl(UserBean user,HttpServletRequest req) {
|
||||
int i=userservice.UpdateUser(user);
|
||||
if (i > 0) {
|
||||
req.setAttribute("message", "修改成功");
|
||||
} else {
|
||||
req.setAttribute("message", "修改失败");
|
||||
}
|
||||
return "/admin/UpdatUser";
|
||||
}
|
||||
// 添加管理员
|
||||
@RequestMapping("AddAdmin")
|
||||
public String AddAdmin() {
|
||||
return "/admin/AddAdmin";
|
||||
}
|
||||
|
||||
//删除用户
|
||||
@RequestMapping("DelUser")
|
||||
public String DelUser(UserBean user,HttpServletRequest req){
|
||||
int i=userservice.DelUser(user);
|
||||
if (i > 0) {
|
||||
req.setAttribute("Dmessage", "删除成功");
|
||||
} else {
|
||||
req.setAttribute("Dmessage", "删除失败");
|
||||
}
|
||||
List<UserBean> list = admiservice.SelectUser();
|
||||
req.setAttribute("listUser", list);
|
||||
return "/admin/UserList";
|
||||
}
|
||||
|
||||
//删除招领信息
|
||||
@RequestMapping("DelFoundGoods")
|
||||
public String DelFoundGoods(FoundGoodsBean foundgoodsbean,HttpServletRequest req){
|
||||
int i=foundservice.DelFoundGoods(foundgoodsbean);
|
||||
if (i > 0) {
|
||||
req.setAttribute("Dmessage", "删除成功");
|
||||
} else {
|
||||
req.setAttribute("Dmessage", "删除失败");
|
||||
}
|
||||
List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
|
||||
req.setAttribute("foundList", list);
|
||||
return "/admin/FoundList";
|
||||
}
|
||||
|
||||
//删除寻物信息
|
||||
@RequestMapping("DelLostGoods")
|
||||
public String DelLostGoods(LostGoodsBean lostgoodsbean,HttpServletRequest req){
|
||||
int i=lostservice.DelLostGoods(lostgoodsbean);
|
||||
if (i > 0) {
|
||||
req.setAttribute("Dmessage", "删除成功");
|
||||
} else {
|
||||
req.setAttribute("Dmessage", "删除失败");
|
||||
}
|
||||
List<LostGoodsBean> list = lostservice.SelectLostGoods();
|
||||
req.setAttribute("lostlist", list);
|
||||
return "/admin/LostList";
|
||||
}
|
||||
|
||||
//根据物品名字模糊查询
|
||||
@RequestMapping("SelectFoundGoodsByName")
|
||||
public String SelectFoundGoodsByName(@Param("foundName")String foundName,HttpServletRequest request) throws UnsupportedEncodingException{
|
||||
foundName = java.net.URLDecoder.decode(foundName,"UTF-8");
|
||||
GoodsByNameBean goodsbyNameBean=new GoodsByNameBean();
|
||||
goodsbyNameBean.setFoundName(foundName);
|
||||
List<GoodsByNameBean> list=foundservice.SelectFoundGoodsByName(goodsbyNameBean);
|
||||
request.setAttribute("goodsByName", list);
|
||||
return "admin/SelectByNameList";
|
||||
}
|
||||
//根据ID查询个人信息
|
||||
@RequestMapping("selectUserById")
|
||||
public String selectUserById(UserBean user,HttpServletRequest request){
|
||||
List<UserBean> list=admiservice.SelectUserById(user);
|
||||
request.setAttribute("geren",list);
|
||||
return "admin/IdUser";
|
||||
}
|
||||
|
||||
//更新一条招领记录
|
||||
@RequestMapping("updatafound")
|
||||
public String UpdataFoundList(@Param("foundId")int foundId,HttpServletRequest request){
|
||||
FoundGoodsBean fBean=foundservice.SelectFoundById(foundId);
|
||||
request.setAttribute("fBean", fBean);
|
||||
return "admin/AddFound";
|
||||
}
|
||||
|
||||
//更新一条招领记录实现
|
||||
@RequestMapping("updatafoundImpl")
|
||||
public String updtafoundImpl(FoundGoodsBean foundgoodsbean,HttpServletRequest req){
|
||||
foundservice.UpdateFoundGoods(foundgoodsbean);
|
||||
List<FoundGoodsBean> list = foundservice.SelectFoundGoods();
|
||||
req.setAttribute("foundList", list);
|
||||
return "/admin/FoundList";
|
||||
}
|
||||
|
||||
|
||||
//更新一条寻物记录
|
||||
@RequestMapping("updatalost")
|
||||
public String UpdataLostList(@Param("lostId")int lostId,HttpServletRequest request){
|
||||
LostGoodsBean lBean=lostservice.SelectLostById(lostId);
|
||||
request.setAttribute("lBean", lBean);
|
||||
return "admin/AddLost";
|
||||
}
|
||||
|
||||
//更新一条寻物实现
|
||||
@RequestMapping("updatalostImpl")
|
||||
public String updtalostImpl(LostGoodsBean lostGoodsBean,HttpServletRequest req){
|
||||
lostservice.UpdateLostGoods(lostGoodsBean);
|
||||
|
||||
List<LostGoodsBean> list = lostservice.SelectLostGoods();
|
||||
req.setAttribute("lostlist", list);
|
||||
return "/admin/LostList";
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue