package com.easyui.model;
import java.util.Date;
public class User {
private Integer userId;
private String loginname;
private String username;
private String password;
private String rights;
private Integer status;
private Integer roleId;
private Date lastLogin;
private Date lastLoginStart;
private Date lastLoginEnd;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
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 Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getRights() {
return rights;
}
public void setRights(String rights) {
this.rights = rights;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Date getLastLogin() {
return lastLogin;
}
public void setLastLogin(Date lastLogin) {
this.lastLogin = lastLogin;
}
public Date getLastLoginStart() {
return lastLoginStart;
}
public void setLastLoginStart(Date lastLoginStart) {
this.lastLoginStart = lastLoginStart;
}
public Date getLastLoginEnd() {
return lastLoginEnd;
}
public void setLastLoginEnd(Date lastLoginEnd) {
this.lastLoginEnd = lastLoginEnd;
}
}
UserMapper.xml
UserMapper.java
package com.easyui.mapper;
import java.util.List;
import java.util.Map;
import com.easyui.model.User;
public interface UserMapper extends BaseMapper{
//查询所有用户
List selAllUser();
//查询所有用户数量
public int selAllUserNum();
//根据根据用户名和密码来判断该用户是否存在
public User selUser(User user);
}
BaseMapper.java 里面不声明任何方法
7、这些建完之后,需要创建业务层service
UserService.java
package com.easyui.service;
import java.util.List;
import java.util.Map;
import com.easyui.model.User;
public interface UserService {
//用户列表
public List selAllUser();
//根据用户名和密码来查询该用户
public User selUser(String loginname,String password);
}
UserServiceImpl.java
package com.easyui.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.easyui.mapper.UserMapper;
import com.easyui.model.User;
import com.easyui.service.UserService;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public List selAllUser() {
return userMapper.selAllUser();
}
@Override
public User selUser(String loginname, String password) {
User user=new User();
user.setLoginname(loginname);
user.setPassword(password);
return userMapper.selUser(user);
}
}
package com.easyui.controller;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.easyui.util.Const;
/**
* @author Administrator
* 验证码生成类
*/
@Controller
@RequestMapping("/code")
public class SecCodeController {
@RequestMapping
public void generate(HttpSession session,HttpServletResponse response){
ByteArrayOutputStream output = new ByteArrayOutputStream();
String code = drawImg(output);
session.setAttribute(Const.SESSION_SECURITY_CODE, code); //放入session
//System.out.println(session.getAttribute(Const.SESSION_SECURITY_CODE));
try {
ServletOutputStream out = response.getOutputStream();
output.writeTo(out);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private String drawImg(ByteArrayOutputStream output){
String code = "";
for(int i=0; i<4; i++){
code += randomChar();
}
int width = 70;
int height = 25;
BufferedImage bi = new BufferedImage(width,height,BufferedImage.TYPE_3BYTE_BGR);
Font font = new Font("Times New Roman",Font.PLAIN,20);
Graphics2D g = bi.createGraphics();
g.setFont(font);
Color color = new Color(66,2,82);
g.setColor(color);
g.setBackground(new Color(226,226,240));
g.clearRect(0, 0, width, height);
FontRenderContext context = g.getFontRenderContext();
Rectangle2D bounds = font.getStringBounds(code, context);
double x = (width - bounds.getWidth()) / 2;
double y = (height - bounds.getHeight()) / 2;
double ascent = bounds.getY();
double baseY = y - ascent;
g.drawString(code, (int)x, (int)baseY);
g.dispose();
try {
ImageIO.write(bi, "jpg", output);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return code;
}
private char randomChar(){
Random r = new Random();
String s = "ABCDEFGHJKLMNPRSTUVWXYZ0123456789";
return s.charAt(r.nextInt(s.length()));
}
}
其中用到了一个工具类:Const.java
package com.easyui.util;
import org.springframework.context.ApplicationContext;
public class Const {
public static final String SESSION_SECURITY_CODE = "sessionSecCode";
}
只需要在调用该对象合适(比如下列的setStyles)的方法后让该方法返回该对象(通过this 因为一旦一个函数称为一个对象方法的话那么在这个方法内部this(结合下面的setStyles)指向这个对象)
function create(type){
var element=document.createElement(type);
//this=element;
JAX-WS
SOAP Version 1.2 Part 0: Primer (Second Edition)
SOAP Version 1.2 Part 1: Messaging Framework (Second Edition)
SOAP Version 1.2 Part 2: Adjuncts (Second Edition)
Which style of WSDL
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml