|
|
|
|
@ -2,265 +2,213 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="me.mofun.mapper.SpellbuyrecordMapper">
|
|
|
|
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
|
|
<resultMap id="BaseResultMap" type="me.mofun.entity.Spellbuyrecord">
|
|
|
|
|
<id column="spellbuyRecordId" property="spellbuyRecordId" />
|
|
|
|
|
<result column="fkSpellbuyProductId" property="fkSpellbuyProductId" />
|
|
|
|
|
<result column="buyer" property="buyer" />
|
|
|
|
|
<result column="buyPrice" property="buyPrice" />
|
|
|
|
|
<result column="buyDate" property="buyDate" />
|
|
|
|
|
<result column="spRandomNo" property="spRandomNo" />
|
|
|
|
|
<result column="spWinningStatus" property="spWinningStatus" />
|
|
|
|
|
<result column="buyStatus" property="buyStatus" />
|
|
|
|
|
<result column="buyIp" property="buyIp" />
|
|
|
|
|
<result column="buyLocal" property="buyLocal" />
|
|
|
|
|
<result column="buySource" property="buySource" />
|
|
|
|
|
<result column="Attribute_66" property="attribute66" />
|
|
|
|
|
<result column="Attribute_67" property="attribute67" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 结果集映射:关联Product和Spellbuyproduct实体 -->
|
|
|
|
|
<resultMap id="ProductSpellbuyResultMap" type="me.mofun.entity.vo.ProductSpellbuyVO">
|
|
|
|
|
<!-- 商品实体映射 -->
|
|
|
|
|
<association property="product" javaType="me.mofun.entity.Product">
|
|
|
|
|
<id column="productId" property="productId" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="productName" property="productName" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="productPrice" property="productPrice" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="marketPrice" property="marketPrice" jdbcType="DECIMAL"/>
|
|
|
|
|
<result column="singlePrice" property="singlePrice" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="productLimit" property="productLimit" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="productRealPrice" property="productRealPrice" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="productTitle" property="productTitle" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="productDetail" property="productDetail" jdbcType="LONGVARCHAR"/>
|
|
|
|
|
<result column="productType" property="productType" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="productBrand" property="productBrand" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="headImage" property="headImage" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="status" property="status" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="isShow" property="isShow" jdbcType="BIT"/>
|
|
|
|
|
<result column="isVirtual" property="isVirtual" jdbcType="BIT"/>
|
|
|
|
|
<result column="isNeedLogic" property="isNeedLogic" jdbcType="BIT"/>
|
|
|
|
|
<result column="logicURL" property="logicURL" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="shopId" property="shopId" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="authorId" property="authorId" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="style" property="style" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="attribute71" property="attribute71" jdbcType="VARCHAR"/>
|
|
|
|
|
|
|
|
|
|
</association>
|
|
|
|
|
|
|
|
|
|
<!-- 拼购商品实体映射 -->
|
|
|
|
|
<association property="spellbuyproduct" javaType="me.mofun.entity.Spellbuyproduct">
|
|
|
|
|
<id column="spId" property="spellbuyProductId" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="fkProductId" property="fkProductId" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="spellbuyStartDate" property="spellbuyStartDate" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="spellbuyEndDate" property="spellbuyEndDate" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="spellbuyCount" property="spellbuyCount" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="spellbuyPrice" property="spellbuyPrice" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="marketPriceSp" property="marketPrice" jdbcType="DECIMAL"/>
|
|
|
|
|
<result column="actionName" property="actionName" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="spSinglePrice" property="spSinglePrice" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="productPeriod" property="productPeriod" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="spellbuyLimit" property="spellbuyLimit" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="spStatus" property="spStatus" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="spellbuyType" property="spellbuyType" jdbcType="INTEGER"/>
|
|
|
|
|
<result column="attribute64" property="attribute64" jdbcType="VARCHAR"/>
|
|
|
|
|
<result column="attribute65" property="attribute65" jdbcType="VARCHAR"/>
|
|
|
|
|
</association>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 首页最热门商品查询 -->
|
|
|
|
|
<select id="selectHotProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice
|
|
|
|
|
<!-- 热门商品查询 -->
|
|
|
|
|
<select id="findHotProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where 1=1
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
group by pt.productId
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页最新上架商品 -->
|
|
|
|
|
<select id="selectIndexNewProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice
|
|
|
|
|
<select id="indexNewProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where pt.status = 1
|
|
|
|
|
and pt.isShow = 1
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
where pt.status=1
|
|
|
|
|
and pt.isShow=1
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyStartDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页人气排行商品 -->
|
|
|
|
|
<select id="selectIndexHotProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
<select id="indexHotProductList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where 1=1
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.productPeriod desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 他们正在购买列表 -->
|
|
|
|
|
<select id="selectNowBuyList" resultType="java.util.Map">
|
|
|
|
|
<!-- 正在购买列表 -->
|
|
|
|
|
<select id="getNowBuyList" resultType="me.mofun.entity.dto.SpellbuyrecordDTO">
|
|
|
|
|
select ur.*, sd.*, pt.*, st.*
|
|
|
|
|
from user ur, spellbuyrecord sd, product pt, spellbuyproduct st
|
|
|
|
|
from User ur, spellbuyrecord sd, Product pt, spellbuyproduct st
|
|
|
|
|
where 1=1
|
|
|
|
|
and sd.buyer = ur.userId
|
|
|
|
|
and sd.fkSpellbuyProductId = st.spellbuyProductId
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and sd.buyDate between #{startDate} and #{endDate}
|
|
|
|
|
and sd.buyer=ur.userId
|
|
|
|
|
and sd.fkSpellbuyProductId=st.spellbuyProductId
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页按商品类型查询商品 -->
|
|
|
|
|
<select id="selectProductByTypeId" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
<!-- 按商品类型查询商品 -->
|
|
|
|
|
<select id="findProductByTypeId" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
where st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and (
|
|
|
|
|
pt.productType = #{typeId}
|
|
|
|
|
<foreach collection="childTypes" item="type" separator="or">
|
|
|
|
|
or pt.productType = #{type.typeId}
|
|
|
|
|
and (1=2
|
|
|
|
|
or (1=1 and pt.productType= #{typeId})
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" separator="or">
|
|
|
|
|
or (1=1 and pt.productType= #{childTypeId})
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 商品页按类型查询 -->
|
|
|
|
|
<select id="selectProductByTypeIdList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
<!-- 商品页按商品类型查询 -->
|
|
|
|
|
<select id="productByTypeIdList" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where pt.status = 1
|
|
|
|
|
and pt.isShow = 1
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
where pt.status=1
|
|
|
|
|
and pt.isShow=1
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and (
|
|
|
|
|
pt.productType = #{typeId}
|
|
|
|
|
<foreach collection="childTypes" item="type" separator="or">
|
|
|
|
|
or pt.productType = #{type.typeId}
|
|
|
|
|
and (1=2
|
|
|
|
|
or (1=1 and pt.productType= #{typeId})
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" separator="or">
|
|
|
|
|
or (1=1 and pt.productType= #{childTypeId})
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="brandId != null and brandId != ''">
|
|
|
|
|
and pt.productBrand = #{brandId}
|
|
|
|
|
and pt.productBrand=#{brandId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyStartDate desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice asc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice/1.5))
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</if>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyStartDate desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice asc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice / 1.5))
|
|
|
|
|
GROUP by pt.productId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 商品页按类型及店铺查询 -->
|
|
|
|
|
<select id="selectProductByTypeIdAndShopId" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
<!-- 商品页按商品类型及所属用户查询 -->
|
|
|
|
|
<select id="productByTypeIdListAndShopId" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where pt.status = 1
|
|
|
|
|
and pt.isShow = 1
|
|
|
|
|
and pt.shopId = #{shopId}
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
where pt.status=1
|
|
|
|
|
and pt.isShow=1
|
|
|
|
|
and pt.shopId=#{shopId}
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and (
|
|
|
|
|
pt.productType = #{typeId}
|
|
|
|
|
<foreach collection="childTypes" item="type" separator="or">
|
|
|
|
|
or pt.productType = #{type.typeId}
|
|
|
|
|
and (1=2
|
|
|
|
|
or (1=1 and pt.productType= #{typeId})
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" separator="or">
|
|
|
|
|
or (1=1 and pt.productType= #{childTypeId})
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="brandId != null and brandId != ''">
|
|
|
|
|
and pt.productBrand = #{brandId}
|
|
|
|
|
and pt.productBrand=#{brandId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyStartDate desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice asc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice/1.5))
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</if>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyStartDate desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice asc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice / 1.5))
|
|
|
|
|
GROUP by pt.productId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 搜索商品 -->
|
|
|
|
|
<select id="selectSearchProduct" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*, pt.marketPrice as pt_marketPrice,
|
|
|
|
|
<select id="searchProduct" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where st.fkProductId = pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
and pt.productName like concat('%', #{keyword}, '%')
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by st.spellbuyStartDate desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId order by pt.productPrice asc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice / 1.5))
|
|
|
|
|
GROUP by pt.productId order by st.spellbuyCount desc
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
where st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
and pt.productName like CONCAT('%', #{keyword}, '%')
|
|
|
|
|
<if test="orderName == 'hot'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'date'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by st.spellbuyStartDate desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'price'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'priceAsc'">
|
|
|
|
|
GROUP by st.spellbuyProductId
|
|
|
|
|
order by pt.productPrice asc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'about'">
|
|
|
|
|
and (st.spellbuyCount > (pt.productPrice/1.5))
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderName == 'surplus'">
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by (pt.productPrice - st.spellbuyCount) asc
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 最新参与记录 -->
|
|
|
|
|
<select id="selectLatestParticipate" resultType="java.util.Map">
|
|
|
|
|
<!-- 其他方法的SQL映射... -->
|
|
|
|
|
<select id="latestParticipate" resultType="java.util.Map">
|
|
|
|
|
select ur.*, sd.*
|
|
|
|
|
from user ur, spellbuyrecord sd
|
|
|
|
|
where sd.buyer = ur.userId
|
|
|
|
|
where sd.buyer=ur.userId
|
|
|
|
|
and sd.fkSpellbuyProductId = #{spellbuyProductId}
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询某用户的购买记录 -->
|
|
|
|
|
<select id="selectBuyHistoryByUser" resultType="me.mofun.entity.pojo.BuyHistoryJSON">
|
|
|
|
|
select
|
|
|
|
|
st.spellbuyProductId as productId,
|
|
|
|
|
<select id="getRandomNumberListPage" resultType="me.mofun.pojo.Randomnumber">
|
|
|
|
|
SELECT * from randomnumber rr
|
|
|
|
|
where rr.productId = #{spellbuyProductId}
|
|
|
|
|
and rr.userId = #{userId}
|
|
|
|
|
order by rr.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="buyHistoryByUser" resultType="me.mofun.pojo.BuyHistoryJSON">
|
|
|
|
|
select st.spellbuyProductId as productId,
|
|
|
|
|
pt.productName as productName,
|
|
|
|
|
pt.productTitle as productTitle,
|
|
|
|
|
pt.headImage as productImg,
|
|
|
|
|
@ -271,13 +219,13 @@
|
|
|
|
|
sd.spellbuyRecordId as historyId,
|
|
|
|
|
st.spellbuyCount as spellbuyCount,
|
|
|
|
|
st.spellbuyPrice as productPrice
|
|
|
|
|
from spellbuyrecord sd, spellbuyproduct st, product pt, user ur
|
|
|
|
|
where sd.fkSpellbuyProductId = st.spellbuyProductId
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and sd.buyer = ur.userId
|
|
|
|
|
and sd.buyer = #{userId}
|
|
|
|
|
from spellbuyrecord sd,spellbuyproduct st,product pt,user ur
|
|
|
|
|
where sd.fkSpellbuyProductId=st.spellbuyProductId
|
|
|
|
|
and st.fkProductId=pt.productId
|
|
|
|
|
and sd.buyer=ur.userId
|
|
|
|
|
and sd.buyer=#{userId}
|
|
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
|
|
and sd.buyDate >= #{startDate}
|
|
|
|
|
and sd.buyDate >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
|
|
and sd.buyDate <= #{endDate}
|
|
|
|
|
@ -286,21 +234,5 @@
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectNowBuyAjaxList" resultType="java.util.Map">
|
|
|
|
|
select ur.*, sd.*, pt.*, st.*
|
|
|
|
|
from user ur, spellbuyrecord sd, product pt, spellbuyproduct st
|
|
|
|
|
where sd.buyer = ur.userId
|
|
|
|
|
and sd.fkSpellbuyProductId = st.spellbuyProductId
|
|
|
|
|
and st.fkProductId = pt.productId
|
|
|
|
|
and sd.spellbuyRecordId = #{spellbuyRecordId} <!-- 按记录ID过滤 -->
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectAllBuyRecord" resultType="java.util.Map">
|
|
|
|
|
select * from spellbuyrecord
|
|
|
|
|
where buyDate between #{startDate} and #{endDate}
|
|
|
|
|
order by buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectLotteryDetail" resultType="java.util.Map"></select>
|
|
|
|
|
</mapper>
|
|
|
|
|
</mapper>
|