| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?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.patrolTrack.mapper.TPestcPatrolTrackMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.modulePest.patrolTrack.entity.TPestcPatrolTrack">
- <id column="id" property="id" />
- <result column="aassess_no" property="aassessNo" />
- <result column="observe_point_id" property="observePointId" />
- <result column="observe_point_name" property="observePointName" />
- <result column="maintenance_company_id" property="maintenanceCompanyId" />
- <result column="maintenance_company_name" property="maintenanceCompanyName" />
- <result column="section_id" property="sectionId" />
- <result column="section_name" property="sectionName" />
- <result column="point_road_id" property="pointRoadId" />
- <result column="key_road_id" property="keyRoadId" />
- <result column="user_id" property="userId" />
- <result column="user_name" property="userName" />
- <result column="is_exist" property="isExist" />
- <result column="type" property="type" />
- <result column="state" property="state" />
- <result column="start_time" property="startTime" />
- <result column="end_time" property="endTime" />
- <result column="total_time" property="totalTime" />
- <result column="mileage" property="mileage" />
- <result column="start_coordinates" property="startCoordinates" />
- <result column="end_coordinates" property="endCoordinates" />
- <result column="total_coordinates" property="totalCoordinates" />
- <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, aassess_no, observe_point_id, observe_point_name, maintenance_company_id, maintenance_company_name, section_id, section_name, point_road_id, key_road_id, user_id, user_name, is_exist, type, state, start_time, end_time, total_time, mileage, start_coordinates, end_coordinates, total_coordinates, remark, create_user_id, create_date, update_user_id, update_date, del_flg
- </sql>
- <select id="selectPatrolTrackIssueModelList"
- resultType="com.yt.zhylplat.moduleExcel.model.PatrolTrackIssueModel">
- SELECT
- pti.create_date,
- pt.observe_point_name,
- pt.user_name,
- ptd.survey_address,
- '是' as isPest,
- case
- when pti.danger_type = 1 then '食叶性害虫'
- when pti.danger_type = 2 then '刺吸性害虫'
- when pti.danger_type = 3 then '钻蛀性害虫'
- when pti.danger_type = 4 then '地下害虫'
- when pti.danger_type = 5 then '病害类'
- when pti.danger_type = 6 then '其他'
- end as danger_type,
- pti.pest_name,
- pti.`host`,
- case
- when pti.danger_level = 0 then '轻'
- when pti.danger_level = 1 then '中'
- when pti.danger_level = 2 then '重'
- end as danger_level,
- REPLACE(ptif.file_url,'https://park.pingok.cn/','') as deal_file_url,
- ptif.file_url
- FROM
- T_Pestc_Patrol_Track pt
- LEFT JOIN
- T_Pestc_Patrol_Track_Issue pti on pt.id = pti.patrol_id
- LEFT JOIN
- (
- SELECT
- patrol_id,
- GROUP_CONCAT(CONCAT(point_road_name,'(',road_start_spot, '-', road_end_spot, ')') SEPARATOR ',') as survey_address
- FROM
- T_Pestc_Patrol_Track_Detail
- GROUP BY
- patrol_id
- ) ptd on pt.id = ptd.patrol_id
- LEFT JOIN
- (
- SELECT
- patrol_issue_id,
- GROUP_CONCAT(file_url SEPARATOR ',') as file_url
- FROM
- T_Pestc_Patrol_Track_Issue_File
- GROUP BY
- patrol_issue_id
- ) ptif on pti.id = ptif.patrol_issue_id
- WHERE
- pt.del_flg = 0
- and
- pti.patrol_id is not null
- <if test="observePointId != null">
- and pt.observe_point_id = #{observePointId}
- </if>
- <if test="queryStartDate != null and queryStartDate != ''">
- and date_format(pt.create_date,'%Y-%m-%d') <![CDATA[ >= ]]> #{queryStartDate}
- </if>
- <if test="queryEndDate != null and queryEndDate != ''">
- and date_format(pt.create_date,'%Y-%m-%d') <![CDATA[ <= ]]> #{queryEndDate}
- </if>
- </select>
- </mapper>
|