<?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.baseinfo.mapper.BaseGroupInfoMapper">

    <resultMap type="BaseGroupInfo" id="BaseGroupInfoResult">
        <result property="objid"    column="objid"    />
        <result property="groupid"    column="groupid"    />
        <result property="groupname"    column="groupname"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <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="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectBaseGroupInfoVo">
        select objid, groupid, groupname, status, remark, create_by, create_time, update_by, update_time, del_flag from base_group_info
    </sql>

    <select id="selectBaseGroupInfoList" parameterType="BaseGroupInfo" resultMap="BaseGroupInfoResult">
        <include refid="selectBaseGroupInfoVo"/>
        <where>
            <if test="groupid != null  and groupid != ''"> and groupid = #{groupid}</if>
            <if test="groupname != null  and groupname != ''"> and groupname like ('%' + #{groupname} + '%')</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>

    <select id="selectBaseGroupInfoById" parameterType="Long" resultMap="BaseGroupInfoResult">
        <include refid="selectBaseGroupInfoVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertBaseGroupInfo" parameterType="BaseGroupInfo">
        insert into base_group_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null">objid,</if>
            <if test="groupid != null">groupid,</if>
            <if test="groupname != null">groupname,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">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="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="objid != null">#{objid},</if>
            <if test="groupid != null">#{groupid},</if>
            <if test="groupname != null">#{groupname},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateBaseGroupInfo" parameterType="BaseGroupInfo">
        update base_group_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="groupid != null">groupid = #{groupid},</if>
            <if test="groupname != null">groupname = #{groupname},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">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="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteBaseGroupInfoById" parameterType="Long">
        delete from base_group_info where objid = #{objid}
    </delete>

    <delete id="deleteBaseGroupInfoByIds" parameterType="String">
        delete from base_group_info where objid in
        <foreach item="objid" collection="array" open="(" separator="," close=")">
            #{objid}
        </foreach>
    </delete>

</mapper>
