[FO] 일계부 항목 수정 가능하도록 추가

This commit is contained in:
김현주
2025-06-12 15:58:57 +09:00
parent 1ed5e7ad69
commit 2f7591e687
6 changed files with 61 additions and 26 deletions

View File

@@ -12,7 +12,7 @@ public interface DailyRecordMapper {
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
/**
* 일계부 등록 여부
* 일계부 항목 등록 여부
*
* @param reqVO
* @return
@@ -20,14 +20,21 @@ public interface DailyRecordMapper {
Integer getDailyRecordExistCount(DailyRecordUIReqVO reqVO);
/**
* 일계부 등록(생성)
* 일계부 항목 등록(생성)
*
* @param command
*/
void createDailyRecord(CreateDailyRecordCmd command);
/**
* 일계부 상태 수정
* 일계부 항목 수정
*
* @param command
*/
void updateDailyRecord(CreateDailyRecordCmd command);
/**
* 일계부 항목의 상태 수정
*
* @param command
* @return

View File

@@ -66,6 +66,9 @@ public class DailyRecordServiceImpl implements DailyRecordService {
log.debug("[CreateDailyRecord] record={}", command);
} else {
// TODO : NONE 으로 변경시 연관 테이블 데이터 삭제할 것인가?
dailyRecordMapper.updateDailyRecord(command);
log.warn("[DailyRecordCreate] existCount={}, recordMonth={}, dayGroupNo={}", existCount, reqVO.getRecordMonth(), reqVO.getDayGroupNo());
}
}

View File

@@ -40,6 +40,21 @@
)
</insert>
<update id="updateDailyRecord">
update daily_record set <include refid="common.fields.UpdateBaseSet"/>
, all_status = #{allStatus}
, income_status = #{incomeStatus}
, work_status = #{workStatus}
, expense_status = #{expenseStatus}
, power_status = #{powerStatus}
, forestry_status = #{forestryStatus}
, farming_status = #{farmingStatus}
where is_deleted = false
and record_month = #{recordMonth}
and day_group_no = #{dayGroupNo}
and household_seq = #{householdSeq}
</update>
<update id="updateDailyRecordStatus">
update daily_record set <include refid="common.fields.UpdateBaseSet"/>
<if test="allStatus != null and allStatus != ''">

View File

@@ -25,14 +25,18 @@ krip.daily.goToPrev = function(target, searchMonth, groupNo) {
console.log(url);
}
krip.daily.goToPrev = function() {
// TODO : history.back 으로 해결 되는가?
history.back();
}
krip.daily.goToNext = function(target, searchMonth, groupNo) {
let url = krip.daily.httpUrl.target;
url = url.replace('{month}', searchMonth);
url = url.replace('{groupNo}', groupNo);
url = url.replace('{target}', target);
console.log(url);
//location.href = url;
location.href = url;
};
/**

View File

@@ -32,7 +32,8 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">수입</span>
<input type="checkbox" name="incomeStatus" value="WAITING" data-target="income">
<input type="checkbox" name="incomeStatus" value="TARGET" data-target="income"
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TARGET') or #strings.equals(dailyRecord.incomeStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
@@ -41,7 +42,8 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">임업노동 투입 내역</span>
<input type="checkbox" name="workStatus" value="WAITING" data-target="work">
<input type="checkbox" name="workStatus" value="TARGET" data-target="work"
th:checked="${#strings.equals(dailyRecord.workStatus, 'TARGET') or #strings.equals(dailyRecord.workStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
@@ -50,7 +52,8 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">지출</span>
<input type="checkbox" name="expenseStatus" value="WAITING" data-target="expense">
<input type="checkbox" name="expenseStatus" value="TARGET" data-target="expense"
th:checked="${#strings.equals(dailyRecord.expenseStatus, 'TARGET') or #strings.equals(dailyRecord.expenseStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
@@ -59,7 +62,8 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">동력 사용시간</span>
<input type="checkbox" name="powerStatus" value="WAITING" data-target="power">
<input type="checkbox" name="powerStatus" value="TARGET" data-target="power"
th:checked="${#strings.equals(dailyRecord.powerStatus, 'TARGET') or #strings.equals(dailyRecord.powerStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
@@ -68,17 +72,21 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">자가임업 생산물 중 자가소비량</span>
<input type="checkbox" name="forestryStatus" value="WAITING" data-target="forestry">
<input type="checkbox" name="forestryStatus" value="TARGET" data-target="forestry"
th:checked="${#strings.equals(dailyRecord.forestryStatus, 'TARGET') or #strings.equals(dailyRecord.forestryStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
<!-- TODO : 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택 -->
<div class="component-input">
<!--/* [정책] 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택, 21일 이후는 마지막 날 */-->
<div class="component-input"
th:if="${reqVO.groupNo eq 4 or reqVO.groupNo eq 8 or reqVO.groupNo eq 12
or reqVO.groupNo eq 16 or reqVO.groupNo eq 17}">
<label class="switch-inner type-txt">
<span class="switch-label">자가농업 생산물 중 자가소비량</span>
<input type="checkbox" name="farmingStatus" value="WAITING" data-target="farming">
<input type="checkbox" name="farmingStatus" value="TARGET" data-target="farming"
th:checked="${#strings.equals(dailyRecord.farmingStatus, 'TARGET') or #strings.equals(dailyRecord.farmingStatus, 'DONE')}">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
@@ -90,7 +98,7 @@
</main>
<div class="component-btns fixed">
<div class="btns-row" th:if="${!dailyRecord.updated}">
<div class="btns-row">
<button type="button" class="btn btn-l btn-primary" th:onclick="formControl.createValid([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
<span class="btn-txt">다음 단계로 이동</span>
</button>
@@ -104,7 +112,7 @@
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
create: /*[[|/api/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'createUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
@@ -156,9 +164,9 @@
const obj = $(f).serializeObject();
ajaxUtil._ajaxAsync(
ENV.httpUrl.root,
ENV.httpUrl.create,
obj,
function (rstData, status) {
function () {
if (f.todayNone.value === 'Y') {
krip.daily.goToMain();
} else {

View File

@@ -106,7 +106,7 @@
<!-- 하단 고정 버튼 -->
<div class="component-btns fixed">
<div class="btns-row">
<button type="button" class="btn btn-l btn-secondary">
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
<span class="btn-txt">이전 단계로 이동</span>
</button>
<!-- 비활성화 스타일/ 버튼 속성 disable 추가-->
@@ -222,24 +222,23 @@
function(rstHtml, status) {
$('.modal01').find('.modal-content').html(rstHtml);
// TODO
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'));
etUI.components.SelectBox().core.init(document.querySelector('#cropCode'));
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'));
/*
const selectbox = etUI.components.SelectBox();
etUI.components.SelectBox().core.init(document.querySelector('#selectCategory'), {
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
// TODO : console.log ?
console.log(1111)
}
});
etUI.components.SelectBox().core.init(document.querySelector('#selectUnit'), {
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'), {
onChange: function() {
console.log('sssssssssss')
},
@@ -247,20 +246,19 @@
console.log(3333)
}
});
*/
document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
/*document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
etUI.components.SelectBox();
const selectbox2 = document.querySelector('.component-select');
selectbox2.addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
*/
*/
//document.queerySelector('#unitSelect')