功能模块迁移 以及部分配置修改2

master
xuao 2 months ago
parent 1921dd42b8
commit f7b1f762be

@ -64,7 +64,7 @@
<poi.version>4.1.2</poi.version>
<easyexcel.version>3.3.0</easyexcel.version>
<swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version>
<javax.servlet-api.version>4.1.0</javax.servlet-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<artemis-http-client.version>1.1.2</artemis-http-client.version>
<jaxb-runtime.version>2.3.1</jaxb-runtime.version>
</properties>
@ -267,6 +267,7 @@
<version>${javax.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
@ -425,6 +426,16 @@
</dependency>
<dependency>
<groupId>icu.mhb</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>

@ -1,6 +1,6 @@
package me.mofun.controller;
import me.mofun.entity.News;
import me.mofun.entity.Newstype;
import me.mofun.entity.Suggestion;
import me.mofun.entity.pojo.HelpInfo;
@ -10,121 +10,139 @@ import me.mofun.service.ISysConfigureService;
import me.mofun.utils.ViewUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
/**
*
*
*/
@Controller
@RequestMapping("/help")
public class HelpController {
@Autowired
private ViewUtils viewUtils;
private final String module = "login";
private Suggestion suggestion;
private String rnd;
private List<HelpInfo> helpInfoList;
private List<Newstype> helpTypeList;
@Autowired
private ISysConfigureService sysConfigureService;
@Autowired
private INewstypeService newsTypeService;
@Autowired
private INewsService newsService;
HttpServletRequest request = null;
HttpServletResponse response = null;
public Integer newsId; //帮助信息的文章编号,亦即 news表中的 newsId
// public String index(){
// News news = newsService.getById(newsId.toString());
// helpTypeList = newsTypeService.indexNewsTypeByParentId(2);
// helpInfoList = new ArrayList<HelpInfo>();
// for(NewsType nt:helpTypeList){
// HelpInfo item = new HelpInfo();
// List<News> newsList = newsService.indexNews(nt.getId(),null);
// item.setCategoryId(nt.getId());
// item.setCategoryName(nt.getCategoryName());
// item.setInfoList(newsList);
// helpInfoList.add(item);
// }
// return "index";
// }
// public String doSuggestion(){
// request = Struts2Utils.getRequest();
// try {
// Cookie[] cookies = request.getCookies();
// if(request.isRequestedSessionIdFromCookie()){
// for (int i = 0; i < cookies.length; i++) {
// Cookie cookie = cookies[i];
// if(cookie.getName().equals("rndCode")){
// String rndCode = cookie.getValue();
// if(rnd.trim().equalsIgnoreCase(rndCode)){
// sysConfigureService.doSuggestion(suggestion);
// Struts2Utils.render("text/html", "<script>alert(\"提交成功!感谢您的投诉建议。\");window.location.href=\"/index.html\";</script>","encoding:UTF-8");
// }else{
// Struts2Utils.render("text/html", "<script>alert(\"验证码输入错误!\");history.go(-1);</script>","encoding:UTF-8");
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// Struts2Utils.render("text/html", "<script>alert(\"操作失败,请联系管理员!\");history.go(-1);</script>","encoding:UTF-8");
// }
//
// return null;
// }
@GetMapping("/deliveryFees")
public ModelAndView deliveryFees() {
return viewUtils.create(module, "deliveryFees");
}
@GetMapping("/prodCheck")
public ModelAndView prodCheck() {
return viewUtils.create(module, "prodCheck");
}
@GetMapping("/shiptwo")
public ModelAndView shiptwo() {
return viewUtils.create(module, "shiptwo");
}
// 模块名称,用于视图路径拼接
private final String module = "help";
@GetMapping("/privacy")
public ModelAndView privacy() {
return viewUtils.create(module, "privacy");
}
@GetMapping("/userExperience")
public ModelAndView userExperience() {
return viewUtils.create(module, "userExperience");
}
@Autowired
private ISysConfigureService sysConfigureService;
@GetMapping("/qqgroup")
public ModelAndView qqgroup() {
return viewUtils.create(module, "qqgroup");
}
@Autowired
private INewstypeService newsTypeService;
@GetMapping("/show")
public ModelAndView show() {
return viewUtils.create(module, "show");
}
@Autowired
private INewsService newsService;
/**
*
*
*
* @param newsId ID
* @return ModelAndView
*/
@GetMapping("/index")
public ModelAndView index(@RequestParam(required = false) Integer newsId) {
ModelAndView mav = viewUtils.create(module, "index");
// 获取新闻详情如果newsId存在
if (newsId != null) {
News news = newsService.getById(newsId.toString());
mav.addObject("news", news);
}
// 获取帮助类型列表父ID为2的新闻类型
List<Newstype> helpTypeList = newsTypeService.indexNewsTypeByParentId(2);
mav.addObject("helpTypeList", helpTypeList);
// 构建帮助信息列表,每个类型下包含对应的新闻
List<HelpInfo> helpInfoList = new ArrayList<>();
if (helpTypeList != null && !helpTypeList.isEmpty()) {
for (Newstype newsType : helpTypeList) {
HelpInfo helpInfo = new HelpInfo();
helpInfo.setCategoryId(newsType.getId());
helpInfo.setCategoryName(newsType.getCategoryName());
// 获取该类型下的新闻列表
List<News> newsList = newsService.indexNews(newsType.getId(), null);
helpInfo.setInfoList(newsList);
helpInfoList.add(helpInfo);
}
}
mav.addObject("helpInfoList", helpInfoList);
return mav;
}
/**
*
*
*
* @param request
* @param response
* @param suggestion
* @param rnd
* @throws IOException IO
*/
@PostMapping("/doSuggestion")
public void doSuggestion(HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute Suggestion suggestion,
@RequestParam(required = false) String rnd) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
// 校验参数
if (suggestion == null) {
out.print("<script>alert(\"提交内容不能为空!\");history.go(-1);</script>");
return;
}
// 验证验证码
Cookie[] cookies = request.getCookies();
if (request.isRequestedSessionIdFromCookie() && cookies != null) {
for (Cookie cookie : cookies) {
if ("rndCode".equals(cookie.getName())) {
String rndCode = cookie.getValue();
// 验证验证码是否正确
if (rnd != null && rnd.trim().equalsIgnoreCase(rndCode)) {
// 保存建议
sysConfigureService.doSuggestion(suggestion);
out.print("<script>alert(\"提交成功!感谢您的投诉建议。\");window.location.href=\"/index.html\";</script>");
} else {
out.print("<script>alert(\"验证码输入错误!\");history.go(-1);</script>");
}
return;
}
}
}
// 未找到验证码Cookie
out.print("<script>alert(\"验证码验证失败!请刷新页面重试。\");history.go(-1);</script>");
} catch (Exception e) {
e.printStackTrace();
out.print("<script>alert(\"操作失败,请联系管理员!\");history.go(-1);</script>");
} finally {
if (out != null) {
out.close();
}
}
}
// 以下为页面跳转方法与原Action对应
@GetMapping("/openCookie")
public ModelAndView openCookie() {
@ -181,4 +199,38 @@ public class HelpController {
return viewUtils.create(module, "suggestion");
}
}
@GetMapping("/deliveryFees")
public ModelAndView deliveryFees() {
return viewUtils.create(module, "deliveryFees");
}
@GetMapping("/prodCheck")
public ModelAndView prodCheck() {
return viewUtils.create(module, "prodCheck");
}
@GetMapping("/shiptwo")
public ModelAndView shiptwo() {
return viewUtils.create(module, "shiptwo");
}
@GetMapping("/privacy")
public ModelAndView privacy() {
return viewUtils.create(module, "privacy");
}
@GetMapping("/userExperience")
public ModelAndView userExperience() {
return viewUtils.create(module, "userExperience");
}
@GetMapping("/qqgroup")
public ModelAndView qqgroup() {
return viewUtils.create(module, "qqgroup");
}
@GetMapping("/show")
public ModelAndView show() {
return viewUtils.create(module, "show");
}
}

