parent
99e9fb3e91
commit
d1feac6650
@ -0,0 +1,36 @@
|
||||
package com.luoo.comment.dao;
|
||||
|
||||
import client.vo.SimpleUser;
|
||||
import com.luoo.comment.pojo.UserInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserInfoDao extends JpaRepository<UserInfo, String>, JpaSpecificationExecutor<UserInfo> {
|
||||
public UserInfo findByMobile(String mobile);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update tb_user_info set follow_count=follow_count+? where id = ?", nativeQuery = true)
|
||||
void updatefollowcount(int x, String appUserInfoId);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update tb_user_info set fans_count=fans_count+? where id = ?", nativeQuery = true)
|
||||
void updatefanscount(int x, String friendid);
|
||||
|
||||
public long countByNickName(String nickName);
|
||||
|
||||
@Query(value = "select * from tb_user_info where id in ?1 order by field(id,?1)", nativeQuery = true)
|
||||
public List<UserInfo> orderByField(List<String> idList);
|
||||
|
||||
@Query(value = "select new client.vo.SimpleUser(id, nickName) from UserInfo where id in ?1 order by field(id,?1)")
|
||||
public List<SimpleUser> getSimpleUserOrderByField(List<String> idList);
|
||||
|
||||
@Query(value = "select * from tb_user_info where id = ?1", nativeQuery = true)
|
||||
public UserInfo getById(String id);
|
||||
|
||||
@Query(value = "select * from tb_user_info where badges like '%1%' ", nativeQuery = true)
|
||||
public List<UserInfo> getThanks();
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.luoo.comment.pojo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name="tb_user_info")
|
||||
public class UserInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
/**
|
||||
* 个性签名
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 性别 0:男 1:女 2:保密
|
||||
*/
|
||||
private Integer sex;
|
||||
/**
|
||||
* 出生年月日
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date birthday;
|
||||
/**
|
||||
* 粉丝数
|
||||
*/
|
||||
private int fansCount;
|
||||
/**
|
||||
* 关注数
|
||||
*/
|
||||
private int followCount;
|
||||
/**
|
||||
* 获赞数
|
||||
*/
|
||||
private int thumbUpCount;
|
||||
/**
|
||||
* 喜欢歌曲数
|
||||
*/
|
||||
private int songCount;
|
||||
/**
|
||||
* 收藏期刊数
|
||||
*/
|
||||
private int journalCount;
|
||||
/**
|
||||
* 获得评论数
|
||||
*/
|
||||
private int commentReplyCount;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date joinTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastLoginTime;
|
||||
|
||||
/**
|
||||
* 最后使用的设备ID
|
||||
*/
|
||||
private String lastUseDeviceId;
|
||||
|
||||
/**
|
||||
* 手机品牌
|
||||
*/
|
||||
private String lastUseDeviceBrand;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
private String lastLoginIp;
|
||||
|
||||
/**
|
||||
* 0:禁用 1:正常
|
||||
*/
|
||||
private int status;
|
||||
/**
|
||||
* 0:禁用 1:正常
|
||||
*/
|
||||
private int onlineStatus;
|
||||
|
||||
private String badges;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.luoo.comment.service;
|
||||
|
||||
|
||||
import com.luoo.comment.dao.UserInfoDao;
|
||||
import com.luoo.comment.pojo.UserInfo;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 服务层
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class UserInfoService {
|
||||
@Autowired
|
||||
private UserInfoDao userInfoDao;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询实体
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public UserInfo findById(String id) {
|
||||
return userInfoDao.getById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue