package com.springmvc.entity;
import java.io.Serializable;
/**
* Created by Vitelon on 2017-03-30
* 用户实体类.
*/
public class User implements Serializable {
private static final long serialVersionUID = 1L;
/**用户ID*/
private String id;
/**用户名*/
private String username;
/**密码*/
private String password;
/**姓名*/
private String sex;
public User() {
}
public User(String id, String username, String password, String sex) {
this.id = id;
this.username = username;
this.password = password;
this.sex = sex;
}
public String getId() {
return id;
}
public void setId(String 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 String getSex() {
return sex;
}
public void setSex(String name) {
this.sex = sex;
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
", sex='" + sex + '\'' +
'}';
}
}
dao接口:
package com.springmvc.dao;
import com.springmvc.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by Vitelon on 2017-03-30
* 用户dao接口.
*/
@Repository("UserDao")
public interface UserDao {
/**
* Created by Vitelon on 2017-03-22
* 根据用户名和密码查询用户
* @param username
* @param password
* @return
*/
public User findByUsernameAndPwd(@Param("username") String username, @Param("password") String password);
/**
* Created by Vitelon on 2017-03-30
* 获取用户
* @return
*/
public List find(User User);
/**
* Created by Vitelon on 2017-03-30
* 新增
* @param User
*/
public void add(User User);
/**
* Created by Vitelon on 2017-03-30
* 修改
* @param User
*/
public void update(User User);
/**
* Created by Vitelon on 2017-03-30
* 删除
* @param id
*/
public void delete(String id);
}
mapper配置文件:
t.id,
t.username,
t.password,
t.sex,
service接口:
package com.springmvc.service;
import com.springmvc.entity.User;
import java.util.List;
/**
* Created by Vitelon on 2017-03-30
* 用户service接口
*/
public interface UserService {
/**
* Created by Vitelon on 2017-03-22
* 根据用户名和密码查询用户
* @param username
* @param password
* @return
*/
public User findByUsernameAndPwd(String username, String password);
/**
* Created by Vitelon on 2017-03-30
* 获取用户
* @return
*/
public List find(User User);
/**
* Created by Vitelon on 2017-03-30
* 新增
* @param User
*/
public void add(User User);
/**
* Created by Vitelon on 2017-03-30
* 修改
* @param User
*/
public void update(User User);
/**
* Created by Vitelon on 2017-03-30
* 删除
* @param id
*/
public void delete(String id);
}
service实现类:
package com.springmvc.service.impl;
import com.springmvc.dao.UserDao;
import com.springmvc.entity.User;
import com.springmvc.service.UserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by Vitelon on 2017-03-30
* 用户service实现类
*/
@Service("UserService")
public class UserServiceImpl implements UserService {
@Resource(name = "UserDao")
private UserDao userDao;
public User findByUsernameAndPwd(String name, String pwd) {
return userDao.findByUsernameAndPwd(name, pwd);
}
public List find(User user){
return userDao.find(user);
}
public void add(User user) {
userDao.add(user);
}
public void update(User user) {
userDao.update(user);
}
public void delete(String id) {
userDao.delete(id);
}
}
#include<iostream>
#include<cassert>
using namespace std;
template<class T, int SIZE = 50>
class Stack{
private:
T list[SIZE];//数组存放栈的元素
int top;//栈顶位置
public:
Stack(
Gson提供了丰富的预定义类型适配器,在对象和JSON串之间进行序列化和反序列化时,指定对象和字符串之间的转换方式,
DateTypeAdapter
public final class DateTypeAdapter extends TypeAdapter<Date> {
public static final TypeAdapterFacto