Merge branch 'kangsun' into 'dev'
[BO] 임가 현황 - 임산물 현황 작업 중 (8) See merge request korea-research/korea-research!16
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortOut;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductsStatusDao implements GetForestProductsStatusPortOut {
|
||||
private final GetForestProductsStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd) {
|
||||
return mapper.getForestProductsStatus(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetForestProductsStatusMapper {
|
||||
List<GetForestProductsStatus> getForestProductsStatus(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.adapters.web.model.GetForestProductsStatusReqVO;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.adapters.web.model.GetForestProductsStatusResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductsStatusController {
|
||||
private final GetForestProductsStatusPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/household/forestProducts")
|
||||
ResponseEntity<List<GetForestProductsStatus>> operate(
|
||||
GetForestProductsStatusReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(portIn.operate(
|
||||
new GetForestProductsStatusCmd(reqVO.getHouseholdSeq(), reqVO.getMonth())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusReqVO {
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusResVO {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetForestProductsStatusPortIn {
|
||||
List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import java.util.List;
|
||||
|
||||
public interface GetForestProductsStatusPortOut {
|
||||
List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortIn;
|
||||
import app.module.admin.usecase.household.getForestProductsStatus.ports.GetForestProductsStatusPortOut;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductsStatusService implements GetForestProductsStatusPortIn {
|
||||
private final GetForestProductsStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public List<GetForestProductsStatus> operate(GetForestProductsStatusCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatus {
|
||||
private Long id;
|
||||
private String streetNum;
|
||||
private String landType;
|
||||
private String town;
|
||||
private String availableArea;
|
||||
private String cropName;
|
||||
private String landArea;
|
||||
private String mainYield;
|
||||
private String mainYieldText;
|
||||
private String mainSaleAmount;
|
||||
private String mainSaleAmountText;
|
||||
private String subYield;
|
||||
private String subYieldText;
|
||||
private String subSaleAmount;
|
||||
private String subSaleAmountText;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductsStatusCmd {
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.admin.usecase.household.getForestProductsStatus.adapters.persistence.GetForestProductsStatusMapper">
|
||||
<select id="getForestProductsStatus"
|
||||
resultType="app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus">
|
||||
/* getForestProductsStatus : 임가 현황의 임산물 현황 목록 조회 */
|
||||
SELECT df.id, /* 임산물 현황 id */
|
||||
df.street_num, /* 지번 */
|
||||
df.land_type, /* 지목 */
|
||||
df.town, /* 읍면동 */
|
||||
df.available_area, /* 가능면적 */
|
||||
df.crop_name, /* 재배작물명 */
|
||||
df.land_area, /* 면적 */
|
||||
df.main_yield, /* 주생산물 수확량 */
|
||||
ui_main_yield.code_text, /* 주생산물 수확량 단위 */
|
||||
df.main_sale_amount, /* 주생산물 판매량 */
|
||||
ui_main_sale.code_text , /* 주생산물 판매량 단위 */
|
||||
df.sub_yield, /* 부생산물 수확량 */
|
||||
ui_sub_yield.code_text , /* 주생산물 판매량 단위 */
|
||||
df.sub_sale_amount, /* 부생산물 판매량 */
|
||||
ui_sub_sale.code_text /* 부생산물 판매량 단위 */
|
||||
FROM forest_product df
|
||||
-- TODO(ks) : 일단 전부 join.. 추후에 view 로 만들든지 개선해보기..
|
||||
LEFT JOIN uicode ui_main_yield ON ui_main_yield.parent_id = 'code.record.unit' AND ui_main_yield.id = df.main_yield_unit_code
|
||||
LEFT JOIN uicode ui_main_sale ON ui_main_sale.parent_id = 'code.record.unit' AND ui_main_sale.id = df.main_sale_unit_code
|
||||
LEFT JOIN uicode ui_sub_yield ON ui_sub_yield.parent_id = 'code.record.unit' AND ui_sub_yield.id = df.sub_yield_unit_code
|
||||
LEFT JOIN uicode ui_sub_sale ON ui_sub_sale.parent_id = 'code.record.unit' AND ui_sub_sale.id = df.sub_sale_unit_code
|
||||
WHERE df.household_seq = #{householdSeq}
|
||||
AND df.month = #{month}
|
||||
AND df.is_deleted = false
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -423,8 +423,55 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-content" data-tab-value="tab2">
|
||||
<div class="tab-content forest-product" data-tab-value="tab2">
|
||||
<div class="content-inner">
|
||||
<section class="table-group">
|
||||
<div class="table-tit-group">
|
||||
<h3></h3>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn small">
|
||||
<span class="btn-txt">등록여부</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-secondary">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="forest-product">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7"></th>
|
||||
<th colspan="4">주생산물</th>
|
||||
<th colspan="4">부생산물</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>지번</th>
|
||||
<th>지목</th>
|
||||
<th>읍면동</th>
|
||||
<th>가능면적(평)</th>
|
||||
<th>재배작물명</th>
|
||||
<th>면적(평)</th>
|
||||
<th>수확량</th>
|
||||
<th>단위</th>
|
||||
<th>판매량</th>
|
||||
<th>단위</th>
|
||||
<th>수확량</th>
|
||||
<th>단위</th>
|
||||
<th>판매량</th>
|
||||
<th>단위</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -512,7 +559,7 @@
|
||||
break;
|
||||
case 'forest-product': // 임산물 현황
|
||||
console.log("임산물 현황");
|
||||
// getForestProductStatus();
|
||||
getForestProductsStatus();
|
||||
break;
|
||||
case 'bank-auto-transfer': // 은행자동이체내역
|
||||
console.log("은행자동이체내역");
|
||||
@@ -866,7 +913,66 @@
|
||||
|
||||
tbody.append(tmpl);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const getForestProductsStatus = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/forestProducts',
|
||||
{
|
||||
householdSeq: f.householdSeq.value,
|
||||
month: f.recordMonth.value
|
||||
},
|
||||
function(response) { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
const tbody = $('.tab-content.forest-product').find('tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
let tmpl = '';
|
||||
$(response).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.streetNum)}</td> <!-- 지번 -->
|
||||
<td>${ifNullDash(item.landType)}</td><!-- 지목 -->
|
||||
<td>${ifNullDash(item.town)}</td><!-- 읍면동 -->
|
||||
<td>${ifNullDash(item.availableArea)}</td><!-- 가능면적(평) -->
|
||||
<td>${ifNullDash(item.cropName)}</td><!-- 재배작물명 -->
|
||||
<td>${ifNullDash(item.landArea)}</td><!-- 면적(평) -->
|
||||
<td class="align-right">${ifNullDash(item.mainYield)}</td><!-- 주생산물 수확량 -->
|
||||
<td>${ifNullDash(item.mainYieldText)}</td><!-- 주생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.mainSaleAmount)}</td><!-- 주생산물 판매량 -->
|
||||
<td>${ifNullDash(item.mainSaleAmountText)}</td><!-- 주생산물 판매량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.subYield)}</td><!-- 부생산물 수확량 -->
|
||||
<td>${ifNullDash(item.subYieldText)}</td><!-- 부생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.subSaleAmount)}</td><!-- 부생산물 판매량 -->
|
||||
<td>${ifNullDash(item.subSaleAmountText)}</td><!-- 부생산물 판매량 단위 -->
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
tbody.append(tmpl);
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// nodata 처리
|
||||
const noData = (target, status, length) => {
|
||||
const noDataText = status === 'TARGET' ? '등록이 필요합니다.' : '등록없음';
|
||||
|
||||
Reference in New Issue
Block a user