| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?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.TLhzxMaintenanceCompletionFlowerRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionFlowerRecord">
- <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="change_flower" property="changeFlower" />
- <result column="apply_fertilizer" property="applyFertilizer" />
- <result column="seedling_adjustment_m" property="seedlingAdjustmentM" />
- <result column="seedling_adjustment_z" property="seedlingAdjustmentZ" />
- <result column="green_trim_count" property="greenTrimCount" />
- <result column="green_trim" property="greenTrim" />
- <result column="turn_soil" property="turnSoil" />
- <result column="green_weed" property="greenWeed" />
- <result column="watering" property="watering" />
- <result column="righting_seedling" property="rightingSeedling" />
- <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, change_flower, apply_fertilizer, seedling_adjustment_m, seedling_adjustment_z, green_trim_count, green_trim, turn_soil, green_weed, watering, righting_seedling, other, create_user_id, create_date, update_user_id, update_date, del_flg, remark
- </sql>
- <select id="selectCompletionFlowerRecordPage"
- resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionFlowerRecord">
- select
- rsmc.section_id,
- s.section_name,
- rsmc.maintenance_company_id,
- mc.maintenance_company_name,
- if(cfr.change_flower is null, 0, cfr.change_flower) as change_flower,
- if(cfr.apply_fertilizer is null, 0, cfr.apply_fertilizer) as apply_fertilizer,
- if(cfr.seedling_adjustment_m is null, 0, cfr.seedling_adjustment_m) as seedling_adjustment_m,
- if(cfr.seedling_adjustment_z is null, 0, cfr.seedling_adjustment_z) as seedling_adjustment_z,
- if(cfr.green_trim_count is null, 0, cfr.green_trim_count) as green_trim_count,
- if(cfr.green_trim is null, 0, cfr.green_trim) as green_trim,
- if(cfr.turn_soil is null, 0, cfr.turn_soil) as turn_soil,
- if(cfr.green_weed is null, 0, cfr.green_weed) as green_weed,
- if(cfr.watering is null, 0, cfr.watering) as watering,
- if(cfr.righting_seedling is null, 0, cfr.righting_seedling) as righting_seedling,
- cfr.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="completionFlowerRecordSql"/>) cfr on rsmc.section_id = cfr.section_id and rsmc.maintenance_company_id = cfr.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="maintenanceCompletionFlowerRecord.sectionId">
- and rsmc.section_id = #{maintenanceCompletionFlowerRecord.sectionId}
- </if>
- <if test="maintenanceCompletionFlowerRecord.maintenanceCompanyId">
- and rsmc.maintenance_company_id = #{maintenanceCompletionFlowerRecord.maintenanceCompanyId}
- </if>
- </where>
- order by
- rsmc.section_id,
- rsmc.maintenance_company_id
- </select>
- <sql id="completionFlowerRecordSql">
- select
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name,
- sum(if(mcfr.change_flower is null, 0, mcfr.change_flower)) as change_flower,
- sum(if(mcfr.apply_fertilizer is null, 0, mcfr.apply_fertilizer)) as apply_fertilizer,
- sum(if(mcfr.seedling_adjustment_m is null, 0, mcfr.seedling_adjustment_m)) as seedling_adjustment_m,
- sum(if(mcfr.seedling_adjustment_z is null, 0, mcfr.seedling_adjustment_z)) as seedling_adjustment_z,
- sum(if(mcfr.green_trim_count is null, 0, mcfr.green_trim_count)) as green_trim_count,
- sum(if(mcfr.green_trim is null, 0, mcfr.green_trim)) as green_trim,
- sum(if(mcfr.turn_soil is null, 0, mcfr.turn_soil)) as turn_soil,
- sum(if(mcfr.green_weed is null, 0, mcfr.green_weed)) as green_weed,
- sum(if(mcfr.watering is null, 0, mcfr.watering)) as watering,
- sum(if(mcfr.righting_seedling is null, 0, mcfr.righting_seedling)) as righting_seedling,
- group_concat(mcfr.other separator ';') as other
- from
- T_Lhzx_Maintenance_Completion_Flower_Record mcfr
- left join
- T_Lhzx_Maintenance_Completion_Record mcr on mcfr.completion_record_id = mcr.id
- <where>
- and mcr.del_flg = 0
- <if test="maintenanceCompletionFlowerRecord.queryStartTime != null and maintenanceCompletionFlowerRecord.queryStartTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{maintenanceCompletionFlowerRecord.queryStartTime}
- </if>
- <if test="maintenanceCompletionFlowerRecord.queryEndTime != null and maintenanceCompletionFlowerRecord.queryEndTime != ''">
- and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{maintenanceCompletionFlowerRecord.queryEndTime}
- </if>
- </where>
- group by
- mcr.section_id,
- mcr.section_name,
- mcr.maintenance_company_id,
- mcr.maintenance_company_name
- </sql>
- </mapper>
|