Нет описания

TPestcSpottedMothMiridRecordMapper.xml 4.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.modulePest.specialRecord.mapper.TPestcSpottedMothMiridRecordMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
  6. <id column="id" property="id"/>
  7. <result column="survey_user_id" property="surveyUserId"/>
  8. <result column="survey_address" property="surveyAddress"/>
  9. <result column="survey_date" property="surveyDate"/>
  10. <result column="host_plant" property="hostPlant"/>
  11. <result column="sample_num" property="sampleNum"/>
  12. <result column="nymph_amount" property="nymphAmount"/>
  13. <result column="insect_age" property="insectAge"/>
  14. <result column="insect_state" property="insectState"/>
  15. <result column="survey_type" property="surveyType"/>
  16. <result column="remark" property="remark"/>
  17. <result column="create_user_id" property="createUserId"/>
  18. <result column="create_date" property="createDate"/>
  19. <result column="update_user_id" property="updateUserId"/>
  20. <result column="update_date" property="updateDate"/>
  21. <result column="del_flg" property="delFlg"/>
  22. </resultMap>
  23. <!-- 通用查询结果列 -->
  24. <sql id="Base_Column_List">
  25. id, survey_user_id, survey_address, survey_date, host_plant, sample_num, nymph_amount, insect_age, insect_state, survey_type, remark, create_user_id, create_date, update_user_id, update_date, del_flg
  26. </sql>
  27. <select id="pageList" resultMap="BaseResultMap">
  28. select
  29. uuid,
  30. survey_date
  31. from T_Pestc_Spotted_Moth_Mirid_Record
  32. where del_flg = '0'
  33. and survey_type = #{tPestcSpottedMothMiridRecord.surveyType}
  34. <if test="tPestcSpottedMothMiridRecord.surveyDate !=null">
  35. and survey_date = #{tPestcSpottedMothMiridRecord.surveyDate}
  36. </if>
  37. <if test="tPestcSpottedMothMiridRecord.surveyAddress !=null and tPestcSpottedMothMiridRecord.surveyAddress != '' ">
  38. and survey_address like concat('%',#{tPestcSpottedMothMiridRecord.surveyAddress},'%')
  39. </if>
  40. <if test="tPestcSpottedMothMiridRecord.hostPlant !=null and tPestcSpottedMothMiridRecord.hostPlant != '' ">
  41. and host_lant like concat('%',#{tPestcSpottedMothMiridRecord.hostPlant},'%')
  42. </if>
  43. <if test="tPestcSpottedMothMiridRecord.maintenanceCompanyId !=null and tPestcSpottedMothMiridRecord.maintenanceCompanyId != '' ">
  44. and maintenance_ompany_id = #{tPestcSpottedMothMiridRecord.maintenanceCompanyId}
  45. </if>
  46. <if test="tPestcSpottedMothMiridRecord.surveyUserId !=null and tPestcSpottedMothMiridRecord.surveyUserId != '' ">
  47. and survey_user_id = #{tPestcSpottedMothMiridRecord.surveyUserId}
  48. </if>
  49. group by uuid,survey_date
  50. order by survey_date desc
  51. </select>
  52. <select id="selectSpottedMothMiridRecordList"
  53. resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
  54. select
  55. DATE_FORMAT( survey_date, '%Y-%m-%d' ) as surveyDateStr,
  56. sum(if(nymph_amount is null, 0, nymph_amount)) as nymph_amount
  57. from
  58. T_Pestc_Spotted_Moth_Mirid_Record
  59. where
  60. del_flg = 0
  61. and
  62. survey_type = 1
  63. <if test="surveyUserId != null">
  64. and survey_user_id = #{surveyUserId}
  65. </if>
  66. group by
  67. survey_date
  68. order by
  69. survey_date
  70. </select>
  71. <select id="selectSpottedMothMiridRecordListByMonth"
  72. resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
  73. select
  74. DATE_FORMAT(survey_date, '%Y-%m') as surveyMonth,
  75. sum(if(nymph_amount is null, 0, nymph_amount)) as nymph_amount
  76. from
  77. T_Pestc_Spotted_Moth_Mirid_Record
  78. where
  79. del_flg = 0
  80. and
  81. survey_type = 2
  82. <if test="surveyUserId != null">
  83. and survey_user_id = #{surveyUserId}
  84. </if>
  85. group by
  86. DATE_FORMAT(survey_date, '%Y-%m')
  87. order by
  88. DATE_FORMAT(survey_date, '%Y-%m')
  89. </select>
  90. </mapper>