| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.modulePest.specialRecord.mapper.TPestcCoalPollutionStarCowRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap"
- type="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcCoalPollutionStarCowRecord">
- <id column="id" property="id"/>
- <result column="survey_user_id" property="surveyUserId"/>
- <result column="survey_address" property="surveyAddress"/>
- <result column="survey_date" property="surveyDate"/>
- <result column="host_plant" property="hostPlant"/>
- <result column="sample_num" property="sampleNum"/>
- <result column="disease_sample_amount" property="diseaseSampleAmount"/>
- <result column="survey_type" property="surveyType"/>
- <result column="remark" property="remark"/>
- <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"/>
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, survey_user_id, survey_address, survey_date, host_plant, sample_num, disease_sample_amount, survey_type, remark, create_user_id, create_date, update_user_id, update_date, del_flg
- </sql>
- <select id="pageList" resultMap="BaseResultMap">
- select
- uuid,
- survey_date
- from T_Pestc_Coal_Pollution_Star_Cow_Record
- where del_flg = '0'
- and survey_type = #{tPestcCoalPollutionStarCowRecord.surveyType}
- <if test="tPestcCoalPollutionStarCowRecord.surveyDate !=null">
- and survey_date = #{tPestcCoalPollutionStarCowRecord.surveyDate}
- </if>
- <if test="tPestcCoalPollutionStarCowRecord.surveyAddress !=null and tPestcCoalPollutionStarCowRecord.surveyAddress != '' ">
- and survey_address like concat('%',#{tPestcCoalPollutionStarCowRecord.surveyAddress},'%')
- </if>
- <if test="tPestcCoalPollutionStarCowRecord.hostPlant !=null and tPestcCoalPollutionStarCowRecord.hostPlant != '' ">
- and host_plant like concat('%',#{tPestcCoalPollutionStarCowRecord.hostPlant},'%')
- </if>
- <if test="tPestcCoalPollutionStarCowRecord.surveyUserId !=null and tPestcCoalPollutionStarCowRecord.surveyUserId != '' ">
- and survey_user_id = #{tPestcCoalPollutionStarCowRecord.surveyUserId}
- </if>
- group by uuid,survey_date
- order by survey_date desc
- </select>
- <select id="selectCoalPollutionStarCowRecordList"
- resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcCoalPollutionStarCowRecord">
- select
- date_format(survey_date, '%Y-%m') as surveyMonth,
- sum(if(disease_sample_amount is null, 0, disease_sample_amount)) as disease_sample_amount
- from
- T_Pestc_Coal_Pollution_Star_Cow_Record
- where
- del_flg = 0
- <if test="surveyType != null">
- and survey_type = #{surveyType}
- </if>
- <if test="surveyUserId != null">
- and survey_user_id = #{surveyUserId}
- </if>
- group by
- date_format(survey_date, '%Y-%m')
- order by
- date_format(survey_date, '%Y-%m')
- </select>
- <select id="selectCoalPollutionRecordList"
- resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcCoalPollutionStarCowRecord">
- select
- date_format(temp.survey_date, '%Y-%m') as surveyMonth,
- avg(temp.sufferRate) as sufferRate
- from
- (<include refid="coalPollutionSufferRateSql"/>) temp
- group by
- date_format(temp.survey_date, '%Y-%m')
- order by
- date_format(temp.survey_date, '%Y-%m')
- </select>
- <sql id="coalPollutionSufferRateSql">
- select
- survey_date,
- survey_user_id,
- sum(if(disease_sample_amount is null or disease_sample_amount = 0, 0, 1)) / 5 as sufferRate
- from
- T_Pestc_Coal_Pollution_Star_Cow_Record
- where
- del_flg = 0
- and
- survey_type = 1
- <if test="surveyUserId != null">
- and survey_user_id = #{surveyUserId}
- </if>
- group by
- survey_date,
- survey_user_id
- </sql>
- </mapper>
|