ddangelorb
3 years ago
10 changed files with 83 additions and 15 deletions
-
2db/ddl.sql
-
6src/main/java/org/waterproofingdata/wpdauth/controller/UsersController.java
-
10src/main/java/org/waterproofingdata/wpdauth/dto/UsersResponseDTO.java
-
2src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java
-
1src/main/java/org/waterproofingdata/wpdauth/model/Users.java
-
31src/main/java/org/waterproofingdata/wpdauth/model/UsersRolesproviderActivationKey.java
-
11src/main/java/org/waterproofingdata/wpdauth/repository/EduCemadenOrganizationsRepository.java
-
8src/main/java/org/waterproofingdata/wpdauth/repository/UsersRepository.java
-
10src/main/java/org/waterproofingdata/wpdauth/repository/UsersRolesproviderActivationKeyRepository.java
-
17src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java
@ -0,0 +1,31 @@ |
|||
package org.waterproofingdata.wpdauth.model; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.GeneratedValue; |
|||
import javax.persistence.GenerationType; |
|||
import javax.persistence.Id; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.Setter; |
|||
|
|||
|
|||
@Entity(name = "users_rolesprovider_activationkey") |
|||
@Getter |
|||
@Setter |
|||
@NoArgsConstructor |
|||
public class UsersRolesproviderActivationKey { |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
private Integer id; |
|||
|
|||
@Column(nullable = false, name="users_id") |
|||
private Integer usersid; |
|||
|
|||
@Column(nullable = false, name="roles_id") |
|||
private Integer rolesid; |
|||
|
|||
@Column(nullable = false) |
|||
private String activationkey; |
|||
} |
@ -1,8 +1,19 @@ |
|||
package org.waterproofingdata.wpdauth.repository; |
|||
|
|||
import org.springframework.data.jpa.repository.Query; |
|||
|
|||
import javax.transaction.Transactional; |
|||
|
|||
import org.springframework.data.jpa.repository.JpaRepository; |
|||
import org.waterproofingdata.wpdauth.model.EduCemadenOrganizations; |
|||
|
|||
public interface EduCemadenOrganizationsRepository extends JpaRepository<EduCemadenOrganizations, Integer> { |
|||
EduCemadenOrganizations findByPhone(String phone); |
|||
|
|||
@Query(value = "SELECT e.*, ueo.activationkey FROM educemaden_organizations e INNER JOIN users_educemaden_organizations ueo ON e.id = ueo.educemaden_organizations_id WHERE ueo.users_id = ?1;", nativeQuery = true) |
|||
EduCemadenOrganizations findByUserId(Integer idUser); |
|||
|
|||
@Transactional |
|||
@Query(value = "INSERT INTO users_educemaden_organizations(id, users_id, educemaden_organizations_id, activationkey) VALUES (DEFAULT, ?1, ?2, ?3);", nativeQuery = true) |
|||
void insertUsersEduCemadenOrganizations(Integer idUser, Integer idEduCemadenOrganizations, String activationkey); |
|||
} |
@ -0,0 +1,10 @@ |
|||
package org.waterproofingdata.wpdauth.repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.springframework.data.jpa.repository.JpaRepository; |
|||
import org.waterproofingdata.wpdauth.model.UsersRolesproviderActivationKey; |
|||
|
|||
public interface UsersRolesproviderActivationKeyRepository extends JpaRepository<UsersRolesproviderActivationKey, Integer> { |
|||
List<UsersRolesproviderActivationKey> findByUsersid(Integer usersid); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue