<?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.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinOriginMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">
|
<id column="uto_id" property="id" jdbcType="BIGINT"/>
|
<result column="uto_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="uto_rights_id" property="rightsId" jdbcType="VARCHAR"/>
|
<result column="uto_money" property="money" jdbcType="DECIMAL"/>
|
<result column="uto_money_surplus" property="moneySurplus" jdbcType="DECIMAL"/>
|
<result column="uto_type" property="type" jdbcType="INTEGER"/>
|
<result column="uto_origin" property="origin" typeHandler="com.yeshi.fanli.util.mybatishandler.tlj.TaoLiJinOriginEnumHandler"/>
|
<result column="uto_remark" property="remark" jdbcType="VARCHAR"/>
|
<result column="uto_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="uto_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
<sql id="Base_Column_List">uto_id,uto_uid,uto_rights_id,uto_money,uto_money_surplus,uto_type,uto_origin,uto_remark,uto_create_time,uto_update_time</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_origin where uto_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_origin where uto_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_origin (uto_id,uto_uid,uto_rights_id,uto_money,uto_money_surplus,uto_type,uto_origin,uto_remark,uto_create_time,uto_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{rightsId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{moneySurplus,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{origin,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_origin
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">uto_id,</if>
|
<if test="uid != null">uto_uid,</if>
|
<if test="rightsId != null">uto_rights_id,</if>
|
<if test="money != null">uto_money,</if>
|
<if test="moneySurplus != null">uto_money_surplus,</if>
|
<if test="type != null">uto_type,</if>
|
<if test="origin != null">uto_origin,</if>
|
<if test="remark != null">uto_remark,</if>
|
<if test="createTime != null">uto_create_time,</if>
|
<if test="updateTime != null">uto_update_time,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
<if test="rightsId != null">#{rightsId,jdbcType=VARCHAR},</if>
|
<if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="moneySurplus != null">#{moneySurplus,jdbcType=DECIMAL},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="origin != null">#{origin,jdbcType=VARCHAR},</if>
|
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">update yeshi_ec_user_taolijin_origin set uto_uid = #{uid,jdbcType=BIGINT},uto_rights_id = #{rightsId,jdbcType=VARCHAR},uto_money = #{money,jdbcType=DECIMAL},uto_money_surplus = #{moneySurplus,jdbcType=DECIMAL},uto_type = #{type,jdbcType=INTEGER},uto_origin = #{origin,jdbcType=VARCHAR},uto_remark = #{remark,jdbcType=VARCHAR},uto_create_time = #{createTime,jdbcType=TIMESTAMP},uto_update_time = #{updateTime,jdbcType=TIMESTAMP} where uto_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">update yeshi_ec_user_taolijin_origin
|
<set>
|
<if test="uid != null">uto_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="rightsId != null">uto_rights_id=#{rightsId,jdbcType=VARCHAR},</if>
|
<if test="money != null">uto_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="moneySurplus != null">uto_money_surplus=#{moneySurplus,jdbcType=DECIMAL},</if>
|
<if test="type != null">uto_type=#{type,jdbcType=INTEGER},</if>
|
<if test="origin != null">uto_origin=#{origin,jdbcType=VARCHAR},</if>
|
<if test="remark != null">uto_remark=#{remark,jdbcType=VARCHAR},</if>
|
<if test="createTime != null">uto_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">uto_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where uto_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="countMoneyByDate" resultType="java.math.BigDecimal">
|
SELECT IFNULL(SUM(t.`uto_money`),0) FROM `yeshi_ec_user_taolijin_origin` t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` <![CDATA[<>]]>'refund' AND t.`uto_origin` <![CDATA[<>]]>'giveSendBack'
|
<if test="dateType == 1"> <!-- 今日 -->
|
AND TO_DAYS(t.`uto_create_time`) = TO_DAYS(NOW());
|
</if>
|
<if test="dateType == 2"> <!-- 昨日 -->
|
AND TO_DAYS(NOW()) - TO_DAYS(t.`uto_create_time`) = 1
|
</if>
|
<if test="dateType == 3"> <!-- 本月 -->
|
AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
|
</if>
|
<if test="dateType == 4"> <!--上月 -->
|
AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(t.`uto_create_time`, '%Y%m')) = 1
|
</if>
|
</select>
|
|
<select id="countByUidAndOrigin" resultType="Long">
|
SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{origin}
|
</select>
|
|
<select id="getByUidAndOrigin" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{origin}
|
LIMIT 1
|
</select>
|
|
<select id="countRankByThisMonth" resultType="Long">
|
SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = 'rankWin'
|
AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
|
</select>
|
|
<select id="getRankByThisMonth" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{type}
|
AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
|
LIMIT 1
|
</select>
|
|
<select id="getOverdueTaoLiJin" resultMap="BaseResultMap" >
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_create_time`<![CDATA[<=]]> #{date}
|
AND t.`uto_money_surplus`<![CDATA[>]]> 0 AND t.`uto_origin`<![CDATA[<>]]>'rankWin'
|
</select>
|
|
<select id="getOverdueTaoLiJinByRank" resultMap="BaseResultMap" >
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_create_time`<![CDATA[<=]]> #{date}
|
AND t.`uto_money_surplus`<![CDATA[>]]> 0 AND t.`uto_origin`= 'rankWin'
|
</select>
|
|
<select id="getSurplusLiJin" resultMap="BaseResultMap" >
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_money_surplus`<![CDATA[>]]> 0
|
ORDER BY t.`uto_create_time`
|
</select>
|
|
<select id="countByUidAndType" resultType="Long">
|
SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{type}
|
</select>
|
|
<select id="countMoneyByOrigin" resultType="java.math.BigDecimal">
|
SELECT IFNULL(SUM(t.`uto_money`),0) FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_rights_id` = #{rightsId} AND t.`uto_origin` = #{origin}
|
</select>
|
|
<select id="getOriginByRightsId" resultMap="BaseResultMap" >
|
SELECT * FROM yeshi_ec_user_taolijin_origin t
|
WHERE t.`uto_rights_id` = #{rightsId}
|
LIMIT 1
|
</select>
|
|
</mapper>
|