[FO] 일계부 자가임업 CRUD, 공통 수정

This commit is contained in:
김현주
2025-06-20 15:11:38 +09:00
parent 14fc4e1886
commit e434e4240e
30 changed files with 1235 additions and 51 deletions

View File

@@ -0,0 +1,70 @@
<?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.front.usecase.daily.forestry.adapters.persistence.DailyForestryMapper">
<select id="getDailyForestryList"
resultType="app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryDto">
select ds.id, ds.daily_record_seq
, ds.product_name, ds.usage
, ds.quantity, ds.unit_code, ds.unit_self, ds.estimated_value
from daily_forestry ds
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = ${id}
</if>
order by
ds.id desc
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_forestry ds
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = ${id}
</if>
</select>
<insert id="createDailyForestry" useGeneratedKeys="true" keyProperty="id">
insert into daily_forestry (
daily_record_seq, expense_mark
, product_name, usage
, quantity, unit_code, unit_self, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}, #{expenseMark}
, #{productName}, #{usage}
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<update id="updateDailyForestry">
update daily_forestry set <include refid="common.fields.UpdateBaseSet"/>
, expense_mark = #{expenseMark}
, product_name = #{productName}
, usage = #{usage}
, quantity = #{quantity}
, unit_code = #{unitCode}
, unit_self = #{unitSelf}
, estimated_value = #{estimatedValue}
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
and id = #{id}
</update>
<update id="removeDailyForestry">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
<if test="id != null and id != ''">
and id = #{id}
</if>
</update>
</mapper>

View File

