Files
korea-research/front/src/main/resources/mappers/daily/DailyForestryMapper.xml

71 lines
2.8 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.front.usecase.daily.forestry.adapters.persistence.DailyForestryMapper">
<select id="getDailyForestryList"
resultType="app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryDto">
select ds.id, ds.daily_record_seq
, ds.product_name, ds.usage
, ds.quantity, ds.unit_code, ds.unit_self, ds.estimated_value
from daily_forestry 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>
order by
ds.id desc
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_forestry 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="createDailyForestry" useGeneratedKeys="true" keyProperty="id">
insert into daily_forestry (
daily_record_seq, expense_mark
, product_name, usage
, quantity, unit_code, unit_self, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}, #{expenseMark}
, #{productName}, #{usage}
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<update id="updateDailyForestry">
update daily_forestry set <include refid="common.fields.UpdateBaseSet"/>
, expense_mark = #{expenseMark}
, product_name = #{productName}
, usage = #{usage}
, quantity = #{quantity}
, unit_code = #{unitCode}
, unit_self = #{unitSelf}
, estimated_value = #{estimatedValue}
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
and id = #{id}
</update>
<update id="removeDailyForestry">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
<if test="id != null and id != ''">
and id = #{id}
</if>
</update>
</mapper>