|
|
@@ -0,0 +1,97 @@
|
|
|
+<?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.FsCompanyQrcRedPackageRecordMapper">
|
|
|
+
|
|
|
+ <!-- 结果映射 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.fs.qw.domain.FsCompanyQrcRedPackageRecord">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="amount" property="amount" />
|
|
|
+ <result column="send_time" property="sendTime" />
|
|
|
+ <result column="collect_time" property="collectTime" />
|
|
|
+ <result column="collect_type" property="collectType" />
|
|
|
+ <result column="user_id" property="userId" />
|
|
|
+ <result column="user_phone" property="userPhone" />
|
|
|
+ <result column="company_user_id" property="companyUserId" />
|
|
|
+ <result column="batch_id" property="batchId" />
|
|
|
+ <result column="company_id" property="companyId" />
|
|
|
+ <result column="company_name" property="companyName" />
|
|
|
+ <result column="create_time" property="createTime" />
|
|
|
+ <result column="update_time" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基础字段 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, amount, send_time, collect_time, collect_type, user_id, user_phone,
|
|
|
+ company_user_id, batch_id, company_id, company_name, create_time, update_time
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 根据主键查询 -->
|
|
|
+ <select id="selectById" resultMap="BaseResultMap">
|
|
|
+ SELECT <include refid="Base_Column_List" />
|
|
|
+ FROM fs_company_qrc_red_package_record
|
|
|
+ WHERE id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 条件查询(非空字段作为条件) -->
|
|
|
+ <select id="selectList" resultMap="BaseResultMap">
|
|
|
+ SELECT <include refid="Base_Column_List" />
|
|
|
+ FROM fs_company_qrc_red_package_record
|
|
|
+ <where>
|
|
|
+ <if test="amount != null">AND amount = #{amount}</if>
|
|
|
+ <if test="sendTime != null">AND send_time = #{sendTime}</if>
|
|
|
+ <if test="collectTime != null">AND collect_time = #{collectTime}</if>
|
|
|
+ <if test="collectType != null and collectType != ''">AND collect_type = #{collectType}</if>
|
|
|
+ <if test="userId != null and userId != ''">AND user_id = #{userId}</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''">AND user_phone = #{userPhone}</if>
|
|
|
+ <if test="companyUserId != null">AND company_user_id = #{companyUserId}</if>
|
|
|
+ <if test="batchId != null and batchId != ''">AND batch_id = #{batchId}</if>
|
|
|
+ <if test="companyId != null">AND company_id = #{companyId}</if>
|
|
|
+ <if test="companyName != null and companyName != ''">AND company_name = #{companyName}</if>
|
|
|
+ </where>
|
|
|
+ ORDER BY create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRedPackageRecordByUserId" resultType="com.fs.qw.domain.FsCompanyQrcRedPackageRecord">
|
|
|
+ SELECT <include refid="Base_Column_List" />
|
|
|
+ FROM fs_company_qrc_red_package_record
|
|
|
+ WHERE user_id = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 新增(所有字段,主键需自行赋值或使用自增) -->
|
|
|
+ <insert id="insert" parameterType="com.fs.qw.domain.FsCompanyQrcRedPackageRecord">
|
|
|
+ INSERT INTO fs_company_qrc_red_package_record (
|
|
|
+ id, amount, send_time, collect_time, collect_type, user_id,
|
|
|
+ user_phone, company_user_id, batch_id, company_id, company_name,
|
|
|
+ create_time, update_time
|
|
|
+ ) VALUES (
|
|
|
+ #{id}, #{amount}, #{sendTime}, #{collectTime}, #{collectType}, #{userId},
|
|
|
+ #{userPhone}, #{companyUserId}, #{batchId}, #{companyId}, #{companyName},
|
|
|
+ #{createTime}, #{updateTime}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 动态更新(根据主键,非空字段更新) -->
|
|
|
+ <update id="updateById" parameterType="com.fs.qw.domain.FsCompanyQrcRedPackageRecord">
|
|
|
+ UPDATE fs_company_qrc_red_package_record
|
|
|
+ <set>
|
|
|
+ <if test="amount != null">amount = #{amount},</if>
|
|
|
+ <if test="sendTime != null">send_time = #{sendTime},</if>
|
|
|
+ <if test="collectTime != null">collect_time = #{collectTime},</if>
|
|
|
+ <if test="collectType != null and collectType != ''">collect_type = #{collectType},</if>
|
|
|
+ <if test="userId != null and userId != ''">user_id = #{userId},</if>
|
|
|
+ <if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if>
|
|
|
+ <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
|
|
|
+ <if test="batchId != null and batchId != ''">batch_id = #{batchId},</if>
|
|
|
+ <if test="companyId != null">company_id = #{companyId},</if>
|
|
|
+ <if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 删除 -->
|
|
|
+ <delete id="deleteById">
|
|
|
+ DELETE FROM fs_company_qrc_red_package_record WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|