[BO] 일계부 등록 현황의 삭제 처리

This commit is contained in:
김현주
2025-06-26 18:08:49 +09:00
parent 3b632d3b3f
commit 529903cea0
12 changed files with 297 additions and 5 deletions

View File

@@ -0,0 +1,62 @@
<?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.tab.dailyRecord.removeDaily.adapters.persistence.RemoveDailyMapper">
<select id="removeDailyIncome">
<if test="removeIds != null and removeIds != ''">
update daily_income set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="removeDailyWork">
<if test="removeIds != null and removeIds != ''">
update daily_work set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyExpense">
<if test="removeIds != null and removeIds != ''">
update daily_expense set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyPower">
<if test="removeIds != null and removeIds != ''">
update daily_power set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyForestry">
<if test="removeIds != null and removeIds != ''">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyFarming">
<if test="removeIds != null and removeIds != ''">
update daily_farming set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
</mapper>

View File

@@ -502,7 +502,7 @@
<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}">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_income" value="${item.id}">
</label>
</div>
</td>
@@ -510,7 +510,7 @@
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
<td class="underline">${ifNullHyphen(item.incomeKind)}</td><!-- 수입의 종류 -->
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
@@ -817,7 +817,39 @@
const currentListId = $(el).data('listId');
console.log('removeDaily', currentStep, currentListId);
alert('TODO : 삭제')
if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) {
alert('삭제내용은 최소 1건은 선택해야 합니다.');
return;
} else if ($('#'+currentListId).find('input[type="checkbox"]').length === $('#'+currentListId).find('input[type="checkbox"]:checked').length) {
alert('등록내용은 최소 1건이 남아 있어야 합니다.');
return;
}
const selectedValues = [];
$('#'+currentListId).find('input[type="checkbox"]:checked').each((idx, item) => {
selectedValues.push($(item).val());
});
const obj = {};
obj.selectedIds = selectedValues;
obj.currentStep = currentStep;
console.log(obj)
etUI.dialog.confirm({
title: '삭제 안내',
message: '선택하신 항목을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
positiveCallback: function () {
ajaxUtil._ajaxAsyncNoWaiting(
'/api/household/daily/remove',
obj,
function () {
alert('데이터 삭제가 완료되었습니다.');
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
},
);
},
});
}
</script>
</div>