Работа с базой и перемещение файлов
This commit is contained in:
parent
f022b2df1a
commit
1a19f1f88d
@ -1,8 +1,9 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -10,9 +11,11 @@ import javax.persistence.Id;
|
|||||||
public class Message {
|
public class Message {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
private Long idMess;
|
private Long idMess;
|
||||||
private Long idUser;
|
private Long idUser;
|
||||||
private String text;
|
private String text;
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,15 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
public class NextUnit {
|
public class NextUnit {
|
||||||
|
|
||||||
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long idNext;
|
private Long idNext;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
package org.sadtech.consultant.entity;
|
package org.sadtech.consultant.database.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ public class User {
|
|||||||
private String token;
|
private String token;
|
||||||
private String lastName;
|
private String lastName;
|
||||||
private String city;
|
private String city;
|
||||||
private List<SocialNetworks> socialNetworks;
|
// private List<SocialNetworks> socialNetworks;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Message;
|
import org.sadtech.consultant.database.entity.Message;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface MessageRepository extends JpaRepository<Message, Long> {
|
public interface MessageRepository extends JpaRepository<Message, Long> {
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.NextUnit;
|
import org.sadtech.consultant.database.entity.NextUnit;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface NextUnitRepositoriy extends JpaRepository<NextUnit, Long> {
|
public interface NextUnitRepositoriy extends JpaRepository<NextUnit, Long> {
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.SaveUnit;
|
import org.sadtech.consultant.database.entity.SaveUnit;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface SaveUnitRepositoriy extends JpaRepository<SaveUnit, Long> {
|
public interface SaveUnitRepositoriy extends JpaRepository<SaveUnit, Long> {
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.SocialNetworks;
|
import org.sadtech.consultant.database.entity.SocialNetworks;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface SocialNetworksRepositoriy extends JpaRepository<SocialNetworks, Long> {
|
public interface SocialNetworksRepositoriy extends JpaRepository<SocialNetworks, Long> {
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Unit;
|
import org.sadtech.consultant.database.entity.Unit;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface UnitRepositoriy extends JpaRepository<Unit, Long> {
|
public interface UnitRepositoriy extends JpaRepository<Unit, Long> {
|
@ -1,6 +1,6 @@
|
|||||||
package org.sadtech.consultant.repository;
|
package org.sadtech.consultant.database.repository;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.User;
|
import org.sadtech.consultant.database.entity.User;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface UserRepositoriy extends JpaRepository<User, Long> {
|
public interface UserRepositoriy extends JpaRepository<User, Long> {
|
@ -0,0 +1,8 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
import org.sadtech.consultant.database.entity.Message;
|
||||||
|
|
||||||
|
public interface MessageService {
|
||||||
|
|
||||||
|
void addMessage(Message message);
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
public interface NextUnitService {
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
public interface SaveUnitService {
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
public interface SocialNetworksService {
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
import org.sadtech.consultant.database.entity.Unit;
|
||||||
|
|
||||||
|
public interface UnitService {
|
||||||
|
|
||||||
|
void addUnit(Unit unit);
|
||||||
|
void removeUnit(Long id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package org.sadtech.consultant.database.service;
|
||||||
|
|
||||||
|
import org.sadtech.consultant.database.entity.User;
|
||||||
|
|
||||||
|
public interface UserService {
|
||||||
|
|
||||||
|
void addUser(User user);
|
||||||
|
void removeUser(Long id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
|
import org.sadtech.consultant.database.entity.Message;
|
||||||
|
import org.sadtech.consultant.database.repository.MessageRepository;
|
||||||
|
import org.sadtech.consultant.database.service.MessageService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MessageServiceImpl implements MessageService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageRepository repository;
|
||||||
|
|
||||||
|
public void addMessage(Message message) {
|
||||||
|
repository.saveAndFlush(message);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
import org.sadtech.consultant.repository.NextUnitRepositoriy;
|
import org.sadtech.consultant.database.repository.NextUnitRepositoriy;
|
||||||
import org.sadtech.consultant.service.NextUnitService;
|
import org.sadtech.consultant.database.service.NextUnitService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
import org.sadtech.consultant.repository.SaveUnitRepositoriy;
|
import org.sadtech.consultant.database.repository.SaveUnitRepositoriy;
|
||||||
import org.sadtech.consultant.service.SaveUnitService;
|
import org.sadtech.consultant.database.service.SaveUnitService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
import org.sadtech.consultant.repository.SocialNetworksRepositoriy;
|
import org.sadtech.consultant.database.repository.SocialNetworksRepositoriy;
|
||||||
import org.sadtech.consultant.service.SocialNetworksService;
|
import org.sadtech.consultant.database.service.SocialNetworksService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Unit;
|
import org.sadtech.consultant.database.entity.Unit;
|
||||||
import org.sadtech.consultant.repository.UnitRepositoriy;
|
import org.sadtech.consultant.database.repository.UnitRepositoriy;
|
||||||
import org.sadtech.consultant.service.UnitService;
|
import org.sadtech.consultant.database.service.UnitService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
package org.sadtech.consultant.database.service.impl;
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.User;
|
import org.sadtech.consultant.database.entity.User;
|
||||||
import org.sadtech.consultant.repository.UserRepositoriy;
|
import org.sadtech.consultant.database.repository.UserRepositoriy;
|
||||||
import org.sadtech.consultant.service.UserService;
|
import org.sadtech.consultant.database.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Message;
|
|
||||||
|
|
||||||
public interface MessageService {
|
|
||||||
|
|
||||||
void addMessage(Message message);
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
public interface NextUnitService {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
public interface SaveUnitService {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
public interface SocialNetworksService {
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Unit;
|
|
||||||
|
|
||||||
public interface UnitService {
|
|
||||||
|
|
||||||
void addUnit(Unit unit);
|
|
||||||
void removeUnit(Long id);
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package org.sadtech.consultant.service;
|
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.User;
|
|
||||||
|
|
||||||
public interface UserService {
|
|
||||||
|
|
||||||
void addUser(User user);
|
|
||||||
void removeUser(Long id);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package org.sadtech.consultant.service.impl;
|
|
||||||
|
|
||||||
import org.sadtech.consultant.entity.Message;
|
|
||||||
import org.sadtech.consultant.repository.MessageRepository;
|
|
||||||
import org.sadtech.consultant.service.MessageService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class MessageServiceImpl implements MessageService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MessageRepository repository;
|
|
||||||
|
|
||||||
public void addMessage(Message message) {
|
|
||||||
repository.saveAndFlush(message);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user