2017-10-14 06:09:26 +00:00
|
|
|
package com.boot.security.server.dao;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.Delete;
|
|
|
|
|
import org.apache.ibatis.annotations.Insert;
|
|
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
|
|
|
import org.apache.ibatis.annotations.Options;
|
|
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
|
|
2017-10-15 10:12:35 +00:00
|
|
|
import com.zw.admin.server.model.User;
|
2017-10-14 06:09:26 +00:00
|
|
|
|
|
|
|
|
@Mapper
|
|
|
|
|
public interface UserDao {
|
|
|
|
|
|
|
|
|
|
@Options(useGeneratedKeys = true, keyProperty = "id")
|
2017-10-15 10:12:35 +00:00
|
|
|
@Insert("insert into sys_user(username, password, salt, nickname, headImgUrl, phone, telephone, email, birthday, sex, status, createTime, updateTime) values(#{username}, #{password}, #{salt}, #{nickname}, #{headImgUrl}, #{phone}, #{telephone}, #{email}, #{birthday}, #{sex}, #{status}, now(), now())")
|
|
|
|
|
int save(User user);
|
2017-10-14 06:09:26 +00:00
|
|
|
|
|
|
|
|
@Select("select * from sys_user t where t.id = #{id}")
|
2017-10-15 10:12:35 +00:00
|
|
|
User getById(Long id);
|
2017-10-14 06:09:26 +00:00
|
|
|
|
|
|
|
|
@Select("select * from sys_user t where t.username = #{username}")
|
2017-10-15 10:12:35 +00:00
|
|
|
User getUser(String username);
|
2017-10-14 06:09:26 +00:00
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
|
2017-10-15 10:12:35 +00:00
|
|
|
List<User> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
2017-10-14 06:09:26 +00:00
|
|
|
@Param("limit") Integer limit);
|
|
|
|
|
|
|
|
|
|
@Delete("delete from sys_role_user where userId = #{userId}")
|
|
|
|
|
int deleteUserRole(Long userId);
|
|
|
|
|
|
|
|
|
|
int saveUserRoles(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);
|
|
|
|
|
|
2017-10-15 10:12:35 +00:00
|
|
|
int update(User user);
|
2017-10-14 06:09:26 +00:00
|
|
|
}
|