| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <?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="com.yt.zhylplat.moduleMain.completion.mapper.TLhzxMaintenanceCompletionGreenRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- <id column="id" property="id" />
- <result column="completion_record_id" property="completionRecordId" />
- <result column="road_id" property="roadId" />
- <result column="road_name" property="roadName" />
- <result column="road_start_spot" property="roadStartSpot" />
- <result column="road_end_spot" property="roadEndSpot" />
- <result column="seedling_adjustment_m" property="seedlingAdjustmentM" />
- <result column="seedling_adjustment_z" property="seedlingAdjustmentZ" />
- <result column="remove_stump" property="removeStump" />
- <result column="green_weed" property="greenWeed" />
- <result column="facility_maintenance" property="facilityMaintenance" />
- <result column="green_trim_count" property="greenTrimCount" />
- <result column="green_trim" property="greenTrim" />
- <result column="apply_fertilizer" property="applyFertilizer" />
- <result column="trimming" property="trimming" />
- <result column="green_space_clean" property="greenSpaceClean" />
- <result column="righting_seedling" property="rightingSeedling" />
- <result column="watering" property="watering" />
- <result column="turn_soil" property="turnSoil" />
- <result column="underpin" property="underpin" />
- <result column="underpin_start_spot" property="underpinStartSpot" />
- <result column="underpin_end_spot" property="underpinEndSpot" />
- <result column="other" property="other" />
- <result column="create_user_id" property="createUserId" />
- <result column="create_date" property="createDate" />
- <result column="update_user_id" property="updateUserId" />
- <result column="update_date" property="updateDate" />
- <result column="del_flg" property="delFlg" />
- <result column="remark" property="remark" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, completion_record_id, road_id, road_name, road_start_spot, road_end_spot, seedling_adjustment_m, seedling_adjustment_z, remove_stump, green_weed, facility_maintenance, green_trim_count, green_trim, apply_fertilizer, trimming, green_space_clean, righting_seedling, watering, turn_soil, underpin, underpin_start_spot, underpin_end_spot, other, create_user_id, create_date, update_user_id, update_date, del_flg, remark
- </sql>
- <select id="selectCompletionGreenRecordPage"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- temp.*
- from
- (<include refid="selectCompletionGreenRecordPageSql"/>) temp
- </select>
- <select id="selectGreenWorkPlanItemPage"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- temp.*
- from
- (<include refid="selectGreenWorkPlanItemPageSql"/>) temp
- </select>
- <select id="selectCompletionGreenRecordListBySectionType"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- temp.section_type,
- sum(if(temp.seedling_adjustment_m is null, 0, temp.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(temp.seedling_adjustment_z is null, 0, temp.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(temp.remove_stump is null, 0, temp.remove_stump)) as remove_stump,
- sum(if(temp.green_weed is null, 0, temp.green_weed)) as green_weed,
- sum(if(temp.facility_maintenance is null, 0, temp.facility_maintenance)) as facility_maintenance,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.green_trim is null, 0, temp.green_trim)) as green_trim,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.trimming is null, 0, temp.trimming)) as trimming,
- sum(if(temp.green_space_clean is null, 0, temp.green_space_clean)) as green_space_clean,
- sum(if(temp.righting_seedling is null, 0, temp.righting_seedling)) as righting_seedling,
- sum(if(temp.watering is null, 0, temp.watering)) as watering,
- sum(if(temp.turn_soil is null, 0, temp.turn_soil)) as turn_soil
- from
- (<include refid="selectCompletionGreenRecordPageSql"/>) temp
- group by
- temp.section_type
- </select>
- <select id="getCompletionGreenRecordSumCount"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- sum(if(temp.seedling_adjustment_m is null, 0, temp.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(temp.seedling_adjustment_z is null, 0, temp.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(temp.remove_stump is null, 0, temp.remove_stump)) as remove_stump,
- sum(if(temp.green_weed is null, 0, temp.green_weed)) as green_weed,
- sum(if(temp.facility_maintenance is null, 0, temp.facility_maintenance)) as facility_maintenance,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.green_trim is null, 0, temp.green_trim)) as green_trim,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.trimming is null, 0, temp.trimming)) as trimming,
- sum(if(temp.green_space_clean is null, 0, temp.green_space_clean)) as green_space_clean,
- sum(if(temp.righting_seedling is null, 0, temp.righting_seedling)) as righting_seedling,
- sum(if(temp.watering is null, 0, temp.watering)) as watering,
- sum(if(temp.turn_soil is null, 0, temp.turn_soil)) as turn_soil
- from
- (<include refid="selectCompletionGreenRecordPageSql"/>) temp
- </select>
- <select id="selectGreenWorkPlanItemListBySectionType"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- temp.section_type,
- sum(if(temp.seedling_adjustment_m is null, 0, temp.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(temp.seedling_adjustment_z is null, 0, temp.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(temp.remove_stump is null, 0, temp.remove_stump)) as remove_stump,
- sum(if(temp.green_weed is null, 0, temp.green_weed)) as green_weed,
- sum(if(temp.facility_maintenance is null, 0, temp.facility_maintenance)) as facility_maintenance,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.green_trim is null, 0, temp.green_trim)) as green_trim,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.trimming is null, 0, temp.trimming)) as trimming,
- sum(if(temp.green_space_clean is null, 0, temp.green_space_clean)) as green_space_clean,
- sum(if(temp.righting_seedling is null, 0, temp.righting_seedling)) as righting_seedling,
- sum(if(temp.watering is null, 0, temp.watering)) as watering,
- sum(if(temp.turn_soil is null, 0, temp.turn_soil)) as turn_soil
- from
- (<include refid="selectGreenWorkPlanItemPageSql"/>) temp
- group by
- temp.section_type
- </select>
- <select id="getGreenWorkPlanItemSumCount"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionGreenRecord">
- select
- sum(if(temp.seedling_adjustment_m is null, 0, temp.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(temp.seedling_adjustment_z is null, 0, temp.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(temp.remove_stump is null, 0, temp.remove_stump)) as remove_stump,
- sum(if(temp.green_weed is null, 0, temp.green_weed)) as green_weed,
- sum(if(temp.facility_maintenance is null, 0, temp.facility_maintenance)) as facility_maintenance,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.green_trim is null, 0, temp.green_trim)) as green_trim,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.trimming is null, 0, temp.trimming)) as trimming,
- sum(if(temp.green_space_clean is null, 0, temp.green_space_clean)) as green_space_clean,
- sum(if(temp.righting_seedling is null, 0, temp.righting_seedling)) as righting_seedling,
- sum(if(temp.watering is null, 0, temp.watering)) as watering,
- sum(if(temp.turn_soil is null, 0, temp.turn_soil)) as turn_soil
- from
- (<include refid="selectGreenWorkPlanItemPageSql"/>) temp
- </select>
- <sql id="selectCompletionGreenRecordPageSql">
- select
- s.section_type,
- rsmc.section_id,
- s.section_name,
- rsmc.maintenance_company_id,
- mc.maintenance_company_name,
- if(cgr.seedling_adjustment_m is null, 0, cgr.seedling_adjustment_m) as seedling_adjustment_m,
- if(cgr.seedling_adjustment_z is null, 0, cgr.seedling_adjustment_z) as seedling_adjustment_z,
- if(cgr.remove_stump is null, 0, cgr.remove_stump) as remove_stump,
- if(cgr.green_weed is null, 0, cgr.green_weed) as green_weed,
- if(cgr.facility_maintenance is null, 0, cgr.facility_maintenance) as facility_maintenance,
- if(cgr.green_trim_count is null, 0, cgr.green_trim_count) as green_trim_count,
- if(cgr.green_trim is null, 0, cgr.green_trim) as green_trim,
- if(cgr.apply_fertilizer is null, 0, cgr.apply_fertilizer) as apply_fertilizer,
- if(cgr.trimming is null, 0, cgr.trimming) as trimming,
- if(cgr.green_space_clean is null, 0, cgr.green_space_clean) as green_space_clean,
- if(cgr.righting_seedling is null, 0, cgr.righting_seedling) as righting_seedling,
- if(cgr.watering is null, 0, cgr.watering) as watering,
- if(cgr.turn_soil is null, 0, cgr.turn_soil) as turn_soil,
- cgr.other
- from (
- select distinct
- section_id,
- maintenance_company_id
- from
- T_Lhzx_Road_Section_Maintenance_Company
- where
- del_flg = 0
- ) rsmc
- left join
- (<include refid="completionGreenRecordSql"/>) cgr on rsmc.section_id = cgr.section_id and rsmc.maintenance_company_id = cgr.maintenance_company_id
- left join
- T_Lhzx_Maintenance_Company mc on rsmc.maintenance_company_id = mc.id
- left join
- T_Lhzx_Section s on rsmc.section_id = s.id
- <where>
- <if test="maintenanceCompletionGreenRecord.sectionId">
- and rsmc.section_id = #{maintenanceCompletionGreenRecord.sectionId}
- </if>
- <if test="maintenanceCompletionGreenRecord.maintenanceCompanyId">
- and rsmc.maintenance_company_id = #{maintenanceCompletionGreenRecord.maintenanceCompanyId}
- </if>
- </where>
- order by
- rsmc.section_id,
- rsmc.maintenance_company_id
- </sql>
- <sql id="selectGreenWorkPlanItemPageSql">
- select
- s.section_type,
- rsmc.section_id,
- s.section_name,
- rsmc.maintenance_company_id,
- mc.maintenance_company_name,
- if(cgr.seedling_adjustment_m is null, 0, cgr.seedling_adjustment_m) as seedling_adjustment_m,
- if(cgr.seedling_adjustment_z is null, 0, cgr.seedling_adjustment_z) as seedling_adjustment_z,
- if(cgr.green_weed is null, 0, cgr.green_weed) as green_weed,
- if(cgr.facility_maintenance is null, 0, cgr.facility_maintenance) as facility_maintenance,
- if(cgr.green_trim_count is null, 0, cgr.green_trim_count) as green_trim_count,
- if(cgr.green_trim is null, 0, cgr.green_trim) as green_trim,
- if(cgr.apply_fertilizer is null, 0, cgr.apply_fertilizer) as apply_fertilizer,
- if(cgr.trimming is null, 0, cgr.trimming) as trimming,
- if(cgr.watering is null, 0, cgr.watering) as watering,
- if(cgr.turn_soil is null, 0, cgr.turn_soil) as turn_soil,
- cgr.other
- from (
- select distinct
- section_id,
- maintenance_company_id
- from
- T_Lhzx_Road_Section_Maintenance_Company
- where
- del_flg = 0
- ) rsmc
- left join
- (<include refid="greenWorkPlanItemSql"/>) cgr on rsmc.section_id = cgr.section_id and rsmc.maintenance_company_id = cgr.maintenance_company_id
- left join
- T_Lhzx_Maintenance_Company mc on rsmc.maintenance_company_id = mc.id
- left join
- T_Lhzx_Section s on rsmc.section_id = s.id
- <where>
- <if test="maintenanceCompletionGreenRecord.sectionId">
- and rsmc.section_id = #{maintenanceCompletionGreenRecord.sectionId}
- </if>
- <if test="maintenanceCompletionGreenRecord.sectionType">
- and s.section_type = #{maintenanceCompletionGreenRecord.sectionType}
- </if>
- <if test="maintenanceCompletionGreenRecord.maintenanceCompanyId">
- and rsmc.maintenance_company_id = #{maintenanceCompletionGreenRecord.maintenanceCompanyId}
- </if>
- </where>
- order by
- rsmc.section_id,
- rsmc.maintenance_company_id
- </sql>
- <sql id="completionGreenRecordSql">
- select
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name,
- sum(if(mcgr.seedling_adjustment_m is null, 0, mcgr.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(mcgr.seedling_adjustment_z is null, 0, mcgr.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(mcgr.remove_stump is null, 0, mcgr.remove_stump)) as remove_stump,
- sum(if(mcgr.green_weed is null, 0, mcgr.green_weed)) as green_weed,
- sum(if(mcgr.facility_maintenance is null, 0, mcgr.facility_maintenance)) as facility_maintenance,
- sum(if(mcgr.green_trim_count is null, 0, mcgr.green_trim_count)) as green_trim_count,
- sum(if(mcgr.green_trim is null, 0, mcgr.green_trim)) as green_trim,
- sum(if(mcgr.apply_fertilizer is null, 0, mcgr.apply_fertilizer)) as apply_fertilizer,
- sum(if(mcgr.trimming is null, 0, mcgr.trimming)) as trimming,
- sum(if(mcgr.green_space_clean is null, 0, mcgr.green_space_clean)) as green_space_clean,
- sum(if(mcgr.righting_seedling is null, 0, mcgr.righting_seedling)) as righting_seedling,
- sum(if(mcgr.watering is null, 0, mcgr.watering)) as watering,
- sum(if(mcgr.turn_soil is null, 0, mcgr.turn_soil)) as turn_soil,
- group_concat(mcgr.other separator ';') as other
- from
- T_Lhzx_Maintenance_Completion_Green_Record mcgr
- left join
- T_Lhzx_Maintenance_Completion_Record mcr on mcgr.completion_record_id = mcr.id
- <where>
- and mcr.del_flg = 0
- <if test="maintenanceCompletionGreenRecord.queryStartTime != null and maintenanceCompletionGreenRecord.queryStartTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{maintenanceCompletionGreenRecord.queryStartTime}
- </if>
- <if test="maintenanceCompletionGreenRecord.queryEndTime != null and maintenanceCompletionGreenRecord.queryEndTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{maintenanceCompletionGreenRecord.queryEndTime}
- </if>
- <if test="maintenanceCompletionGreenRecord.planMonth != null and maintenanceCompletionGreenRecord.planMonth != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m') = #{maintenanceCompletionGreenRecord.planMonth}
- </if>
- </where>
- group by
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name
- </sql>
- <sql id="greenWorkPlanItemSql">
- select
- gwp.section_id,
- gwp.object_id as maintenance_company_id,
- sum(if(gwpdi.seedling_adjustment_m is null, 0, gwpdi.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(gwpdi.seedling_adjustment_z is null, 0, gwpdi.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(gwpdi.green_weed is null, 0, gwpdi.green_weed)) as green_weed,
- sum(if(gwpdi.facility_maintenance is null, 0, gwpdi.facility_maintenance)) as facility_maintenance,
- sum(if(gwpdi.green_trim_count is null, 0, gwpdi.green_trim_count)) as green_trim_count,
- sum(if(gwpdi.green_trim is null, 0, gwpdi.green_trim)) as green_trim,
- sum(if(gwpdi.apply_fertilizer is null, 0, gwpdi.apply_fertilizer)) as apply_fertilizer,
- sum(if(gwpdi.trimming is null, 0, gwpdi.trimming)) as trimming,
- sum(if(gwpdi.watering is null, 0, gwpdi.watering)) as watering,
- sum(if(gwpdi.turn_soil is null, 0, gwpdi.turn_soil)) as turn_soil,
- group_concat(gwpdi.facility_maintenance separator ';') as other
- from
- T_Lhgy_Green_Work_Plan_Detail_Item gwpdi
- left join
- T_Lhgy_Green_Work_Plan gwp on gwpdi.plan_id = gwp.id
- <where>
- and gwpdi.delete_flag = 0
- <if test="maintenanceCompletionGreenRecord.planMonth != null and maintenanceCompletionGreenRecord.planMonth != ''">
- and DATE_FORMAT(gwp.start_time, '%Y-%m') = #{maintenanceCompletionGreenRecord.planMonth}
- </if>
- </where>
- group by
- gwp.section_id,
- gwp.object_id
- </sql>
- </mapper>
|