parent
80e4db53b6
commit
4a8ca4f2e6
@ -0,0 +1,19 @@
|
||||
package com.luoo.user.dao;
|
||||
|
||||
import com.luoo.user.pojo.Friend;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
public interface FriendDao extends JpaRepository<Friend,String> {
|
||||
|
||||
public Friend findByUseridAndFriendid(String userid,String friendid);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update tb_friend set islike = ? where userid = ? and friendid = ?",nativeQuery = true)
|
||||
public void updateIslike(String islike,String userid,String friendid);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "delete from tb_friend where userid = ? and friendid = ?",nativeQuery = true)
|
||||
void deletefriend(String userid, String friendid);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.luoo.user.dao;
|
||||
|
||||
import com.luoo.user.pojo.NoFriend;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface NoFriendDao extends JpaRepository<NoFriend,String> {
|
||||
|
||||
public NoFriend findByUseridAndFriendid(String userid,String friendid);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.luoo.user.pojo;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tb_friend")
|
||||
@IdClass(Friend.class)
|
||||
public class Friend implements Serializable {
|
||||
|
||||
@Id
|
||||
private String userid;
|
||||
|
||||
@Id
|
||||
private String friendid;
|
||||
|
||||
private String islike;
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getFriendid() {
|
||||
return friendid;
|
||||
}
|
||||
|
||||
public void setFriendid(String friendid) {
|
||||
this.friendid = friendid;
|
||||
}
|
||||
|
||||
public String getIslike() {
|
||||
return islike;
|
||||
}
|
||||
|
||||
public void setIslike(String islike) {
|
||||
this.islike = islike;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.luoo.user.pojo;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tb_nofriend")
|
||||
@IdClass(NoFriend.class)
|
||||
public class NoFriend implements Serializable {
|
||||
|
||||
@Id
|
||||
private String userid;
|
||||
|
||||
@Id
|
||||
private String friendid;
|
||||
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getFriendid() {
|
||||
return friendid;
|
||||
}
|
||||
|
||||
public void setFriendid(String friendid) {
|
||||
this.friendid = friendid;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue