mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-05 00:21:38 +08:00
添加用户登录(还未验证)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 50726
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 12/03/2022 21:55:59
|
||||
Date: 13/03/2022 01:51:00
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -149,4 +149,25 @@ CREATE TABLE `file_object_info` (
|
||||
-- Records of file_object_info
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user_info`;
|
||||
CREATE TABLE `user_info` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`encript_pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`user_identity` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`weixin_third_party_auth_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`qq_third_party_auth_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user_info
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
@@ -1,5 +1,40 @@
|
||||
package plus.bookshelf.Controller.Controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class BaseController {
|
||||
// content-type 常量
|
||||
public static final String CONTENT_TYPE_FORMED = "application/x-www-form-urlencoded";
|
||||
|
||||
@Autowired
|
||||
HttpServletRequest httpServletRequest;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 获取用户登陆状态
|
||||
*/
|
||||
public Boolean isLogin() {
|
||||
return (Boolean) httpServletRequest.getSession().getAttribute("IS_LOGIN");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户的登录状态
|
||||
* @return String uuidToken
|
||||
*/
|
||||
public String onLogin(UserModel userModel) {
|
||||
String uuidToken = UUID.randomUUID().toString();
|
||||
redisTemplate.expire(uuidToken, 1, TimeUnit.HOURS);
|
||||
|
||||
// 建立token和用户登录态之间的联系
|
||||
redisTemplate.opsForValue().set(uuidToken, userModel);
|
||||
return uuidToken;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package plus.bookshelf.Controller.Controller;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import plus.bookshelf.Controller.VO.UserVO;
|
||||
import plus.bookshelf.Service.Impl.UserServiceImpl;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
import plus.bookshelf.Service.Service.UserService;
|
||||
|
||||
import static plus.bookshelf.Controller.Controller.BaseController.CONTENT_TYPE_FORMED;
|
||||
|
||||
@Controller
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
UserServiceImpl userService;
|
||||
|
||||
@RequestMapping(value = "login", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
@ResponseBody
|
||||
public UserVO login(@RequestParam(value = "username") String username,
|
||||
@RequestParam(value = "encryptpwd") String encryptPwd) {
|
||||
UserModel userModel = userService.userLogin(username, encryptPwd);
|
||||
UserVO userVO = convertFromService(userModel);
|
||||
return userVO;
|
||||
}
|
||||
|
||||
private UserVO convertFromService(UserModel userModel) {
|
||||
if (userModel == null) {
|
||||
return null;
|
||||
}
|
||||
UserVO userVO = new UserVO();
|
||||
BeanUtils.copyProperties(userModel, userVO);
|
||||
return userVO;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package plus.bookshelf.Controller.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserVO {
|
||||
|
||||
// 用户Id
|
||||
Integer id;
|
||||
|
||||
// 用户名
|
||||
String username;
|
||||
|
||||
// 用户昵称
|
||||
String nickname;
|
||||
|
||||
// 用户身份 NOT_LOGIN, ADMIN, LOGIN_USER;
|
||||
String userIdentity;
|
||||
|
||||
// 用户头像
|
||||
String avatar;
|
||||
|
||||
// 用户手机号
|
||||
String phone;
|
||||
}
|
300
bookshelfplus/src/main/java/plus/bookshelf/Dao/DO/UserDO.java
Normal file
300
bookshelfplus/src/main/java/plus/bookshelf/Dao/DO/UserDO.java
Normal file
@@ -0,0 +1,300 @@
|
||||
package plus.bookshelf.Dao.DO;
|
||||
|
||||
public class UserDO {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.id
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.username
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.encript_pwd
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String encriptPwd;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.nickname
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.user_identity
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String userIdentity;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.avatar
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.phone
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.weixin_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String weixinThirdPartyAuthCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.qq_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
private String qqThirdPartyAuthCode;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.id
|
||||
*
|
||||
* @return the value of user_info.id
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.id
|
||||
*
|
||||
* @param id the value for user_info.id
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.username
|
||||
*
|
||||
* @return the value of user_info.username
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.username
|
||||
*
|
||||
* @param username the value for user_info.username
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.encript_pwd
|
||||
*
|
||||
* @return the value of user_info.encript_pwd
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getEncriptPwd() {
|
||||
return encriptPwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.encript_pwd
|
||||
*
|
||||
* @param encriptPwd the value for user_info.encript_pwd
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setEncriptPwd(String encriptPwd) {
|
||||
this.encriptPwd = encriptPwd == null ? null : encriptPwd.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.nickname
|
||||
*
|
||||
* @return the value of user_info.nickname
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.nickname
|
||||
*
|
||||
* @param nickname the value for user_info.nickname
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname == null ? null : nickname.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.user_identity
|
||||
*
|
||||
* @return the value of user_info.user_identity
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getUserIdentity() {
|
||||
return userIdentity;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.user_identity
|
||||
*
|
||||
* @param userIdentity the value for user_info.user_identity
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setUserIdentity(String userIdentity) {
|
||||
this.userIdentity = userIdentity == null ? null : userIdentity.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.avatar
|
||||
*
|
||||
* @return the value of user_info.avatar
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.avatar
|
||||
*
|
||||
* @param avatar the value for user_info.avatar
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar == null ? null : avatar.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.phone
|
||||
*
|
||||
* @return the value of user_info.phone
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.phone
|
||||
*
|
||||
* @param phone the value for user_info.phone
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone == null ? null : phone.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.weixin_third_party_auth_code
|
||||
*
|
||||
* @return the value of user_info.weixin_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getWeixinThirdPartyAuthCode() {
|
||||
return weixinThirdPartyAuthCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.weixin_third_party_auth_code
|
||||
*
|
||||
* @param weixinThirdPartyAuthCode the value for user_info.weixin_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setWeixinThirdPartyAuthCode(String weixinThirdPartyAuthCode) {
|
||||
this.weixinThirdPartyAuthCode = weixinThirdPartyAuthCode == null ? null : weixinThirdPartyAuthCode.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.qq_third_party_auth_code
|
||||
*
|
||||
* @return the value of user_info.qq_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public String getQqThirdPartyAuthCode() {
|
||||
return qqThirdPartyAuthCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.qq_third_party_auth_code
|
||||
*
|
||||
* @param qqThirdPartyAuthCode the value for user_info.qq_third_party_auth_code
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
public void setQqThirdPartyAuthCode(String qqThirdPartyAuthCode) {
|
||||
this.qqThirdPartyAuthCode = qqThirdPartyAuthCode == null ? null : qqThirdPartyAuthCode.trim();
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
package plus.bookshelf.Dao.Mapper;
|
||||
|
||||
import plus.bookshelf.Dao.DO.UserDO;
|
||||
|
||||
public interface UserDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
int insert(UserDO record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
int insertSelective(UserDO record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
UserDO selectByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
int updateByPrimaryKeySelective(UserDO record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
*
|
||||
* @mbg.generated Sun Mar 13 01:51:14 SGT 2022
|
||||
*/
|
||||
int updateByPrimaryKey(UserDO record);
|
||||
|
||||
UserDO selectByUsernameAndEncryptpwd(String username, String encryptPwd);
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package plus.bookshelf.Service.Impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import plus.bookshelf.Dao.DO.UserDO;
|
||||
import plus.bookshelf.Dao.Mapper.UserDOMapper;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
import plus.bookshelf.Service.Service.UserService;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
UserDOMapper userDOMapper;
|
||||
|
||||
@Override
|
||||
public UserModel userLogin(String username, String encryptPwd) {
|
||||
UserDO userDO = userDOMapper.selectByUsernameAndEncryptpwd(username, encryptPwd);
|
||||
UserModel userModel = convertFromDataObject(userDO);
|
||||
|
||||
return userModel;
|
||||
}
|
||||
|
||||
private UserModel convertFromDataObject(UserDO userDO) {
|
||||
if (userDO == null) {
|
||||
return null;
|
||||
}
|
||||
UserModel userModel = new UserModel();
|
||||
userModel.setId(userDO.getId());
|
||||
userModel.setUsername(userDO.getUsername());
|
||||
userModel.setEncriptPwd(userDO.getEncriptPwd());
|
||||
userModel.setNickname(userDO.getNickname());
|
||||
userModel.setUserIdentity(userDO.getUserIdentity());
|
||||
userModel.setAvatar(userDO.getAvatar());
|
||||
userModel.setPhone(userDO.getPhone());
|
||||
userModel.setWeixinThirdPartyAuthCode(userDO.getWeixinThirdPartyAuthCode());
|
||||
userModel.setQqThirdPartyAuthCode(userDO.getQqThirdPartyAuthCode());
|
||||
|
||||
return userModel;
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package plus.bookshelf.Service.Model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserModel {
|
||||
|
||||
// 用户Id
|
||||
Integer id;
|
||||
|
||||
// 用户名
|
||||
String username;
|
||||
|
||||
// 用户加密后的密码
|
||||
String encriptPwd;
|
||||
|
||||
// 用户昵称
|
||||
String nickname;
|
||||
|
||||
// 用户身份 NOT_LOGIN, ADMIN, LOGIN_USER;
|
||||
String userIdentity;
|
||||
|
||||
// 用户头像
|
||||
String avatar;
|
||||
|
||||
// 用户手机号
|
||||
String phone;
|
||||
|
||||
// 微信第三方登录授权
|
||||
String weixinThirdPartyAuthCode;
|
||||
|
||||
// QQ第三方登录授权
|
||||
String qqThirdPartyAuthCode;
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package plus.bookshelf.Service.Service;
|
||||
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
|
||||
public interface UserService {
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param username
|
||||
* @param encryptPwd
|
||||
*/
|
||||
UserModel userLogin(String username, String encryptPwd);
|
||||
}
|
188
bookshelfplus/src/main/resources/mapping/UserDOMapper.xml
Normal file
188
bookshelfplus/src/main/resources/mapping/UserDOMapper.xml
Normal file
@@ -0,0 +1,188 @@
|
||||
<?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="plus.bookshelf.Dao.Mapper.UserDOMapper">
|
||||
<resultMap id="BaseResultMap" type="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="username" jdbcType="VARCHAR" property="username" />
|
||||
<result column="encript_pwd" jdbcType="VARCHAR" property="encriptPwd" />
|
||||
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
|
||||
<result column="user_identity" jdbcType="VARCHAR" property="userIdentity" />
|
||||
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
<result column="weixin_third_party_auth_code" jdbcType="VARCHAR" property="weixinThirdPartyAuthCode" />
|
||||
<result column="qq_third_party_auth_code" jdbcType="VARCHAR" property="qqThirdPartyAuthCode" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
id, username, encript_pwd, nickname, user_identity, avatar, phone, weixin_third_party_auth_code,
|
||||
qq_third_party_auth_code
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
delete from user_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
insert into user_info (id, username, encript_pwd,
|
||||
nickname, user_identity, avatar,
|
||||
phone, weixin_third_party_auth_code, qq_third_party_auth_code
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{encriptPwd,jdbcType=VARCHAR},
|
||||
#{nickname,jdbcType=VARCHAR}, #{userIdentity,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR},
|
||||
#{phone,jdbcType=VARCHAR}, #{weixinThirdPartyAuthCode,jdbcType=VARCHAR}, #{qqThirdPartyAuthCode,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
insert into user_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="username != null">
|
||||
username,
|
||||
</if>
|
||||
<if test="encriptPwd != null">
|
||||
encript_pwd,
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
nickname,
|
||||
</if>
|
||||
<if test="userIdentity != null">
|
||||
user_identity,
|
||||
</if>
|
||||
<if test="avatar != null">
|
||||
avatar,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
<if test="weixinThirdPartyAuthCode != null">
|
||||
weixin_third_party_auth_code,
|
||||
</if>
|
||||
<if test="qqThirdPartyAuthCode != null">
|
||||
qq_third_party_auth_code,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="username != null">
|
||||
#{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="encriptPwd != null">
|
||||
#{encriptPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
#{nickname,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userIdentity != null">
|
||||
#{userIdentity,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="avatar != null">
|
||||
#{avatar,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="weixinThirdPartyAuthCode != null">
|
||||
#{weixinThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="qqThirdPartyAuthCode != null">
|
||||
#{qqThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
update user_info
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="encriptPwd != null">
|
||||
encript_pwd = #{encriptPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
nickname = #{nickname,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userIdentity != null">
|
||||
user_identity = #{userIdentity,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="avatar != null">
|
||||
avatar = #{avatar,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="weixinThirdPartyAuthCode != null">
|
||||
weixin_third_party_auth_code = #{weixinThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="qqThirdPartyAuthCode != null">
|
||||
qq_third_party_auth_code = #{qqThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
This element was generated on Sun Mar 13 01:51:14 SGT 2022.
|
||||
-->
|
||||
update user_info
|
||||
set username = #{username,jdbcType=VARCHAR},
|
||||
encript_pwd = #{encriptPwd,jdbcType=VARCHAR},
|
||||
nickname = #{nickname,jdbcType=VARCHAR},
|
||||
user_identity = #{userIdentity,jdbcType=VARCHAR},
|
||||
avatar = #{avatar,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
weixin_third_party_auth_code = #{weixinThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
qq_third_party_auth_code = #{qqThirdPartyAuthCode,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<select id="selectByUsernameAndEncryptpwd" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user_info
|
||||
where username = #{username} and encript_pwd = #{encryptPwd}
|
||||
</select>
|
||||
</mapper>
|
@@ -74,5 +74,8 @@
|
||||
<!--<table tableName="file_object_info" domainObjectName="FileObjectDO" enableCountByExample="false"-->
|
||||
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
|
||||
<!-- selectByExampleQueryId="false"></table>-->
|
||||
<!--<table tableName="user_info" domainObjectName="UserDO" enableCountByExample="false"-->
|
||||
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
|
||||
<!-- selectByExampleQueryId="false"></table>-->
|
||||
</context>
|
||||
</generatorConfiguration>
|
Reference in New Issue
Block a user