Commit f63e986f by ypenglv

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	nafmii-common/src/main/java/org/nafmii/common/utils/JwtUtils.java
#	nafmii-common/src/main/java/org/nafmii/common/vo/AppUser.java
2 parents 58bb8e70 03e8be0d
Showing 22 changed files with 106 additions and 669 deletions
package org.nafmii.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class CenterRole implements Serializable {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "角色名称")
private String rName;
@ApiModelProperty(value = "创建时间")
private Date creatTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "启用禁用 0 启用 1禁用")
private String isEnable;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getrName() {
return rName;
}
public void setrName(String rName) {
this.rName = rName;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getIsEnable() {
return isEnable;
}
public void setIsEnable(String isEnable) {
this.isEnable = isEnable;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", rName=").append(rName);
sb.append(", creatTime=").append(creatTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isEnable=").append(isEnable);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file \ No newline at end of file
package org.nafmii.feignservice; package org.nafmii.feign;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
* @author:zhoujh * @author:zhoujh
* @Function:TODO * @Function:TODO
* @date 2021/4/22 9:04 * @date 2021/4/22 9:04
* @ClassName: * @ClassName:feign调用接口
* @version: * @version:
* @remark: * @remark:
*/ */
......
package org.nafmii.controller; package org.nafmii.user.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.nafmii.service.AppService; import org.nafmii.user.service.AppService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
......
package org.nafmii.controller; package org.nafmii.user.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.nafmii.dto.user.LoginDto; import org.nafmii.user.dto.user.LoginDto;
import org.nafmii.dto.user.RegisterDto; import org.nafmii.user.dto.user.RegisterDto;
import org.nafmii.response.ApiResponse; import org.nafmii.response.ApiResponse;
import org.nafmii.service.UserService; import org.nafmii.user.service.UserService;
import org.nafmii.vo.AppUser; import org.nafmii.user.vo.UserVO;
import org.nafmii.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
package org.nafmii.dto.user; package org.nafmii.user.dto.user;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package org.nafmii.dto.user; package org.nafmii.user.dto.user;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
/** /**
* @author:zhoujh * @author:zhoujh
......
package org.nafmii.mapper.user; package org.nafmii.user.mapper.user;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.nafmii.dto.user.LoginDto; import org.nafmii.user.dto.user.LoginDto;
import org.nafmii.entity.user.AppUser; import org.nafmii.user.po.user.AppUser;
import org.nafmii.entity.user.AppUserExample; import org.nafmii.user.po.user.AppUserExample;
import org.nafmii.vo.UserVO; import org.nafmii.user.vo.UserVO;
import java.util.List; import java.util.List;
@Mapper @Mapper
...@@ -22,9 +22,9 @@ public interface AppUserMapper { ...@@ -22,9 +22,9 @@ public interface AppUserMapper {
List<AppUser> selectByExample(AppUserExample example); List<AppUser> selectByExample(AppUserExample example);
List<UserVO> selectByPassword(LoginDto loginDto); UserVO selectByPassword(LoginDto loginDto);
List<UserVO> selectByPhone(@Param("phone") String phone); UserVO selectByPhone(@Param("phone") String phone);
AppUser selectByPrimaryKey(Long id); AppUser selectByPrimaryKey(Long id);
......
package org.nafmii.entity.user; package org.nafmii.user.po.user;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package org.nafmii.entity.user; package org.nafmii.user.po.user;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
......
package org.nafmii.service; package org.nafmii.user.service;
/** /**
* @author:zhoujh * @author:zhoujh
* @Function:TODO * @Function:TODO
* @date 2021/4/22 9:29 * @date 2021/4/27 9:50
* @ClassName: * @ClassName:
* @version: * @version:
* @remark: * @remark:
*/ */
public interface AppService { public interface AppService {
//test
String search(); String search();
} }
package org.nafmii.service; package org.nafmii.user.service;
import org.nafmii.dto.user.LoginDto;
import org.nafmii.dto.user.RegisterDto;
import org.nafmii.response.ApiResponse; import org.nafmii.response.ApiResponse;
import org.nafmii.vo.UserVO; import org.nafmii.user.dto.user.LoginDto;
import org.nafmii.user.dto.user.RegisterDto;
import org.nafmii.user.vo.UserVO;
/** /**
* @author:zhoujh * @author:zhoujh
* @Function:TODO * @Function:TODO
* @date 2021/4/25 10:20 * @date 2021/4/27 9:53
* @ClassName: * @ClassName:
* @version: * @version:
* @remark: * @remark:
......
package org.nafmii.service.impl; package org.nafmii.user.service.impl;
import org.nafmii.feignservice.AdminService; /**
import org.nafmii.service.AppService; * @author:zhoujh
* @Function:TODO
* @date 2021/4/27 9:51
* @ClassName:
* @version:
* @remark:
*/
import org.nafmii.feign.AdminService;
import org.nafmii.user.service.AppService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package org.nafmii.service.impl; package org.nafmii.user.service.impl;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/27 9:54
* @ClassName:
* @version:
* @remark:
*/
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nafmii.dto.user.LoginDto;
import org.nafmii.dto.user.RegisterDto;
import org.nafmii.entity.user.AppUser;
import org.nafmii.entity.user.AppUserExample;
import org.nafmii.enums.UserEnum; import org.nafmii.enums.UserEnum;
import org.nafmii.exception.BusinessException; import org.nafmii.exception.BusinessException;
import org.nafmii.mapper.user.AppUserMapper;
import org.nafmii.response.ApiResponse; import org.nafmii.response.ApiResponse;
import org.nafmii.service.UserService; import org.nafmii.user.dto.user.LoginDto;
import org.nafmii.user.dto.user.RegisterDto;
import org.nafmii.user.mapper.user.AppUserMapper;
import org.nafmii.user.po.user.AppUser;
import org.nafmii.user.service.UserService;
import org.nafmii.user.vo.UserAndRoleVo;
import org.nafmii.user.vo.UserVO;
import org.nafmii.utils.GuavaUtil; import org.nafmii.utils.GuavaUtil;
import org.nafmii.utils.JwtUtils; import org.nafmii.utils.JwtUtils;
import org.nafmii.utils.SnowFlakeUtil; import org.nafmii.utils.SnowFlakeUtil;
import org.nafmii.vo.UserAndRoleVo;
import org.nafmii.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -36,7 +41,6 @@ import java.util.List; ...@@ -36,7 +41,6 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
@Resource @Resource
private AppUserMapper appUserMapper; private AppUserMapper appUserMapper;
/** /**
...@@ -79,6 +83,11 @@ public class UserServiceImpl implements UserService { ...@@ -79,6 +83,11 @@ public class UserServiceImpl implements UserService {
*/ */
@Override @Override
public ApiResponse register(RegisterDto registerDto) { public ApiResponse register(RegisterDto registerDto) {
//通过手机号查询用户信息
UserVO userVO = appUserMapper.selectByPhone(registerDto.getPhone());
if (null != userVO){
throw new BusinessException("该用户已经注册");
}
//用户实体类 //用户实体类
AppUser appUser = new AppUser(); AppUser appUser = new AppUser();
appUser.setId(SnowFlakeUtil.nextId()); appUser.setId(SnowFlakeUtil.nextId());
...@@ -121,12 +130,12 @@ public class UserServiceImpl implements UserService { ...@@ -121,12 +130,12 @@ public class UserServiceImpl implements UserService {
*/ */
@Override @Override
public ApiResponse<UserVO> userLogin(LoginDto loginDto) { public ApiResponse<UserVO> userLogin(LoginDto loginDto) {
List<UserVO> userVo = new ArrayList<>(); UserVO userVo = new UserVO();
//首先判断登陆方式 //首先判断登陆方式
if (loginDto.getType().equals("0")){ if (loginDto.getType().equals("0")){
//密码登陆 //密码登陆
userVo = appUserMapper.selectByPassword(loginDto); userVo = appUserMapper.selectByPassword(loginDto);
if (userVo.isEmpty()){ if (null == userVo){
throw new BusinessException("请先注册"); throw new BusinessException("请先注册");
} }
}else{ }else{
...@@ -140,10 +149,14 @@ public class UserServiceImpl implements UserService { ...@@ -140,10 +149,14 @@ public class UserServiceImpl implements UserService {
throw new BusinessException("验证码错误请重新输入"); throw new BusinessException("验证码错误请重新输入");
} }
userVo = appUserMapper.selectByPhone(loginDto.getPhone()); userVo = appUserMapper.selectByPhone(loginDto.getPhone());
if (userVo.isEmpty()){ if (null == userVo){
throw new BusinessException("请先注册"); throw new BusinessException("请先注册");
} }
} }
//通过用户id查找相关角色信息
//生成token
// String token = JwtUtils.createToken(loginDto.getPhone(),substring);
// userVo.setToken(token);
ApiResponse apiResponse =new ApiResponse(); ApiResponse apiResponse =new ApiResponse();
apiResponse.setData(userVo); apiResponse.setData(userVo);
return apiResponse; return apiResponse;
......
package org.nafmii.vo; package org.nafmii.user.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.nafmii.entity.CenterRole;
/** /**
* @author:zhoujh * @author:zhoujh
......
package org.nafmii.vo; package org.nafmii.user.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author:zhoujh * @author:zhoujh
...@@ -65,4 +64,7 @@ public class UserVO { ...@@ -65,4 +64,7 @@ public class UserVO {
@ApiModelProperty(value = "是否有效标识 0 有效用户 1无效用户") @ApiModelProperty(value = "是否有效标识 0 有效用户 1无效用户")
private String isEnable; private String isEnable;
@ApiModelProperty(value = "token")
private String token;
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nafmii.mapper.user.AppUserMapper"> <mapper namespace="org.nafmii.user.mapper.user.AppUserMapper">
<resultMap id="BaseResultMap" type="org.nafmii.entity.user.AppUser"> <resultMap id="BaseResultMap" type="org.nafmii.user.po.user.AppUser">
<id column="ID" jdbcType="BIGINT" property="id" /> <id column="ID" jdbcType="BIGINT" property="id" />
<result column="USER_NAME" jdbcType="VARCHAR" property="userName" /> <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
<result column="LOGIN_PWD" jdbcType="VARCHAR" property="loginPwd" /> <result column="LOGIN_PWD" jdbcType="VARCHAR" property="loginPwd" />
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
ID, USER_NAME, LOGIN_PWD, REAL_NAME, PHONE, BIRTHDAY, EMAIL, HEAD_PICTURE, NATIONALITY, ID, USER_NAME, LOGIN_PWD, REAL_NAME, PHONE, BIRTHDAY, EMAIL, HEAD_PICTURE, NATIONALITY,
UNIT_NAME, OPEN_ID, FIGERPRINT_FALG, FACEID_FALG, CREATE_TIME, UPDATE_TIME, IS_ENABLE UNIT_NAME, OPEN_ID, FIGERPRINT_FALG, FACEID_FALG, CREATE_TIME, UPDATE_TIME, IS_ENABLE
</sql> </sql>
<select id="selectByPassword" parameterType="org.nafmii.dto.user.LoginDto" resultType="org.nafmii.vo.UserVO"> <select id="selectByPassword" parameterType="org.nafmii.user.dto.user.LoginDto" resultType="org.nafmii.user.vo.UserVO">
select ID as id, select ID as id,
USER_NAME as userName, LOGIN_PWD as loginPwd, REAL_NAME as realName, PHONE as phone, BIRTHDAY as birthday, EMAIL as email, HEAD_PICTURE as headPicture, NATIONALITY as nationality, USER_NAME as userName, LOGIN_PWD as loginPwd, REAL_NAME as realName, PHONE as phone, BIRTHDAY as birthday, EMAIL as email, HEAD_PICTURE as headPicture, NATIONALITY as nationality,
UNIT_NAME as unitName, OPEN_ID as openId, FIGERPRINT_FALG as figerprintFalg, FACEID_FALG as faceidFalg, CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable UNIT_NAME as unitName, OPEN_ID as openId, FIGERPRINT_FALG as figerprintFalg, FACEID_FALG as faceidFalg, CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
and LOGIN_PWD !=#{loginPwd} and LOGIN_PWD !=#{loginPwd}
</if> </if>
</select> </select>
<select id="selectByPhone" parameterType="map" resultType="org.nafmii.vo.UserVO"> <select id="selectByPhone" parameterType="map" resultType="org.nafmii.user.vo.UserVO">
select ID as id, select ID as id,
USER_NAME as userName, LOGIN_PWD as loginPwd, REAL_NAME as realName, PHONE as phone, BIRTHDAY as birthday, EMAIL as email, HEAD_PICTURE as headPicture, NATIONALITY as nationality, USER_NAME as userName, LOGIN_PWD as loginPwd, REAL_NAME as realName, PHONE as phone, BIRTHDAY as birthday, EMAIL as email, HEAD_PICTURE as headPicture, NATIONALITY as nationality,
UNIT_NAME as unitName, OPEN_ID as openId, FIGERPRINT_FALG as figerprintFalg, FACEID_FALG as faceidFalg, CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable UNIT_NAME as unitName, OPEN_ID as openId, FIGERPRINT_FALG as figerprintFalg, FACEID_FALG as faceidFalg, CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
and PHONE !=#{phone} and PHONE !=#{phone}
</if> </if>
</select> </select>
<select id="selectByExample" parameterType="org.nafmii.entity.user.AppUserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="org.nafmii.user.po.user.AppUserExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
...@@ -126,13 +126,13 @@ ...@@ -126,13 +126,13 @@
delete from APP_USER delete from APP_USER
where ID = #{id,jdbcType=BIGINT} where ID = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="org.nafmii.entity.user.AppUserExample"> <delete id="deleteByExample" parameterType="org.nafmii.user.po.user.AppUserExample">
delete from APP_USER delete from APP_USER
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="org.nafmii.entity.user.AppUser"> <insert id="insert" parameterType="org.nafmii.user.po.user.AppUser">
insert into APP_USER (ID, USER_NAME, LOGIN_PWD, insert into APP_USER (ID, USER_NAME, LOGIN_PWD,
REAL_NAME, PHONE, BIRTHDAY, REAL_NAME, PHONE, BIRTHDAY,
EMAIL, HEAD_PICTURE, NATIONALITY, EMAIL, HEAD_PICTURE, NATIONALITY,
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
#{faceidFalg,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{faceidFalg,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isEnable,jdbcType=VARCHAR}) #{isEnable,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="org.nafmii.entity.user.AppUserExample"> <insert id="insertSelective" parameterType="org.nafmii.user.po.user.AppUserExample">
insert into APP_USER insert into APP_USER
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="org.nafmii.entity.user.AppUserExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="org.nafmii.user.po.user.AppUserExample" resultType="java.lang.Long">
select count(*) from APP_USER select count(*) from APP_USER
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="org.nafmii.entity.user.AppUserExample"> <update id="updateByPrimaryKeySelective" parameterType="org.nafmii.user.po.user.AppUserExample">
update APP_USER update APP_USER
<set> <set>
<if test="userName != null"> <if test="userName != null">
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
</set> </set>
where ID = #{id,jdbcType=BIGINT} where ID = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="org.nafmii.entity.user.AppUser"> <update id="updateByPrimaryKey" parameterType="org.nafmii.user.po.user.AppUser">
update APP_USER update APP_USER
set USER_NAME = #{userName,jdbcType=VARCHAR}, set USER_NAME = #{userName,jdbcType=VARCHAR},
LOGIN_PWD = #{loginPwd,jdbcType=VARCHAR}, LOGIN_PWD = #{loginPwd,jdbcType=VARCHAR},
......
package org.nafmii.common.utils; package org.nafmii.utils;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import org.nafmii.common.vo.AppUser;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -20,24 +19,24 @@ public class JwtUtils { ...@@ -20,24 +19,24 @@ public class JwtUtils {
private static final String ROLE_CLAIMS = "rol"; private static final String ROLE_CLAIMS = "rol";
public static String generateJsonWebToken(AppUser user) { // public static String generateJsonWebToken(AppUser user) {
if (user.getId() == null || user.getUserName() == null ) { // if (user.getId() == null || user.getUserName() == null ) {
return null; // return null;
} // }
//
Map<String,Object> map = new HashMap<>(); // Map<String,Object> map = new HashMap<>();
map.put(ROLE_CLAIMS, "rol"); // map.put(ROLE_CLAIMS, "rol");
String token = Jwts // String token = Jwts
.builder() // .builder()
.setSubject(SUBJECT) // .setSubject(SUBJECT)
.setClaims(map) // .setClaims(map)
.claim("id", user.getId()) // .claim("id", user.getId())
.claim("name", user.getUserName()) // .claim("name", user.getUserName())
.setIssuedAt(new Date()) // .setIssuedAt(new Date())
.setExpiration(new Date(System.currentTimeMillis() + EXPIRITION)) // .setExpiration(new Date(System.currentTimeMillis() + EXPIRITION))
.signWith(SignatureAlgorithm.HS256, APPSECRET_KEY).compact(); // .signWith(SignatureAlgorithm.HS256, APPSECRET_KEY).compact();
return token; // return token;
} // }
/** /**
     * 生成token      * 生成token
......
package org.nafmii.common.vo;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class AppUser implements Serializable {
private Long id;
@ApiModelProperty(value = "昵称")
private String userName;
@ApiModelProperty(value = "登录密码")
private String loginPwd;
@ApiModelProperty(value = "中文姓名")
private String realName;
@ApiModelProperty(value = "手机号/登录账号")
private String phone;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "头像图片地址")
private String headPicture;
@ApiModelProperty(value = "国籍")
private String nationality;
@ApiModelProperty(value = "单位全称")
private String unitName;
@ApiModelProperty(value = "微信OPENT_ID")
private String openId;
@ApiModelProperty(value = "是否开启指纹登录 0 未开启 1 已开启")
private String figerprintFalg;
@ApiModelProperty(value = "是否开启人脸识别登录 0 未开启 1 已开启")
private String faceidFalg;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "是否有效标识 0 有效用户 1无效用户")
private String isEnable;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getLoginPwd() {
return loginPwd;
}
public void setLoginPwd(String loginPwd) {
this.loginPwd = loginPwd;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getHeadPicture() {
return headPicture;
}
public void setHeadPicture(String headPicture) {
this.headPicture = headPicture;
}
public String getNationality() {
return nationality;
}
public void setNationality(String nationality) {
this.nationality = nationality;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getFigerprintFalg() {
return figerprintFalg;
}
public void setFigerprintFalg(String figerprintFalg) {
this.figerprintFalg = figerprintFalg;
}
public String getFaceidFalg() {
return faceidFalg;
}
public void setFaceidFalg(String faceidFalg) {
this.faceidFalg = faceidFalg;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getIsEnable() {
return isEnable;
}
public void setIsEnable(String isEnable) {
this.isEnable = isEnable;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userName=").append(userName);
sb.append(", loginPwd=").append(loginPwd);
sb.append(", realName=").append(realName);
sb.append(", phone=").append(phone);
sb.append(", birthday=").append(birthday);
sb.append(", email=").append(email);
sb.append(", headPicture=").append(headPicture);
sb.append(", nationality=").append(nationality);
sb.append(", unitName=").append(unitName);
sb.append(", openId=").append(openId);
sb.append(", figerprintFalg=").append(figerprintFalg);
sb.append(", faceidFalg=").append(faceidFalg);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isEnable=").append(isEnable);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,12 @@ package org.nafmii.enums; ...@@ -3,12 +3,12 @@ package org.nafmii.enums;
/** /**
* @author:zhoujh * @author:zhoujh
* @Function:TODO * @Function:TODO
* @date 2021/4/26 14:23 * @date 2021/4/27 9:57
* @ClassName:用户枚举 * @ClassName:
* @version: * @version:
* @remark: * @remark:
*/ */
public enum UserEnum { public enum UserEnum{
/** /**
* 是否开启人脸识别登录 0 未开启 1 已开启 * 是否开启人脸识别登录 0 未开启 1 已开启
*/ */
......
package org.nafmii.nafmiimbg.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class CenterRole implements Serializable {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "角色名称")
private String rName;
@ApiModelProperty(value = "创建时间")
private Date creatTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "启用禁用 0 启用 1禁用")
private String isEnable;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getrName() {
return rName;
}
public void setrName(String rName) {
this.rName = rName;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getIsEnable() {
return isEnable;
}
public void setIsEnable(String isEnable) {
this.isEnable = isEnable;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", rName=").append(rName);
sb.append(", creatTime=").append(creatTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isEnable=").append(isEnable);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nafmii.nafmiimbg.mapper.CenterRoleMapper">
<resultMap id="BaseResultMap" type="org.nafmii.nafmiimbg.model.CenterRole">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="R_NAME" jdbcType="VARCHAR" property="rName" />
<result column="CREAT_TIME" jdbcType="TIMESTAMP" property="creatTime" />
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
<result column="IS_ENABLE" jdbcType="VARCHAR" property="isEnable" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
ID, R_NAME, CREAT_TIME, UPDATE_TIME, IS_ENABLE
</sql>
<select id="selectByExample" parameterType="org.nafmii.nafmiimbg.model.CenterRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from CENTER_ROLE
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from CENTER_ROLE
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from CENTER_ROLE
where ID = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="org.nafmii.nafmiimbg.model.CenterRoleExample">
delete from CENTER_ROLE
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="org.nafmii.nafmiimbg.model.CenterRole">
insert into CENTER_ROLE (ID, R_NAME, CREAT_TIME,
UPDATE_TIME, IS_ENABLE)
values (#{id,jdbcType=BIGINT}, #{rName,jdbcType=VARCHAR}, #{creatTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isEnable,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="org.nafmii.nafmiimbg.model.CenterRole">
insert into CENTER_ROLE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="rName != null">
R_NAME,
</if>
<if test="creatTime != null">
CREAT_TIME,
</if>
<if test="updateTime != null">
UPDATE_TIME,
</if>
<if test="isEnable != null">
IS_ENABLE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="rName != null">
#{rName,jdbcType=VARCHAR},
</if>
<if test="creatTime != null">
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isEnable != null">
#{isEnable,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="org.nafmii.nafmiimbg.model.CenterRoleExample" resultType="java.lang.Long">
select count(*) from CENTER_ROLE
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update CENTER_ROLE
<set>
<if test="record.id != null">
ID = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.rName != null">
R_NAME = #{record.rName,jdbcType=VARCHAR},
</if>
<if test="record.creatTime != null">
CREAT_TIME = #{record.creatTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isEnable != null">
IS_ENABLE = #{record.isEnable,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update CENTER_ROLE
set ID = #{record.id,jdbcType=BIGINT},
R_NAME = #{record.rName,jdbcType=VARCHAR},
CREAT_TIME = #{record.creatTime,jdbcType=TIMESTAMP},
UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP},
IS_ENABLE = #{record.isEnable,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="org.nafmii.nafmiimbg.model.CenterRole">
update CENTER_ROLE
<set>
<if test="rName != null">
R_NAME = #{rName,jdbcType=VARCHAR},
</if>
<if test="creatTime != null">
CREAT_TIME = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isEnable != null">
IS_ENABLE = #{isEnable,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="org.nafmii.nafmiimbg.model.CenterRole">
update CENTER_ROLE
set R_NAME = #{rName,jdbcType=VARCHAR},
CREAT_TIME = #{creatTime,jdbcType=TIMESTAMP},
UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
IS_ENABLE = #{isEnable,jdbcType=VARCHAR}
where ID = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!