Browse Source

Adding EduCemadenOrganizations

main
ddangelorb 3 years ago
parent
commit
c97adbf11e
  1. 48
      src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java
  2. 8
      src/main/java/org/waterproofingdata/wpdauth/repository/EduCemadenOrganizationsRepository.java
  3. 17
      src/main/java/org/waterproofingdata/wpdauth/repository/UsersRepository.java

48
src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java

@ -0,0 +1,48 @@
package org.waterproofingdata.wpdauth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity(name = "educemaden_organizations")
@Getter
@Setter
@NoArgsConstructor
public class EduCemadenOrganizations {
@Id
private Integer id;
@Column(nullable = true)
private String active;
@Column(nullable = false)
private String name;
@Column(nullable = true)
private String creation_date;
@Column(nullable = true)
private String inep_code;
@Column(unique = true, nullable = false)
private String phone;
@Column(nullable = true)
private String type;
@Column(nullable = true)
private String website;
@Column(nullable = true)
private String login;
@Column(nullable = true)
private String address;
@Column(nullable = true)
private String responsible;
}

8
src/main/java/org/waterproofingdata/wpdauth/repository/EduCemadenOrganizationsRepository.java

@ -0,0 +1,8 @@
package org.waterproofingdata.wpdauth.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.waterproofingdata.wpdauth.model.EduCemadenOrganizations;
public interface EduCemadenOrganizationsRepository extends JpaRepository<EduCemadenOrganizations, Integer> {
EduCemadenOrganizations findByPhone(String phone);
}

17
src/main/java/org/waterproofingdata/wpdauth/repository/UsersRepository.java

@ -1,8 +1,10 @@
package org.waterproofingdata.wpdauth.repository;
import org.waterproofingdata.wpdauth.model.Users;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.waterproofingdata.wpdauth.model.Users;
public interface UsersRepository extends JpaRepository<Users, Integer> {
@ -10,8 +12,15 @@ public interface UsersRepository extends JpaRepository<Users, Integer> {
Users findByUsername(String username);
//@Transactional
//void activateByUsername(String username, String activationkey);
//PostGreSQL -> SELECT uuid_generate_v4();
@Transactional
@Query(value = "UPDATE users SET active = ?2 WHERE username = ?1", nativeQuery = true)
void activateByUsername(String username, Integer active);
@Transactional
@Query(value = "INSERT INTO users_rolesprovider_activationkey(users_id, roles_id, activationkey) VALUES VALUES (?1, ?2, ?3);", nativeQuery = true)
void insertUsersRolesProvider(Integer idUser, Integer idRoles, String activationkey);
@Transactional
@Query(value = "INSERT INTO users_educemaden_organizations(users_id, educemaden_organizations_id, activationkey) VALUES (?1, ?2, ?3);", nativeQuery = true)
void insertUsersEduCemadenOrganizations(Integer idUser, Integer idEduCemadenOrganizations, String activationkey);
}
Loading…
Cancel
Save