Aucune description

TLhzxMaintenanceCompletionFlowerRecordMapper.xml 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yt.zhylplat.moduleMain.completion.mapper.TLhzxMaintenanceCompletionFlowerRecordMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionFlowerRecord">
  6. <id column="id" property="id" />
  7. <result column="completion_record_id" property="completionRecordId" />
  8. <result column="road_id" property="roadId" />
  9. <result column="road_name" property="roadName" />
  10. <result column="road_start_spot" property="roadStartSpot" />
  11. <result column="road_end_spot" property="roadEndSpot" />
  12. <result column="change_flower" property="changeFlower" />
  13. <result column="apply_fertilizer" property="applyFertilizer" />
  14. <result column="seedling_adjustment_m" property="seedlingAdjustmentM" />
  15. <result column="seedling_adjustment_z" property="seedlingAdjustmentZ" />
  16. <result column="green_trim_count" property="greenTrimCount" />
  17. <result column="green_trim" property="greenTrim" />
  18. <result column="turn_soil" property="turnSoil" />
  19. <result column="green_weed" property="greenWeed" />
  20. <result column="watering" property="watering" />
  21. <result column="righting_seedling" property="rightingSeedling" />
  22. <result column="other" property="other" />
  23. <result column="create_user_id" property="createUserId" />
  24. <result column="create_date" property="createDate" />
  25. <result column="update_user_id" property="updateUserId" />
  26. <result column="update_date" property="updateDate" />
  27. <result column="del_flg" property="delFlg" />
  28. <result column="remark" property="remark" />
  29. </resultMap>
  30. <!-- 通用查询结果列 -->
  31. <sql id="Base_Column_List">
  32. 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
  33. </sql>
  34. <select id="selectCompletionFlowerRecordPage"
  35. resultType="com.yt.zhylplat.moduleMain.completion.entity.TLhzxMaintenanceCompletionFlowerRecord">
  36. select
  37. rsmc.section_id,
  38. s.section_name,
  39. rsmc.maintenance_company_id,
  40. mc.maintenance_company_name,
  41. if(cfr.change_flower is null, 0, cfr.change_flower) as change_flower,
  42. if(cfr.apply_fertilizer is null, 0, cfr.apply_fertilizer) as apply_fertilizer,
  43. if(cfr.seedling_adjustment_m is null, 0, cfr.seedling_adjustment_m) as seedling_adjustment_m,
  44. if(cfr.seedling_adjustment_z is null, 0, cfr.seedling_adjustment_z) as seedling_adjustment_z,
  45. if(cfr.green_trim_count is null, 0, cfr.green_trim_count) as green_trim_count,
  46. if(cfr.green_trim is null, 0, cfr.green_trim) as green_trim,
  47. if(cfr.turn_soil is null, 0, cfr.turn_soil) as turn_soil,
  48. if(cfr.green_weed is null, 0, cfr.green_weed) as green_weed,
  49. if(cfr.watering is null, 0, cfr.watering) as watering,
  50. if(cfr.righting_seedling is null, 0, cfr.righting_seedling) as righting_seedling,
  51. cfr.other
  52. from (
  53. select distinct
  54. section_id,
  55. maintenance_company_id
  56. from
  57. T_Lhzx_Road_Section_Maintenance_Company
  58. where
  59. del_flg = 0
  60. ) rsmc
  61. left join
  62. (<include refid="completionFlowerRecordSql"/>) cfr on rsmc.section_id = cfr.section_id and rsmc.maintenance_company_id = cfr.maintenance_company_id
  63. left join
  64. T_Lhzx_Maintenance_Company mc on rsmc.maintenance_company_id = mc.id
  65. left join
  66. T_Lhzx_Section s on rsmc.section_id = s.id
  67. <where>
  68. <if test="maintenanceCompletionFlowerRecord.sectionId">
  69. and rsmc.section_id = #{maintenanceCompletionFlowerRecord.sectionId}
  70. </if>
  71. <if test="maintenanceCompletionFlowerRecord.maintenanceCompanyId">
  72. and rsmc.maintenance_company_id = #{maintenanceCompletionFlowerRecord.maintenanceCompanyId}
  73. </if>
  74. </where>
  75. order by
  76. rsmc.section_id,
  77. rsmc.maintenance_company_id
  78. </select>
  79. <sql id="completionFlowerRecordSql">
  80. select
  81. mcr.section_id,
  82. mcr.section_name,
  83. mcr.maintenance_company_id,
  84. mcr.maintenance_company_name,
  85. sum(if(mcfr.change_flower is null, 0, mcfr.change_flower)) as change_flower,
  86. sum(if(mcfr.apply_fertilizer is null, 0, mcfr.apply_fertilizer)) as apply_fertilizer,
  87. sum(if(mcfr.seedling_adjustment_m is null, 0, mcfr.seedling_adjustment_m)) as seedling_adjustment_m,
  88. sum(if(mcfr.seedling_adjustment_z is null, 0, mcfr.seedling_adjustment_z)) as seedling_adjustment_z,
  89. sum(if(mcfr.green_trim_count is null, 0, mcfr.green_trim_count)) as green_trim_count,
  90. sum(if(mcfr.green_trim is null, 0, mcfr.green_trim)) as green_trim,
  91. sum(if(mcfr.turn_soil is null, 0, mcfr.turn_soil)) as turn_soil,
  92. sum(if(mcfr.green_weed is null, 0, mcfr.green_weed)) as green_weed,
  93. sum(if(mcfr.watering is null, 0, mcfr.watering)) as watering,
  94. sum(if(mcfr.righting_seedling is null, 0, mcfr.righting_seedling)) as righting_seedling,
  95. group_concat(mcfr.other separator ';') as other
  96. from
  97. T_Lhzx_Maintenance_Completion_Flower_Record mcfr
  98. left join
  99. T_Lhzx_Maintenance_Completion_Record mcr on mcfr.completion_record_id = mcr.id
  100. <where>
  101. and mcr.del_flg = 0
  102. <if test="maintenanceCompletionFlowerRecord.queryStartTime != null and maintenanceCompletionFlowerRecord.queryStartTime != ''">
  103. and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{maintenanceCompletionFlowerRecord.queryStartTime}
  104. </if>
  105. <if test="maintenanceCompletionFlowerRecord.queryEndTime != null and maintenanceCompletionFlowerRecord.queryEndTime != ''">
  106. and DATE_FORMAT(mcr.complete_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{maintenanceCompletionFlowerRecord.queryEndTime}
  107. </if>
  108. </where>
  109. group by
  110. mcr.section_id,
  111. mcr.section_name,
  112. mcr.maintenance_company_id,
  113. mcr.maintenance_company_name
  114. </sql>
  115. </mapper>