package com.xiaoniu.websystem.controller.assete;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.xiaoniu.websystem.entity.StorLocation;
import com.xiaoniu.websystem.service.StorageService;
//库位
@Controller
@RequestMapping("/location")
public class StorageController {
private final static Log log = LogFactory.getLog(StorageController.class);
@Autowired
private StorageService storageservice;
@RequestMapping("/locationHome")
public ModelAndView locationhome(HttpServletRequest request) {
// 指定表示层
ModelAndView model = new ModelAndView("/assetsManagement/location");
// 获取所有库位
List<StorLocation> locationlist = storageservice.getAll();
// 数据
model.addObject("locationlist", locationlist);
return model;
}
@SuppressWarnings("finally")
@RequestMapping("/del")
public String delclcation(String kid, HttpServletRequest request) {
try {
String str = storageservice.dellocation(kid);
request.setAttribute("InfoMessage", str);
return "Redirect:/location/locationHome";
} catch (Exception e) {
e.printStackTrace();
request.setAttribute("InfoMessage",
"删除信息失败!具体异常信息:" + e.getMessage());
} finally {
return "/assetsManagement/location";
}
}
现在需要返回到查询方法