@ -1,6 +1,5 @@
package me.mofun.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import me.mofun.entity.*;
import me.mofun.entity.pojo.BuyHistoryJSON;
import me.mofun.entity.pojo.ProductJSON;
@ -23,11 +22,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,16 @@
package me.mofun.entity.dto;
import lombok.Data;
import me.mofun.entity.Latestlottery;
import me.mofun.entity.Shareimage;
import me.mofun.entity.Shareinfo;
import java.io.Serializable;
@Data
public class ShareinfoShareimageLatestlotteryDTO implements Serializable {
private Shareinfo shareinfo;
private Shareimage shareimage;
private Latestlottery latestlottery;
}

@ -0,0 +1,21 @@
package me.mofun.entity.dto;
import lombok.Data;
import me.mofun.entity.Product;
import me.mofun.entity.Spellbuyproduct;
import me.mofun.entity.Spellbuyrecord;
import me.mofun.entity.User;
@Data
public class SpellbuyrecordDTO {
private Product product;
private User user;
private Spellbuyrecord spellbuyrecord;
private Spellbuyproduct spellbuyproduct;
}

@ -0,0 +1,50 @@
package me.mofun.entity.pojo;
public class CommissionqueryJSON {
private String userId;
private String userName;
private String date;
private String description;
private Double buyMoney;
private Double commission;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Double getBuyMoney() {
return buyMoney;
}
public void setBuyMoney(Double buyMoney) {
this.buyMoney = buyMoney;
}
public Double getCommission() {
return commission;
}
public void setCommission(Double commission) {
this.commission = commission;
}
}

