Files
korea-research/admin/src/main/resources/mappers/household/daily/SaveDailyIncomeMapper.xml
2025-11-11 17:53:04 +09:00

94 lines
4.2 KiB
XML

<?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.saveDailyIncome.adapters.persistence.SaveDailyIncomeMapper">
<select id="getDailyIncome"
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.persistence.modal.GetDailyIncomeDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.crop_code, ds.income_kind, ds.source_purpose
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
from daily_income ds
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
and ds.id = #{id}
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_income ds
<include refid="app.module.core.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="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, category, expense_mark
, is_credit, crop_code, income_kind, source_purpose
, quantity, unit_code, unit_self, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}, #{inputType}, #{category}, #{expenseMark}
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<update id="updateDailyIncome">
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
, is_credit = #{credit}
, expense_mark = #{expenseMark}
, crop_code = #{cropCode}
, income_kind = #{incomeKind}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}
, unit_code = #{unitCode}
, unit_self = #{unitSelf}
, price = #{price}
, estimated_value = #{estimatedValue}
, ocr_error_result = false
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
and id = #{id}
</update>
<update id="updateDailyIncomeOnlyId">
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
, is_credit = #{credit}
, expense_mark = #{expenseMark}
, crop_code = #{cropCode}
, income_kind = #{incomeKind}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}
, unit_code = #{unitCode}
, unit_self = #{unitSelf}
, price = #{price}
, estimated_value = #{estimatedValue}
, ocr_error_result = false
, daily_record_seq = #{dailyRecordSeq}
where is_deleted = false
and id = #{id}
</update>
<insert id="createDailyIncomeExcel" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, category, income_mark, expense_mark
, is_credit, crop_code, income_kind, source_purpose
, quantity, unit_code, unit_self, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}, #{expenseMark}
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
</mapper>