<?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.TPublicServiceIsoundMapper">

    <resultMap type="com.ruoyi.system.domain.publicservice.TPublicServiceIsound" id="TPublicServiceIsoundResult">
        <result property="soundId"    column="sound_id"    />
        <result property="soundName"    column="sound_name"    />
        <result property="soundPhone"    column="sound_phone"    />
        <result property="soundCode"    column="sound_code"    />
        <result property="soundDesc"    column="sound_desc"    />
        <result property="soundResult"    column="sound_result"    />
        <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="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
    </resultMap>

    <sql id="selectTPublicServiceIsoundVo">
        select sound_id, sound_name, sound_phone, sound_code, sound_desc,
         sound_result, check_anonymous, create_by, create_time,
          update_by, update_time, valid, longitude, latitude
           from t_public_service_isound
    </sql>

    <select id="list" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIsound" resultMap="TPublicServiceIsoundResult">
        <include refid="selectTPublicServiceIsoundVo"/>
        <where>
            <if test="soundName != null  and soundName != ''"> and sound_name like concat('%', #{soundName}, '%')</if>
            <if test="soundPhone != null  and soundPhone != ''"> and sound_phone = #{soundPhone}</if>
            <if test="soundCode != null  and soundCode != ''"> and sound_code = #{soundCode}</if>
            <if test="soundDesc != null  and soundDesc != ''"> and sound_desc = #{soundDesc}</if>
            <if test="soundResult != null  and soundResult != ''"> and sound_result = #{soundResult}</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="longitude != null  and longitude != ''"> and longitude = #{longitude}</if>
            <if test="latitude != null  and latitude != ''"> and latitude = #{latitude}</if>
        </where>
        order by sound_id desc
    </select>

    <select id="getObjectById" resultMap="TPublicServiceIsoundResult">
        <include refid="selectTPublicServiceIsoundVo"/>
        where sound_id = #{soundId}
    </select>

    <insert id="save" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIsound" useGeneratedKeys="true" keyProperty="soundId">
        insert into t_public_service_isound
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="soundId != null ">sound_id,</if>
            <if test="soundName != null  and soundName != ''">sound_name,</if>
            <if test="soundPhone != null  and soundPhone != ''">sound_phone,</if>
            <if test="soundCode != null  and soundCode != ''">sound_code,</if>
            <if test="soundDesc != null  and soundDesc != ''">sound_desc,</if>
            <if test="soundResult != null  and soundResult != ''">sound_result,</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="longitude != null  and longitude != ''">longitude,</if>
            <if test="latitude != null  and latitude != ''">latitude,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="soundId != null ">#{soundId},</if>
            <if test="soundName != null  and soundName != ''">#{soundName},</if>
            <if test="soundPhone != null  and soundPhone != ''">#{soundPhone},</if>
            <if test="soundCode != null  and soundCode != ''">#{soundCode},</if>
            <if test="soundDesc != null  and soundDesc != ''">#{soundDesc},</if>
            <if test="soundResult != null  and soundResult != ''">#{soundResult},</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="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.TPublicServiceIsound">
        update t_public_service_isound
        <trim prefix="SET" suffixOverrides=",">
            <if test="soundName != null and soundName != ''">sound_name = #{soundName},</if>
            <if test="soundPhone != null and soundPhone != ''">sound_phone = #{soundPhone},</if>
            <if test="soundCode != null and soundCode != ''">sound_code = #{soundCode},</if>
            <if test="soundDesc != null and soundDesc != ''">sound_desc = #{soundDesc},</if>
            <if test="soundResult != null and soundResult != ''">sound_result = #{soundResult},</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="longitude != null and longitude != ''">longitude = #{longitude},</if>
            <if test="latitude != null and latitude != ''">latitude = #{latitude},</if>
        </trim>
        where sound_id = #{soundId}
    </update>

    <delete id="remove">
        delete from t_public_service_isound
        where sound_id = #{soundId}
    </delete>

    <delete id="batchRemove">
        delete from t_public_service_isound where
        sound_id in
        <foreach item="soundId" collection="soundId" open="(" separator="," close=")">
            #{soundId}
        </foreach>
    </delete>

    <select id="getMaxNo" parameterType="com.ruoyi.system.domain.publicservice.TPublicServiceIsound" resultMap="TPublicServiceIsoundResult">
        select max(sound_code) sound_code
        from t_public_service_iSound
    </select>

</mapper>
