<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.gridfocusgroup" name="网格人员">

    <select id="selectGridFocusGroupTypeList" parameterType="map" resultType="map" expose="true">
        SELECT
            id,
            sort,
            name,
            name title,
            label_img,
            label_type,
            parent_id
        FROM
            jl_grid_focusgroup_type
        WHERE
            del_flag = '0'
        <if test="parent_id != null and parent_id != ''">
            AND parent_id = #{parent_id}
        </if>
    </select>

    <select id="GetGridFocusGroupTypeList" parameterType="map" resultType="map" >
        SELECT
        id,
        sort,
        name,
        name title,
        label_img,
        label_type,
        parent_id
        FROM
        jl_grid_focusgroup_type
        WHERE
        del_flag = '0'
        AND name = #{name}
    </select>
    <insert id="insertGridFocusGroupType" parameterType="map" expose="true" name="添加标签类别">
        INSERT INTO jl_grid_focusgroup_type(
            id,
            sort,
            name,
            label_img,
            label_type,
            parent_id,
            del_flag,
            create_by,
            create_time
        )VALUES(
            UUID(),
            #{sort},
            #{name},
            #{label_img},
            #{label_type},
            #{parent_id},
            '0',
            #{_user.id},
            NOW()
        )
    </insert>

    <update id="updateGridFocusGroupType" parameterType="map" expose="true" name="修改标签类别">
        UPDATE
            jl_grid_focusgroup_type
        SET
            sort = #{sort},
            name = #{name},
            label_img = #{label_img},
            label_type = #{label_type},
            <if test="del_flag != null and del_flag != ''">
                del_flag = #{del_flag},
            </if>
            update_by = #{_user.id},
            update_time = NOW()
        WHERE
            id = #{id}
    </update>
</mapper>
