<?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.system.mapper.publicservice.TPublicServiceIfindMapper">

    <resultMap type="com.ruoyi.system.domain.publicservice.TPublicServiceIfind" id="TPublicServiceIfindResult">
        <result property="findId"    column="find_id"    />
        <result property="finderName"    column="finder_name"    />
        <result property="finderPhone"    column="finder_phone"    />
        <result property="findCode"    column="find_code"    />
        <result property="belongArea"    column="belong_area"    />
        <result property="address"    column="address"    />
        <result property="findDesc"    column="find_desc"    />
        <result property="findResult"    column="find_result"    />
        <result property="genTask"    column="gen_task"    />
        <result property="checkAnonymous"    column="check_anonymous"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="valid"    column="valid"    />
        <result property="projectId"    column="project_id"    />
        <result property="projectName"    column="project_name"    />
        <result property="projectAdvise"    column="project_advise"    />
        <result property="projectStatus"    column="project_status"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
    </resultMap>

    <sql id="selectTPublicServiceIfindVo">
        select find_id, finder_name, finder_phone, find_code, belong_area,
         address, find_desc, find_result, gen_task, check_anonymous,
          create_by, create_time, update_by, update_time,
           valid, project_id, project_name, project_advise, project_status,
            longitude, latitude
            from t_public_service_ifind
    </sql>

    <select id="list" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIfind" resultMap="TPublicServiceIfindResult">
        <include refid="selectTPublicServiceIfindVo"/>
        <where>
            <if test="finderName != null  and finderName != ''"> and finder_name like concat('%', #{finderName}, '%')</if>
            <if test="finderPhone != null  and finderPhone != ''"> and finder_phone = #{finderPhone}</if>
            <if test="findCode != null  and findCode != ''"> and find_code = #{findCode}</if>
            <if test="belongArea != null  and belongArea != ''"> and belong_area = #{belongArea}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="findDesc != null  and findDesc != ''"> and find_desc like concat('%', #{findDesc}, '%')</if>
            <if test="findResult != null  and findResult != ''"> and find_result = #{findResult}</if>
            <if test="genTask != null  and genTask != ''"> and gen_task = #{genTask}</if>
            <if test="checkAnonymous != null  and checkAnonymous != ''"> and check_anonymous = #{checkAnonymous}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateBy != null "> and update_by = #{updateBy}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="valid != null "> and valid = #{valid}</if>
            <if test="projectId != null  and projectId != ''"> and project_id = #{projectId}</if>
            <if test="projectName != null  and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
            <if test="projectAdvise != null  and projectAdvise != ''"> and project_advise = #{projectAdvise}</if>
            <if test="projectStatus != null  and projectStatus != ''"> and project_status = #{projectStatus}</if>
            <if test="longitude != null  and longitude != ''"> and longitude = #{longitude}</if>
            <if test="latitude != null  and latitude != ''"> and latitude = #{latitude}</if>
            <if test="belongYear != null  and belongYear != ''"> and DATE_FORMAT(create_time,'%Y') = #{belongYear}</if>
        </where>
         order by find_id desc
    </select>

    <select id="getObjectById" resultMap="TPublicServiceIfindResult">
        <include refid="selectTPublicServiceIfindVo"/>
        where find_id = #{findId}
    </select>

    <insert id="save" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIfind" useGeneratedKeys="true" keyProperty="findId">
        insert into t_public_service_ifind
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="findId != null ">find_id,</if>
            <if test="finderName != null  and finderName != ''">finder_name,</if>
            <if test="finderPhone != null  and finderPhone != ''">finder_phone,</if>
            <if test="findCode != null  and findCode != ''">find_code,</if>
            <if test="belongArea != null  and belongArea != ''">belong_area,</if>
            <if test="address != null  and address != ''">address,</if>
            <if test="findDesc != null  and findDesc != ''">find_desc,</if>
            <if test="findResult != null  and findResult != ''">find_result,</if>
            <if test="genTask != null  and genTask != ''">gen_task,</if>
            <if test="checkAnonymous != null  and checkAnonymous != ''">check_anonymous,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null ">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="valid != null ">valid,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="projectName != null  and projectName != ''">project_name,</if>
            <if test="projectAdvise != null  and projectAdvise != ''">project_advise,</if>
            <if test="projectStatus != null  and projectStatus != ''">project_status,</if>
            <if test="longitude != null  and longitude != ''">longitude,</if>
            <if test="latitude != null  and latitude != ''">latitude,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="findId != null ">#{findId},</if>
            <if test="finderName != null  and finderName != ''">#{finderName},</if>
            <if test="finderPhone != null  and finderPhone != ''">#{finderPhone},</if>
            <if test="findCode != null  and findCode != ''">#{findCode},</if>
            <if test="belongArea != null  and belongArea != ''">#{belongArea},</if>
            <if test="address != null  and address != ''">#{address},</if>
            <if test="findDesc != null  and findDesc != ''">#{findDesc},</if>
            <if test="findResult != null  and findResult != ''">#{findResult},</if>
            <if test="genTask != null  and genTask != ''">#{genTask},</if>
            <if test="checkAnonymous != null  and checkAnonymous != ''">#{checkAnonymous},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null ">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="valid != null ">#{valid},</if>
            <if test="projectId != null  and projectId != ''">#{projectId},</if>
            <if test="projectName != null  and projectName != ''">#{projectName},</if>
            <if test="projectAdvise != null  and projectAdvise != ''">#{projectAdvise},</if>
            <if test="projectStatus != null  and projectStatus != ''">#{projectStatus},</if>
            <if test="longitude != null  and longitude != ''">#{longitude},</if>
            <if test="latitude != null  and latitude != ''">#{latitude},</if>
         </trim>
    </insert>

    <update id="update" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIfind">
        update t_public_service_ifind
        <trim prefix="SET" suffixOverrides=",">
            <if test="finderName != null and finderName != ''">finder_name = #{finderName},</if>
            <if test="finderPhone != null and finderPhone != ''">finder_phone = #{finderPhone},</if>
            <if test="findCode != null and findCode != ''">find_code = #{findCode},</if>
            <if test="belongArea != null and belongArea != ''">belong_area = #{belongArea},</if>
            <if test="address != null and address != ''">address = #{address},</if>
            <if test="findDesc != null and findDesc != ''">find_desc = #{findDesc},</if>
            <if test="findResult != null and findResult != ''">find_result = #{findResult},</if>
            <if test="genTask != null and genTask != ''">gen_task = #{genTask},</if>
            <if test="checkAnonymous != null and checkAnonymous != ''">check_anonymous = #{checkAnonymous},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="valid != null">valid = #{valid},</if>
            <if test="projectId != null and projectId != ''">project_id = #{projectId},</if>
            <if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
            <if test="projectAdvise != null and projectAdvise != ''">project_advise = #{projectAdvise},</if>
            <if test="projectStatus != null and projectStatus != ''">project_status = #{projectStatus},</if>
            <if test="longitude != null and longitude != ''">longitude = #{longitude},</if>
            <if test="latitude != null and latitude != ''">latitude = #{latitude},</if>
        </trim>
        where find_id = #{findId}
    </update>

    <delete id="remove">
        delete from t_public_service_ifind
        where find_id = #{findId}
    </delete>

    <delete id="batchRemove">
        delete from t_public_service_ifind where
        find_id in
        <foreach item="findId" collection="findId" open="(" separator="," close=")">
            #{findId}
        </foreach>
    </delete>

    <select id="getMaxNo" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIfind" resultMap="TPublicServiceIfindResult">
        select max(find_code) find_code
        from t_public_service_ifind
    </select>
</mapper>
