| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods; |
| | | |
| | | public interface CommonOrderGoodsMapper extends BaseMapper<CommonOrderGoods>{ |
| | | |
| | | public interface CommonOrderGoodsMapper extends BaseMapper<CommonOrderGoods> { |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * @param list 订单对象 |
| | | * |
| | | * @param list |
| | | * 订单对象 |
| | | * @return |
| | | */ |
| | | List<CommonOrderGoods> listByOrderNoAndType(List<CommonOrder> list); |
| | | |
| | | |
| | | /** |
| | | * 根据商品ID与商品类型查询商品 |
| | | * |
| | | * @param goodsId |
| | | * @param goodsType |
| | | * @return |
| | | */ |
| | | List<CommonOrderGoods> listByGoodsIdAndGoodsType(@Param("goodsId") String goodsId, |
| | | @Param("goodsType") int goodsType); |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.vo.order.CommonOrderVO; |
| | | |
| | | public interface CommonOrderMapper extends BaseMapper<CommonOrder> { |
| | | |
| | | |
| | | /** |
| | | * 查询用户订单 并订单号分组 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> listGroupOrderNoByUid(@Param("start") long start, @Param("count") int count, |
| | | @Param("uid") Long uid,@Param("state") Integer state, @Param("type") Integer type, |
| | | @Param("orderNo")String orderNo, @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | List<CommonOrderVO> listGroupOrderNoByUid(@Param("start") long start, @Param("count") int count, |
| | | @Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, |
| | | @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 统计用户订单 并订单号分组 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countGroupOrderNoByUid(@Param("uid") Long uid, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderNo")String orderNo, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | long countGroupOrderNoByUid(@Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, |
| | | @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * @param list 订单对象 |
| | | * |
| | | * @param list |
| | | * 订单对象 |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> listByOrderNoAndType(List<CommonOrderVO> list); |
| | | |
| | | |
| | | /** |
| | | * 统计订单-根据红包类型 自购 邀请 分享 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> countOrderByHongBaoType(@Param("uid") Long uid, @Param("day") Integer day); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 总订单 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countOrder(@Param("uid")Long uid, @Param("isToday")Integer isToday); |
| | | |
| | | long countOrder(@Param("uid") Long uid, @Param("isToday") Integer isToday); |
| | | |
| | | /** |
| | | * 总订单 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal countOrderMoney(@Param("uid")Long uid, @Param("isToday")Integer isToday); |
| | | |
| | | |
| | | BigDecimal countOrderMoney(@Param("uid") Long uid, @Param("isToday") Integer isToday); |
| | | |
| | | /** |
| | | * 昨日总订单-根据红包类型 自购 邀请 分享 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> countByUidAndOrderState(@Param("uid") Long uid, @Param("type") Integer type, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 根据订单号和订单类型查询数量 |
| | | * |
| | | * @param orderNO |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | int countByOrderNOAndOrderType(@Param("orderNO") String orderNO, @Param("orderType") int orderType); |
| | | |
| | | } |
| | |
| | | public final static int STATE_YILINGQU = 3;
|
| | | public final static int STATE_SHIXIAO = 4;
|
| | |
|
| | | // 5-部分失效
|
| | | // 5-部分失效(返回客户端显示用,不用作逻辑处理)
|
| | | public final static int STATE_BUFENSHIXIAO = 5;
|
| | |
|
| | | // 自购红包 老版 2属于自购
|
| | |
| | | public final static int TYPE_TAOBAO = 1;
|
| | | // 京东
|
| | | public final static int TYPE_JINGDONG = 2;
|
| | | |
| | |
|
| | | @Column(name = "cog_id")
|
| | | private Long id;
|
| | |
|
| | |
| | | @Expose
|
| | | @Column(name = "cog_goods_id")
|
| | | private String goodsId;
|
| | |
|
| | | // 商品的类型
|
| | | @Column(name = "cog_goods_type")
|
| | | private Integer goodsType;// 等同于CommonOrder的sourceType
|
| | |
|
| | | // 标题(变化时新建)
|
| | | @Expose
|
| | |
| | | @Expose
|
| | | @Column(name = "cog_shop_id")
|
| | | private Long shopId;
|
| | | |
| | |
|
| | | // 店铺名称
|
| | | @Expose
|
| | | @Column(name = "cog_shop_name")
|
| | | private String shopName;
|
| | | |
| | |
|
| | | // 店铺的类型
|
| | | @Expose
|
| | | @Column(name = "cog_shop_type")
|
| | |
| | | // 创建时间
|
| | | @Column(name = "cog_create_time")
|
| | | private Date createTime;
|
| | | |
| | |
|
| | | // 更新时间
|
| | | @Column(name = "cog_update_time")
|
| | | private Date updateTime;
|
| | | |
| | |
|
| | | public CommonOrderGoods(){
|
| | | |
| | | public CommonOrderGoods() {
|
| | |
|
| | | }
|
| | | |
| | | public CommonOrderGoods(Long id){
|
| | |
|
| | | public CommonOrderGoods(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Integer getGoodsType() {
|
| | | return goodsType;
|
| | | }
|
| | |
|
| | | public void setGoodsType(Integer goodsType) {
|
| | | this.goodsType = goodsType;
|
| | | }
|
| | |
|
| | | public String getGoodsId() {
|
| | | return goodsId;
|
| | | }
|
| | |
| | | <!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.HongBaoV2Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER"/> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER"/> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER"/> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR"/> |
| | | <result column="hb_pre_get_time" property="preGetTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.push.PushGoods"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order where hb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order where hb_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{urank,jdbcType=INTEGER},#{parent.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{version,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">hb_id,</if> |
| | | <if test="userInfo != null">hb_uid,</if> |
| | | <if test="urank != null">hb_urank,</if> |
| | | <if test="parent != null">hb_pid,</if> |
| | | <if test="money != null">hb_money,</if> |
| | | <if test="type != null">hb_type,</if> |
| | | <if test="state != null">hb_state,</if> |
| | | <if test="version != null">hb_version,</if> |
| | | <if test="beizhu != null">hb_beizhu,</if> |
| | | <if test="preGetTime != null">hb_pre_get_time,</if> |
| | | <if test="getTime != null">hb_get_time,</if> |
| | | <if test="createTime != null">hb_create_time,</if> |
| | | <if test="updateTime != null">hb_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,jdbcType=TIMESTAMP},</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.user.HongBaoV2">update yeshi_ec_common_order set hb_uid = #{userInfo.id,jdbcType=BIGINT},hb_urank = #{urank,jdbcType=INTEGER},hb_pid = #{parent.id,jdbcType=BIGINT},hb_money = #{money,jdbcType=DECIMAL},hb_type = #{type,jdbcType=INTEGER},hb_state = #{state,jdbcType=INTEGER},hb_version = #{version,jdbcType=INTEGER},hb_beizhu = #{beizhu,jdbcType=VARCHAR},hb_pre_get_time = #{preGetTime,jdbcType=TIMESTAMP},hb_get_time = #{getTime,jdbcType=TIMESTAMP},hb_create_time = #{createTime,jdbcType=TIMESTAMP},hb_update_time = #{updateTime,jdbcType=TIMESTAMP} where hb_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2">update yeshi_ec_common_order |
| | | <set> |
| | | <if test="userInfo != null">hb_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">hb_urank=#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">hb_pid=#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">hb_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">hb_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">hb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">hb_version=#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">hb_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">hb_pre_get_time=#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">hb_get_time=#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">hb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">hb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER" /> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="hb_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.push.PushGoods"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_v2 |
| | | (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{urank,jdbcType=INTEGER},#{parent.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{version,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_hongbao_v2 |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">hb_id,</if> |
| | | <if test="userInfo != null">hb_uid,</if> |
| | | <if test="urank != null">hb_urank,</if> |
| | | <if test="parent != null">hb_pid,</if> |
| | | <if test="money != null">hb_money,</if> |
| | | <if test="type != null">hb_type,</if> |
| | | <if test="state != null">hb_state,</if> |
| | | <if test="version != null">hb_version,</if> |
| | | <if test="beizhu != null">hb_beizhu,</if> |
| | | <if test="preGetTime != null">hb_pre_get_time,</if> |
| | | <if test="getTime != null">hb_get_time,</if> |
| | | <if test="createTime != null">hb_create_time,</if> |
| | | <if test="updateTime != null">hb_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,jdbcType=TIMESTAMP},</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.user.HongBaoV2">update |
| | | yeshi_ec_hongbao_v2 set hb_uid = |
| | | #{userInfo.id,jdbcType=BIGINT},hb_urank = |
| | | #{urank,jdbcType=INTEGER},hb_pid = |
| | | #{parent.id,jdbcType=BIGINT},hb_money = |
| | | #{money,jdbcType=DECIMAL},hb_type = #{type,jdbcType=INTEGER},hb_state |
| | | = #{state,jdbcType=INTEGER},hb_version = |
| | | #{version,jdbcType=INTEGER},hb_beizhu = |
| | | #{beizhu,jdbcType=VARCHAR},hb_pre_get_time = |
| | | #{preGetTime,jdbcType=TIMESTAMP},hb_get_time = |
| | | #{getTime,jdbcType=TIMESTAMP},hb_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},hb_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | update yeshi_ec_hongbao_v2 |
| | | <set> |
| | | <if test="userInfo != null">hb_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">hb_urank=#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">hb_pid=#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">hb_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">hb_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">hb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">hb_version=#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">hb_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">hb_pre_get_time=#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">hb_get_time=#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">hb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">hb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <!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.CommonOrderGoodsMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="cog_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="cog_goods_id" property="goodsId" jdbcType="VARCHAR"/> |
| | | <result column="cog_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="cog_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="cog_price" property="price" jdbcType="DECIMAL"/> |
| | | <result column="cog_shop_id" property="shopId" jdbcType="BIGINT"/> |
| | | <result column="cog_shop_name" property="shopName" jdbcType="VARCHAR"/> |
| | | <result column="cog_shop_type" property="shopType" jdbcType="VARCHAR"/> |
| | | <result column="cog_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="cog_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cog_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">cog_id,cog_goods_id,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order_goods (cog_id,cog_goods_id,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time) values (#{id,jdbcType=BIGINT},#{goodsId,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{price,jdbcType=DECIMAL},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">cog_id,</if> |
| | | <if test="goodsId != null">cog_goods_id,</if> |
| | | <if test="title != null">cog_title,</if> |
| | | <if test="picture != null">cog_picture,</if> |
| | | <if test="price != null">cog_price,</if> |
| | | <if test="shopId != null">cog_shop_id,</if> |
| | | <if test="shopName != null">cog_shop_name,</if> |
| | | <if test="shopType != null">cog_shop_type,</if> |
| | | <if test="state != null">cog_state,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | <if test="updateTime != null">cog_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodsId != null">#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">#{shopType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,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.yeshi.fanli.entity.order.CommonOrderGoods">update yeshi_ec_common_order_goods set cog_goods_id = #{goodsId,jdbcType=VARCHAR},cog_title = #{title,jdbcType=VARCHAR},cog_picture = #{picture,jdbcType=VARCHAR},cog_price = #{price,jdbcType=DECIMAL},cog_shop_id = #{shopId,jdbcType=BIGINT},cog_shop_name = #{shopName,jdbcType=VARCHAR},cog_shop_type = #{shopType,jdbcType=VARCHAR},cog_state = #{state,jdbcType=INTEGER},cog_create_time = #{createTime,jdbcType=TIMESTAMP},cog_update_time = #{updateTime,jdbcType=TIMESTAMP} where cog_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods">update yeshi_ec_common_order_goods |
| | | <set> |
| | | <if test="goodsId != null">cog_goods_id=#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">cog_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">cog_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">cog_price=#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">cog_shop_id=#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">cog_shop_name=#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">cog_shop_type=#{shopType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">cog_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">cog_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where cog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="cog_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="cog_goods_id" property="goodsId" jdbcType="VARCHAR" /> |
| | | <result column="cog_goods_type" property="goodsType" jdbcType="INTEGER" /> |
| | | <result column="cog_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="cog_picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="cog_price" property="price" jdbcType="DECIMAL" /> |
| | | <result column="cog_shop_id" property="shopId" jdbcType="BIGINT" /> |
| | | <result column="cog_shop_name" property="shopName" jdbcType="VARCHAR" /> |
| | | <result column="cog_shop_type" property="shopType" jdbcType="VARCHAR" /> |
| | | <result column="cog_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="cog_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="cog_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">cog_id,cog_goods_id,cog_goods_type,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByGoodsIdAndGoodsType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_common_order_goods where cog_goods_id = #{goodsId} and |
| | | cog_goods_type=#{goodsType} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_common_order_goods |
| | | (cog_id,cog_goods_id,cog_goods_type,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{goodsId,jdbcType=VARCHAR},#{goodsType,jdbcType=INTEGER},#{title,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{price,jdbcType=DECIMAL},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_common_order_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">cog_id,</if> |
| | | <if test="goodsId != null">cog_goods_id,</if> |
| | | <if test="goodsType != null">cog_goods_type,</if> |
| | | <if test="title != null">cog_title,</if> |
| | | <if test="picture != null">cog_picture,</if> |
| | | <if test="price != null">cog_price,</if> |
| | | <if test="shopId != null">cog_shop_id,</if> |
| | | <if test="shopName != null">cog_shop_name,</if> |
| | | <if test="shopType != null">cog_shop_type,</if> |
| | | <if test="state != null">cog_state,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | <if test="updateTime != null">cog_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodsId != null">#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="goodsType != null">#{goodsType,jdbcType=INTEGER},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">#{shopType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,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.yeshi.fanli.entity.order.CommonOrderGoods">update |
| | | yeshi_ec_common_order_goods set cog_goods_id = |
| | | #{goodsId,jdbcType=VARCHAR},cog_goods_type = |
| | | #{goodsType,jdbcType=INTEGER}cog_title = |
| | | #{title,jdbcType=VARCHAR},cog_picture = |
| | | #{picture,jdbcType=VARCHAR},cog_price = |
| | | #{price,jdbcType=DECIMAL},cog_shop_id = |
| | | #{shopId,jdbcType=BIGINT},cog_shop_name = |
| | | #{shopName,jdbcType=VARCHAR},cog_shop_type = |
| | | #{shopType,jdbcType=VARCHAR},cog_state = |
| | | #{state,jdbcType=INTEGER},cog_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},cog_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where cog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | update yeshi_ec_common_order_goods |
| | | <set> |
| | | <if test="goodsId != null">cog_goods_id=#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="goodsType != null">cog_goods_type=#{goodsType,jdbcType=INTEGER},</if> |
| | | <if test="title != null">cog_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">cog_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">cog_price=#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">cog_shop_id=#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">cog_shop_name=#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">cog_shop_type=#{shopType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">cog_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">cog_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where cog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | <!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.CommonOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER"/> |
| | | <result column="co_source_position" property="sourcePosition" jdbcType="VARCHAR"/> |
| | | <result column="co_count" property="count" jdbcType="INTEGER"/> |
| | | <result column="co_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL"/> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL"/> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL"/> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL"/> |
| | | <result column="co_third_create_time" property="thirdCreateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER"/> |
| | | <result column="co_source_position" property="sourcePosition" jdbcType="VARCHAR"/> |
| | | <result column="co_count" property="count" jdbcType="INTEGER"/> |
| | | <result column="co_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL"/> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL"/> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL"/> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL"/> |
| | | <result column="co_third_create_time" property="thirdCreateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="totalMoney" property="hongBao" jdbcType="DECIMAL"/> |
| | | <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER"/> |
| | | <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER"/> |
| | | <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP"/> |
| | | <result column="preAccountTime" property="preAccountTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="totalCount" property="totalCount" jdbcType="INTEGER"/> |
| | | <result column="totalSettlement" property="totalSettlement" jdbcType="DECIMAL"/> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,cog_create_time,cog_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,cog_create_time,cog_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">co_id,</if> |
| | | <if test="userInfo != null">co_uid,</if> |
| | | <if test="orderNo != null">co_order_no,</if> |
| | | <if test="sourceType != null">co_source_type,</if> |
| | | <if test="sourcePosition != null">co_source_position,</if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id,</if> |
| | | <if test="count != null">co_count,</if> |
| | | <if test="state != null">co_state,</if> |
| | | <if test="estimate != null">co_estimate,</if> |
| | | <if test="eIncome != null">co_eIncome,</if> |
| | | <if test="payment != null">co_payment,</if> |
| | | <if test="settlement != null">co_settlement,</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time,</if> |
| | | <if test="settleTime != null">co_settle_time,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | <if test="updateTime != null">cog_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">#{sourcePosition,jdbcType=VARCHAR},</if> |
| | | <if test="commonOrderGoods != null">#{commonOrderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="count != null">#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settleTime != null">#{settleTime,jdbcType=TIMESTAMP},</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.order.CommonOrder">update yeshi_ec_common_order set co_uid = #{userInfo.id,jdbcType=BIGINT},co_order_no = #{orderNo,jdbcType=VARCHAR},co_source_type = #{sourceType,jdbcType=INTEGER},co_source_position = #{sourcePosition,jdbcType=VARCHAR},co_order_goods_id = #{commonOrderGoods.id,jdbcType=BIGINT},co_count = #{count,jdbcType=INTEGER},co_state = #{state,jdbcType=INTEGER},co_estimate = #{estimate,jdbcType=DECIMAL},co_eIncome = #{eIncome,jdbcType=DECIMAL},co_payment = #{payment,jdbcType=DECIMAL},co_settlement = #{settlement,jdbcType=DECIMAL},co_third_create_time = #{thirdCreateTime,jdbcType=TIMESTAMP},co_settle_time = #{settleTime,jdbcType=TIMESTAMP},cog_create_time = #{createTime,jdbcType=TIMESTAMP},cog_update_time = #{updateTime,jdbcType=TIMESTAMP} where co_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update yeshi_ec_common_order |
| | | <set> |
| | | <if test="userInfo != null">co_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">co_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">co_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">co_source_position=#{sourcePosition,jdbcType=VARCHAR},</if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id=#{commonOrderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="count != null">co_count=#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">co_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">co_estimate=#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">co_eIncome=#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">co_payment=#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">co_settlement=#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time=#{thirdCreateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settleTime != null">co_settle_time=#{settleTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">cog_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where co_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listGroupOrderNoByUid" resultMap="ResultMap" > |
| | | SELECT COALESCE(SUM(th.`hb_money`),0)AS totalMoney,tc.*,th.hb_state AS hongBaoState, th.hb_type AS hongBaoType, |
| | | th.hb_get_time AS accountTime,th.hb_get_time AS accountTime,th.hb_pre_get_time AS preAccountTime |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> |
| | | <result column="co_source_position" property="sourcePosition" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="co_count" property="count" jdbcType="INTEGER" /> |
| | | <result column="co_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL" /> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | <result column="co_third_create_time" property="thirdCreateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> |
| | | <result column="co_source_position" property="sourcePosition" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="co_count" property="count" jdbcType="INTEGER" /> |
| | | <result column="co_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL" /> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | <result column="co_third_create_time" property="thirdCreateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> |
| | | <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> |
| | | <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> |
| | | <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> |
| | | <result column="preAccountTime" property="preAccountTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="totalCount" property="totalCount" jdbcType="INTEGER" /> |
| | | <result column="totalSettlement" property="totalSettlement" |
| | | jdbcType="DECIMAL" /> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_common_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">co_id,</if> |
| | | <if test="userInfo != null">co_uid,</if> |
| | | <if test="orderNo != null">co_order_no,</if> |
| | | <if test="sourceType != null">co_source_type,</if> |
| | | <if test="sourcePosition != null">co_source_position,</if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id,</if> |
| | | <if test="count != null">co_count,</if> |
| | | <if test="state != null">co_state,</if> |
| | | <if test="estimate != null">co_estimate,</if> |
| | | <if test="eIncome != null">co_eIncome,</if> |
| | | <if test="payment != null">co_payment,</if> |
| | | <if test="settlement != null">co_settlement,</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time,</if> |
| | | <if test="settleTime != null">co_settle_time,</if> |
| | | <if test="createTime != null">co_create_time,</if> |
| | | <if test="updateTime != null">co_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">#{sourcePosition,jdbcType=VARCHAR},</if> |
| | | <if test="commonOrderGoods != null">#{commonOrderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="count != null">#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settleTime != null">#{settleTime,jdbcType=TIMESTAMP},</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.order.CommonOrder">update |
| | | yeshi_ec_common_order set co_uid = |
| | | #{userInfo.id,jdbcType=BIGINT},co_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},co_source_type = |
| | | #{sourceType,jdbcType=INTEGER},co_source_position = |
| | | #{sourcePosition,jdbcType=VARCHAR},co_order_goods_id = |
| | | #{commonOrderGoods.id,jdbcType=BIGINT},co_count = |
| | | #{count,jdbcType=INTEGER},co_state = |
| | | #{state,jdbcType=INTEGER},co_estimate = |
| | | #{estimate,jdbcType=DECIMAL},co_eIncome = |
| | | #{eIncome,jdbcType=DECIMAL},co_payment = |
| | | #{payment,jdbcType=DECIMAL},co_settlement = |
| | | #{settlement,jdbcType=DECIMAL},co_third_create_time = |
| | | #{thirdCreateTime,jdbcType=TIMESTAMP},co_settle_time = |
| | | #{settleTime,jdbcType=TIMESTAMP},co_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},co_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where co_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | update yeshi_ec_common_order |
| | | <set> |
| | | <if test="userInfo != null">co_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">co_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">co_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">co_source_position=#{sourcePosition,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id=#{commonOrderGoods.id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="count != null">co_count=#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">co_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">co_estimate=#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">co_eIncome=#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">co_payment=#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">co_settlement=#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time=#{thirdCreateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="settleTime != null">co_settle_time=#{settleTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">co_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">co_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where co_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listGroupOrderNoByUid" resultMap="ResultMap"> |
| | | SELECT COALESCE(SUM(th.`hb_money`),0)AS totalMoney,tc.*,th.hb_state AS |
| | | hongBaoState, th.hb_type AS hongBaoType, |
| | | th.hb_get_time AS accountTime,th.hb_get_time AS accountTime,th.hb_pre_get_time AS |
| | | preAccountTime |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | <if test="state != null"> |
| | | AND th.hb_state = #{state} |
| | | </if> |
| | |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | GROUP BY tc.`co_order_no` |
| | | ORDER BY tc.co_create_time DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countGroupOrderNoByUid" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | GROUP BY tc.`co_order_no` |
| | | ORDER BY tc.co_create_time DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countByOrderNOAndOrderType" resultType="java.lang.Integer"> |
| | | select count(co_id) from yeshi_ec_common_order where co_order_no=#{orderNO} and co_source_type=#{orderType} |
| | | </select> |
| | | |
| | | |
| | | <select id="countGroupOrderNoByUid" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | <if test="state != null"> |
| | | AND th.hb_state = #{state} |
| | | </if> |
| | |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listByOrderNoAndType" resultMap="ResultMap" parameterType="java.util.List"> |
| | | SELECT COALESCE(SUM(tc.`co_settlement`),0)AS totalSettlement,COALESCE(SUM(tc.`co_count`),0)AS totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.* |
| | | FROM yeshi_ec_common_order_goods tg |
| | | LEFT JOIN yeshi_ec_common_order tc ON tc.`co_order_goods_id` = tg.`cog_id` |
| | | WHERE |
| | | <foreach collection="list" item="item" separator=" OR "> |
| | | (tc.`co_source_type` = #{item.sourceType,jdbcType=INTEGER} AND tc.`co_order_no` = #{item.orderNo,jdbcType=VARCHAR}) |
| | | </foreach> |
| | | GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` |
| | | </select> |
| | | |
| | | <select id="countOrderByHongBaoType" resultType="java.util.HashMap"> |
| | | SELECT SUM(self)AS totalSelf, SUM(shared)AS totalShared ,SUM(invite)AS totalInvite FROM ( |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS self,0 AS shared,0 AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON tr.`ho_hongbao_id` = th.`hb_id` |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 1 OR th.`hb_type` = 2) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | UNION |
| | | |
| | | SELECT 0 AS self, IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS shared,0 AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | UNION |
| | | SELECT 0 AS self,0 AS shared,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | |
| | | <select id="countOrder" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE 1=1 |
| | | <if test="uid != null"> |
| | | AND th.`hb_uid` = ${uid} |
| | | </if> |
| | | <if test ="isToday == 1"> |
| | | </select> |
| | | |
| | | <select id="listByOrderNoAndType" resultMap="ResultMap" |
| | | parameterType="java.util.List"> |
| | | SELECT COALESCE(SUM(tc.`co_settlement`),0)AS |
| | | totalSettlement,COALESCE(SUM(tc.`co_count`),0)AS |
| | | totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.* |
| | | FROM yeshi_ec_common_order_goods tg |
| | | LEFT JOIN yeshi_ec_common_order tc ON tc.`co_order_goods_id` = tg.`co_id` |
| | | WHERE |
| | | <foreach collection="list" item="item" separator=" OR "> |
| | | (tc.`co_source_type` = #{item.sourceType,jdbcType=INTEGER} AND |
| | | tc.`co_order_no` = #{item.orderNo,jdbcType=VARCHAR}) |
| | | </foreach> |
| | | GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` |
| | | </select> |
| | | |
| | | <select id="countOrderByHongBaoType" resultType="java.util.HashMap"> |
| | | SELECT SUM(self)AS totalSelf, SUM(shared)AS totalShared ,SUM(invite)AS |
| | | totalInvite FROM ( |
| | | SELECT IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS self,0 AS shared,0 AS |
| | | invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT |
| | | JOIN yeshi_ec_hongbao_v2 th ON tr.`ho_hongbao_id` = th.`hb_id` |
| | | WHERE |
| | | th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 1 OR th.`hb_type` = 2) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countOrderMoney" resultType="java.lang.Long"> |
| | | SELECT IFNULL(SUM(th.`hb_money`),0)AS totalmoney FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND <![CDATA[tc.`co_state` <> 4]]> |
| | | <if test ="isToday == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | GROUP BY tc.`co_order_no`,tc.`co_source_type` |
| | | </select> |
| | | |
| | | <select id="countByUidAndOrderState" resultType="java.util.HashMap"> |
| | | SELECT SUM(valid)AS totalValid, SUM(proces)AS totalProces ,SUM(Invalid)AS totalInvite |
| | | FROM (SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS valid,0 AS proces,0 AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND (tc.`co_state` = 1 OR tc.`co_state` = 2) |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS proces,0 AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND tc.`co_state` =3 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid`= #{uid} AND tc.`co_state` = 4 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | UNION |
| | | |
| | | SELECT 0 AS self, IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS shared,0 AS invite FROM |
| | | yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT |
| | | JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | UNION |
| | | SELECT 0 AS self,0 AS shared,IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS invite FROM |
| | | yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="countOrder" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE 1=1 |
| | | <if test="uid != null"> |
| | | AND th.`hb_uid` = ${uid} |
| | | </if> |
| | | <if test="isToday == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countOrderMoney" resultType="java.lang.Long"> |
| | | SELECT IFNULL(SUM(th.`hb_money`),0)AS totalmoney FROM |
| | | yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND <![CDATA[tc.`co_state` <> 4]]> |
| | | <if test="isToday == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | GROUP BY tc.`co_order_no`,tc.`co_source_type` |
| | | </select> |
| | | |
| | | <select id="countByUidAndOrderState" resultType="java.util.HashMap"> |
| | | SELECT SUM(valid)AS totalValid, SUM(proces)AS totalProces |
| | | ,SUM(Invalid)AS totalInvite |
| | | FROM (SELECT IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS valid,0 AS proces,0 AS |
| | | Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND |
| | | (tc.`co_state` = 1 OR tc.`co_state` = 2) |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS proces,0 AS Invalid |
| | | FROM |
| | | yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND |
| | | tc.`co_state` =3 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(DISTINCT |
| | | tc.`co_order_no`,tc.`co_source_type`),0) AS Invalid |
| | | FROM |
| | | yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid`= #{uid} AND |
| | | tc.`co_state` = 4 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!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.HongBaoOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.HongBaoOrder"> |
| | | <id column="ho_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="cog_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="hongBaoV2" column="ho_hongbao_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="ho_hongbao_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="ho_order_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="ho_order_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ho_id,ho_hongbao_id,ho_order_id,cog_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order (ho_id,ho_hongbao_id,ho_order_id,cog_create_time) values (#{id,jdbcType=BIGINT},#{hongBaoV2.id,jdbcType=BIGINT},#{commonOrder.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ho_id,</if> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id,</if> |
| | | <if test="commonOrder != null">ho_order_id,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="hongBaoV2 != null">#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order set ho_hongbao_id = #{hongBaoV2.id,jdbcType=BIGINT},ho_order_id = #{commonOrder.id,jdbcType=BIGINT},cog_create_time = #{createTime,jdbcType=TIMESTAMP} where ho_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order |
| | | <set> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id=#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">ho_order_id=#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where ho_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.HongBaoOrder"> |
| | | <id column="ho_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="ho_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="hongBaoV2" column="ho_hongbao_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="ho_hongbao_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="ho_order_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="ho_order_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | ho_id,ho_hongbao_id,ho_order_id,ho_create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order |
| | | (ho_id,ho_hongbao_id,ho_order_id,ho_create_time) values |
| | | (#{id,jdbcType=BIGINT},#{hongBaoV2.id,jdbcType=BIGINT},#{commonOrder.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_hongbao_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ho_id,</if> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id,</if> |
| | | <if test="commonOrder != null">ho_order_id,</if> |
| | | <if test="createTime != null">ho_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="hongBaoV2 != null">#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update |
| | | yeshi_ec_hongbao_order set ho_hongbao_id = |
| | | #{hongBaoV2.id,jdbcType=BIGINT},ho_order_id = |
| | | #{commonOrder.id,jdbcType=BIGINT},ho_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where ho_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder"> |
| | | update yeshi_ec_hongbao_order |
| | | <set> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id=#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">ho_order_id=#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">ho_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where ho_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | package com.yeshi.fanli.service.impl.hongbao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | |
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | @Service
|
| | | public class HongBaoV2ServiceImpl implements HongBaoV2Service {
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoMapper;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderMapper taoBaoOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private OrderItemMapper orderItemMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderMapper commonOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderGoodsMapper commonOrderGoodsMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
|
| | | @Override
|
| | | public int insert(HongBaoV2 record) {
|
| | |
| | | public HongBaoV2 selectByPrimaryKey(Long id) {
|
| | | return hongBaoV2Mapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | private HongBaoV2 getHongBaoV2(HongBao hb) {
|
| | | int type = hb.getType().intValue();
|
| | | HongBaoV2 v2 = new HongBaoV2(hb.getId());
|
| | | v2.setCreateTime(new Date(hb.getCreatetime()));
|
| | | if (hb.getGetTime() == null || hb.getGetTime() == 0)
|
| | | v2.setGetTime(null);
|
| | | else
|
| | | v2.setGetTime(new Date(hb.getGetTime()));
|
| | |
|
| | | v2.setMoney(hb.getMoney());
|
| | | if (hb.getParent() != null)
|
| | | v2.setParent(new HongBaoV2(hb.getParent().getId()));
|
| | |
|
| | | if (hb.getPreGettime() == null || hb.getPreGettime() == 0)
|
| | | v2.setPreGetTime(null);
|
| | | else
|
| | | v2.setPreGetTime(new Date(hb.getPreGettime()));
|
| | |
|
| | | v2.setState(hb.getState());
|
| | | v2.setType(type);
|
| | | v2.setUpdateTime(new Date(hb.getCreatetime()));
|
| | | v2.setUrank(hb.getUrank());
|
| | | v2.setUserInfo(hb.getUserInfo());
|
| | | v2.setVersion(hb.getVersion());
|
| | | return v2;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void convert(HongBao hb) {
|
| | | if (hb == null || hb.getParent() != null)
|
| | | return;
|
| | |
|
| | | int type = hb.getType().intValue();
|
| | | if (type == HongBao.TYPE_TAOBAO || type == HongBao.TYPE_SHARE_GOODS) {// 自购与分享赚需要查询出所有的订单
|
| | | // 属于返利订单
|
| | | String orderId = "";
|
| | | if (hb.getOrder() != null) {
|
| | | orderId = hb.getOrder().getOrderId();
|
| | | // 查询同一订单号的非子红包
|
| | |
|
| | | } else
|
| | | orderId = hb.getOrderId();
|
| | |
|
| | | int count = commonOrderMapper.countByOrderNOAndOrderType(orderId, Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | // 已经插入订单
|
| | | if (count > 0)
|
| | | return;
|
| | |
|
| | | //
|
| | |
|
| | | if (hb.getVersion() == 1) {// 很老版本的处理方式,已hongbao为主
|
| | | if (hongBaoV2Mapper.selectByPrimaryKey(hb.getId()) != null)
|
| | | return;
|
| | | HongBaoV2 hongBaoV2 = getHongBaoV2(hb);
|
| | | hongBaoV2.setBeizhu("订单号:" + orderId);
|
| | | hongBaoV2Mapper.insert(hongBaoV2);
|
| | |
|
| | | if (hb.getHasChild())// 存在子红包
|
| | | {
|
| | | List<HongBao> children = hongBaoMapper.selectChildHongBaoByPid(hb.getId());
|
| | | if (children != null)
|
| | | for (HongBao hongBao : children) {
|
| | | HongBaoV2 child = getHongBaoV2(hongBao);
|
| | | hongBaoV2Mapper.insert(child);
|
| | | }
|
| | | }
|
| | |
|
| | | } else {// 新版本处理方式
|
| | |
|
| | | List<HongBao> list = hongBaoMapper.selectByOrderId(orderId);
|
| | |
|
| | | if (list.size() == 0)
|
| | | list = hongBaoMapper.selectByOid(hb.getOrder().getId());
|
| | | if (list != null)
|
| | | // 删除子红包
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (list.get(i).getParent() != null) {
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | if (list.size() <= 0)
|
| | | return;
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderMapper.selectTaoBaoOrderByOrderId(orderId);
|
| | | if (orderList == null || orderList.size() != list.size()) {
|
| | | System.out.println("红包数与订单数不对应");
|
| | | return;
|
| | | }
|
| | |
|
| | | // 按照auctionId,payMoney排序
|
| | | Comparator<HongBao> cm = new Comparator<HongBao>() {
|
| | |
|
| | | @Override
|
| | | public int compare(HongBao o1, HongBao o2) {
|
| | | return o1.getAuctionId() == o2.getAuctionId()
|
| | | ? (o1.getPayMoney().subtract(o2.getPayMoney()).compareTo(new BigDecimal(0)))
|
| | | : (int) (o1.getAuctionId() - o2.getAuctionId());
|
| | | }
|
| | | };
|
| | |
|
| | | Collections.sort(list, cm);
|
| | |
|
| | | Comparator<TaoBaoOrder> cmOrder = new Comparator<TaoBaoOrder>() {
|
| | |
|
| | | @Override
|
| | | public int compare(TaoBaoOrder o1, TaoBaoOrder o2) {
|
| | | return o1.getAuctionId() == o2.getAuctionId()
|
| | | ? (o1.getPayment().subtract(o2.getPayment()).compareTo(new BigDecimal(0)))
|
| | | : (int) (o1.getAuctionId() - o2.getAuctionId());
|
| | | }
|
| | | };
|
| | |
|
| | | Collections.sort(orderList, cmOrder);
|
| | |
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | CommonOrder commonOrder = TaoBaoOrderUtil.convert(orderList.get(i));
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(orderList.get(i).getAuctionId() + "");
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | // 商品是否已经插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | else
|
| | | goods.setId(commonGoodsList.get(commonGoodsList.size() - 1).getId());
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | |
|
| | | commonOrder.setUserInfo(list.get(i).getUserInfo());
|
| | |
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | |
|
| | | // 插入红包
|
| | | HongBaoV2 hongBaoV2 = getHongBaoV2(list.get(i));
|
| | | hongBaoV2.setId(list.get(i).getId());
|
| | | hongBaoV2Mapper.insert(hongBaoV2);
|
| | |
|
| | | HongBaoOrder ho = new HongBaoOrder();
|
| | | ho.setCommonOrder(commonOrder);
|
| | | ho.setCreateTime(new Date());
|
| | | ho.setHongBaoV2(hongBaoV2);
|
| | | hongBaoOrderMapper.insertSelective(ho);
|
| | |
|
| | | if (list.get(i).getHasChild())// 存在子红包
|
| | | {
|
| | | List<HongBao> children = hongBaoMapper.selectChildHongBaoByPid(list.get(i).getId());
|
| | | if (children != null)
|
| | | for (HongBao hongBao : children) {
|
| | | HongBaoV2 child = getHongBaoV2(hongBao);
|
| | | hongBaoV2Mapper.insert(child);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } else {// 直接插入
|
| | |
|
| | | if (type != HongBao.TYPE_ERJI && type != HongBao.TYPE_YIJI && type != HongBao.TYPE_SHARE_YIJI
|
| | | && type != HongBao.TYPE_SHARE_ERJI) {
|
| | | if (hongBaoV2Mapper.selectByPrimaryKey(hb.getId()) == null)
|
| | | hongBaoV2Mapper.insert(getHongBaoV2(hb));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | taoBaoOrderMapper.insertSelective(taoBaoOrder);
|
| | | }
|
| | | } else {
|
| | | //测试
|
| | | if(1>0)
|
| | | return;
|
| | | |
| | | boolean hasPayOrder = false;
|
| | | for (TaoBaoOrder order : oldOrderList)
|
| | | if (order.getOrderState().equalsIgnoreCase("订单付款")) {
|
| | |
| | | package com.yeshi.fanli.service.inter.hongbao;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
|
| | | public interface HongBaoV2Service {
|
| | |
| | | public int insertSelective(HongBaoV2 record);
|
| | |
|
| | | public int updateByPrimaryKey(HongBaoV2 record);
|
| | | |
| | |
|
| | | public int updateByPrimaryKeySelective(HongBaoV2 record);
|
| | | |
| | |
|
| | | public int deleteByPrimaryKey(Long id);
|
| | | |
| | |
|
| | | public HongBaoV2 selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 将老版本的红包对象转为新版本的对象
|
| | | * |
| | | * @param hb
|
| | | */
|
| | | public void convert(HongBao hb);
|
| | |
|
| | | }
|
| | |
| | | orderProcessService.processOrder(map);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | // TimeUtil.getGernalTime(balanceTime, "HH:mm:ss");
|
| | | return TimeUtil.convertToTimeTemp(time, "yyyy-M-dd HH:mm:ss");
|
| | | }
|
| | |
|
| | | public static CommonOrder convert(TaoBaoOrder taoBaoOrder) {
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(taoBaoOrder.getCount());
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrder.seteIncome(taoBaoOrder.geteIncome());
|
| | | commonOrder.setEstimate(taoBaoOrder.getEstimate());
|
| | | commonOrder.setOrderNo(taoBaoOrder.getOrderId());
|
| | | commonOrder.setPayment(taoBaoOrder.getPayment());
|
| | | commonOrder.setSettlement(taoBaoOrder.getSettlement());
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
|
| | | commonOrder.setSettleTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setSourcePosition(
|
| | | String.format("mm_%s_%s_%s", "124933865", taoBaoOrder.getSourceMediaId(), taoBaoOrder.getAdPositionId()));
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | int state = 0;
|
| | | if ("订单付款".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单成功".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单失效".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | } else if ("订单结算".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_JS;
|
| | | }
|
| | |
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | |
|
| | | return commonOrder;
|
| | |
|
| | | }
|
| | | }
|