<?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.party.mapper.PartyActivityMapper">
    
    <resultMap type="com.ruoyi.party.domain.PartyActivity" id="PartyActivityResult">
        <result property="id"    column="id"    />
        <result property="zt"    column="zt"    />
        <result property="fwlx"    column="fwlx"    />
        <result property="hddd"    column="hddd"    />
        <result property="nr"    column="nr"    />
        <result property="zcr"    column="zcr"    />
        <result property="lxdh"    column="lxdh"    />
        <result property="ssdzzmc"    column="ssdzzmc"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="hdrs"    column="hdrs"    />
        <result property="jlr"    column="jlr"    />
        <result property="kssj"    column="kssj"    />
        <result property="jssj"    column="jssj"    />
        <result property="pic"    column="pic"    />
        <result property="wgCode"    column="wg_code"    />
    </resultMap>

    <sql id="selectPartyActivityVo">
        select id, zt, fwlx, hddd, nr, zcr, lxdh, ssdzzmc, create_user, create_time, hdrs, jlr, kssj, jssj,pic,wg_code from party_activity
    </sql>

    <select id="selectPartyActivityList" parameterType="com.ruoyi.party.domain.PartyActivity" resultMap="PartyActivityResult">
        <include refid="selectPartyActivityVo"/>
        <where>  
            <if test="zt != null  and zt != ''"> and zt like concat('%', #{zt}, '%')</if>
            <if test="fwlx != null  and fwlx != ''"> and fwlx = #{fwlx}</if>
            <if test="hddd != null  and hddd != ''"> and hddd = #{hddd}</if>
            <if test="nr != null  and nr != ''"> and nr = #{nr}</if>
            <if test="zcr != null  and zcr != ''"> and zcr = #{zcr}</if>
            <if test="lxdh != null  and lxdh != ''"> and lxdh = #{lxdh}</if>
            <if test="ssdzzmc != null  and ssdzzmc != ''"> and ssdzzmc = #{ssdzzmc}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="hdrs != null  and hdrs != ''"> and hdrs = #{hdrs}</if>
            <if test="jlr != null  and jlr != ''"> and jlr = #{jlr}</if>
            <if test="kssj != null  and kssj != ''"> and kssj &gt;= #{kssj}</if>
            <if test="jssj != null  and jssj != ''"> and jssj &lt;= #{jssj}</if>
            <if test="wgCode != null  and wgCode != ''"> and wg_code = #{wgCode}</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectPartyActivityById" parameterType="String" resultMap="PartyActivityResult">
        <include refid="selectPartyActivityVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPartyActivity" parameterType="com.ruoyi.party.domain.PartyActivity">
        insert into party_activity
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="zt != null">zt,</if>
            <if test="fwlx != null">fwlx,</if>
            <if test="hddd != null">hddd,</if>
            <if test="nr != null">nr,</if>
            <if test="zcr != null">zcr,</if>
            <if test="lxdh != null">lxdh,</if>
            <if test="ssdzzmc != null">ssdzzmc,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="hdrs != null">hdrs,</if>
            <if test="jlr != null">jlr,</if>
            <if test="kssj != null">kssj,</if>
            <if test="jssj != null">jssj,</if>
            <if test="pic != null">pic,</if>
            <if test="wgCode != null">wg_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="zt != null">#{zt},</if>
            <if test="fwlx != null">#{fwlx},</if>
            <if test="hddd != null">#{hddd},</if>
            <if test="nr != null">#{nr},</if>
            <if test="zcr != null">#{zcr},</if>
            <if test="lxdh != null">#{lxdh},</if>
            <if test="ssdzzmc != null">#{ssdzzmc},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="hdrs != null">#{hdrs},</if>
            <if test="jlr != null">#{jlr},</if>
            <if test="kssj != null">#{kssj},</if>
            <if test="jssj != null">#{jssj},</if>
            <if test="pic != null">#{pic},</if>
            <if test="wgCode != null">#{wgCode},</if>
         </trim>
    </insert>

    <update id="updatePartyActivity" parameterType="com.ruoyi.party.domain.PartyActivity">
        update party_activity
        <trim prefix="SET" suffixOverrides=",">
            <if test="zt != null">zt = #{zt},</if>
            <if test="fwlx != null">fwlx = #{fwlx},</if>
            <if test="hddd != null">hddd = #{hddd},</if>
            <if test="nr != null">nr = #{nr},</if>
            <if test="zcr != null">zcr = #{zcr},</if>
            <if test="lxdh != null">lxdh = #{lxdh},</if>
            <if test="ssdzzmc != null">ssdzzmc = #{ssdzzmc},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="hdrs != null">hdrs = #{hdrs},</if>
            <if test="jlr != null">jlr = #{jlr},</if>
            <if test="kssj != null">kssj = #{kssj},</if>
            <if test="jssj != null">jssj = #{jssj},</if>
            <if test="pic != null">pic = #{pic},</if>
            <if test="wgCode != null">wg_code = #{wgCode},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePartyActivityById" parameterType="String">
        delete from party_activity where id = #{id}
    </delete>

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

    <select id="getPartyActivity" resultType="java.util.HashMap">
        select count(*) count, fwlx from party_activity where fwlx is not null
        <if test="orgId != null and orgId != ''">
            and ssdzzmc = #{orgId}
        </if>
        group by fwlx
    </select>

</mapper>