<?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.taoke.autopay.dao.credit.UserCreditBalanceMapper">
|
<resultMap id="BaseResultMap" type="com.taoke.autopay.entity.credit.UserCreditBalance">
|
<id column="id" property="id" jdbcType="BIGINT"/>
|
<result column="credit_balance" property="creditBalance" jdbcType="INTEGER"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">id,credit_balance,create_time,update_time</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from table_user_credit_balance
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
|
<select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from table_user_credit_balance
|
where id = #{id,jdbcType=BIGINT} for update
|
</select>
|
|
<sql id="listWhereSQL">
|
<if test="query.id!=null">AND id = #{query.id}</if>
|
<if test="query.creditBalance!=null">AND credit_balance = #{query.creditBalance}</if>
|
<if test="query.minCreateTime!=null">AND create_time >= #{query.minCreateTime}</if>
|
<if test="query.maxCreateTime!=null">AND create_time <![CDATA[ < ]]> #{query.maxCreateTime}</if>
|
<if test="query.minUpdateTime!=null">AND update_time >= #{query.minUpdateTime}</if>
|
<if test="query.maxUpdateTime!=null">AND update_time <![CDATA[ < ]]> #{query.maxUpdateTime}</if>
|
</sql>
|
|
<select id="list" resultMap="BaseResultMap" >
|
select
|
<include refid="Base_Column_List" />
|
from table_user_credit_balance
|
where 1=1
|
<include refid="listWhereSQL"/>
|
<if test="query.sortList!=null">
|
order by
|
<foreach collection="query.sortList" item="item" separator=",">
|
${item}
|
</foreach>
|
</if>
|
limit #{query.start},#{query.count}
|
</select>
|
|
<select id="listByIds" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from table_user_credit_balance
|
<foreach collection="ids" item="id" open=" where ( " close=")" separator=" OR ">
|
id = #{id}
|
</foreach>
|
</select>
|
|
|
|
<select id="count" resultType="java.lang.Long">
|
select count(*)
|
from table_user_credit_balance
|
where 1=1
|
<include refid="listWhereSQL"/>
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
delete from table_user_credit_balance
|
where id = #{id,jdbcType=BIGINT}
|
</delete>
|
|
<insert id="insert" parameterType="com.taoke.autopay.entity.credit.UserCreditBalance" useGeneratedKeys="true" keyProperty="id">
|
insert into table_user_credit_balance (id,credit_balance,create_time,update_time)
|
values (#{id,jdbcType=BIGINT},#{creditBalance,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.taoke.autopay.entity.credit.UserCreditBalance" useGeneratedKeys="true" keyProperty="id">
|
insert into table_user_credit_balance
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="creditBalance != null">credit_balance,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="creditBalance != null">#{creditBalance,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.credit.UserCreditBalance">
|
update table_user_credit_balance
|
set credit_balance = #{creditBalance,jdbcType=INTEGER},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.credit.UserCreditBalance">
|
update table_user_credit_balance
|
<set>
|
<if test="creditBalance != null">credit_balance = #{creditBalance,jdbcType=INTEGER},</if>
|
<if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
</mapper>
|