<?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.hw.ems.base.mapper.BasePublicManageMapper">

    <resultMap type="BasePublicManage" id="BasePublicManageResult">
        <result property="id"    column="id"    />
        <result property="beginTime"    column="begin_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="publicShareType"    column="public_share_type"    />
        <result property="publicShareRule"    column="public_share_rule"    />
        <result property="publicShareValue"    column="public_share_value"    />
        <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="remark"    column="remark"    />
        <result property="other1"    column="other1"    />
        <result property="other2"    column="other2"    />
    </resultMap>

    <sql id="selectBasePublicManageVo">
        select id, begin_time, end_time, public_share_type, public_share_rule, public_share_value, create_by, create_time, update_by, update_time, remark, other1, other2 from base_public_manage
    </sql>

    <select id="selectBasePublicManageList" parameterType="BasePublicManage" resultMap="BasePublicManageResult">
        <include refid="selectBasePublicManageVo"/>
        <where>
            <if test="beginTime != null "> and begin_time = #{beginTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="publicShareType != null  and publicShareType != ''"> and public_share_type = #{publicShareType}</if>
            <if test="publicShareRule != null  and publicShareRule != ''"> and public_share_rule = #{publicShareRule}</if>
            <if test="publicShareValue != null "> and public_share_value = #{publicShareValue}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="other1 != null  and other1 != ''"> and other1 = #{other1}</if>
            <if test="other2 != null  and other2 != ''"> and other2 = #{other2}</if>
        </where>
    </select>

    <select id="selectBasePublicManageById" parameterType="Long" resultMap="BasePublicManageResult">
        <include refid="selectBasePublicManageVo"/>
        where id = #{id}
    </select>

    <insert id="insertBasePublicManage" parameterType="BasePublicManage">
        insert into base_public_manage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="beginTime != null">begin_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="publicShareType != null">public_share_type,</if>
            <if test="publicShareRule != null">public_share_rule,</if>
            <if test="publicShareValue != null">public_share_value,</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="remark != null">remark,</if>
            <if test="other1 != null">other1,</if>
            <if test="other2 != null">other2,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="beginTime != null">#{beginTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="publicShareType != null">#{publicShareType},</if>
            <if test="publicShareRule != null">#{publicShareRule},</if>
            <if test="publicShareValue != null">#{publicShareValue},</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="remark != null">#{remark},</if>
            <if test="other1 != null">#{other1},</if>
            <if test="other2 != null">#{other2},</if>
         </trim>
    </insert>

    <update id="updateBasePublicManage" parameterType="BasePublicManage">
        update base_public_manage
        <trim prefix="SET" suffixOverrides=",">
            <if test="beginTime != null">begin_time = #{beginTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="publicShareType != null">public_share_type = #{publicShareType},</if>
            <if test="publicShareRule != null">public_share_rule = #{publicShareRule},</if>
            <if test="publicShareValue != null">public_share_value = #{publicShareValue},</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="remark != null">remark = #{remark},</if>
            <if test="other1 != null">other1 = #{other1},</if>
            <if test="other2 != null">other2 = #{other2},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBasePublicManageById" parameterType="Long">
        delete from base_public_manage where id = #{id}
    </delete>

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

</mapper>
