Sin descripción

TPestcAphidRecordMapper.xml 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.TPestcAphidRecordMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcAphidRecord">
  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="dry_hatch_num" property="dryHatchNum"/>
  11. <result column="dry_hatch_amount" property="dryHatchAmount"/>
  12. <result column="remark" property="remark"/>
  13. <result column="create_user_id" property="createUserId"/>
  14. <result column="create_date" property="createDate"/>
  15. <result column="update_user_id" property="updateUserId"/>
  16. <result column="update_date" property="updateDate"/>
  17. <result column="del_flg" property="delFlg"/>
  18. </resultMap>
  19. <!-- 通用查询结果列 -->
  20. <sql id="Base_Column_List">
  21. id, survey_user_id, survey_address, survey_date, dry_hatch_num, dry_hatch_amount, remark, create_user_id, create_date, update_user_id, update_date, del_flg
  22. </sql>
  23. <select id="pageList" resultMap="BaseResultMap">
  24. select
  25. uuid,
  26. survey_date
  27. from T_Pestc_Aphid_Record
  28. where del_flg = '0'
  29. <if test="tPestcAphidRecord.surveyDate !=null">
  30. and survey_date = #{tPestcAphidRecord.surveyDate}
  31. </if>
  32. <if test="tPestcAphidRecord.surveyAddress !=null and tPestcAphidRecord.surveyAddress != '' ">
  33. and survey_address like concat('%',#{tPestcAphidRecord.surveyAddress},'%')
  34. </if>
  35. <if test="tPestcAphidRecord.surveyUserId !=null and tPestcAphidRecord.surveyUserId != '' ">
  36. and survey_user_id = #{tPestcAphidRecord.surveyUserId}
  37. </if>
  38. group by uuid,survey_date
  39. order by survey_date desc
  40. </select>
  41. <select id="selectAphidRecordList"
  42. resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcAphidRecord">
  43. select
  44. DATE_FORMAT( survey_date, '%Y-%m-%d' ) as surveyDateStr,
  45. avg(if(dry_hatch_amount is null, 0, dry_hatch_amount)) as dry_hatch_amount
  46. from
  47. T_Pestc_Aphid_Record
  48. where
  49. del_flg = 0
  50. <if test="surveyUserId != null">
  51. and survey_user_id = #{surveyUserId}
  52. </if>
  53. group by
  54. survey_date
  55. order by
  56. survey_date
  57. </select>
  58. </mapper>