|
|
@@ -0,0 +1,163 @@
|
|
|
+<?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.ruoyi.base.mapper.AiGrapeDiseaseReportMapper">
|
|
|
+
|
|
|
+ <resultMap type="AiGrapeDiseaseReport" id="AiGrapeDiseaseReportResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="cropType" column="crop_type" />
|
|
|
+ <result property="deviceCode" column="device_code" />
|
|
|
+ <result property="lng" column="lng" />
|
|
|
+ <result property="lat" column="lat" />
|
|
|
+ <result property="diseaseName" column="disease_name" />
|
|
|
+ <result property="confidence" column="confidence" />
|
|
|
+ <result property="severityLevel" column="severity_level" />
|
|
|
+ <result property="collectTime" column="collect_time" />
|
|
|
+ <result property="farmName" column="farm_name" />
|
|
|
+ <result property="farmId" column="farm_id" />
|
|
|
+ <result property="imgUrl" column="img_url" />
|
|
|
+ <result property="handleStatus" column="handle_status" />
|
|
|
+ <result property="emergencyMeasure" column="emergency_measure" />
|
|
|
+ <result property="manageAdvice" column="manage_advice" />
|
|
|
+ <result property="preventPlan" column="prevent_plan" />
|
|
|
+ <result property="handleNote" column="handle_note" />
|
|
|
+ <result property="handleUser" column="handle_user" />
|
|
|
+ <result property="handleTime" column="handle_time" />
|
|
|
+ <result property="createdTime" column="CREATED_TIME" />
|
|
|
+ <result property="updatedTime" column="UPDATED_TIME" />
|
|
|
+ <result property="todayCount" column="today_count" />
|
|
|
+ <result property="pendingCount" column="pending_count" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectAiGrapeDiseaseReportVo">
|
|
|
+ select id, crop_type, device_code, lng, lat, disease_name, confidence, severity_level, collect_time, farm_name, img_url, handle_status, emergency_measure, manage_advice, prevent_plan, handle_note, handle_user, handle_time, CREATED_TIME, UPDATED_TIME from ai_grape_disease_report
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectAiGrapeDiseaseReportList" parameterType="AiGrapeDiseaseReport" resultMap="AiGrapeDiseaseReportResult">
|
|
|
+ select agdr.*, sd.dept_name as farm_name
|
|
|
+ from ai_grape_disease_report as agdr left join sys_dept sd on agdr.farm_id = sd.dept_id
|
|
|
+ <where>
|
|
|
+ <if test="cropType != null and cropType != ''"> and crop_type like concat('%', #{cropType}, '%')</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
|
|
+ <if test="lng != null "> and lng = #{lng}</if>
|
|
|
+ <if test="lat != null "> and lat = #{lat}</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''"> and disease_name like concat('%', #{diseaseName}, '%')</if>
|
|
|
+ <if test="confidence != null "> and confidence = #{confidence}</if>
|
|
|
+ <if test="severityLevel != null "> and severity_level = #{severityLevel}</if>
|
|
|
+ <if test="collectTime != null "> and collect_time = #{collectTime}</if>
|
|
|
+ <if test="farmName != null and farmName != ''"> and farm_name like concat('%', #{farmName}, '%')</if>
|
|
|
+ <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
|
|
|
+ <if test="handleStatus != null "> and handle_status = #{handleStatus}</if>
|
|
|
+ <if test="emergencyMeasure != null and emergencyMeasure != ''"> and emergency_measure = #{emergencyMeasure}</if>
|
|
|
+ <if test="manageAdvice != null and manageAdvice != ''"> and manage_advice = #{manageAdvice}</if>
|
|
|
+ <if test="preventPlan != null and preventPlan != ''"> and prevent_plan = #{preventPlan}</if>
|
|
|
+ <if test="handleNote != null and handleNote != ''"> and handle_note = #{handleNote}</if>
|
|
|
+ <if test="handleUser != null and handleUser != ''"> and handle_user = #{handleUser}</if>
|
|
|
+ <if test="handleTime != null "> and handle_time = #{handleTime}</if>
|
|
|
+ <if test="createdTime != null "> and CREATED_TIME = #{createdTime}</if>
|
|
|
+ <if test="updatedTime != null "> and UPDATED_TIME = #{updatedTime}</if>
|
|
|
+ <if test="deptIdList != null and deptIdList.size() != 0"> and agdr.farm_id in (<foreach collection="deptIdList" item="deptId" separator=",">#{deptId}</foreach>)</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAiGrapeDiseaseReportById" parameterType="Long" resultMap="AiGrapeDiseaseReportResult">
|
|
|
+ select agdr.*, sd.dept_name as farm_name
|
|
|
+ from ai_grape_disease_report as agdr left join sys_dept sd on agdr.farm_id = sd.dept_id
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="selectAiGrapeDiseaseReportByCount" resultMap="AiGrapeDiseaseReportResult">
|
|
|
+ SELECT
|
|
|
+ (SELECT COUNT(*)
|
|
|
+ FROM ai_grape_disease_report
|
|
|
+ WHERE DATE(collect_time) = CURDATE()) AS today_count,
|
|
|
+ (SELECT COUNT(*)
|
|
|
+ FROM ai_grape_disease_report
|
|
|
+ WHERE handle_status = 0) AS pending_count;
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertAiGrapeDiseaseReport" parameterType="AiGrapeDiseaseReport" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into ai_grape_disease_report
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="cropType != null and cropType != ''">crop_type,</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">device_code,</if>
|
|
|
+ <if test="lng != null">lng,</if>
|
|
|
+ <if test="lat != null">lat,</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">disease_name,</if>
|
|
|
+ <if test="confidence != null">confidence,</if>
|
|
|
+ <if test="severityLevel != null">severity_level,</if>
|
|
|
+ <if test="collectTime != null">collect_time,</if>
|
|
|
+ <if test="farmName != null">farm_name,</if>
|
|
|
+ <if test="imgUrl != null and imgUrl != ''">img_url,</if>
|
|
|
+ <if test="handleStatus != null">handle_status,</if>
|
|
|
+ <if test="emergencyMeasure != null and emergencyMeasure != ''">emergency_measure,</if>
|
|
|
+ <if test="manageAdvice != null and manageAdvice != ''">manage_advice,</if>
|
|
|
+ <if test="preventPlan != null and preventPlan != ''">prevent_plan,</if>
|
|
|
+ <if test="handleNote != null">handle_note,</if>
|
|
|
+ <if test="handleUser != null">handle_user,</if>
|
|
|
+ <if test="handleTime != null">handle_time,</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME,</if>
|
|
|
+ <if test="updatedTime != null">UPDATED_TIME,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="cropType != null and cropType != ''">#{cropType},</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
|
|
+ <if test="lng != null">#{lng},</if>
|
|
|
+ <if test="lat != null">#{lat},</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">#{diseaseName},</if>
|
|
|
+ <if test="confidence != null">#{confidence},</if>
|
|
|
+ <if test="severityLevel != null">#{severityLevel},</if>
|
|
|
+ <if test="collectTime != null">#{collectTime},</if>
|
|
|
+ <if test="farmName != null">#{farmName},</if>
|
|
|
+ <if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
|
|
|
+ <if test="handleStatus != null">#{handleStatus},</if>
|
|
|
+ <if test="emergencyMeasure != null and emergencyMeasure != ''">#{emergencyMeasure},</if>
|
|
|
+ <if test="manageAdvice != null and manageAdvice != ''">#{manageAdvice},</if>
|
|
|
+ <if test="preventPlan != null and preventPlan != ''">#{preventPlan},</if>
|
|
|
+ <if test="handleNote != null">#{handleNote},</if>
|
|
|
+ <if test="handleUser != null">#{handleUser},</if>
|
|
|
+ <if test="handleTime != null">#{handleTime},</if>
|
|
|
+ <if test="createdTime != null">#{createdTime},</if>
|
|
|
+ <if test="updatedTime != null">#{updatedTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateAiGrapeDiseaseReport" parameterType="AiGrapeDiseaseReport">
|
|
|
+ update ai_grape_disease_report
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="cropType != null and cropType != ''">crop_type = #{cropType},</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
|
|
+ <if test="lng != null">lng = #{lng},</if>
|
|
|
+ <if test="lat != null">lat = #{lat},</if>
|
|
|
+ <if test="diseaseName != null and diseaseName != ''">disease_name = #{diseaseName},</if>
|
|
|
+ <if test="confidence != null">confidence = #{confidence},</if>
|
|
|
+ <if test="severityLevel != null">severity_level = #{severityLevel},</if>
|
|
|
+ <if test="collectTime != null">collect_time = #{collectTime},</if>
|
|
|
+ <if test="farmName != null">farm_name = #{farmName},</if>
|
|
|
+ <if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
|
|
|
+ <if test="handleStatus != null">handle_status = #{handleStatus},</if>
|
|
|
+ <if test="emergencyMeasure != null and emergencyMeasure != ''">emergency_measure = #{emergencyMeasure},</if>
|
|
|
+ <if test="manageAdvice != null and manageAdvice != ''">manage_advice = #{manageAdvice},</if>
|
|
|
+ <if test="preventPlan != null and preventPlan != ''">prevent_plan = #{preventPlan},</if>
|
|
|
+ <if test="handleNote != null">handle_note = #{handleNote},</if>
|
|
|
+ <if test="handleUser != null">handle_user = #{handleUser},</if>
|
|
|
+ <if test="handleTime != null">handle_time = #{handleTime},</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
|
|
|
+ <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteAiGrapeDiseaseReportById" parameterType="Long">
|
|
|
+ delete from ai_grape_disease_report where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteAiGrapeDiseaseReportByIds" parameterType="String">
|
|
|
+ delete from ai_grape_disease_report where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|