<?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.order.dividents.TeamDividentsSourceOrderUserMapMapper">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap">
|
<id column="sou_id" property="id" jdbcType="BIGINT" />
|
<result column="sou_source_uid" property="sourceUid" jdbcType="BIGINT" />
|
<result column="sou_target_uid" property="targetUid" jdbcType="BIGINT" />
|
<result column="sou_state" property="state" jdbcType="INTEGER" />
|
<result column="sou_type" property="type" jdbcType="INTEGER" />
|
<result column="sou_rate" property="rate" jdbcType="DECIMAL" />
|
<result column="sou_money" property="money" jdbcType="DECIMAL" />
|
<result column="sou_pre_send_time" property="preSendTime"
|
jdbcType="TIMESTAMP" />
|
<result column="sou_create_time" property="createTime"
|
jdbcType="TIMESTAMP" />
|
<result column="sou_update_time" property="updateTime"
|
jdbcType="TIMESTAMP" />
|
<result column="sou_beizhu" property="beiZhu" jdbcType="VARCHAR" />
|
<result column="sou_send_time" property="sendTime" jdbcType="TIMESTAMP" />
|
<association property="sourceOrder" column="sou_source_order_id"
|
javaType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder">
|
<id column="sou_source_order_id" property="id" jdbcType="BIGINT" />
|
</association>
|
|
</resultMap>
|
<sql id="Base_Column_List">sou_id,sou_source_order_id,sou_source_uid,sou_target_uid,sou_state,sou_type,sou_rate,sou_money,sou_pre_send_time,sou_create_time,sou_update_time,sou_beizhu,sou_send_time
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_team_dividents_source_order_user where sou_id =
|
#{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_team_dividents_source_order_user where sou_id =
|
#{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap"
|
useGeneratedKeys="true" keyProperty="id">insert into
|
yeshi_ec_team_dividents_source_order_user
|
(sou_id,sou_source_order_id,sou_source_uid,sou_target_uid,sou_state,sou_type,sou_rate,sou_money,sou_pre_send_time,sou_create_time,sou_update_time,sou_beizhu,sou_send_time)
|
values
|
(#{id,jdbcType=BIGINT},#{sourceOrder.id,jdbcType=BIGINT},#{sourceUid,jdbcType=BIGINT},#{targetUid,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{rate,jdbcType=DECIMAL},#{money,jdbcType=DECIMAL},#{preSendTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR},#{sendTime,jdbcType=TIMESTAMP})
|
</insert>
|
<insert id="insertSelective"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_team_dividents_source_order_user
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">sou_id,</if>
|
<if test="sourceOrder != null">sou_source_order_id,</if>
|
<if test="sourceUid != null">sou_source_uid,</if>
|
<if test="targetUid != null">sou_target_uid,</if>
|
<if test="state != null">sou_state,</if>
|
<if test="type != null">sou_type,</if>
|
<if test="rate != null">sou_rate,</if>
|
<if test="money != null">sou_money,</if>
|
<if test="preSendTime != null">sou_pre_send_time,</if>
|
<if test="createTime != null">sou_create_time,</if>
|
<if test="updateTime != null">sou_update_time,</if>
|
<if test="beiZhu != null">sou_beizhu,</if>
|
<if test="sendTime != null">sou_send_time,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="sourceOrder != null">#{sourceOrder.id,jdbcType=BIGINT},</if>
|
<if test="sourceUid != null">#{sourceUid,jdbcType=BIGINT},</if>
|
<if test="targetUid != null">#{targetUid,jdbcType=BIGINT},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="rate != null">#{rate,jdbcType=DECIMAL},</if>
|
<if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="preSendTime != null">#{preSendTime,jdbcType=TIMESTAMP},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
|
<if test="sendTime != null">#{sendTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap">update yeshi_ec_team_dividents_source_order_user set
|
sou_source_order_id = #{sourceOrder.id,jdbcType=BIGINT},sou_source_uid
|
= #{sourceUid,jdbcType=BIGINT},sou_target_uid =
|
#{targetUid,jdbcType=BIGINT},sou_state =
|
#{state,jdbcType=INTEGER},sou_type = #{type,jdbcType=INTEGER},sou_rate
|
= #{rate,jdbcType=DECIMAL},sou_money =
|
#{money,jdbcType=DECIMAL},sou_pre_send_time =
|
#{preSendTime,jdbcType=TIMESTAMP},sou_create_time =
|
#{createTime,jdbcType=TIMESTAMP},sou_update_time =
|
#{updateTime,jdbcType=TIMESTAMP},sou_beizhu =
|
#{beiZhu,jdbcType=VARCHAR} ,sou_send_time
|
=#{sendTime,jdbcType=TIMESTAMP} where sou_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective"
|
parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap">
|
update yeshi_ec_team_dividents_source_order_user
|
<set>
|
<if test="sourceOrder != null">sou_source_order_id=#{sourceOrder.id,jdbcType=BIGINT},
|
</if>
|
<if test="sourceUid != null">sou_source_uid=#{sourceUid,jdbcType=BIGINT},</if>
|
<if test="targetUid != null">sou_target_uid=#{targetUid,jdbcType=BIGINT},</if>
|
<if test="state != null">sou_state=#{state,jdbcType=INTEGER},</if>
|
<if test="type != null">sou_type=#{type,jdbcType=INTEGER},</if>
|
<if test="rate != null">sou_rate=#{rate,jdbcType=DECIMAL},</if>
|
<if test="money != null">sou_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="preSendTime != null">sou_pre_send_time=#{preSendTime,jdbcType=TIMESTAMP},</if>
|
<if test="createTime != null">sou_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">sou_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="beiZhu != null">sou_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
|
<if test="sendTime !=null">sou_send_time =#{sendTime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where sou_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
|
|
<update id="invalidOrderBySourceUid">
|
update yeshi_ec_team_dividents_source_order_user
|
<set>
|
sou_state=4,
|
sou_update_time=now(),
|
sou_beizhu=#{beiZhu},
|
</set>
|
where sou_source_uid=#{sourceUid}
|
<if test="stateList!=null">
|
<foreach collection="stateList" open=" and (" separator=" or "
|
close=")" item="state">sou_state=#{state}</foreach>
|
</if>
|
|
</update>
|
|
<select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_team_dividents_source_order_user where sou_id = #{0} for
|
update
|
</select>
|
<select id="list" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_team_dividents_source_order_user where 1=1
|
<if test="sourceOrderId!=null">and sou_source_order_id=#{sourceOrderId}</if>
|
<if test="sourceUid!=null">and sou_source_uid=#{sourceUid}</if>
|
<if test="targetUid!=null">and sou_target_uid=#{targetUid}</if>
|
<if test="preSendTime!=null">and sou_pre_send_time=#{preSendTime}</if>
|
<if test="stateList!=null">
|
<foreach collection="stateList" open=" and (" separator=" or "
|
close=")" item="state">sou_state=#{state}</foreach>
|
</if>
|
<if test="typeList!=null">
|
<foreach collection="typeList" open=" and (" separator=" or "
|
close=")" item="type">sou_type=#{type}</foreach>
|
</if>
|
limit #{start},#{count}
|
</select>
|
<select id="count" resultType="java.lang.Long">
|
select count(*) from yeshi_ec_team_dividents_source_order_user where
|
1=1
|
<if test="sourceOrderId!=null">and sou_source_order_id=#{sourceOrderId}</if>
|
<if test="sourceUid!=null">and sou_source_uid=#{sourceUid}</if>
|
<if test="targetUid!=null">and sou_target_uid=#{targetUid}</if>
|
<if test="preSendTime!=null">and sou_pre_send_time=#{preSendTime}</if>
|
<if test="stateList!=null">
|
<foreach collection="stateList" open=" and (" separator=" or "
|
close=")" item="state">sou_state=#{state}</foreach>
|
</if>
|
<if test="typeList!=null">
|
<foreach collection="typeList" open=" and (" separator=" or "
|
close=")" item="type">sou_type=#{type}</foreach>
|
</if>
|
</select>
|
<select id="listCanSendSourceUidByPreSendTime" resultType="java.lang.Long">SELECT
|
DISTINCT(o.`sou_source_uid`) FROM
|
`yeshi_ec_team_dividents_source_order_user` o WHERE o.`sou_state`=2
|
AND o.`sou_pre_send_time`=#{preSendTime} limit #{start},#{count}
|
</select>
|
<select id="countCanSendSourceUidByPreSendTime" resultType="java.lang.Long">SELECT
|
count(DISTINCT(o.`sou_source_uid`)) FROM
|
`yeshi_ec_team_dividents_source_order_user` o WHERE o.`sou_state`=2
|
AND o.`sou_pre_send_time`=#{preSendTime}
|
</select>
|
</mapper>
|