| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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.TPestcSpottedMothMiridRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
- <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="nymph_amount" property="nymphAmount"/>
- <result column="insect_age" property="insectAge"/>
- <result column="insect_state" property="insectState"/>
- <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, nymph_amount, insect_age, insect_state, 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_Spotted_Moth_Mirid_Record
- where del_flg = '0'
- and survey_type = #{tPestcSpottedMothMiridRecord.surveyType}
- <if test="tPestcSpottedMothMiridRecord.surveyDate !=null">
- and survey_date = #{tPestcSpottedMothMiridRecord.surveyDate}
- </if>
- <if test="tPestcSpottedMothMiridRecord.surveyAddress !=null and tPestcSpottedMothMiridRecord.surveyAddress != '' ">
- and survey_address like concat('%',#{tPestcSpottedMothMiridRecord.surveyAddress},'%')
- </if>
- <if test="tPestcSpottedMothMiridRecord.hostPlant !=null and tPestcSpottedMothMiridRecord.hostPlant != '' ">
- and host_lant like concat('%',#{tPestcSpottedMothMiridRecord.hostPlant},'%')
- </if>
- <if test="tPestcSpottedMothMiridRecord.maintenanceCompanyId !=null and tPestcSpottedMothMiridRecord.maintenanceCompanyId != '' ">
- and maintenance_ompany_id = #{tPestcSpottedMothMiridRecord.maintenanceCompanyId}
- </if>
- <if test="tPestcSpottedMothMiridRecord.surveyUserId !=null and tPestcSpottedMothMiridRecord.surveyUserId != '' ">
- and survey_user_id = #{tPestcSpottedMothMiridRecord.surveyUserId}
- </if>
- group by uuid,survey_date
- order by survey_date desc
- </select>
- <select id="selectSpottedMothMiridRecordList"
- resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
- select
- DATE_FORMAT( survey_date, '%Y-%m-%d' ) as surveyDateStr,
- sum(if(nymph_amount is null, 0, nymph_amount)) as nymph_amount
- from
- T_Pestc_Spotted_Moth_Mirid_Record
- where
- del_flg = 0
- and
- survey_type = 1
- <if test="surveyUserId != null">
- and survey_user_id = #{surveyUserId}
- </if>
- group by
- survey_date
- order by
- survey_date
- </select>
- <select id="selectSpottedMothMiridRecordListByMonth"
- resultType="com.yt.zhylplat.modulePest.specialRecord.entity.TPestcSpottedMothMiridRecord">
- select
- DATE_FORMAT(survey_date, '%Y-%m') as surveyMonth,
- sum(if(nymph_amount is null, 0, nymph_amount)) as nymph_amount
- from
- T_Pestc_Spotted_Moth_Mirid_Record
- where
- del_flg = 0
- and
- survey_type = 2
- <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>
- </mapper>
|