수입/지출 데이터 삭제시 OCR의 경우 파일 실삭제

This commit is contained in:
주수현
2025-07-07 11:11:10 +09:00
parent e85d6feda1
commit 35c9bab244
12 changed files with 247 additions and 7 deletions

View File

@@ -27,6 +27,27 @@
</if>
</select>
<select id="getRecordExistTypeCount">
select count(1) as count,
ds.input_type,
rhr.file_id,
COALESCE(fc.file_id_count, 0) as file_id_count
from daily_expense ds
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
left join
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
left join (
select file_id,COUNT(*) AS file_id_count
FROM receipt_has_record
where is_deleted = false and type = 'EXPENSE'
group by file_id
) fc on fc.file_id = rhr.file_id
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = #{id}
</if>
group by ds.id,rhr.file_id,fc.file_id_count
</select>
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
insert into daily_expense (
daily_record_seq, input_type, category, income_mark
@@ -69,4 +90,13 @@
</if>
</update>
<update id="removeDailyExpenseReceipt">
update receipt_has_record set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
<if test="id != null and id != ''">
and receipt_type_id = #{id}
</if>
</update>
</mapper>

View File

@@ -27,6 +27,30 @@
</if>
</select>
<select id="getRecordExistTypeCount">
select count(1) as count,
ds.input_type,
rhr.file_id,
COALESCE(fc.file_id_count, 0) as file_id_count
from daily_income ds
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
left join
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
left join (
select file_id,COUNT(*) AS file_id_count
FROM receipt_has_record
where is_deleted = false and type = 'INCOME'
group by file_id
) fc on fc.file_id = rhr.file_id
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = #{id}
</if>
group by ds.id,rhr.file_id,fc.file_id_count
</select>
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, category, expense_mark
@@ -70,4 +94,13 @@
</if>
</update>
<update id="removeDailyIncomeReceipt">
update receipt_has_record set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
<if test="id != null and id != ''">
and receipt_type_id = #{id}
</if>
</update>
</mapper>

View File

@@ -272,14 +272,17 @@
);
},
addFileInput() {
// 새로운 input type="file" 요소 생성
// 여기에서 파일 첨부 몇개인지 확인하고 하루 3개,,,, 총 6개씩,,,
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = 'image/*';
fileInput.style.display = 'none';
fileInput.name = 'file';
// 파일 선택 시 이벤트 처리
// 파일 선택
fileInput.addEventListener('change', (event) => {
const files = event.target.files;
const previewContainer = $('#file-upload-container');
@@ -330,7 +333,6 @@
`);
previewContainer.append(fileItem);
// 파일 정보와 서버 응답 저장
uploadedReceipt.push({
fileId: fileItemId,
file: file,