From 554de444b87aab5f93cb1593a8095612cf9479a7 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期二, 09 六月 2020 17:34:30 +0800 Subject: [PATCH] 订单 --- fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackExchangeMapper.xml | 184 +++++++++++++++++++++++---------------------- 1 files changed, 94 insertions(+), 90 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackExchangeMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackExchangeMapper.xml index 52786f8..4f89f61 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackExchangeMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackExchangeMapper.xml @@ -1,90 +1,94 @@ -<?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.redpack.RedPackExchangeMapper"> - <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.redpack.RedPackExchange"> - <id column="rpe_id" property="id" jdbcType="BIGINT"/> - <result column="rpe_uid" property="uid" jdbcType="BIGINT"/> - <result column="rpe_money" property="money" jdbcType="DECIMAL"/> - <result column="rpe_state" property="state" jdbcType="INTEGER"/> - <result column="rpe_audit_id" property="auditId" jdbcType="BIGINT"/> - <result column="rpe_reason" property="reason" jdbcType="VARCHAR"/> - <result column="rpe_audit_time" property="auditTime" jdbcType="TIMESTAMP"/> - <result column="rpe_create_time" property="createTime" jdbcType="TIMESTAMP"/> - </resultMap> - <sql id="Base_Column_List">rpe_id,rpe_uid,rpe_money,rpe_state,rpe_audit_id,rpe_reason,rpe_audit_time,rpe_create_time</sql> - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select - <include refid="Base_Column_List"/>from yeshi_ec_red_pack_exchange where rpe_id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_exchange where rpe_id = #{id,jdbcType=BIGINT}</delete> - <insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_exchange (rpe_id,rpe_uid,rpe_money,rpe_state,rpe_audit_id,rpe_reason,rpe_audit_time,rpe_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{auditId,jdbcType=BIGINT},#{reason,jdbcType=VARCHAR},#{auditTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP})</insert> - <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_exchange - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null">rpe_id,</if> - <if test="uid != null">rpe_uid,</if> - <if test="money != null">rpe_money,</if> - <if test="state != null">rpe_state,</if> - <if test="auditId != null">rpe_audit_id,</if> - <if test="reason != null">rpe_reason,</if> - <if test="auditTime != null">rpe_audit_time,</if> - <if test="createTime != null">rpe_create_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="money != null">#{money,jdbcType=DECIMAL},</if> - <if test="state != null">#{state,jdbcType=INTEGER},</if> - <if test="auditId != null">#{auditId,jdbcType=BIGINT},</if> - <if test="reason != null">#{reason,jdbcType=VARCHAR},</if> - <if test="auditTime != null">#{auditTime,jdbcType=TIMESTAMP},</if> - <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> - </trim> - </insert> - <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange">update yeshi_ec_red_pack_exchange set rpe_uid = #{uid,jdbcType=BIGINT},rpe_money = #{money,jdbcType=DECIMAL},rpe_state = #{state,jdbcType=INTEGER},rpe_audit_id = #{auditId,jdbcType=BIGINT},rpe_reason = #{reason,jdbcType=VARCHAR},rpe_audit_time = #{auditTime,jdbcType=TIMESTAMP},rpe_create_time = #{createTime,jdbcType=TIMESTAMP} where rpe_id = #{id,jdbcType=BIGINT}</update> - <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange">update yeshi_ec_red_pack_exchange - <set> - <if test="uid != null">rpe_uid=#{uid,jdbcType=BIGINT},</if> - <if test="money != null">rpe_money=#{money,jdbcType=DECIMAL},</if> - <if test="state != null">rpe_state=#{state,jdbcType=INTEGER},</if> - <if test="auditId != null">rpe_audit_id=#{auditId,jdbcType=BIGINT},</if> - <if test="reason != null">rpe_reason=#{reason,jdbcType=VARCHAR},</if> - <if test="auditTime != null">rpe_audit_time=#{auditTime,jdbcType=TIMESTAMP},</if> - <if test="createTime != null">rpe_create_time=#{createTime,jdbcType=TIMESTAMP},</if> - </set> where rpe_id = #{id,jdbcType=BIGINT} - </update> - - <select id="query" resultMap="BaseResultMap"> - SELECT * FROM yeshi_ec_red_pack_exchange d - WHERE 1=1 - <if test="key != null and key != ''"> - AND d.rpe_uid = #{key} - </if> - <if test="state != null "> - AND d.rpe_state = #{state} - </if> - ORDER BY d.`rpe_state`,d.`rpe_create_time` DESC - LIMIT #{start},#{count} - </select> - - <select id="count" resultType="Long"> - SELECT IFNULL(COUNT(rpe_id),0) FROM yeshi_ec_red_pack_exchange d - WHERE 1=1 - <if test="key != null and key != ''"> - AND d.rpe_uid = #{key} - </if> - <if test="state != null "> - AND d.rpe_state = #{state} - </if> - </select> - - <select id="countByUidAndState" resultType="Long"> - SELECT IFNULL(COUNT(d.rpe_id),0) FROM yeshi_ec_red_pack_exchange d - WHERE d.rpe_uid = #{uid} AND d.`rpe_state` = #{state} - </select> - - <select id="countMoneyByUidAndState" resultType="BigDecimal"> - SELECT IFNULL(SUM(d.rpe_money),0) FROM yeshi_ec_red_pack_exchange d - WHERE d.rpe_uid = #{uid} AND d.`rpe_state` = #{state} - </select> - -</mapper> +<?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.redpack.RedPackExchangeMapper"> + <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.redpack.RedPackExchange"> + <id column="rpe_id" property="id" jdbcType="BIGINT"/> + <result column="rpe_uid" property="uid" jdbcType="BIGINT"/> + <result column="rpe_money" property="money" jdbcType="DECIMAL"/> + <result column="rpe_state" property="state" jdbcType="INTEGER"/> + <result column="rpe_audit_id" property="auditId" jdbcType="BIGINT"/> + <result column="rpe_reason" property="reason" jdbcType="VARCHAR"/> + <result column="rpe_audit_time" property="auditTime" jdbcType="TIMESTAMP"/> + <result column="rpe_create_time" property="createTime" jdbcType="TIMESTAMP"/> + </resultMap> + <sql id="Base_Column_List">rpe_id,rpe_uid,rpe_money,rpe_state,rpe_audit_id,rpe_reason,rpe_audit_time,rpe_create_time</sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select + <include refid="Base_Column_List"/>from yeshi_ec_red_pack_exchange where rpe_id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_exchange where rpe_id = #{id,jdbcType=BIGINT}</delete> + <insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_exchange (rpe_id,rpe_uid,rpe_money,rpe_state,rpe_audit_id,rpe_reason,rpe_audit_time,rpe_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{auditId,jdbcType=BIGINT},#{reason,jdbcType=VARCHAR},#{auditTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP})</insert> + <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_exchange + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">rpe_id,</if> + <if test="uid != null">rpe_uid,</if> + <if test="money != null">rpe_money,</if> + <if test="state != null">rpe_state,</if> + <if test="auditId != null">rpe_audit_id,</if> + <if test="reason != null">rpe_reason,</if> + <if test="auditTime != null">rpe_audit_time,</if> + <if test="createTime != null">rpe_create_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="money != null">#{money,jdbcType=DECIMAL},</if> + <if test="state != null">#{state,jdbcType=INTEGER},</if> + <if test="auditId != null">#{auditId,jdbcType=BIGINT},</if> + <if test="reason != null">#{reason,jdbcType=VARCHAR},</if> + <if test="auditTime != null">#{auditTime,jdbcType=TIMESTAMP},</if> + <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> + </trim> + </insert> + <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange">update yeshi_ec_red_pack_exchange set rpe_uid = #{uid,jdbcType=BIGINT},rpe_money = #{money,jdbcType=DECIMAL},rpe_state = #{state,jdbcType=INTEGER},rpe_audit_id = #{auditId,jdbcType=BIGINT},rpe_reason = #{reason,jdbcType=VARCHAR},rpe_audit_time = #{auditTime,jdbcType=TIMESTAMP},rpe_create_time = #{createTime,jdbcType=TIMESTAMP} where rpe_id = #{id,jdbcType=BIGINT}</update> + <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackExchange">update yeshi_ec_red_pack_exchange + <set> + <if test="uid != null">rpe_uid=#{uid,jdbcType=BIGINT},</if> + <if test="money != null">rpe_money=#{money,jdbcType=DECIMAL},</if> + <if test="state != null">rpe_state=#{state,jdbcType=INTEGER},</if> + <if test="auditId != null">rpe_audit_id=#{auditId,jdbcType=BIGINT},</if> + <if test="reason != null">rpe_reason=#{reason,jdbcType=VARCHAR},</if> + <if test="auditTime != null">rpe_audit_time=#{auditTime,jdbcType=TIMESTAMP},</if> + <if test="createTime != null">rpe_create_time=#{createTime,jdbcType=TIMESTAMP},</if> + </set> where rpe_id = #{id,jdbcType=BIGINT} + </update> + + <select id="query" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_red_pack_exchange d + WHERE 1=1 + <if test="key != null and key != ''"> + AND d.rpe_uid = #{key} + </if> + <if test="state != null "> + AND d.rpe_state = #{state} + </if> + ORDER BY d.`rpe_state`,d.`rpe_create_time` DESC + LIMIT #{start},#{count} + </select> + + <select id="count" resultType="Long"> + SELECT IFNULL(COUNT(rpe_id),0) FROM yeshi_ec_red_pack_exchange d + WHERE 1=1 + <if test="key != null and key != ''"> + AND d.rpe_uid = #{key} + </if> + <if test="state != null "> + AND d.rpe_state = #{state} + </if> + </select> + + <select id="countByUidAndState" resultType="Long"> + SELECT IFNULL(COUNT(d.rpe_id),0) FROM yeshi_ec_red_pack_exchange d + WHERE d.rpe_uid = #{uid} AND d.`rpe_state` = #{state} + </select> + + <select id="countMoneyByUidAndState" resultType="BigDecimal"> + SELECT IFNULL(SUM(d.rpe_money),0) FROM yeshi_ec_red_pack_exchange d + WHERE d.rpe_uid = #{uid} AND d.`rpe_state` = #{state} + </select> + + <select id="countTodayByUid" resultType="Long"> + SELECT IFNULL(COUNT(d.rpe_id),0) FROM yeshi_ec_red_pack_exchange d + WHERE d.rpe_uid = #{uid} AND TO_DAYS(d.`rpe_create_time`) = TO_DAYS(NOW()) + </select> +</mapper> -- Gitblit v1.8.0