@ -0,0 +1,54 @@
package me.mofun.entity.pojo;
public class RandomNumberJSON {
private String buyDate;
private String buyCount;
private String randomNumbers;
public RandomNumberJSON() {
super();
}
public RandomNumberJSON(String buyDate, String buyCount,
String randomNumbers) {
super();
this.buyDate = buyDate;
this.buyCount = buyCount;
this.randomNumbers = randomNumbers;
}
public String getBuyCount() {
return buyCount;
}
public void setBuyCount(String buyCount) {
this.buyCount = buyCount;
}
public String getBuyDate() {
return buyDate;
}
public void setBuyDate(String buyDate) {
this.buyDate = buyDate;
}
public String getRandomNumbers() {
return randomNumbers;
}
public void setRandomNumbers(String randomNumbers) {
this.randomNumbers = randomNumbers;
}
}

@ -0,0 +1,14 @@
package me.mofun.entity.vo;
import lombok.Data;
import me.mofun.entity.Commissionquery;
import me.mofun.entity.User;
@Data
public class CommissionqueryUserVo {
private Commissionquery commissionquery;
private User user;
}

@ -1,7 +1,6 @@
package me.mofun.service;
import com.baomidou.mybatisplus.extension.service.IService;
import icu.mhb.mybatisplus.plugln.base.service.JoinIService;
import me.mofun.entity.User;
import me.mofun.entity.Userbyaddress;
import me.mofun.entity.vo.Pagination;
@ -16,7 +15,7 @@ import java.util.List;
* @author xu
* @since 2025-08-23
*/
public interface IUserService extends IService<User> {
public interface IUserService extends JoinIService<User> {
public int add(User user) ;
@ -75,7 +74,7 @@ public interface IUserService extends IService<User> {
* @param pageSize
* @return
*/
public Pagination adminUserList(String typeId,String keyword,String orderName,int pageNo,int pageSize);
public Pagination adminUserList(String typeId, String keyword, String orderName, int pageNo, int pageSize);
/**
*

@ -37,16 +37,6 @@ spring:
username: ipdz
password: ipdz@test
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect # 从jdbc.properties同步方言
hibernate:
ddl-auto: none # 从applicationContext-base.xml同步原配置为none
show-sql: true
properties:
hibernate:
format_sql: true
use_sql_comments: true # 从applicationContext-base.xml补充
jdbc.batch_size: 30
# 线程池配置从thread.properties同步
task:
execution:

@ -2,18 +2,336 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.mofun.mapper.ShareinfoMapper">
<!-- 通用查询映射结果 -->
<!-- 基础ResultMap -->
<resultMap id="BaseResultMap" type="me.mofun.entity.Shareinfo">
<id column="uid" property="uid" />
<result column="productId" property="productId" />
<result column="shareTitle" property="shareTitle" />
<result column="shareContent" property="shareContent" />
<result column="upCount" property="upCount" />
<result column="replyCount" property="replyCount" />
<result column="reward" property="reward" />
<result column="shareDate" property="shareDate" />
<result column="userId" property="userId" />
<result column="status" property="status" />
<id column="uid" property="uid"/>
<result column="productId" property="productId"/>
<result column="shareTitle" property="shareTitle"/>
<result column="shareContent" property="shareContent"/>
<result column="upCount" property="upCount"/>
<result column="replyCount" property="replyCount"/>
<result column="reward" property="reward"/>
<result column="shareDate" property="shareDate"/>
<result column="userId" property="userId"/>
<result column="status" property="status"/>
</resultMap>
</mapper>
<!-- 关联Shareimage的ResultMap -->
<resultMap id="ShareinfoWithShareimageResultMap" type="me.mofun.entity.Shareinfo" extends="BaseResultMap">
<association property="shareimage" javaType="me.mofun.entity.Shareimage">
<id column="se_uid" property="uid"/>
<result column="shareInfoId" property="shareInfoId"/>
<result column="images" property="images"/>
</association>
</resultMap>
<!-- 关联Latestlottery的ResultMap -->
<resultMap id="ShareinfoWithLatestlotteryResultMap" type="me.mofun.entity.Shareinfo" extends="BaseResultMap">
<association property="latestlottery" javaType="me.mofun.entity.Latestlottery">
<id column="ly_id" property="id"/>
<result column="ly_productId" property="productId"/>
<result column="productType" property="productType"/>
<result column="productName" property="productName"/>
<result column="productTitle" property="productTitle"/>
<result column="productPrice" property="productPrice"/>
<result column="productImg" property="productImg"/>
<result column="productPeriod" property="productPeriod"/>
<result column="userName" property="userName"/>
<result column="Location" property="Location"/>
<result column="announcedTime" property="announcedTime"/>
<result column="announcedType" property="announcedType"/>
<result column="buyTime" property="buyTime"/>
<result column="spellbuyRecordId" property="spellbuyRecordId"/>
<result column="spellbuyProductId" property="spellbuyProductId"/>
<result column="randomNumber" property="randomNumber"/>
<result column="dateSum" property="dateSum"/>
<result column="sscNumber" property="sscNumber"/>
<result column="sscPeriod" property="sscPeriod"/>
<result column="buyNumberCount" property="buyNumberCount"/>
<result column="ly_userId" property="userId"/>
<result column="buyUser" property="buyUser"/>
<result column="userFace" property="userFace"/>
<result column="ly_status" property="status"/>
<result column="shareStatus" property="shareStatus"/>
<result column="shareId" property="shareId"/>
<result column="buyType" property="buyType"/>
</association>
</resultMap>
<!-- 关联Shareimage和Latestlottery的ResultMap -->
<resultMap id="ShareinfoWithAllResultMap" type="me.mofun.entity.Shareinfo" extends="ShareinfoWithShareimageResultMap">
<association property="latestlottery" javaType="me.mofun.entity.Latestlottery">
<id column="ly_id" property="id"/>
<result column="ly_productId" property="productId"/>
<result column="productType" property="productType"/>
<result column="productName" property="productName"/>
<result column="productTitle" property="productTitle"/>
<result column="productPrice" property="productPrice"/>
<result column="productImg" property="productImg"/>
<result column="productPeriod" property="productPeriod"/>
<result column="userName" property="userName"/>
<result column="Location" property="Location"/>
<result column="announcedTime" property="announcedTime"/>
<result column="announcedType" property="announcedType"/>
<result column="buyTime" property="buyTime"/>
<result column="spellbuyRecordId" property="spellbuyRecordId"/>
<result column="spellbuyProductId" property="spellbuyProductId"/>
<result column="randomNumber" property="randomNumber"/>
<result column="dateSum" property="dateSum"/>
<result column="sscNumber" property="sscNumber"/>
<result column="sscPeriod" property="sscPeriod"/>
<result column="buyNumberCount" property="buyNumberCount"/>
<result column="ly_userId" property="userId"/>
<result column="buyUser" property="buyUser"/>
<result column="userFace" property="userFace"/>
<result column="ly_status" property="status"/>
<result column="shareStatus" property="shareStatus"/>
<result column="shareId" property="shareId"/>
<result column="buyType" property="buyType"/>
</association>
</resultMap>
<!-- DTO结果映射 -->
<resultMap id="ShareinfoShareimageLatestlotteryDTOResultMap" type="me.mofun.entity.dto.ShareinfoShareimageLatestlotteryDTO">
<association property="shareinfo" resultMap="BaseResultMap"/>
<association property="shareimage" javaType="me.mofun.entity.Shareimage">
<id column="se_uid" property="uid"/>
<result column="shareInfoId" property="shareInfoId"/>
<result column="images" property="images"/>
</association>
<association property="latestlottery" javaType="me.mofun.entity.Latestlottery">
<id column="ly_id" property="id"/>
<result column="ly_productId" property="productId"/>
<!-- 其他字段与上面相同 -->
</association>
</resultMap>
<!-- 分页查询loadPageShare -->
<select id="loadPageShare" resultMap="ShareinfoShareimageLatestlotteryDTOResultMap">
select
so.*,
se.uid as se_uid, se.shareInfoId, se.images,
ly.id as ly_id, ly.productId as ly_productId, ly.productType, ly.productName,
ly.productTitle, ly.productPrice, ly.productImg, ly.productPeriod, ly.userName,
ly.Location, ly.announcedTime, ly.announcedType, ly.buyTime, ly.spellbuyRecordId,
ly.spellbuyProductId, ly.randomNumber, ly.dateSum, ly.sscNumber, ly.sscPeriod,
ly.buyNumberCount, ly.userId as ly_userId, ly.buyUser, ly.userFace, ly.status as ly_status,
ly.shareStatus, ly.shareId, ly.buyType
from shareinfo so
inner join shareimage se on so.uid = se.shareInfoId
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
group by so.uid
<if test="type == 'new20'">
order by so.shareDate desc
</if>
<if test="type == 'hot20'">
order by so.upCount desc
</if>
<if test="type == 'reply20'">
order by so.replyCount desc
</if>
</select>
<!-- 统计总数 -->
<select id="countPageShare" resultType="java.lang.Integer">
select count(DISTINCT(so.uid))
from shareinfo so
inner join shareimage se on so.uid = se.shareInfoId
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
</select>
<!-- adminShareList查询 -->
<select id="adminShareList" resultMap="ShareinfoWithLatestlotteryResultMap">
select
so.*,
ly.id as ly_id, ly.productId as ly_productId, ly.productType, ly.productName,
ly.productTitle, ly.productPrice, ly.productImg, ly.productPeriod, ly.userName,
ly.Location, ly.announcedTime, ly.announcedType, ly.buyTime, ly.spellbuyRecordId,
ly.spellbuyProductId, ly.randomNumber, ly.dateSum, ly.sscNumber, ly.sscPeriod,
ly.buyNumberCount, ly.userId as ly_userId, ly.buyUser, ly.userFace, ly.status as ly_status,
ly.shareStatus, ly.shareId, ly.buyType
from shareinfo so
inner join latestlottery ly on so.userId = ly.userId and so.productId = ly.spellbuyProductId
<where>
<if test="status != null and status != 'null' and status != ''">
and so.status = #{status}
</if>
</where>
<if test="type == 'new20'">
order by so.shareDate desc
</if>
<if test="type == 'hot20'">
order by so.upCount desc
</if>
<if test="type == 'reply20'">
order by so.replyCount desc
</if>
</select>
<!-- adminShareList总数 -->
<select id="countAdminShareList" resultType="java.lang.Integer">
select count(*)
from shareinfo so
inner join latestlottery ly on so.userId = ly.userId and so.productId = ly.spellbuyProductId
<where>
<if test="status != null and status != 'null' and status != ''">
and so.status = #{status}
</if>
</where>
</select>
<!-- shareShow查询 -->
<select id="shareShow" resultMap="ShareinfoWithLatestlotteryResultMap">
select
so.*,
ly.id as ly_id, ly.productId as ly_productId, ly.productType, ly.productName,
ly.productTitle, ly.productPrice, ly.productImg, ly.productPeriod, ly.userName,
ly.Location, ly.announcedTime, ly.announcedType, ly.buyTime, ly.spellbuyRecordId,
ly.spellbuyProductId, ly.randomNumber, ly.dateSum, ly.sscNumber, ly.sscPeriod,
ly.buyNumberCount, ly.userId as ly_userId, ly.buyUser, ly.userFace, ly.status as ly_status,
ly.shareStatus, ly.shareId, ly.buyType
from shareinfo so
inner join latestlottery ly on so.userId = ly.userId and so.productId = ly.spellbuyProductId
where so.uid = #{id}
</select>
<!-- productInfoShareListByProductId分页查询 -->
<select id="productInfoShareListByProductId" resultType="java.util.Map">
select
so.*, ly.*, sp.*, se.*, u.*
from shareinfo so
inner join latestlottery ly on so.userId = ly.userId and so.productId = ly.spellbuyProductId
inner join spellbuyproduct sp on so.productId = sp.spellbuyproductId
inner join shareimage se on se.shareinfoid = so.uid
inner join user u on so.userId = u.userId
where sp.fkProductId = #{id}
</select>
<!-- productInfoShareListByProductId总数 -->
<select id="countProductInfoShareListByProductId" resultType="java.lang.Integer">
select count(*)
from shareinfo so
inner join latestlottery ly on so.userId = ly.userId and so.productId = ly.spellbuyProductId
inner join spellbuyproduct sp on so.productId = sp.spellbuyproductId
inner join shareimage se on se.shareinfoid = so.uid
inner join user u on so.userId = u.userId
where sp.fkProductId = #{id}
</select>
<!-- shareByUser查询 -->
<select id="shareByUser" resultMap="ShareinfoWithAllResultMap">
select
so.*,
se.uid as se_uid, se.shareInfoId, se.images,
ly.id as ly_id, ly.productId as ly_productId, ly.productType, ly.productName,
ly.productTitle, ly.productPrice, ly.productImg, ly.productPeriod, ly.userName,
ly.Location, ly.announcedTime, ly.announcedType, ly.buyTime, ly.spellbuyRecordId,
ly.spellbuyProductId, ly.randomNumber, ly.dateSum, ly.sscNumber, ly.sscPeriod,
ly.buyNumberCount, ly.userId as ly_userId, ly.buyUser, ly.userFace, ly.status as ly_status,
ly.shareStatus, ly.shareId, ly.buyType
from shareinfo so
inner join shareimage se on so.uid = se.shareInfoId
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
and so.userId = #{userId}
<if test="startDate != null and startDate != ''">
and so.shareDate >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and so.shareDate <= #{endDate}
</if>
group by so.uid
order by so.shareDate desc
</select>
<!-- shareByUser总数 -->
<select id="countShareByUser" resultType="java.lang.Integer">
select count(*)
from shareinfo so
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
and so.userId = #{userId}
<if test="startDate != null and startDate != ''">
and so.shareDate >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and so.shareDate <= #{endDate}
</if>
</select>
<!-- getShareimage查询 -->
<select id="getShareimage" resultType="me.mofun.entity.Shareimage">
select * from shareimage where shareInfoId = #{shareId}
</select>
<!-- shareByComment查询 -->
<select id="shareByComment" resultType="java.util.Map">
select ss.*, ur.*
from sharecomments ss
inner join user ur on ss.userId = ur.userId
where ss.shareInfoId = #{shareId}
and ss.reCommentId is null
order by createDate desc
</select>
<!-- shareByComment总数 -->
<select id="countShareByComment" resultType="java.lang.Integer">
select count(*)
from sharecomments ss
inner join user ur on ss.userId = ur.userId
where ss.shareInfoId = #{shareId}
and ss.reCommentId is null
</select>
<!-- getReCommentList查询 -->
<select id="getReCommentList" resultType="java.util.Map">
select ss.*, ur.*
from sharecomments ss
inner join user ur on ss.userId = ur.userId
where ss.reCommentId = #{shareCommentId}
</select>
<!-- getIndexSharecommentsList查询 -->
<select id="getIndexSharecommentsList" resultType="java.util.Map">
select ss.*, ur.*
from sharecomments ss
inner join user ur on ss.userId = ur.userId
order by ss.createDate desc
limit 18
</select>
<!-- loadShareInfoByNew查询 -->
<select id="loadShareInfoByNew" resultMap="ShareinfoWithLatestlotteryResultMap">
select
so.*,
ly.id as ly_id, ly.productId as ly_productId, ly.productType, ly.productName,
ly.productTitle, ly.productPrice, ly.productImg, ly.productPeriod, ly.userName,
ly.Location, ly.announcedTime, ly.announcedType, ly.buyTime, ly.spellbuyRecordId,
ly.spellbuyProductId, ly.randomNumber, ly.dateSum, ly.sscNumber, ly.sscPeriod,
ly.buyNumberCount, ly.userId as ly_userId, ly.buyUser, ly.userFace, ly.status as ly_status,
ly.shareStatus, ly.shareId, ly.buyType
from shareinfo so
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
group by so.uid
<if test="type == 'new20'">
order by so.shareDate desc
</if>
<if test="type == 'hot20'">
order by so.upCount desc
</if>
<if test="type == 'reply20'">
order by so.replyCount desc
</if>
</select>
<!-- loadShareInfoByNew总数 -->
<select id="countLoadShareInfoByNew" resultType="java.lang.Integer">
select count(DISTINCT(so.uid))
from shareinfo so
inner join latestlottery ly on so.productId = ly.spellbuyProductId and so.userId = ly.userId
where so.status = 2
</select>
</mapper>

@ -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 &lt;&gt; 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 &lt;&gt; 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 &lt;&gt; 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 &lt;&gt; 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 &lt;&gt; 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 &lt;&gt; 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 &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and sd.buyDate &lt;= #{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>
Loading…
Cancel
Save