package com.example.system.entity;
import java.util.Date;
/**
* 用户信息对象
* @author xutao
* 创建时间:2020-12-8 上午13:59:23
*/public class sysUser{
public int id;//id
public String username;//用户名
public String loginname;//登录账号
public String password;//密码
public int areaid;//区域编码
public int orgid;//机构id
public String sex;//性别
public String email;//邮箱
public int phone;//手机号码
public String ipaddress;//IP地址
public int errorcount;//错误计数
public Date lastlogintime;//上次登录时间
public Date passwdinvaltime;//密码失效时间
public Date locktime;//锁定时间
public int delflag;//删除标识
public Date createtime;//创建时间
public String createuser;//创建用户
public Date updatetime;//更新时间
public String updateuser;//更新用户
public int groupid;//组别id
public int roleid;//角色id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAreaid() {
return areaid;
}
public void setAreaid(int areaid) {
this.areaid = areaid;
}
public int getOrgid() {
return orgid;
}
public void setOrgid(int orgid) {
this.orgid = orgid;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getPhone() {
return phone;
}
public void setPhone(int phone) {
this.phone = phone;
}
public String getIpaddress() {
return ipaddress;
}
public void setIpaddress(String ipaddress) {
this.ipaddress = ipaddress;
}
public int getErrorcount() {
return errorcount;
}
public void setErrorcount(int errorcount) {
this.errorcount = errorcount;
}
public Date getLastlogintime() {
return lastlogintime;
}
public void setLastlogintime(Date lastlogintime) {
this.lastlogintime = lastlogintime;
}
public Date getPasswdinvaltime() {
return passwdinvaltime;
}
public void setPasswdinvaltime(Date passwdinvaltime) {
this.passwdinvaltime = passwdinvaltime;
}
public Date getLocktime() {
return locktime;
}
public void setLocktime(Date locktime) {
this.locktime = locktime;
}
public int getDelflag() {
return delflag;
}
public void setDelflag(int delflag) {
this.delflag = delflag;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public String getCreateuser() {
return createuser;
}
public void setCreateuser(String createuser) {
this.createuser = createuser;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public String getUpdateuser() {
return updateuser;
}
public void setUpdateuser(String updateuser) {
this.updateuser = updateuser;
}
public int getGroupid() {
return groupid;
}
public void setGroupid(int groupid) {
this.groupid = groupid;
}
public int getRoleid() {
return roleid;
}
public void setRoleid(int roleid) {
this.roleid = roleid;
}
}
持久层接口dao
package com.example.system.dao;
import com.example.system.entity.sysUser;
/**
* 登录功能dao接口
* @author lmwang
* 创建时间:2020-12-9 下午16:53:20
*/
public interface loginDao {
//登录验证账号密码
public Object login(String loginName,String password);
//首次登录强制修改密码/重置密码(管理员权限)
public void updatePd(int id,String password);
//登录成功后获取用户唯一id
public Object queryById(String loginName);
//通过唯一id获取用户对象
public sysUser userById(int id);
//用户修改个人信息
public void updateSysUser(sysUser user);
}
dao映射层daoimpl,继承dao接口
package com.example.system.dao.impl;
import com.example.system.dao.loginDao;
import com.example.system.entity.sysUser;
import com.example.system.util.JdbcDaoSupport4mysql;
import com.example.system.util.MysqlDb;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.stereotype.Repository;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
@MysqlDb
@Repository
public class loginDaoImpl extends JdbcDaoSupport4mysql implements loginDao {
@Override
public Object login(String loginName, String password) {
String sql="select password from sys_user where login_name='"+loginName+"'";
ArrayList
业务层service
package com.example.system.service;
import com.example.system.dao.loginDao;
import com.example.system.dao.sysLoginLogDao;
import com.example.system.entity.sysUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class loginService {
@Resource
private loginDao logindao;
@Resource
private sysLoginLogDao sysLoginLogDao;
//登录验证
public boolean login(String loginName,String password){
Object pd= logindao.login(loginName,password);
//密码验证
if(pd.equals(password)){
//登录成功
return true;
}
return false;
}
//修改/重置密码
public void updatePd(int id[],String password){
//password为null时,默认为重置标识reset,执行密码重置操作
if(null==password){
password="000000";
}
for (int i : id) {
logindao.updatePd(i,password);
}
}
//修改用户信息
public void updateSysUser(sysUser user){
logindao.updateSysUser(user);
}
//通过唯一id获取用户详情
public sysUser queryUser(int id){
return logindao.userById(id);
}
//查询登录用户的唯一id
public int queryUserById(String loginName){
return Integer.parseInt(logindao.queryById(loginName).toString());
}
}
今天和同事争论一问题,关于静态变量与非静态变量的初始化顺序,谁先谁后,最终想整理出来!测试代码:
import java.util.Map;
public class T {
public static T t = new T();
private Map map = new HashMap();
public T(){
System.out.println(&quo
完整命令
CREATE DATABASE mynewdb USER SYS IDENTIFIED BY sys_password USER SYSTEM IDENTIFIED BY system_password LOGFILE GROUP 1 ('/u01/logs/my/redo01a.log','/u02/logs/m
多线程并发使用同一个channel
java.nio.BufferOverflowException: null
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183) ~[na:1.7.0_60-ea]
at java.nio.ByteBuffer.put(ByteBuffer.java:832) ~[na:1.7.0_60-ea]