<?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.operatingmanage.TPublicServiceComInfoMapper">

    <resultMap type="com.ruoyi.system.domain.operatingmanage.TPublicServiceComInfo" id="TPublicServiceComInfoResult">
        <result property="comId"    column="com_id"    />
        <result property="comName"    column="com_name"    />
        <result property="comScale"    column="com_scale"    />
        <result property="comBenefits"    column="com_benefits"    />
        <result property="comAddress"    column="com_address"    />
        <result property="comIndustry"    column="com_industry"    />
        <result property="comTime"    column="com_time"    />
        <result property="comPhone"    column="com_phone"    />
        <result property="comOwner"    column="com_owner"    />
        <result property="valid"    column="valid"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="postDesc"    column="post_desc"    />
        <result property="title"    column="title"    />
        <result property="hiddenType"    column="hidden_type"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
    </resultMap>

    <sql id="selectTPublicServiceComInfoVo">
        select com_id, com_name, com_scale, com_benefits, com_address, com_industry,
         com_time, com_phone, com_owner,  valid, create_time, create_by,
          update_time, update_by, post_desc, title, hidden_type,longitude, latitude
           from t_public_service_com_info
    </sql>

    <select id="list" parameterType="com.ruoyi.system.domain.operatingmanage.TPublicServiceComInfo" resultMap="TPublicServiceComInfoResult">
        <include refid="selectTPublicServiceComInfoVo"/>
        <where>
            <if test="comName != null  and comName != ''"> and com_name like concat('%', #{comName}, '%')</if>
            <if test="comScale != null  and comScale != ''"> and com_scale = #{comScale}</if>
            <if test="comBenefits != null  and comBenefits != ''"> and com_benefits = #{comBenefits}</if>
            <if test="comAddress != null  and comAddress != ''"> and com_address = #{comAddress}</if>
            <if test="comIndustry != null  and comIndustry != ''"> and com_industry = #{comIndustry}</if>
            <if test="comTime != null  and comTime != ''"> and com_time = #{comTime}</if>
            <if test="comPhone != null  and comPhone != ''"> and com_phone = #{comPhone}</if>
            <if test="comOwner != null  and comOwner != ''"> and com_owner = #{comOwner}</if>
            <if test="valid != null "> and valid = #{valid}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
            <if test="postDesc != null  and postDesc != ''"> and post_desc = #{postDesc}</if>
            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
            <if test="hiddenType != null  and hiddenType != ''"> and hidden_type = #{hiddenType}</if>
            <if test="longitude != null  and longitude != ''"> and longitude = #{longitude}</if>
            <if test="latitude != null  and latitude != ''"> and latitude = #{latitude}</if>

        </where>
        order by com_id desc
    </select>

    <select id="getObjectById" resultMap="TPublicServiceComInfoResult">
        <include refid="selectTPublicServiceComInfoVo"/>
        where com_id = #{comId}
    </select>

    <insert id="save" parameterType="com.ruoyi.system.domain.operatingmanage.TPublicServiceComInfo" useGeneratedKeys="true" keyProperty="comId">
        insert into t_public_service_com_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="comId != null ">com_id,</if>
            <if test="comName != null  and comName != ''">com_name,</if>
            <if test="comScale != null  and comScale != ''">com_scale,</if>
            <if test="comBenefits != null  and comBenefits != ''">com_benefits,</if>
            <if test="comAddress != null  and comAddress != ''">com_address,</if>
            <if test="comIndustry != null  and comIndustry != ''">com_industry,</if>
            <if test="comTime != null  and comTime != ''">com_time,</if>
            <if test="comPhone != null  and comPhone != ''">com_phone,</if>
            <if test="comOwner != null  and comOwner != ''">com_owner,</if>
            <if test="valid != null ">valid,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="postDesc != null  and postDesc != ''">post_desc,</if>
            <if test="title != null  and title != ''">title,</if>
            <if test="hiddenType != null  and hiddenType != ''">hidden_type,</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="comId != null ">#{comId},</if>
            <if test="comName != null  and comName != ''">#{comName},</if>
            <if test="comScale != null  and comScale != ''">#{comScale},</if>
            <if test="comBenefits != null  and comBenefits != ''">#{comBenefits},</if>
            <if test="comAddress != null  and comAddress != ''">#{comAddress},</if>
            <if test="comIndustry != null  and comIndustry != ''">#{comIndustry},</if>
            <if test="comTime != null  and comTime != ''">#{comTime},</if>
            <if test="comPhone != null  and comPhone != ''">#{comPhone},</if>
            <if test="comOwner != null  and comOwner != ''">#{comOwner},</if>
            <if test="valid != null ">#{valid},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="postDesc != null  and postDesc != ''">#{postDesc},</if>
            <if test="title != null  and title != ''">#{title},</if>
            <if test="hiddenType != null  and hiddenType != ''">#{hiddenType},</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.operatingmanage.TPublicServiceComInfo">
        update t_public_service_com_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="comName != null and comName != ''">com_name = #{comName},</if>
            <if test="comScale != null and comScale != ''">com_scale = #{comScale},</if>
            <if test="comBenefits != null and comBenefits != ''">com_benefits = #{comBenefits},</if>
            <if test="comAddress != null and comAddress != ''">com_address = #{comAddress},</if>
            <if test="comIndustry != null and comIndustry != ''">com_industry = #{comIndustry},</if>
            <if test="comTime != null and comTime != ''">com_time = #{comTime},</if>
            <if test="comPhone != null and comPhone != ''">com_phone = #{comPhone},</if>
            <if test="comOwner != null and comOwner != ''">com_owner = #{comOwner},</if>
            <if test="valid != null">valid = #{valid},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="postDesc != null and postDesc != ''">post_desc = #{postDesc},</if>
            <if test="title != null  and title != ''">title = #{title},</if>
            <if test="hiddenType != null  and hiddenType != ''">hidden_type = #{hiddenType},</if>
            <if test="longitude != null and longitude != ''">longitude = #{longitude},</if>
            <if test="latitude != null and latitude != ''">latitude = #{latitude},</if>
        </trim>
        where com_id = #{comId}
    </update>

    <delete id="remove">
        delete from t_public_service_com_info
        where com_id = #{comId}
    </delete>

    <delete id="batchRemove">
        delete from t_public_service_com_info where
        com_id in
        <foreach item="comId" collection="comId" open="(" separator="," close=")">
            #{comId}
        </foreach>
    </delete>

</mapper>
