parent
e465bfce97
commit
3ebcb84fdb
@ -0,0 +1,25 @@
|
||||
package com.hzu.bookingsystem.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* author 吴志岳
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "tb_auth_group_access")
|
||||
public class UserAuthBean {
|
||||
@Id
|
||||
private Integer uId;
|
||||
|
||||
private Integer groupId;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.hzu.bookingsystem.repository;
|
||||
|
||||
|
||||
import com.hzu.bookingsystem.bean.UserAuthBean;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* author 吴志岳
|
||||
*/
|
||||
public interface UserAuthRepository extends JpaRepository<UserAuthBean,String> {
|
||||
UserAuthBean findByUId(Integer uId);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.hzu.bookingsystem.service;
|
||||
|
||||
import com.hzu.bookingsystem.bean.UserAuthBean;
|
||||
|
||||
public interface UserAuthService {
|
||||
UserAuthBean add(Integer uId, Integer groupId);
|
||||
|
||||
UserAuthBean update(Integer uId, Integer groupId);
|
||||
|
||||
void delete(Integer uId, Integer groupId);
|
||||
|
||||
UserAuthBean findByUId(Integer uId);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.hzu.bookingsystem.service.impl;
|
||||
|
||||
import com.hzu.bookingsystem.bean.UserAuthBean;
|
||||
import com.hzu.bookingsystem.repository.UserAuthRepository;
|
||||
import com.hzu.bookingsystem.service.UserAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserAuthServiceImpl implements UserAuthService {
|
||||
@Autowired
|
||||
private UserAuthRepository userAuthRepository;
|
||||
|
||||
@Override
|
||||
public UserAuthBean add(Integer uId, Integer groupId) {
|
||||
UserAuthBean userAuth = new UserAuthBean(uId,groupId);
|
||||
return userAuthRepository.save(userAuth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAuthBean update(Integer uId, Integer groupId) {
|
||||
UserAuthBean userAuth = new UserAuthBean(uId,groupId);
|
||||
return userAuthRepository.save(userAuth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Integer uId, Integer groupId) {
|
||||
UserAuthBean userAuth = new UserAuthBean(uId,groupId);
|
||||
userAuthRepository.delete(userAuth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAuthBean findByUId(Integer uId) {
|
||||
return userAuthRepository.findByUId(uId);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue