<?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.nq.dao.UserRecordMapper">
|
|
<resultMap type="com.nq.pojo.UserRecord" id="UserRecordResult">
|
<result property="id" column="id" />
|
<result property="userId" column="user_id" />
|
<result property="recordType" column="record_type" />
|
<result property="generateAmt" column="generate_amt" />
|
<result property="generateDescribe" column="generate_describe" />
|
<result property="operateTime" column="operate_time" />
|
</resultMap>
|
|
<sql id="selectUserRecordVo">
|
select id, user_id, record_type, generate_amt, generate_describe, operate_time from user_record
|
</sql>
|
|
<select id="selectUserRecordList" parameterType="com.nq.pojo.UserRecord" resultMap="UserRecordResult">
|
<include refid="selectUserRecordVo"/>
|
<where>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="recordType != null "> and record_type = #{recordType}</if>
|
<if test="generateAmt != null "> and generate_amt = #{generateAmt}</if>
|
<if test="generateDescribe != null and generateDescribe != ''"> and generate_describe = #{generateDescribe}</if>
|
<if test="operateTime != null "> and operate_time = #{operateTime}</if>
|
</where>
|
</select>
|
|
<select id="selectUserRecordById" parameterType="Long" resultMap="UserRecordResult">
|
<include refid="selectUserRecordVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertUserRecord" parameterType="com.nq.pojo.UserRecord">
|
insert into user_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="userId != null">user_id,</if>
|
<if test="recordType != null">record_type,</if>
|
<if test="generateAmt != null">generate_amt,</if>
|
<if test="generateDescribe != null">generate_describe,</if>
|
<if test="operateTime != null">operate_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="userId != null">#{userId},</if>
|
<if test="recordType != null">#{recordType},</if>
|
<if test="generateAmt != null">#{generateAmt},</if>
|
<if test="generateDescribe != null">#{generateDescribe},</if>
|
<if test="operateTime != null">#{operateTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateUserRecord" parameterType="com.nq.pojo.UserRecord">
|
update user_record
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="userId != null">user_id = #{userId},</if>
|
<if test="recordType != null">record_type = #{recordType},</if>
|
<if test="generateAmt != null">generate_amt = #{generateAmt},</if>
|
<if test="generateDescribe != null">generate_describe = #{generateDescribe},</if>
|
<if test="operateTime != null">operate_time = #{operateTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteUserRecordById" parameterType="Long">
|
delete from user_record where id = #{id}
|
</delete>
|
|
<delete id="deleteUserRecordByIds" parameterType="String">
|
delete from user_record where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|