|
|
|
|
@ -2,237 +2,641 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="me.mofun.mapper.SpellbuyrecordMapper">
|
|
|
|
|
|
|
|
|
|
<!-- 热门商品查询 -->
|
|
|
|
|
<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
|
|
|
|
|
order by st.spellbuyCount desc
|
|
|
|
|
<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="attribute66" property="attribute66" />
|
|
|
|
|
<result column="attribute67" property="attribute67" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 定义结果映射 -->
|
|
|
|
|
<resultMap id="ProductSpellbuyproductMap" type="me.mofun.entity.dto.ProductSpellbuyproductDTO">
|
|
|
|
|
<association property="product" javaType="me.mofun.entity.Product">
|
|
|
|
|
<id property="productId" column="pt_productId" />
|
|
|
|
|
<result property="productName" column="pt_productName" />
|
|
|
|
|
<result property="productPrice" column="pt_productPrice" />
|
|
|
|
|
<result property="marketPrice" column="pt_marketPrice" />
|
|
|
|
|
<result property="singlePrice" column="pt_singlePrice" />
|
|
|
|
|
<result property="productLimit" column="pt_productLimit" />
|
|
|
|
|
<result property="productRealPrice" column="pt_productRealPrice" />
|
|
|
|
|
<result property="productTitle" column="pt_productTitle" />
|
|
|
|
|
<result property="productDetail" column="pt_productDetail" />
|
|
|
|
|
<result property="productType" column="pt_productType" />
|
|
|
|
|
<result property="productBrand" column="pt_productBrand" />
|
|
|
|
|
<result property="headImage" column="pt_headImage" />
|
|
|
|
|
<result property="status" column="pt_status" />
|
|
|
|
|
<result property="isShow" column="pt_isShow" />
|
|
|
|
|
<result property="isVirtual" column="pt_isVirtual" />
|
|
|
|
|
<result property="isNeedLogic" column="pt_isNeedLogic" />
|
|
|
|
|
<result property="logicURL" column="pt_logicURL" />
|
|
|
|
|
<result property="shopId" column="pt_shopId" />
|
|
|
|
|
<result property="authorId" column="pt_authorId" />
|
|
|
|
|
<result property="style" column="pt_style" />
|
|
|
|
|
<result property="attribute71" column="pt_attribute71" />
|
|
|
|
|
</association>
|
|
|
|
|
<association property="spellbuyproduct" javaType="me.mofun.entity.Spellbuyproduct">
|
|
|
|
|
<id property="spellbuyProductId" column="st_spellbuyProductId" />
|
|
|
|
|
<result property="fkProductId" column="st_fkProductId" />
|
|
|
|
|
<result property="spellbuyStartDate" column="st_spellbuyStartDate" />
|
|
|
|
|
<result property="spellbuyEndDate" column="st_spellbuyEndDate" />
|
|
|
|
|
<result property="spellbuyCount" column="st_spellbuyCount" />
|
|
|
|
|
<result property="spellbuyPrice" column="st_spellbuyPrice" />
|
|
|
|
|
<result property="marketPrice" column="st_marketPrice" />
|
|
|
|
|
<result property="actionName" column="st_actionName" />
|
|
|
|
|
<result property="spSinglePrice" column="st_spSinglePrice" />
|
|
|
|
|
<result property="productPeriod" column="st_productPeriod" />
|
|
|
|
|
<result property="spellbuyLimit" column="st_spellbuyLimit" />
|
|
|
|
|
<result property="spStatus" column="st_spStatus" />
|
|
|
|
|
<result property="spellbuyType" column="st_spellbuyType" />
|
|
|
|
|
<result property="attribute64" column="st_attribute64" />
|
|
|
|
|
<result property="attribute65" column="st_attribute65" />
|
|
|
|
|
</association>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="SpellbuyrecordDTOMap" type="me.mofun.entity.dto.SpellbuyrecordDTO">
|
|
|
|
|
<association property="product" javaType="me.mofun.entity.Product">
|
|
|
|
|
<id column="pt_productId" property="productId" />
|
|
|
|
|
<result column="pt_productName" property="productName" />
|
|
|
|
|
<result column="pt_productPrice" property="productPrice" />
|
|
|
|
|
<result column="pt_marketPrice" property="marketPrice" />
|
|
|
|
|
<result column="pt_singlePrice" property="singlePrice" />
|
|
|
|
|
<result column="pt_productLimit" property="productLimit" />
|
|
|
|
|
<result column="pt_productRealPrice" property="productRealPrice" />
|
|
|
|
|
<result column="pt_productTitle" property="productTitle" />
|
|
|
|
|
<result column="pt_productDetail" property="productDetail" />
|
|
|
|
|
<result column="pt_productType" property="productType" />
|
|
|
|
|
<result column="pt_productBrand" property="productBrand" />
|
|
|
|
|
<result column="pt_headImage" property="headImage" />
|
|
|
|
|
<result column="pt_status" property="status" />
|
|
|
|
|
<result column="pt_isShow" property="isShow" />
|
|
|
|
|
<result column="pt_isVirtual" property="isVirtual" />
|
|
|
|
|
<result column="pt_isNeedLogic" property="isNeedLogic" />
|
|
|
|
|
<result column="pt_logicURL" property="logicURL" />
|
|
|
|
|
<result column="pt_shopId" property="shopId" />
|
|
|
|
|
<result column="pt_authorId" property="authorId" />
|
|
|
|
|
<result column="pt_style" property="style" />
|
|
|
|
|
<result column="pt_attribute71" property="attribute71" />
|
|
|
|
|
</association>
|
|
|
|
|
<association property="user" javaType="me.mofun.entity.User">
|
|
|
|
|
<id column="ur_userId" property="userId" />
|
|
|
|
|
<result column="ur_userName" property="userName" />
|
|
|
|
|
<result column="ur_userPwd" property="userPwd" />
|
|
|
|
|
<result column="ur_changePwdNo" property="changePwdNo" />
|
|
|
|
|
<result column="ur_changePwdTime" property="changePwdTime" />
|
|
|
|
|
<result column="ur_realName" property="realName" />
|
|
|
|
|
<result column="ur_cardNo" property="cardNo" />
|
|
|
|
|
<result column="ur_mobilePhone" property="mobilePhone" />
|
|
|
|
|
<result column="ur_mobileCheck" property="mobileCheck" />
|
|
|
|
|
<result column="ur_phone" property="phone" />
|
|
|
|
|
<result column="ur_groupIdList" property="groupIdList" />
|
|
|
|
|
<result column="ur_qq" property="qq" />
|
|
|
|
|
<result column="ur_qqOpenId" property="qqOpenId" />
|
|
|
|
|
<result column="ur_mail" property="mail" />
|
|
|
|
|
<result column="ur_mailCheck" property="mailCheck" />
|
|
|
|
|
<result column="ur_mailKey" property="mailKey" />
|
|
|
|
|
<result column="ur_smsKey" property="smsKey" />
|
|
|
|
|
<result column="ur_sex" property="sex" />
|
|
|
|
|
<result column="ur_birthday" property="birthday" />
|
|
|
|
|
<result column="ur_faceImg" property="faceImg" />
|
|
|
|
|
<result column="ur_location" property="location" />
|
|
|
|
|
<result column="ur_postNo" property="postNo" />
|
|
|
|
|
<result column="ur_ipAddress" property="ipAddress" />
|
|
|
|
|
<result column="ur_ipLocation" property="ipLocation" />
|
|
|
|
|
<result column="ur_oldIpAddress" property="oldIpAddress" />
|
|
|
|
|
<result column="ur_maritalStatus" property="maritalStatus" />
|
|
|
|
|
<result column="ur_monthlyIncome" property="monthlyIncome" />
|
|
|
|
|
<result column="ur_Interests" property="Interests" />
|
|
|
|
|
<result column="ur_attribute22" property="attribute22" />
|
|
|
|
|
<result column="ur_oldDate" property="oldDate" />
|
|
|
|
|
<result column="ur_newDate" property="newDate" />
|
|
|
|
|
<result column="ur_balance" property="balance" />
|
|
|
|
|
<result column="ur_userType" property="userType" />
|
|
|
|
|
<result column="ur_experience" property="experience" />
|
|
|
|
|
<result column="ur_signature" property="signature" />
|
|
|
|
|
<result column="ur_invite" property="invite" />
|
|
|
|
|
<result column="ur_inviteShortURL" property="inviteShortURL" />
|
|
|
|
|
<result column="ur_commissionCount" property="commissionCount" />
|
|
|
|
|
<result column="ur_commissionBalance" property="commissionBalance" />
|
|
|
|
|
<result column="ur_commissionMention" property="commissionMention" />
|
|
|
|
|
<result column="ur_commissionPoints" property="commissionPoints" />
|
|
|
|
|
<result column="ur_shopId" property="shopId" />
|
|
|
|
|
<result column="ur_creatorId" property="creatorId" />
|
|
|
|
|
<result column="ur_jobTags" property="jobTags" />
|
|
|
|
|
<result column="ur_roleName" property="roleName" />
|
|
|
|
|
<result column="ur_jobName" property="jobName" />
|
|
|
|
|
</association>
|
|
|
|
|
<association property="spellbuyproduct" javaType="me.mofun.entity.Spellbuyproduct">
|
|
|
|
|
<id column="st_spellbuyProductId" property="spellbuyProductId" />
|
|
|
|
|
<result column="st_fkProductId" property="fkProductId" />
|
|
|
|
|
<result column="st_spellbuyStartDate" property="spellbuyStartDate" />
|
|
|
|
|
<result column="st_spellbuyEndDate" property="spellbuyEndDate" />
|
|
|
|
|
<result column="st_spellbuyCount" property="spellbuyCount" />
|
|
|
|
|
<result column="st_spellbuyPrice" property="spellbuyPrice" />
|
|
|
|
|
<result column="st_marketPrice" property="marketPrice" />
|
|
|
|
|
<result column="st_actionName" property="actionName" />
|
|
|
|
|
<result column="st_spSinglePrice" property="spSinglePrice" />
|
|
|
|
|
<result column="st_productPeriod" property="productPeriod" />
|
|
|
|
|
<result column="st_spellbuyLimit" property="spellbuyLimit" />
|
|
|
|
|
<result column="st_spStatus" property="spStatus" />
|
|
|
|
|
<result column="st_spellbuyType" property="spellbuyType" />
|
|
|
|
|
<result column="st_attribute64" property="attribute64" />
|
|
|
|
|
<result column="st_attribute65" property="attribute65" />
|
|
|
|
|
</association>
|
|
|
|
|
<association property="spellbuyrecord" javaType="me.mofun.entity.Spellbuyrecord">
|
|
|
|
|
<id column="sd_spellbuyRecordId" property="spellbuyRecordId" />
|
|
|
|
|
<result column="sd_fkSpellbuyProductId" property="fkSpellbuyProductId" />
|
|
|
|
|
<result column="sd_buyer" property="buyer" />
|
|
|
|
|
<result column="sd_buyPrice" property="buyPrice" />
|
|
|
|
|
<result column="sd_buyDate" property="buyDate" />
|
|
|
|
|
<result column="sd_spRandomNo" property="spRandomNo" />
|
|
|
|
|
<result column="sd_spWinningStatus" property="spWinningStatus" />
|
|
|
|
|
<result column="sd_buyStatus" property="buyStatus" />
|
|
|
|
|
<result column="sd_buyIp" property="buyIp" />
|
|
|
|
|
<result column="sd_buyLocal" property="buyLocal" />
|
|
|
|
|
<result column="sd_buySource" property="buySource" />
|
|
|
|
|
<result column="sd_attribute66" property="attribute66" />
|
|
|
|
|
<result column="sd_attribute67" property="attribute67" />
|
|
|
|
|
</association>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="SpellbuyrecordExtMap" 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="attribute66" property="attribute66" />
|
|
|
|
|
<result column="attribute67" property="attribute67" />
|
|
|
|
|
<result column="spSinglePrice" property="spSinglePrice" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 首页最热门商品 -->
|
|
|
|
|
<select id="findHotProductList" resultMap="ProductSpellbuyproductMap">
|
|
|
|
|
SELECT
|
|
|
|
|
pt.productId as pt_productId,
|
|
|
|
|
pt.productName as pt_productName,
|
|
|
|
|
pt.productPrice as pt_productPrice,
|
|
|
|
|
pt.marketPrice as pt_marketPrice,
|
|
|
|
|
pt.singlePrice as pt_singlePrice,
|
|
|
|
|
pt.productLimit as pt_productLimit,
|
|
|
|
|
pt.productRealPrice as pt_productRealPrice,
|
|
|
|
|
pt.productTitle as pt_productTitle,
|
|
|
|
|
pt.productDetail as pt_productDetail,
|
|
|
|
|
pt.productType as pt_productType,
|
|
|
|
|
pt.productBrand as pt_productBrand,
|
|
|
|
|
pt.headImage as pt_headImage,
|
|
|
|
|
pt.status as pt_status,
|
|
|
|
|
pt.isShow as pt_isShow,
|
|
|
|
|
pt.isVirtual as pt_isVirtual,
|
|
|
|
|
pt.isNeedLogic as pt_isNeedLogic,
|
|
|
|
|
pt.logicURL as pt_logicURL,
|
|
|
|
|
pt.shopId as pt_shopId,
|
|
|
|
|
pt.authorId as pt_authorId,
|
|
|
|
|
pt.style as pt_style,
|
|
|
|
|
pt.Attribute_71 as pt_attribute71,
|
|
|
|
|
|
|
|
|
|
st.spellbuyProductId as st_spellbuyProductId,
|
|
|
|
|
st.fkProductId as st_fkProductId,
|
|
|
|
|
st.spellbuyStartDate as st_spellbuyStartDate,
|
|
|
|
|
st.spellbuyEndDate as st_spellbuyEndDate,
|
|
|
|
|
st.spellbuyCount as st_spellbuyCount,
|
|
|
|
|
st.spellbuyPrice as st_spellbuyPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice,
|
|
|
|
|
st.actionName as st_actionName,
|
|
|
|
|
st.spSinglePrice as st_spSinglePrice,
|
|
|
|
|
st.productPeriod as st_productPeriod,
|
|
|
|
|
st.spellbuyLimit as st_spellbuyLimit,
|
|
|
|
|
st.spStatus as st_spStatus,
|
|
|
|
|
st.spellbuyType as st_spellbuyType,
|
|
|
|
|
st.Attribute_64 as st_attribute64,
|
|
|
|
|
st.Attribute_65 as st_attribute65
|
|
|
|
|
FROM product pt, spellbuyproduct st
|
|
|
|
|
WHERE st.fkProductId = pt.productId AND st.spStatus <> 1
|
|
|
|
|
GROUP BY pt.productId
|
|
|
|
|
ORDER BY st.spellbuyCount DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页最新上架商品 -->
|
|
|
|
|
<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
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
order by st.spellbuyStartDate desc
|
|
|
|
|
<select id="indexNewProductList" resultMap="ProductSpellbuyproductMap">
|
|
|
|
|
SELECT
|
|
|
|
|
pt.productId as pt_productId,
|
|
|
|
|
pt.productName as pt_productName,
|
|
|
|
|
pt.productPrice as pt_productPrice,
|
|
|
|
|
pt.marketPrice as pt_marketPrice,
|
|
|
|
|
pt.singlePrice as pt_singlePrice,
|
|
|
|
|
pt.productLimit as pt_productLimit,
|
|
|
|
|
pt.productRealPrice as pt_productRealPrice,
|
|
|
|
|
pt.productTitle as pt_productTitle,
|
|
|
|
|
pt.productDetail as pt_productDetail,
|
|
|
|
|
pt.productType as pt_productType,
|
|
|
|
|
pt.productBrand as pt_productBrand,
|
|
|
|
|
pt.headImage as pt_headImage,
|
|
|
|
|
pt.status as pt_status,
|
|
|
|
|
pt.isShow as pt_isShow,
|
|
|
|
|
pt.isVirtual as pt_isVirtual,
|
|
|
|
|
pt.isNeedLogic as pt_isNeedLogic,
|
|
|
|
|
pt.logicURL as pt_logicURL,
|
|
|
|
|
pt.shopId as pt_shopId,
|
|
|
|
|
pt.authorId as pt_authorId,
|
|
|
|
|
pt.style as pt_style,
|
|
|
|
|
pt.Attribute_71 as pt_attribute71,
|
|
|
|
|
|
|
|
|
|
st.spellbuyProductId as st_spellbuyProductId,
|
|
|
|
|
st.fkProductId as st_fkProductId,
|
|
|
|
|
st.spellbuyStartDate as st_spellbuyStartDate,
|
|
|
|
|
st.spellbuyEndDate as st_spellbuyEndDate,
|
|
|
|
|
st.spellbuyCount as st_spellbuyCount,
|
|
|
|
|
st.spellbuyPrice as st_spellbuyPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice,
|
|
|
|
|
st.actionName as st_actionName,
|
|
|
|
|
st.spSinglePrice as st_spSinglePrice,
|
|
|
|
|
st.productPeriod as st_productPeriod,
|
|
|
|
|
st.spellbuyLimit as st_spellbuyLimit,
|
|
|
|
|
st.spStatus as st_spStatus,
|
|
|
|
|
st.spellbuyType as st_spellbuyType,
|
|
|
|
|
st.Attribute_64 as st_attribute64,
|
|
|
|
|
st.Attribute_65 as st_attribute65
|
|
|
|
|
FROM product pt, spellbuyproduct st
|
|
|
|
|
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="indexHotProductList" 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
|
|
|
|
|
order by st.productPeriod desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 正在购买列表 -->
|
|
|
|
|
<select id="getNowBuyList" resultType="me.mofun.entity.dto.SpellbuyrecordDTO">
|
|
|
|
|
select ur.*, sd.*, pt.*, 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
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 按商品类型查询商品 -->
|
|
|
|
|
<select id="indexHotProductList" resultMap="ProductSpellbuyproductMap">
|
|
|
|
|
SELECT
|
|
|
|
|
pt.productId as pt_productId,
|
|
|
|
|
pt.productName as pt_productName,
|
|
|
|
|
pt.productPrice as pt_productPrice,
|
|
|
|
|
pt.marketPrice as pt_marketPrice,
|
|
|
|
|
pt.singlePrice as pt_singlePrice,
|
|
|
|
|
pt.productLimit as pt_productLimit,
|
|
|
|
|
pt.productRealPrice as pt_productRealPrice,
|
|
|
|
|
pt.productTitle as pt_productTitle,
|
|
|
|
|
pt.productDetail as pt_productDetail,
|
|
|
|
|
pt.productType as pt_productType,
|
|
|
|
|
pt.productBrand as pt_productBrand,
|
|
|
|
|
pt.headImage as pt_headImage,
|
|
|
|
|
pt.status as pt_status,
|
|
|
|
|
pt.isShow as pt_isShow,
|
|
|
|
|
pt.isVirtual as pt_isVirtual,
|
|
|
|
|
pt.isNeedLogic as pt_isNeedLogic,
|
|
|
|
|
pt.logicURL as pt_logicURL,
|
|
|
|
|
pt.shopId as pt_shopId,
|
|
|
|
|
pt.authorId as pt_authorId,
|
|
|
|
|
pt.style as pt_style,
|
|
|
|
|
pt.Attribute_71 as pt_attribute71,
|
|
|
|
|
|
|
|
|
|
st.spellbuyProductId as st_spellbuyProductId,
|
|
|
|
|
st.fkProductId as st_fkProductId,
|
|
|
|
|
st.spellbuyStartDate as st_spellbuyStartDate,
|
|
|
|
|
st.spellbuyEndDate as st_spellbuyEndDate,
|
|
|
|
|
st.spellbuyCount as st_spellbuyCount,
|
|
|
|
|
st.spellbuyPrice as st_spellbuyPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice,
|
|
|
|
|
st.actionName as st_actionName,
|
|
|
|
|
st.spSinglePrice as st_spSinglePrice,
|
|
|
|
|
st.productPeriod as st_productPeriod,
|
|
|
|
|
st.spellbuyLimit as st_spellbuyLimit,
|
|
|
|
|
st.spStatus as st_spStatus,
|
|
|
|
|
st.spellbuyType as st_spellbuyType,
|
|
|
|
|
st.Attribute_64 as st_attribute64,
|
|
|
|
|
st.Attribute_65 as st_attribute65
|
|
|
|
|
FROM product pt, spellbuyproduct st
|
|
|
|
|
WHERE st.fkProductId = pt.productId AND st.spStatus <> 1
|
|
|
|
|
GROUP BY pt.productId
|
|
|
|
|
ORDER BY st.productPeriod DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 他们正在购买 -->
|
|
|
|
|
<select id="getNowBuyList" resultMap="SpellbuyrecordDTOMap">
|
|
|
|
|
SELECT
|
|
|
|
|
ur.userId as ur_userId, ur.userName as ur_userName, ur.userPwd as ur_userPwd,
|
|
|
|
|
ur.changePwdNo as ur_changePwdNo, ur.changePwdTime as ur_changePwdTime,
|
|
|
|
|
ur.realName as ur_realName, ur.cardNo as ur_cardNo, ur.mobilePhone as ur_mobilePhone,
|
|
|
|
|
ur.mobileCheck as ur_mobileCheck, ur.phone as ur_phone, ur.groupIdList as ur_groupIdList,
|
|
|
|
|
ur.qq as ur_qq, ur.qqOpenId as ur_qqOpenId, ur.mail as ur_mail, ur.mailCheck as ur_mailCheck,
|
|
|
|
|
ur.mailKey as ur_mailKey, ur.smsKey as ur_smsKey, ur.sex as ur_sex, ur.birthday as ur_birthday,
|
|
|
|
|
ur.faceImg as ur_faceImg, ur.location as ur_location, ur.postNo as ur_postNo,
|
|
|
|
|
ur.ip_address as ur_ipAddress, ur.ip_location as ur_ipLocation, ur.oldIpAddress as ur_oldIpAddress,
|
|
|
|
|
ur.marital_status as ur_maritalStatus, ur.Monthly_income as ur_monthlyIncome,
|
|
|
|
|
ur.Interests as ur_Interests, ur.Attribute_22 as ur_attribute22, ur.oldDate as ur_oldDate,
|
|
|
|
|
ur.newDate as ur_newDate, ur.balance as ur_balance, ur.userType as ur_userType,
|
|
|
|
|
ur.experience as ur_experience, ur.signature as ur_signature, ur.invite as ur_invite,
|
|
|
|
|
ur.inviteShortURL as ur_inviteShortURL, ur.commissionCount as ur_commissionCount,
|
|
|
|
|
ur.commissionBalance as ur_commissionBalance, ur.commissionMention as ur_commissionMention,
|
|
|
|
|
ur.commissionPoints as ur_commissionPoints, ur.shopId as ur_shopId, ur.creatorId as ur_creatorId,
|
|
|
|
|
ur.jobTags as ur_jobTags, ur.roleName as ur_roleName, ur.jobName as ur_jobName,
|
|
|
|
|
|
|
|
|
|
sd.spellbuyRecordId as sd_spellbuyRecordId, sd.fkSpellbuyProductId as sd_fkSpellbuyProductId,
|
|
|
|
|
sd.buyer as sd_buyer, sd.buyPrice as sd_buyPrice, sd.buyDate as sd_buyDate,
|
|
|
|
|
sd.spRandomNo as sd_spRandomNo, sd.spWinningStatus as sd_spWinningStatus,
|
|
|
|
|
sd.buyStatus as sd_buyStatus, sd.buyIp as sd_buyIp, sd.buyLocal as sd_buyLocal,
|
|
|
|
|
sd.buySource as sd_buySource, sd.Attribute_66 as sd_attribute66, sd.Attribute_67 as sd_attribute67,
|
|
|
|
|
|
|
|
|
|
pt.productId as pt_productId, pt.productName as pt_productName, pt.productPrice as pt_productPrice,
|
|
|
|
|
pt.marketPrice as pt_marketPrice, pt.singlePrice as pt_singlePrice, pt.productLimit as pt_productLimit,
|
|
|
|
|
pt.productRealPrice as pt_productRealPrice, pt.productTitle as pt_productTitle,
|
|
|
|
|
pt.productDetail as pt_productDetail, pt.productType as pt_productType,
|
|
|
|
|
pt.productBrand as pt_productBrand, pt.headImage as pt_headImage, pt.status as pt_status,
|
|
|
|
|
pt.isShow as pt_isShow, pt.isVirtual as pt_isVirtual, pt.isNeedLogic as pt_isNeedLogic,
|
|
|
|
|
pt.logicURL as pt_logicURL, pt.shopId as pt_shopId, pt.authorId as pt_authorId,
|
|
|
|
|
pt.style as pt_style, pt.Attribute_71 as pt_attribute71,
|
|
|
|
|
|
|
|
|
|
st.spellbuyProductId as st_spellbuyProductId, st.fkProductId as st_fkProductId,
|
|
|
|
|
st.spellbuyStartDate as st_spellbuyStartDate, st.spellbuyEndDate as st_spellbuyEndDate,
|
|
|
|
|
st.spellbuyCount as st_spellbuyCount, st.spellbuyPrice as st_spellbuyPrice,
|
|
|
|
|
st.marketPrice as st_marketPrice, st.actionName as st_actionName, st.spSinglePrice as st_spSinglePrice,
|
|
|
|
|
st.productPeriod as st_productPeriod, st.spellbuyLimit as st_spellbuyLimit, st.spStatus as st_spStatus,
|
|
|
|
|
st.spellbuyType as st_spellbuyType, st.Attribute_64 as st_attribute64, st.Attribute_65 as st_attribute65
|
|
|
|
|
FROM user ur, spellbuyrecord sd, product pt, spellbuyproduct st
|
|
|
|
|
WHERE sd.buyer = ur.userId AND sd.fkSpellbuyProductId = st.spellbuyProductId AND st.fkProductId = pt.productId
|
|
|
|
|
ORDER BY sd.buyDate DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页按商品类型查询商品 -->
|
|
|
|
|
<select id="findProductByTypeId" resultType="java.util.Map">
|
|
|
|
|
select pt.*, st.*
|
|
|
|
|
from product pt, spellbuyproduct st
|
|
|
|
|
where st.fkProductId=pt.productId
|
|
|
|
|
and st.spStatus <> 1
|
|
|
|
|
SELECT
|
|
|
|
|
pt.*,
|
|
|
|
|
st.*
|
|
|
|
|
FROM product pt, spellbuyproduct st
|
|
|
|
|
WHERE st.fkProductId = pt.productId AND st.spStatus <> 1
|
|
|
|
|
<if test="typeId != null and 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>
|
|
|
|
|
AND (1=2
|
|
|
|
|
OR pt.productType = #{typeId}
|
|
|
|
|
<if test="childTypeIds != null and childTypeIds.size() > 0">
|
|
|
|
|
OR pt.productType IN
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" open="(" separator="," close=")">
|
|
|
|
|
#{childTypeId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
GROUP by pt.productId
|
|
|
|
|
GROUP BY pt.productId
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 商品页按商品类型查询 -->
|
|
|
|
|
<!-- 商品页按商品类型查询商品 -->
|
|
|
|
|
<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
|
|
|
|
|
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
|
|
|
|
|
<if test="typeId != null and 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>
|
|
|
|
|
AND (1=2
|
|
|
|
|
OR pt.productType = #{typeId}
|
|
|
|
|
<if test="childTypeIds != null and childTypeIds.size() > 0">
|
|
|
|
|
OR pt.productType IN
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" open="(" separator="," close=")">
|
|
|
|
|
#{childTypeId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="brandId != null and 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
|
|
|
|
|
AND pt.productBrand = #{brandId}
|
|
|
|
|
</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>
|
|
|
|
|
<otherwise>
|
|
|
|
|
GROUP BY st.spellbuyProductId
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 商品页按商品类型及所属用户查询 -->
|
|
|
|
|
<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
|
|
|
|
|
<!-- 商品页按商品类型及所属用户查询商品 -->
|
|
|
|
|
<select id="productByTypeIdListAndShopId" resultMap="ProductSpellbuyproductMap">
|
|
|
|
|
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
|
|
|
|
|
<if test="typeId != null and 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>
|
|
|
|
|
AND (1=2
|
|
|
|
|
OR pt.productType = #{typeId}
|
|
|
|
|
<if test="childTypeIds != null and childTypeIds.size() > 0">
|
|
|
|
|
OR pt.productType IN
|
|
|
|
|
<foreach collection="childTypeIds" item="childTypeId" open="(" separator="," close=")">
|
|
|
|
|
#{childTypeId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="brandId != null and 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
|
|
|
|
|
AND pt.productBrand = #{brandId}
|
|
|
|
|
</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>
|
|
|
|
|
<otherwise>
|
|
|
|
|
GROUP BY st.spellbuyProductId
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 搜索商品 -->
|
|
|
|
|
<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}, '%')
|
|
|
|
|
<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 id="searchProduct" resultMap="ProductSpellbuyproductMap">
|
|
|
|
|
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>
|
|
|
|
|
<otherwise>
|
|
|
|
|
GROUP BY st.spellbuyProductId
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 其他方法的SQL映射... -->
|
|
|
|
|
<!-- 最新参与 -->
|
|
|
|
|
<select id="latestParticipate" resultType="java.util.Map">
|
|
|
|
|
select ur.*, sd.*
|
|
|
|
|
from user ur, spellbuyrecord sd
|
|
|
|
|
where sd.buyer=ur.userId
|
|
|
|
|
and sd.fkSpellbuyProductId = #{spellbuyProductId}
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
SELECT
|
|
|
|
|
ur.*,
|
|
|
|
|
sd.*
|
|
|
|
|
FROM user ur, spellbuyrecord sd
|
|
|
|
|
WHERE sd.buyer = ur.userId AND sd.fkSpellbuyProductId = #{spellbuyProductId}
|
|
|
|
|
ORDER BY sd.buyDate DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 获取某商品最新参与人数 -->
|
|
|
|
|
<select id="latestParticipateByCount" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
FROM user ur, spellbuyrecord sd
|
|
|
|
|
WHERE sd.buyer = ur.userId AND sd.fkSpellbuyProductId = #{spellbuyProductId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<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 id="getRandomNumberListPage" resultType="java.util.Map">
|
|
|
|
|
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,
|
|
|
|
|
<!-- 查询某用户的购买记录 -->
|
|
|
|
|
<select id="buyHistoryByUser" resultType="me.mofun.entity.pojo.BuyHistoryJSON">
|
|
|
|
|
SELECT
|
|
|
|
|
st.spellbuyProductId as productId,
|
|
|
|
|
pt.productName as productName,
|
|
|
|
|
pt.productTitle as productTitle,
|
|
|
|
|
pt.headImage as productImg,
|
|
|
|
|
st.productPeriod as productPeriod,
|
|
|
|
|
st.spStatus as buyStatus,
|
|
|
|
|
sd.buyDate as buyTime,
|
|
|
|
|
sum(sd.buyPrice) as buyCount,
|
|
|
|
|
SUM(sd.buyPrice) as buyCount,
|
|
|
|
|
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}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
|
|
AND sd.buyDate <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY st.spellbuyProductId
|
|
|
|
|
ORDER BY sd.buyDate DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询某用户购买记录详情 -->
|
|
|
|
|
<select id="getBuyHistoryByDetail" resultType="me.mofun.entity.pojo.BuyHistoryJSON">
|
|
|
|
|
SELECT
|
|
|
|
|
st.spellbuyProductId as productId,
|
|
|
|
|
pt.productName as productName,
|
|
|
|
|
pt.productTitle as productTitle,
|
|
|
|
|
pt.headImage as productImg,
|
|
|
|
|
st.productPeriod as productPeriod,
|
|
|
|
|
st.spStatus as buyStatus,
|
|
|
|
|
sd.buyDate as buyTime,
|
|
|
|
|
SUM(sd.buyPrice) as buyCount,
|
|
|
|
|
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}
|
|
|
|
|
AND st.spellbuyProductId = #{productId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 获取登录用户自己的历史购买记录 -->
|
|
|
|
|
<select id="getUserByHistory" resultMap="SpellbuyrecordExtMap">
|
|
|
|
|
SELECT
|
|
|
|
|
sd.*,
|
|
|
|
|
sp.spSinglePrice
|
|
|
|
|
FROM spellbuyrecord sd, spellbuyproduct sp
|
|
|
|
|
WHERE sd.buyer = #{userId}
|
|
|
|
|
AND sd.fkSpellbuyProductId = #{fkSpellbuyProductId}
|
|
|
|
|
AND sd.fkSpellbuyProductId = sp.spellbuyProductId
|
|
|
|
|
ORDER BY sd.buyDate DESC
|
|
|
|
|
LIMIT 8
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 统计方法 -->
|
|
|
|
|
<select id="getAllByCount" resultType="java.math.BigDecimal">
|
|
|
|
|
SELECT SUM(buyPrice) FROM spellbuyrecord
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findSumByBuyPriceByUserId" resultType="java.math.BigDecimal">
|
|
|
|
|
SELECT SUM(buyPrice) FROM spellbuyrecord WHERE buyer = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="buyHistoryByUserByCount" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*) FROM (
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
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}
|
|
|
|
|
AND sd.buyDate <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
group by st.spellbuyProductId
|
|
|
|
|
order by sd.buyDate desc
|
|
|
|
|
GROUP BY st.spellbuyProductId
|
|
|
|
|
) as counts
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getRandomNumberListPageByCount" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
FROM randomnumber rr
|
|
|
|
|
WHERE rr.productId = #{spellbuyProductId} AND rr.userId = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|