| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <?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.TLhzxMaintenanceCompletionTreeRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- <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="replant" property="replant" />
- <result column="fruit_hair_control" property="fruitHairControl" />
- <result column="wrap_adjustment" property="wrapAdjustment" />
- <result column="apply_fertilizer" property="applyFertilizer" />
- <result column="green_trim_count" property="greenTrimCount" />
- <result column="tree_hole_replant" property="treeHoleReplant" />
- <result column="tree_hole_repair" property="treeHoleRepair" />
- <result column="peeling_bud" property="peelingBud" />
- <result column="cover_repair" property="coverRepair" />
- <result column="righting" property="righting" />
- <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, replant, fruit_hair_control, wrap_adjustment, apply_fertilizer, green_trim_count, tree_hole_replant, tree_hole_repair, peeling_bud, cover_repair, righting, other, create_user_id, create_date, update_user_id, update_date, del_flg, remark
- </sql>
- <select id="selectCompletionTreeRecordPage"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- temp.*
- from
- (<include refid="selectCompletionTreeRecordPageSql"/>) temp
- </select>
- <select id="selectStreetTreeWorkPlanItemPage"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- temp.*
- from
- (<include refid="selectStreetTreeWorkPlanItemPageSql"/>) temp
- </select>
- <select id="selectCompletionTreeRecordListBySectionType"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- temp.section_type,
- sum(if(temp.replant is null, 0, temp.replant)) as replant,
- sum(if(temp.fruit_hair_control is null, 0, temp.fruit_hair_control)) as fruit_hair_control,
- sum(if(temp.wrap_adjustment is null, 0, temp.wrap_adjustment)) as wrap_adjustment,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.tree_hole_replant is null, 0, temp.tree_hole_replant)) as tree_hole_replant,
- sum(if(temp.tree_hole_repair is null, 0, temp.tree_hole_repair)) as tree_hole_repair,
- sum(if(temp.peeling_bud is null, 0, temp.peeling_bud)) as peeling_bud,
- sum(if(temp.cover_repair is null, 0, temp.cover_repair)) as cover_repair,
- sum(if(temp.righting is null, 0, temp.righting)) as righting
- from
- (<include refid="selectCompletionTreeRecordPageSql"/>) temp
- group by
- temp.section_type
- </select>
- <select id="getCompletionTreeRecordSumCount"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- sum(if(temp.replant is null, 0, temp.replant)) as replant,
- sum(if(temp.fruit_hair_control is null, 0, temp.fruit_hair_control)) as fruit_hair_control,
- sum(if(temp.wrap_adjustment is null, 0, temp.wrap_adjustment)) as wrap_adjustment,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.tree_hole_replant is null, 0, temp.tree_hole_replant)) as tree_hole_replant,
- sum(if(temp.tree_hole_repair is null, 0, temp.tree_hole_repair)) as tree_hole_repair,
- sum(if(temp.peeling_bud is null, 0, temp.peeling_bud)) as peeling_bud,
- sum(if(temp.cover_repair is null, 0, temp.cover_repair)) as cover_repair,
- sum(if(temp.righting is null, 0, temp.righting)) as righting
- from
- (<include refid="selectCompletionTreeRecordPageSql"/>) temp
- </select>
- <select id="selectStreetTreeWorkPlanItemListBySectionType"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- temp.section_type,
- sum(if(temp.replant is null, 0, temp.replant)) as replant,
- sum(if(temp.fruit_hair_control is null, 0, temp.fruit_hair_control)) as fruit_hair_control,
- sum(if(temp.wrap_adjustment is null, 0, temp.wrap_adjustment)) as wrap_adjustment,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.tree_hole_replant is null, 0, temp.tree_hole_replant)) as tree_hole_replant,
- sum(if(temp.tree_hole_repair is null, 0, temp.tree_hole_repair)) as tree_hole_repair,
- sum(if(temp.peeling_bud is null, 0, temp.peeling_bud)) as peeling_bud,
- sum(if(temp.cover_repair is null, 0, temp.cover_repair)) as cover_repair,
- sum(if(temp.righting is null, 0, temp.righting)) as righting
- from
- (<include refid="selectStreetTreeWorkPlanItemPageSql"/>) temp
- group by
- temp.section_type
- </select>
- <select id="getStreetTreeWorkPlanItemSumCount"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionTreeRecord">
- select
- sum(if(temp.replant is null, 0, temp.replant)) as replant,
- sum(if(temp.fruit_hair_control is null, 0, temp.fruit_hair_control)) as fruit_hair_control,
- sum(if(temp.wrap_adjustment is null, 0, temp.wrap_adjustment)) as wrap_adjustment,
- sum(if(temp.apply_fertilizer is null, 0, temp.apply_fertilizer)) as apply_fertilizer,
- sum(if(temp.green_trim_count is null, 0, temp.green_trim_count)) as green_trim_count,
- sum(if(temp.tree_hole_replant is null, 0, temp.tree_hole_replant)) as tree_hole_replant,
- sum(if(temp.tree_hole_repair is null, 0, temp.tree_hole_repair)) as tree_hole_repair,
- sum(if(temp.peeling_bud is null, 0, temp.peeling_bud)) as peeling_bud,
- sum(if(temp.cover_repair is null, 0, temp.cover_repair)) as cover_repair,
- sum(if(temp.righting is null, 0, temp.righting)) as righting
- from
- (<include refid="selectStreetTreeWorkPlanItemPageSql"/>) temp
- </select>
- <sql id="selectCompletionTreeRecordPageSql">
- select
- s.section_type,
- rsmc.section_id,
- s.section_name,
- rsmc.maintenance_company_id,
- mc.maintenance_company_name,
- if(ctr.replant is null, 0, ctr.replant) as replant,
- if(ctr.fruit_hair_control is null, 0, ctr.fruit_hair_control) as fruit_hair_control,
- if(ctr.wrap_adjustment is null, 0, ctr.wrap_adjustment) as wrap_adjustment,
- if(ctr.apply_fertilizer is null, 0, ctr.apply_fertilizer) as apply_fertilizer,
- if(ctr.green_trim_count is null, 0, ctr.green_trim_count) as green_trim_count,
- if(ctr.tree_hole_replant is null, 0, ctr.tree_hole_replant) as tree_hole_replant,
- if(ctr.tree_hole_repair is null, 0, ctr.tree_hole_repair) as tree_hole_repair,
- if(ctr.peeling_bud is null, 0, ctr.peeling_bud) as peeling_bud,
- if(ctr.cover_repair is null, 0, ctr.cover_repair) as cover_repair,
- if(ctr.righting is null, 0, ctr.righting) as righting,
- ctr.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="completionTreeRecordSql"/>) ctr on rsmc.section_id = ctr.section_id and rsmc.maintenance_company_id = ctr.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="maintenanceCompletionTreeRecord.sectionId">
- and rsmc.section_id = #{maintenanceCompletionTreeRecord.sectionId}
- </if>
- <if test="maintenanceCompletionTreeRecord.sectionType">
- and s.section_type = #{maintenanceCompletionTreeRecord.sectionType}
- </if>
- <if test="maintenanceCompletionTreeRecord.maintenanceCompanyId">
- and rsmc.maintenance_company_id = #{maintenanceCompletionTreeRecord.maintenanceCompanyId}
- </if>
- </where>
- order by
- rsmc.section_id,
- rsmc.maintenance_company_id
- </sql>
- <sql id="selectStreetTreeWorkPlanItemPageSql">
- select
- s.section_type,
- rsmc.section_id,
- s.section_name,
- rsmc.maintenance_company_id,
- mc.maintenance_company_name,
- if(ctr.replant is null, 0, ctr.replant) as replant,
- if(ctr.fruit_hair_control is null, 0, ctr.fruit_hair_control) as fruit_hair_control,
- if(ctr.wrap_adjustment is null, 0, ctr.wrap_adjustment) as wrap_adjustment,
- if(ctr.apply_fertilizer is null, 0, ctr.apply_fertilizer) as apply_fertilizer,
- if(ctr.green_trim_count is null, 0, ctr.green_trim_count) as green_trim_count,
- if(ctr.tree_hole_replant is null, 0, ctr.tree_hole_replant) as tree_hole_replant,
- if(ctr.tree_hole_repair is null, 0, ctr.tree_hole_repair) as tree_hole_repair,
- if(ctr.peeling_bud is null, 0, ctr.peeling_bud) as peeling_bud,
- if(ctr.cover_repair is null, 0, ctr.cover_repair) as cover_repair,
- if(ctr.righting is null, 0, ctr.righting) as righting,
- ctr.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="selectStreetTreeWorkPlanItemSql"/>) ctr on rsmc.section_id = ctr.section_id and rsmc.maintenance_company_id = ctr.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="maintenanceCompletionTreeRecord.sectionId">
- and rsmc.section_id = #{maintenanceCompletionTreeRecord.sectionId}
- </if>
- <if test="maintenanceCompletionTreeRecord.maintenanceCompanyId">
- and rsmc.maintenance_company_id = #{maintenanceCompletionTreeRecord.maintenanceCompanyId}
- </if>
- </where>
- order by
- rsmc.section_id,
- rsmc.maintenance_company_id
- </sql>
- <sql id="completionTreeRecordSql">
- select
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name,
- sum(if(mctr.replant is null, 0, mctr.replant)) as replant,
- sum(if(mctr.fruit_hair_control is null, 0, mctr.fruit_hair_control)) as fruit_hair_control,
- sum(if(mctr.wrap_adjustment is null, 0, mctr.wrap_adjustment)) as wrap_adjustment,
- sum(if(mctr.apply_fertilizer is null, 0, mctr.apply_fertilizer)) as apply_fertilizer,
- sum(if(mctr.green_trim_count is null, 0, mctr.green_trim_count)) as green_trim_count,
- sum(if(mctr.tree_hole_replant is null, 0, mctr.tree_hole_replant)) as tree_hole_replant,
- sum(if(mctr.tree_hole_repair is null, 0, mctr.tree_hole_repair)) as tree_hole_repair,
- sum(if(mctr.peeling_bud is null, 0, mctr.peeling_bud)) as peeling_bud,
- sum(if(mctr.cover_repair is null, 0, mctr.cover_repair)) as cover_repair,
- sum(if(mctr.righting is null, 0, mctr.righting)) as righting,
- group_concat(mctr.other separator ';') as other
- from
- T_Lhzx_Maintenance_Completion_Tree_Record mctr
- left join
- T_Lhzx_Maintenance_Completion_Record mcr on mctr.completion_record_id = mcr.id
- <where>
- and mcr.del_flg = 0
- <if test="maintenanceCompletionTreeRecord.queryStartTime != null and maintenanceCompletionTreeRecord.queryStartTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{maintenanceCompletionTreeRecord.queryStartTime}
- </if>
- <if test="maintenanceCompletionTreeRecord.queryEndTime != null and maintenanceCompletionTreeRecord.queryEndTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{maintenanceCompletionTreeRecord.queryEndTime}
- </if>
- <if test="maintenanceCompletionTreeRecord.planMonth != null and maintenanceCompletionTreeRecord.planMonth != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m') = #{maintenanceCompletionTreeRecord.planMonth}
- </if>
- </where>
- group by
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name
- </sql>
- <sql id="selectStreetTreeWorkPlanItemSql">
- select
- stwp.section_id,
- stwp.section_name,
- stwp.maintenance_company_id,
- stwp.maintenance_company_name,
- sum(if(stwpdi.replant is null, 0, stwpdi.replant)) as replant,
- sum(if(stwpdi.fruit_hair_control is null, 0, stwpdi.fruit_hair_control)) as fruit_hair_control,
- sum(if(stwpdi.wrap_adjustment is null, 0, stwpdi.wrap_adjustment)) as wrap_adjustment,
- sum(if(stwpdi.apply_fertilizer is null, 0, stwpdi.apply_fertilizer)) as apply_fertilizer,
- sum(if(stwpdi.green_trim_count is null, 0, stwpdi.green_trim_count)) as green_trim_count,
- sum(if(stwpdi.tree_hole_replant is null, 0, stwpdi.tree_hole_replant)) as tree_hole_replant,
- sum(if(stwpdi.tree_hole_repair is null, 0, stwpdi.tree_hole_repair)) as tree_hole_repair,
- sum(if(stwpdi.peeling_bud is null, 0, stwpdi.peeling_bud)) as peeling_bud,
- sum(if(stwpdi.cover_repair is null, 0, stwpdi.cover_repair)) as cover_repair,
- sum(if(stwpdi.righting is null, 0, stwpdi.righting)) as righting,
- group_concat(stwpdi.other separator ';') as other
- from
- T_Lhzx_Street_Tree_Work_Plan_Detail_Item stwpdi
- left join
- T_Lhzx_Street_Tree_Work_Plan stwp on stwp.id = stwpdi.plan_id
- where
- stwpdi.del_flg = 0
- <if test="maintenanceCompletionTreeRecord.planMonth != null and maintenanceCompletionTreeRecord.planMonth != ''">
- and DATE_FORMAT(stwp.start_time, '%Y-%m') = #{maintenanceCompletionTreeRecord.planMonth}
- </if>
- group by
- stwp.section_id,
- stwp.section_name,
- stwp.maintenance_company_id,
- stwp.maintenance_company_name
- </sql>
- </mapper>
|