|
|
@@ -0,0 +1,102 @@
|
|
|
+<?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.fs.qw.mapper.RedPacketMapper">
|
|
|
+
|
|
|
+ <resultMap type="RedPacket" id="RedPacketResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createById" column="create_by_id" />
|
|
|
+ <result property="amount" column="amount" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="isDel" column="is_del" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateById" column="update_by_id" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectRedPacketVo">
|
|
|
+ select id, name, status, create_by, create_by_id, amount, create_time, update_time, is_del, company_id from red_packet
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectRedPacketList" parameterType="RedPacket" resultMap="RedPacketResult">
|
|
|
+ <include refid="selectRedPacketVo"/>
|
|
|
+ <where>
|
|
|
+ and is_del = 0
|
|
|
+ <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="status != null "> and status = #{status}</if>
|
|
|
+ <if test="createById != null "> and create_by_id = #{createById}</if>
|
|
|
+ <if test="amount != null "> and amount = #{amount}</if>
|
|
|
+ <if test="isDel != null "> and is_del = #{isDel}</if>
|
|
|
+ <if test="companyId != null "> and company_id = #{companyId}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectRedPacketById" parameterType="Long" resultMap="RedPacketResult">
|
|
|
+ <include refid="selectRedPacketVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertRedPacket" parameterType="RedPacket" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into red_packet
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null">name,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createById != null">create_by_id,</if>
|
|
|
+ <if test="amount != null">amount,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="isDel != null">is_del,</if>
|
|
|
+ <if test="companyId != null">company_id,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateById != null">update_by_id,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null">#{name},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createById != null">#{createById},</if>
|
|
|
+ <if test="amount != null">#{amount},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="isDel != null">#{isDel},</if>
|
|
|
+ <if test="companyId != null">#{companyId},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateById != null">#{updateById},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateRedPacket" parameterType="RedPacket">
|
|
|
+ update red_packet
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createById != null">create_by_id = #{createById},</if>
|
|
|
+ <if test="amount != null">amount = #{amount},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="isDel != null">is_del = #{isDel},</if>
|
|
|
+ <if test="companyId != null">company_id = #{companyId},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateById != null">update_by_id = #{updateById},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteRedPacketById" parameterType="Long">
|
|
|
+ delete from red_packet where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteRedPacketByIds" parameterType="String">
|
|
|
+ update red_packet set is_del = 1 where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|