관리자 관리 추가, 수정
This commit is contained in:
@@ -27,15 +27,15 @@ public class AuthCoreService {
|
||||
new EntityNotFoundException("중복된 아이디가 있습니다. " + saveReq.getUserId());
|
||||
}
|
||||
|
||||
UserEntity userEntity = new UserEntity(
|
||||
null,
|
||||
saveReq.getUserAuth(),
|
||||
saveReq.getUserNm(),
|
||||
saveReq.getUserId(),
|
||||
saveReq.getEmpId(),
|
||||
saveReq.getUserEmail(),
|
||||
saveReq.getUserPw()
|
||||
);
|
||||
UserEntity userEntity =
|
||||
new UserEntity(
|
||||
null,
|
||||
saveReq.getUserAuth(),
|
||||
saveReq.getUserNm(),
|
||||
saveReq.getUserId(),
|
||||
saveReq.getEmpId(),
|
||||
saveReq.getUserEmail(),
|
||||
saveReq.getUserPw());
|
||||
|
||||
return authRepository.save(userEntity);
|
||||
}
|
||||
@@ -48,8 +48,8 @@ public class AuthCoreService {
|
||||
* @return
|
||||
*/
|
||||
public UserEntity update(Long id, AuthDto.SaveReq saveReq) {
|
||||
UserEntity userEntity = authRepository.findById(id)
|
||||
.orElseThrow(() -> new RuntimeException("유저가 존재하지 않습니다."));
|
||||
UserEntity userEntity =
|
||||
authRepository.findById(id).orElseThrow(() -> new RuntimeException("유저가 존재하지 않습니다."));
|
||||
|
||||
if (saveReq.getUserAuth() != null) {
|
||||
userEntity.setUserAuth(saveReq.getUserAuth());
|
||||
@@ -85,8 +85,8 @@ public class AuthCoreService {
|
||||
* @return
|
||||
*/
|
||||
public UserEntity withdrawal(Long id) {
|
||||
UserEntity userEntity = authRepository.findById(id)
|
||||
.orElseThrow(() -> new RuntimeException("유저가 존재하지 않습니다."));
|
||||
UserEntity userEntity =
|
||||
authRepository.findById(id).orElseThrow(() -> new RuntimeException("유저가 존재하지 않습니다."));
|
||||
|
||||
userEntity.setId(id);
|
||||
userEntity.setDateWithdrawal(ZonedDateTime.now());
|
||||
@@ -102,7 +102,10 @@ public class AuthCoreService {
|
||||
* @return
|
||||
*/
|
||||
public AuthDto.Basic findUserById(Long id) {
|
||||
UserEntity entity = authRepository.findUserById(id).orElseThrow(() -> new EntityNotFoundException("관리자를 찾을 수 없습니다. " + id));
|
||||
UserEntity entity =
|
||||
authRepository
|
||||
.findUserById(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("관리자를 찾을 수 없습니다. " + id));
|
||||
return entity.toDto();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ public class ChangeDetectionCoreService {
|
||||
// 중심 좌표 계산
|
||||
Point centroid = polygon.getCentroid();
|
||||
|
||||
return new ChangeDetectionDto.TestDto(p.getId(), polygon, centroid.getX(), centroid.getY());
|
||||
return new ChangeDetectionDto.TestDto(
|
||||
p.getId(), polygon, centroid.getX(), centroid.getY());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@@ -39,14 +40,14 @@ public class ChangeDetectionCoreService {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
return list.stream()
|
||||
.map(
|
||||
s -> {
|
||||
try {
|
||||
return mapper.readTree(s);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.map(
|
||||
s -> {
|
||||
try {
|
||||
return mapper.readTree(s);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,9 @@ import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -149,5 +146,4 @@ public class MapSheetAnalDataEntity {
|
||||
|
||||
@Column(name = "ref_map_sheet_num")
|
||||
private Long refMapSheetNum;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,16 +23,16 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
@Entity
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Table(
|
||||
name = "tb_user",
|
||||
uniqueConstraints = {@UniqueConstraint(name = "ux_tb_user_user_id", columnNames = "user_id")})
|
||||
name = "tb_user",
|
||||
uniqueConstraints = {@UniqueConstraint(name = "ux_tb_user_user_id", columnNames = "user_id")})
|
||||
public class UserEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_user_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_user_id_gen",
|
||||
sequenceName = "tb_user_user_uid_seq",
|
||||
allocationSize = 1)
|
||||
name = "tb_user_id_gen",
|
||||
sequenceName = "tb_user_user_uid_seq",
|
||||
allocationSize = 1)
|
||||
@Column(name = "user_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -88,7 +88,14 @@ public class UserEntity {
|
||||
@Column(name = "emp_id", nullable = false)
|
||||
private String empId;
|
||||
|
||||
public UserEntity(Long id, String userAuth, String userNm, String userId, String empId, String userEmail, String userPw) {
|
||||
public UserEntity(
|
||||
Long id,
|
||||
String userAuth,
|
||||
String userNm,
|
||||
String userId,
|
||||
String empId,
|
||||
String userEmail,
|
||||
String userPw) {
|
||||
this.id = id;
|
||||
this.userAuth = userAuth;
|
||||
this.userNm = userNm;
|
||||
@@ -100,14 +107,12 @@ public class UserEntity {
|
||||
|
||||
public AuthDto.Basic toDto() {
|
||||
return new AuthDto.Basic(
|
||||
this.id,
|
||||
this.userAuth,
|
||||
this.userNm,
|
||||
this.userId,
|
||||
this.empId,
|
||||
this.userEmail,
|
||||
this.createdDttm
|
||||
);
|
||||
|
||||
this.id,
|
||||
this.userAuth,
|
||||
this.userNm,
|
||||
this.userId,
|
||||
this.empId,
|
||||
this.userEmail,
|
||||
this.createdDttm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QUserEntity userEntity = QUserEntity.userEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 유저 아이디로 조회
|
||||
*
|
||||
@@ -33,7 +32,7 @@ public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
@Override
|
||||
public Optional<UserEntity> findByUserId(String userId) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory.selectFrom(userEntity).where(userEntity.userId.eq(userId)).fetchOne());
|
||||
queryFactory.selectFrom(userEntity).where(userEntity.userId.eq(userId)).fetchOne());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +44,7 @@ public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
@Override
|
||||
public Optional<UserEntity> findUserById(Long id) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory.selectFrom(userEntity).where(userEntity.id.eq(id)).fetchOne());
|
||||
queryFactory.selectFrom(userEntity).where(userEntity.id.eq(id)).fetchOne());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,25 +62,23 @@ public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
}
|
||||
|
||||
List<Basic> content =
|
||||
queryFactory
|
||||
.select(Projections.constructor(AuthDto.Basic.class,
|
||||
userEntity.id,
|
||||
userEntity.userAuth,
|
||||
userEntity.userNm,
|
||||
userEntity.userId,
|
||||
userEntity.empId,
|
||||
userEntity.userEmail,
|
||||
userEntity.createdDttm
|
||||
))
|
||||
.from(userEntity)
|
||||
.where(
|
||||
builder
|
||||
)
|
||||
.orderBy(userEntity.userId.asc())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuthDto.Basic.class,
|
||||
userEntity.id,
|
||||
userEntity.userAuth,
|
||||
userEntity.userNm,
|
||||
userEntity.userId,
|
||||
userEntity.empId,
|
||||
userEntity.userEmail,
|
||||
userEntity.createdDttm))
|
||||
.from(userEntity)
|
||||
.where(builder)
|
||||
.orderBy(userEntity.userId.asc())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory.select(userEntity.id).from(userEntity).where(builder).fetchCount();
|
||||
long total = queryFactory.select(userEntity.id).from(userEntity).where(builder).fetchCount();
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,11 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findPolygonJson(){
|
||||
public List<String> findPolygonJson() {
|
||||
return queryFactory
|
||||
.select(
|
||||
Expressions.stringTemplate("ST_AsGeoJSON({0})", mapSheetAnalDataGeomEntity.geom)
|
||||
)
|
||||
.from(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
.select(Expressions.stringTemplate("ST_AsGeoJSON({0})", mapSheetAnalDataGeomEntity.geom))
|
||||
.from(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user