86 lines
4.0 KiB
XML
86 lines
4.0 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.work.adapters.persistence.DailyWorkMapper">
|
|
|
|
<select id="getDailyWorkList"
|
|
resultType="app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto">
|
|
select ds.id, ds.daily_record_seq
|
|
, ds.item_name, ds.work_name
|
|
, ds.work_land_area, ds.area_unit_code, ds.area_unit_self, ds.harvest_quantity, ds.harvest_unit_code, ds.harvest_unit_self
|
|
, ds.owner_time, ds.spouse_time, ds.family_m_hours, ds.family_f_hours, ds.hired_m_hours
|
|
, ds.hired_f_hours, ds.shared_m_hours, ds.shared_f_hours, ds.volunteer_m_hours, ds.volunteer_f_hours
|
|
from daily_work 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_work 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="createDailyWork" useGeneratedKeys="true" keyProperty="id">
|
|
insert into daily_work (
|
|
daily_record_seq
|
|
, item_name, work_name
|
|
, work_land_area, area_unit_code, area_unit_self, harvest_quantity, harvest_unit_code, harvest_unit_self
|
|
, owner_time, spouse_time, family_m_hours, family_f_hours, hired_m_hours, hired_f_hours, shared_m_hours, shared_f_hours, volunteer_m_hours, volunteer_f_hours
|
|
, is_deleted
|
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
|
) values (
|
|
#{dailyRecordSeq}
|
|
, #{itemName}, #{workName}
|
|
, #{workLandArea}, #{areaUnitCode}, #{areaUnitSelf}, #{harvestQuantity}, #{harvestUnitCode}, #{harvestUnitSelf}
|
|
, #{ownerTime}, #{spouseTime}, #{familyMHours}, #{familyFHours}, #{hiredMHours}, #{hiredFHours}, #{sharedMHours}, #{sharedFHours}, #{volunteerMHours}, #{volunteerFHours}
|
|
, false
|
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateDailyWork">
|
|
update daily_work set <include refid="common.fields.UpdateBaseSet"/>
|
|
, item_name = #{itemName}
|
|
, work_name = #{workName}
|
|
, work_land_area = #{workLandArea}
|
|
, area_unit_code = #{areaUnitCode}
|
|
, area_unit_self = #{areaUnitSelf}
|
|
, harvest_quantity = #{harvestQuantity}
|
|
, harvest_unit_code = #{harvestUnitCode}
|
|
, harvest_unit_self = #{harvestUnitSelf}
|
|
, owner_time = #{ownerTime}
|
|
, spouse_time = #{spouseTime}
|
|
, family_m_hours = #{familyMHours}
|
|
, family_f_hours = #{familyFHours}
|
|
, hired_m_hours = #{hiredMHours}
|
|
, hired_f_hours = #{hiredFHours}
|
|
, shared_m_hours = #{sharedMHours}
|
|
, shared_f_hours = #{sharedFHours}
|
|
, volunteer_m_hours = #{volunteerMHours}
|
|
, volunteer_f_hours = #{volunteerFHours}
|
|
where is_deleted = false
|
|
and daily_record_seq = #{dailyRecordSeq}
|
|
and id = #{id}
|
|
</update>
|
|
|
|
<update id="removeDailyWork">
|
|
update daily_work 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>
|