월별현황 list, detail, update ... core
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
||||
|
||||
private final GetMonthlyInputStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command) {
|
||||
GetMonthlyInputStatus secArticle = mapper.getMonthlyInputStatus(command);
|
||||
|
||||
|
||||
|
||||
return Optional.of(secArticle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetMonthlyInputStatusMapper {
|
||||
|
||||
GetMonthlyInputStatus getMonthlyInputStatus(GetMonthlyInputStatusCmd command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GetMonthlyInputStatusPortIn {
|
||||
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GetMonthlyInputStatusPortOut {
|
||||
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatusService implements GetMonthlyInputStatusPortIn {
|
||||
|
||||
private final GetMonthlyInputStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command) {
|
||||
return portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatus {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatusCmd {
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model.GetMonthlyInputStatussDto;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortOut;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatussDao implements GetMonthlyInputStatussPortOut {
|
||||
|
||||
private final GetMonthlyInputStatussMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command) {
|
||||
// 게시물 목록 얻기
|
||||
List<GetMonthlyInputStatussDto> contents =
|
||||
ListUtils.emptyIfNull(mapper.getMonthlyInputStatuss(pageable, command));
|
||||
|
||||
return new PageImpl<>(
|
||||
contents.stream()
|
||||
.map(
|
||||
article ->
|
||||
new GetMonthlyInputStatuss(
|
||||
article.getId(),
|
||||
article.getHouseholdSeq(),
|
||||
article.getMonth(),
|
||||
article.getForestProductStatus(),
|
||||
article.getBankAutoTransferStatus(),
|
||||
article.getCreatedAt(),
|
||||
article.getCreatedBy(),
|
||||
article.getUpdatedAt(),
|
||||
article.getUpdatedBy()
|
||||
))
|
||||
.collect(Collectors.toList()),
|
||||
pageable,
|
||||
contents.isEmpty() ? 0 : contents.get(0).getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command) {
|
||||
/*// 검색조건 초기화
|
||||
Specification<Article> spec = (root, query, criteriaBuilder) -> null;
|
||||
|
||||
// 검색어 - like 검색
|
||||
if (!StringUtils.isEmpty(command.getSearchField())) {
|
||||
spec =
|
||||
spec.and(
|
||||
(root, query, builder) ->
|
||||
builder.like(
|
||||
root.get(command.getSearchField()),
|
||||
"%" + command.getSearchValue() + "%"));
|
||||
}
|
||||
|
||||
// 공개여부 검색
|
||||
if (!StringUtils.isEmpty(command.getSearchOpen())) {
|
||||
spec =
|
||||
spec.and(
|
||||
((root, query, criteriaBuilder) ->
|
||||
criteriaBuilder.equal(
|
||||
root.get("visible"), Boolean.valueOf(command.getSearchOpen()))));
|
||||
}
|
||||
|
||||
List<Article> result = getArticlesRepo.findAll(spec);
|
||||
|
||||
return result.stream()
|
||||
.map(
|
||||
article ->
|
||||
new GetArticles(
|
||||
article.getId(),
|
||||
article.getUpdatedBy(),
|
||||
article.getUpdatedAt(),
|
||||
article.getTitle(),
|
||||
article.getContent(),
|
||||
article.getVisible(),
|
||||
article.getStartDate(),
|
||||
article.getEndDate(),
|
||||
article.getOrderNo(),
|
||||
article.getUploadFiles().stream()
|
||||
// 목록에 보여줄 대표이미지만 담는다
|
||||
.filter(
|
||||
uploadFile -> uploadFile.getType()
|
||||
.equals(FileUploadType.EXAMPLE_REP))
|
||||
.map(
|
||||
uploadFile ->
|
||||
new GetArticleFiles(
|
||||
uploadFile.getId(),
|
||||
uploadFile.getType(),
|
||||
uploadFile.getPath(),
|
||||
uploadFile.getName(),
|
||||
uploadFile.getOriginName(),
|
||||
uploadFile.getFileLength()))
|
||||
.findFirst()
|
||||
.orElse(null)))
|
||||
.collect(Collectors.toList());*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model.GetMonthlyInputStatussDto;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface GetMonthlyInputStatussMapper {
|
||||
List<GetMonthlyInputStatussDto> getMonthlyInputStatuss(
|
||||
@Param("pageable") Pageable pageable, @Param("cmd") GetMonthlyInputStatussCmd cmd);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class GetMonthlyInputStatussDto {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
|
||||
private Long total;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GetMonthlyInputStatussPortIn {
|
||||
|
||||
Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command);
|
||||
|
||||
List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GetMonthlyInputStatussPortOut {
|
||||
|
||||
Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command);
|
||||
|
||||
List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application;
|
||||
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortOut;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyInputStatussService implements GetMonthlyInputStatussPortIn {
|
||||
|
||||
private final GetMonthlyInputStatussPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command) {
|
||||
return portOut.operate(pageable, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command) {
|
||||
return portOut.operateList(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatuss {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatussCmd {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model.UpdateMonthlyInputStatusDto;
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class UpdateMonthlyInputStatusDao implements UpdateMonthlyInputStatusPortOut {
|
||||
|
||||
private final UpdateMonthlyInputStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public void operate(UpdateMonthlyInputStatusCmd command) {
|
||||
mapper.updateMonthlyInputStatus(
|
||||
new UpdateMonthlyInputStatusDto(
|
||||
command.getId(),
|
||||
command.getHouseholdSeq(),
|
||||
command.getMonth(),
|
||||
command.getForestProductStatus(),
|
||||
command.getBankAutoTransferStatus(),
|
||||
LocalDateTime.now(),
|
||||
CommonUtil.getLoginUsername()
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model.UpdateMonthlyInputStatusDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UpdateMonthlyInputStatusMapper {
|
||||
void updateMonthlyInputStatus(UpdateMonthlyInputStatusDto dto);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UpdateMonthlyInputStatusDto {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||
|
||||
public interface UpdateMonthlyInputStatusPortIn {
|
||||
|
||||
void operate(UpdateMonthlyInputStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||
|
||||
public interface UpdateMonthlyInputStatusPortOut {
|
||||
|
||||
void operate(UpdateMonthlyInputStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application;
|
||||
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class UpdateMonthlyInputStatusService implements UpdateMonthlyInputStatusPortIn {
|
||||
|
||||
private final UpdateMonthlyInputStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public void operate(UpdateMonthlyInputStatusCmd command) {
|
||||
portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateMonthlyInputStatusCmd {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.monthly.getMonthlyInputStatus.adapters.persistence.GetMonthlyInputStatusMapper">
|
||||
<select id="getMonthlyInputStatus"
|
||||
resultType="app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus">
|
||||
|
||||
<if test="id != null">
|
||||
SELECT
|
||||
a.id AS id,
|
||||
a.household_seq AS householdSeq,
|
||||
a.month AS month,
|
||||
a.forest_product_status AS forestProductStatus,
|
||||
a.bank_auto_transfer_status AS bankAutoTransferStatus,
|
||||
a.created_at AS createdAt,
|
||||
a.created_by AS createdBy,
|
||||
a.updated_at AS updatedAt,
|
||||
a.updated_by AS updatedBy
|
||||
FROM monthly_input_status a
|
||||
WHERE a.id = #{id}
|
||||
AND a.is_deleted = false
|
||||
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.GetMonthlyInputStatussMapper">
|
||||
|
||||
<select id="getMonthlyInputStatuss"
|
||||
resultType="app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model.GetMonthlyInputStatussDto">
|
||||
|
||||
SELECT
|
||||
|
||||
a.id AS id,
|
||||
a.household_seq AS householdSeq,
|
||||
a.month AS month,
|
||||
a.forest_product_status AS forestProductStatus,
|
||||
a.bank_auto_transfer_status AS bankAutoTransferStatus,
|
||||
a.created_at AS createdAt,
|
||||
a.created_by AS createdBy,
|
||||
a.updated_at AS updatedAt,
|
||||
a.updated_by AS updatedBy
|
||||
COUNT(*) OVER () AS total
|
||||
FROM monthly_input_status a
|
||||
WHERE a.is_deleted = false
|
||||
|
||||
<if test="cmd.searchField != null and cmd.searchField != ''">
|
||||
<choose>
|
||||
<when test="cmd.searchField eq 'month'">
|
||||
AND a.month ILIKE '%' || #{cmd.searchValue} || '%'
|
||||
</when>
|
||||
<when test="cmd.searchField eq 'household'">
|
||||
AND a.household_seq = #{cmd.searchValue}
|
||||
</when>
|
||||
<when test="cmd.searchField eq 'updatedBy'">
|
||||
AND a.updated_by ILIKE '%' || #{cmd.searchValue} || '%'
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="pageable.sort != null and !pageable.sort.isEmpty()">
|
||||
ORDER BY
|
||||
<foreach collection="pageable.sort" item="order" separator=",">
|
||||
<choose>
|
||||
<when test="order.property eq 'household'">a.household_seq</when>
|
||||
<when test="order.property eq 'updatedBy'">a.updated_by</when>
|
||||
<when test="order.property eq 'updatedAt'">a.updated_at</when>
|
||||
<when test="order.property eq 'createdBy'">a.created_by</when>
|
||||
<when test="order.property eq 'createdAt'">a.created_at</when>
|
||||
<otherwise>a.id</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="order.direction.toString() eq 'DESC'">DESC</when>
|
||||
<otherwise>ASC</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
|
||||
|
||||
|
||||
|
||||
<update id="updateMonthlyInputStatus">
|
||||
/* updateNotice 게시글 수정 */
|
||||
UPDATE monthly_input_status
|
||||
SET
|
||||
household_seq = #{householdSeq},
|
||||
month = #{month},
|
||||
forest_product_status = #{forestProductStatus},
|
||||
bank_auto_transfer_status = #{bankAutoTransferStatus},
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user