public class ItemInfo {
private Integer id;
private String username;
private String password;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ItemInfo(Integer id, String username, String password) {
super();
this.id = id;
this.username = username;
this.password = password;
}
}
ItemMapper.java
public interface ItemMapper {
List selectAll(ItemInfo itemInfo);
void deleteById(Integer id);
void saveItem(ItemInfo itemInfo);
void updateItem(ItemInfo itemInfo);
ItemInfo selectItemInfoById(Integer id);
}
ItemMapper.xml(代码第五行要引入刚才ItemMapper.java的位置)
delete from user where id=#{id}
insert into user values(#{id},#{username}, #{password});
update user
username = #{username},password = #{password}
where id = #{id}
ItemService.java
public interface ItemService {
List selectAll(ItemInfo itemInfo);
void deleteById(Integer id);
void saveItem(ItemInfo itemInfo);
void updateItem(ItemInfo itemInfo);
ItemInfo selectItemInfoById(Integer id);
}
ItemServicelmpl.java
@Service
public class ItemServicelmpl implements ItemService {
@Autowired
private ItemMapper itemMapper;
public List selectAll(ItemInfo itemInfo) {
return itemMapper.selectAll(itemInfo);
}
public void deleteById(Integer id) {
itemMapper.deleteById(id);
}
public void saveItem(ItemInfo itemInfo) {
itemMapper.saveItem(itemInfo);
}
public void updateItem(ItemInfo itemInfo) {
itemMapper.updateItem(itemInfo);
}
public ItemInfo selectItemInfoById(Integer id) {
return itemMapper.selectItemInfoById(id);
}
}
ItemController.java
@Controller
@RequestMapping("/admin/items")
public class ItemController {
@Autowired
private ItemService itemService;
// 显示所有列表
@RequestMapping("allList.do")
public String selectAll(Model model,ItemInfo itemInfo){
List itemList=itemService.selectAll(itemInfo);
model.addAttribute("itemList", itemList);
return "item_list";
}
// 删除
@RequestMapping("delete.do")
public String delete(Integer id){
itemService.deleteById(id);
return "forward:allList.do";
}
// 添加
@RequestMapping("save.do")
public String save(ItemInfo itemInfo){
itemService.saveItem(itemInfo);
return "forward:allList.do";
}
// 修改
@RequestMapping("update.do")
public String update(ItemInfo itemInfo){
itemService.updateItem(itemInfo);
return "forward:allList.do";
}
// 编辑 回显数据
@RequestMapping("edit.do")
@ResponseBody
public ItemInfo edit(Integer id) {
return itemService.selectItemInfoById(id);
}
}
item_list.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Insert title here
1 svn回退版本
1)在window中选择log,根据想要回退的内容,选择revert this version或revert chanages from this version
两者的区别:
revert this version:表示回退到当前版本(该版本后的版本全部作废)
revert chanages from this versio
<!--javascript取当月最后一天-->
<script language=javascript>
var current = new Date();
var year = current.getYear();
var month = current.getMonth();
showMonthLastDay(year, mont
public class MyStack {
private long[] arr;
private int top;
public MyStack() {
arr = new long[10];
top = -1;
}
public MyStack(int maxsize) {
arr = new long[maxsize];
top
Binary search needs an ordered array so that it can use array indexing to dramatically reduce the number of compares required for each search, using the classic and venerable binary search algori