@@ -30,8 +30,11 @@
<div class="list-item"
th:each="item, itemStatus : ${dailyRecord.targetList}"
th:classappend="${(item.name eq 'INCOME' && #lists.isEmpty(incomeList))
|| (item.name eq 'WORK' && #lists.isEmpty(workList))
|| (item.name eq 'EXPENSE' && #lists.isEmpty(expenseList))
|| (item.name eq 'POWER' && #lists.isEmpty(powerList))} ? 'no-data'"
|| (item.name eq 'POWER' && #lists.isEmpty(powerList))
|| (item.name eq 'FORESTRY' && #lists.isEmpty(forestryList))
|| (item.name eq 'FARMING' && #lists.isEmpty(farmingList))} ? 'no-data'"
>
<div class="item-tit-group">
<p class="item-name">[[${item.desc}]]</p>
@@ -47,7 +50,7 @@
</th:block>
<th:block th:each="child, childStatus : ${incomeList}">
<li>
<p>[[${child.categorySelf}]]</p>
<p>[[${child.incomeKind}]]</p>
<span th:if="${not #strings.isEmpty(child.price)}"
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
@@ -66,7 +69,7 @@
</th:block>
<th:block th:each="child, childStatus : ${expenseList}">
<li>
<p>[[${child.categorySelf}]]</p>
<p>[[${child.expenseKind}]]</p>
<span th:if="${not #strings.isEmpty(child.price)}"
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
@@ -74,8 +77,8 @@
</li>
</th:block>
</ul>
<!--/* TODO 임업노동 투입 */-->
<!--/*<ul class="detail-list"
<!--/* 임업노동 투입 */-->
<ul class="detail-list"
th:if="${item.name eq 'WORK'}"
>
<th:block th:if="${#strings.isEmpty(workList)}">
@@ -85,28 +88,14 @@
</th:block>
<th:block th:each="child, childStatus : ${workList}">
<li>
<p>호두</p>
<p>[[${child.itemName}]]</p>
<span>
<span>수확</span>
<span>총 23시간</span>
</span>
</li>
<li>
<p>밤</p>
<span>
<span>줍기</span>
<span>총 12시간</span>
</span>
</li>
<li>
<p>밤</p>
<span>
<span>선별</span>
<span>총 2시간</span>
<span>[[${child.workName}]]</span>
<span>총 [[${child.totalHour}]]시간</span>
</span>
</li>
</th:block>
</ul>*/-->
</ul>
<!--/* 동력 사용시간 */-->
<ul class="detail-list"
th:if="${item.name eq 'POWER'}"
@@ -120,13 +109,29 @@
<li>
<p>[[${child.equipmentName}]]</p>
<span th:if="${not #strings.isEmpty(child.ownedHours)}"
th:text="|총${#numbers.formatInteger(child.ownedHours, 1, 'COMMA')}시간|">총8시간</span>
th:text="|총 ${#numbers.formatInteger(child.ownedHours, 1, 'COMMA')}시간|">총8시간</span>
<span th:if="${not #strings.isEmpty(child.leasedHours)}"
th:text="|총${#numbers.formatInteger(child.leasedHours, 1, 'COMMA')}시간|">총8시간</span>
th:text="|총 ${#numbers.formatInteger(child.leasedHours, 1, 'COMMA')}시간|">총8시간</span>
</li>
</th:block>
</ul>
<!--/* 임업생산물 중 자가소비량 */-->
<ul class="detail-list"
th:if="${item.name eq 'FORESTRY'}"
>
<th:block th:if="${#lists.isEmpty(forestryList)}">
<li>
<p>없음</p>
</li>
</th:block>
<th:block th:each="child, childStatus : ${forestryList}">
<li>
<p>[[${child.productName}]]</p>
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</th:block>
</ul>
<!--/* TODO 임업생산물 중 자가소비량 */-->
<!--/* TODO 농업생산물 중 자가소비량 */-->
</div>
</div>

View File

@@ -70,7 +70,7 @@
</span>
</label>
</div>
<!--/*<div class="component-input">
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">자가임업 생산물 중 자가소비량</span>
<input type="checkbox" name="forestryStatus" value="TARGET" data-target="forestry"
@@ -79,7 +79,7 @@
<span class="switch-handle"></span>
</span>
</label>
</div>*/-->
</div>
<!--/* [정책] 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택, 21일 이후는 마지막 날 */-->
<!--/*<div class="component-input"
th:if="${reqVO.groupNo eq 4 or reqVO.groupNo eq 8 or reqVO.groupNo eq 12

View File

@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<th:block>
<div class="modal-content-inner">
<p class="form-desc">필수입력</p>
<form name="reqModalForm">
<input type="hidden" name="id" th:value="${detail.id}">
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="productName" class="label-txt">
생산물
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="productName" name="productName" th:value="${detail.productName}" maxlength="30" placeholder="생산물을 입력해 주세요">
</div>
</div>
<div class="component-input">
<div class="input-label">
<label for="usage" class="label-txt">
용도
</label>
</div>
<div class="input-field">
<input type="text" id="usage" name="usage" th:value="${detail.usage}" maxlength="30" placeholder="용도를 입력해 주세요">
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="quantity" class="label-txt">
수량
</label>
</div>
<div class="input-field">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity"
th:value="${detail.quantity}" maxlength="10" placeholder="수량을 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 2, 2.5</li>
</ul>
</div>
<div class="select-group">
<div class="select-label">
<p class="label-txt">
단위
</p>
</div>
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
<input type="hidden" name="unitCode" th:value="${detail.unitCode}">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>단위</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.id eq detail.unitCode ? 'current' : ''}"
></li>
</ul>
</div>
</div>
</div>
<div class="component-input" data-option="직접 입력">
<div class="input-field">
<input type="text" name="unitSelf" th:value="${detail.unitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
</div>
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="estimatedValue" class="label-txt">
현물평가액
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-price">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue"
th:value="${detail.estimatedValue}" maxlength="10" placeholder="금액을 입력해 주세요">
<span class="input-field-txt">원</span>
</div>
<ul class="guide-info">
<li>예 : 30000</li>
</ul>
</div>
</section>
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn btn-full btn-l btn-primary" onclick="modalControl.createVaild();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</form>
</div>
</th:block>
</html>

View File

@@ -0,0 +1,207 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="acco-wrap">
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3>
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
</th:block>
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
</th:block>
<strong>임업생산물 중 자가소비량 [[${#lists.isEmpty(forestryList) ? 0 : #lists.size(forestryList)}]]건 등록</strong>
되었습니다.
</h3>
<p th:if="${#lists.isEmpty(forestryList)}">자가임업생산물 중 자가소비량 내역을 등록해 주세요.</p>
<p th:unless="${#lists.isEmpty(forestryList)}">등록 내용을 확인하거나 다음 단계로 이동하세요.</p>
</hgroup>
<!--/* 신규 등록 */-->
<th:block th:if="${#lists.isEmpty(forestryList)}">
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
th:disabled="${#strings.equals(dailyRecord.forestryStatus, 'TODAY_NONE')}">
<i class="ico-small" aria-hidden="true"
th:classappend="${#strings.equals(dailyRecord.forestryStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
<span class="btn-txt">추가 등록</span>
</button>
<div class="component-input align-center">
<label class="checkbox-inner" id="todayNone">
<input type="checkbox" name="todayNone"
data-type="FORESTRY"
th:checked="${#strings.equals(dailyRecord.forestryStatus, 'TODAY_NONE')}">
<span class="checkbox-item">
<span class="checkbox-txt">금일 등록내용 없음</span>
</span>
</label>
</div>
<ul class="info-bullet-list">
<li>
다른 임가가 생산한 것을 취득하거나 외부로부터의 구입 • 증여한 것은 제외해 주세요.
</li>
</ul>
</th:block>
<!--/* 목록 */-->
<th:block th:unless="${#lists.isEmpty(forestryList)}">
<section class="regist-item-area">
<p class="total">
<span>총 <strong>[[${#lists.size(forestryList)}]]</strong>건</span>
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
<i class="ico-reset ico-small" aria-hidden="true"></i>
<span>초기화</span>
</button>
</p>
<div class="item-list">
<div class="list-item"
th:each="item, itemStatus : ${forestryList}">
<div class="item-tit-group">
<p class="item-name">[[${item.productName}]]</p>
<div class="btn-group">
<button type="button" class="delete" th:onclick="krip.daily.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" th:onclick="krip.daily.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
</div>
</div>
<ul class="detail-list">
<li th:if="${not #strings.isEmpty(item.usage)}">
<p>용도</p>
<span th:text="${item.usage}">0시간</span>
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
<p>현물평가액</p>
<span th:text="|${#numbers.formatInteger(item.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</ul>
</div>
</div>
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
<i class="ico-add ico-small" aria-hidden="true"></i>
<span class="btn-txt">추가 등록</span>
</button>
<ul class="info-bullet-list">
<li>
다른 임가가 생산한 것을 취득하거나 외부로부터의 구입 • 증여한 것은 제외해 주세요.
</li>
</ul>
</section>
</th:block>
</div>
</main>
<!-- 하단 고정 버튼 -->
<div class="component-btns fixed"
th:if="${moveStep}">
<div class="btns-row">
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
<span class="btn-txt">이전 단계로 이동</span>
</button>
<button type="button" class="btn btn-l btn-primary"
th:disabled="${not #strings.equals(dailyRecord.forestryStatus, 'TODAY_NONE') and #lists.isEmpty(forestryList)}"
th:onclick="krip.daily.goToNext([[${nextStep}]], [[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
<span class="btn-txt">다음 단계로 이동</span>
</button>
</div>
</div>
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal acco-wrap formModal" data-props-dimm-click="true">
<div class="modal-dimm"></div>
<div class="modal-frame">
<div class="modal-container">
<div class="modal-header">
<h3 class="modal-tit">임업생산물 중 자가소비량 등록</h3>
</div>
<div class="modal-content">
<!--/* form */-->
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</div>
<!-- //모달 팝업 -->
<!-- /* 건의사항 모달 팝업 */ -->
<th:block th:replace="~{/record/comment-modal}"></th:block>
<!-- /* //건의사항 모달 팝업 */ -->
</div>
<section layout:fragment="script">
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
$(function() {
formControl.init();
});
let ENV = {
httpUrl: {
root: /*[[|/record/forestry/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/forestry/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
create: /*[[|/api/record/forestry/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
remove: /*[[|/api/record/forestry/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/forestry/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
modal: {
// 등록 버튼
selectorId: '.button-modal01',
// 등록 영역
selector: '.formModal',
},
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
let formControl = {
init() {
krip.daily.baseBindUI();
},
};
let modalControl = {
_bindModelUI() {
const $select2 = document.querySelector('#unitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="unitCode"]').val(dataValue)
etUI.pages.initDirectInputToggle();
}
});
const $formWrap = $(ENV.modal.selector).find('form');
// data set
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
},
createVaild() {
modalControl.create();
},
create() {
const f = document.reqModalForm;
const obj = $(f).serializeObject();
console.log(obj)
ajaxUtil._ajaxAsync(
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
obj,
function (rstData, status) {
location.reload();
},
);
},
};
</script>
</section>
</html>