zwzw1219 2017-10-14 14:12:56 +08:00
parent 048de5eeba
commit eafd2b1442
5 changed files with 12 additions and 12 deletions

View File

@ -11,27 +11,27 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.boot.security.server.model.User;
import com.boot.security.server.model.SysUser;
@Mapper
public interface UserDao {
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_user(username, password, salt, nickname, headImgUrl, phone, telephone, email, birthday, sex, status, intro, createTime, updateTime) values(#{username}, #{password}, #{salt}, #{nickname}, #{headImgUrl}, #{phone}, #{telephone}, #{email}, #{birthday}, #{sex}, #{status}, #{intro}, now(), now())")
int save(User user);
int save(SysUser user);
@Select("select * from sys_user t where t.id = #{id}")
User getById(Long id);
SysUser getById(Long id);
@Select("select * from sys_user t where t.username = #{username}")
User getUser(String username);
SysUser getUser(String username);
@Update("update sys_user t set t.password = #{password} where t.id = #{id}")
int changePassword(@Param("id") Long id, @Param("password") String password);
Integer count(@Param("params") Map<String, Object> params);
List<User> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
List<SysUser> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
@Param("limit") Integer limit);
@Delete("delete from sys_role_user where userId = #{userId}")
@ -39,5 +39,5 @@ public interface UserDao {
int saveUserRoles(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);
int update(User user);
int update(SysUser user);
}

View File

@ -2,14 +2,14 @@ package com.boot.security.server.dto;
import java.util.List;
import com.boot.security.server.model.User;
import com.boot.security.server.model.SysUser;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class UserDto extends User {
public class UserDto extends SysUser {
private static final long serialVersionUID = -184009306207076712L;

View File

@ -10,7 +10,7 @@ import lombok.Setter;
@Getter
@Setter
public class User extends BaseEntity<Long> {
public class SysUser extends BaseEntity<Long> {
private static final long serialVersionUID = -6525908145032868837L;

View File

@ -1,7 +1,7 @@
<?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="com.zw.admin.server.dao.RoleDao">
<mapper namespace="com.boot.security.server.dao.RoleDao">
<sql id="where">
<where>

View File

@ -1,7 +1,7 @@
<?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="com.zw.admin.server.dao.UserDao">
<mapper namespace="com.boot.security.server.dao.UserDao">
<sql id="where">
<where>
@ -22,7 +22,7 @@
<include refid="where" />
</select>
<select id="list" resultType="User">
<select id="list" resultType="SysUser">
select * from sys_user t
<include refid="where" />
${params.orderBy}