59 lines
2.7 KiB
XML
59 lines
2.7 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.saveDailyExpense.adapters.persistence.SaveDailyExpenseMapper">
|
|
|
|
<select id="getDailyExpense"
|
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto">
|
|
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
|
, ds.expense_kind, ds.source_purpose
|
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
|
from daily_expense 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_expense 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="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
|
insert into daily_expense (
|
|
daily_record_seq, input_type, category, income_mark
|
|
, is_credit, expense_kind, source_purpose
|
|
, quantity, unit_code, unit_self, price, estimated_value
|
|
, is_deleted
|
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
|
) values (
|
|
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}
|
|
, #{credit}, #{expenseKind}, #{sourcePurpose}
|
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
|
, false
|
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateDailyExpense">
|
|
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
|
|
, is_credit = #{credit}
|
|
, income_mark = #{incomeMark}
|
|
, expense_kind = #{expenseKind}
|
|
, source_purpose = #{sourcePurpose}
|
|
, quantity = #{quantity}
|
|
, unit_code = #{unitCode}
|
|
, unit_self = #{unitSelf}
|
|
, price = #{price}
|
|
, estimated_value = #{estimatedValue}
|
|
where is_deleted = false
|
|
and daily_record_seq = #{dailyRecordSeq}
|
|
and id = #{id}
|
|
</update>
|
|
|
|
</mapper>
|