This commit is contained in:
yj 2024-12-21 16:43:20 +08:00
parent 006561127b
commit 4c8e29840b
30 changed files with 1965 additions and 338 deletions

View File

@ -109,6 +109,7 @@ mybatis:
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql

View File

@ -0,0 +1,116 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Comment;
import com.ruoyi.system.service.ICommentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 评论信息Controller
*
* @author ruoyi
* @date 2024-12-21
*/
@RestController
@RequestMapping("/system/comment")
public class CommentController extends BaseController
{
@Autowired
private ICommentService commentService;
/**
* 查询评论信息列表
*/
@PreAuthorize("@ss.hasPermi('system:comment:list')")
@GetMapping("/list")
public TableDataInfo list(Comment comment)
{
startPage();
List<Comment> list = commentService.selectCommentList(comment);
return getDataTable(list);
}
/**
* 导出评论信息列表
*/
@PreAuthorize("@ss.hasPermi('system:comment:export')")
@Log(title = "评论信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Comment comment)
{
List<Comment> list = commentService.selectCommentList(comment);
ExcelUtil<Comment> util = new ExcelUtil<Comment>(Comment.class);
util.exportExcel(response, list, "评论信息数据");
}
/**
* 获取评论信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:comment:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(commentService.selectCommentById(id));
}
/**
* 新增评论信息
*/
@PreAuthorize("@ss.hasPermi('system:comment:add')")
@Log(title = "评论信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Comment comment)
{
return toAjax(commentService.insertComment(comment));
}
/**
* 修改评论信息
*/
@PreAuthorize("@ss.hasPermi('system:comment:edit')")
@Log(title = "评论信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Comment comment)
{
return toAjax(commentService.updateComment(comment));
}
/**
* 删除评论信息
*/
@PreAuthorize("@ss.hasPermi('system:comment:remove')")
@Log(title = "评论信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(commentService.deleteCommentByIds(ids));
}
// @PreAuthorize("@ss.hasPermi('system:comment:list2')")
@Anonymous
@GetMapping("/list2")
public TableDataInfo list2(Comment comment)
{
startPage();
List<Comment> list = commentService.selectCommentList2(comment);
return getDataTable(list);
}
}

View File

@ -0,0 +1,107 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Commodity;
import com.ruoyi.system.service.ICommodityService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 商品信息Controller
*
* @author ruoyi
* @date 2024-12-20
*/
@RestController
@RequestMapping("/system/commodity")
public class CommodityController extends BaseController
{
@Autowired
private ICommodityService commodityService;
/**
* 查询商品信息列表
*/
// @PreAuthorize("@ss.hasPermi('system:commodity:list')")
@Anonymous
@GetMapping("/list")
public TableDataInfo list(Commodity commodity)
{
startPage();
List<Commodity> list = commodityService.selectCommodityList(commodity);
return getDataTable(list);
}
/**
* 导出商品信息列表
*/
@PreAuthorize("@ss.hasPermi('system:commodity:export')")
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Commodity commodity)
{
List<Commodity> list = commodityService.selectCommodityList(commodity);
ExcelUtil<Commodity> util = new ExcelUtil<Commodity>(Commodity.class);
util.exportExcel(response, list, "商品信息数据");
}
/**
* 获取商品信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:commodity:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(commodityService.selectCommodityById(id));
}
/**
* 新增商品信息
*/
@PreAuthorize("@ss.hasPermi('system:commodity:add')")
@Log(title = "商品信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Commodity commodity)
{
return toAjax(commodityService.insertCommodity(commodity));
}
/**
* 修改商品信息
*/
@PreAuthorize("@ss.hasPermi('system:commodity:edit')")
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Commodity commodity)
{
return toAjax(commodityService.updateCommodity(commodity));
}
/**
* 删除商品信息
*/
@PreAuthorize("@ss.hasPermi('system:commodity:remove')")
@Log(title = "商品信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(commodityService.deleteCommodityByIds(ids));
}
}

View File

@ -0,0 +1,116 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Favorite;
import com.ruoyi.system.service.IFavoriteService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 收藏信息Controller
*
* @author ruoyi
* @date 2024-12-20
*/
@RestController
@RequestMapping("/system/favorite")
public class FavoriteController extends BaseController
{
@Autowired
private IFavoriteService favoriteService;
/**
* 查询收藏信息列表
*/
@PreAuthorize("@ss.hasPermi('system:favorite:list')")
@GetMapping("/list")
public TableDataInfo list(Favorite favorite)
{
startPage();
List<Favorite> list = favoriteService.selectFavoriteList(favorite);
return getDataTable(list);
}
/**
* 导出收藏信息列表
*/
@PreAuthorize("@ss.hasPermi('system:favorite:export')")
@Log(title = "收藏信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Favorite favorite)
{
List<Favorite> list = favoriteService.selectFavoriteList(favorite);
ExcelUtil<Favorite> util = new ExcelUtil<Favorite>(Favorite.class);
util.exportExcel(response, list, "收藏信息数据");
}
/**
* 获取收藏信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:favorite:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(favoriteService.selectFavoriteById(id));
}
/**
* 新增收藏信息
*/
@PreAuthorize("@ss.hasPermi('system:favorite:add')")
@Log(title = "收藏信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Favorite favorite)
{
return toAjax(favoriteService.insertFavorite(favorite));
}
/**
* 修改收藏信息
*/
@PreAuthorize("@ss.hasPermi('system:favorite:edit')")
@Log(title = "收藏信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Favorite favorite)
{
return toAjax(favoriteService.updateFavorite(favorite));
}
/**
* 删除收藏信息
*/
@PreAuthorize("@ss.hasPermi('system:favorite:remove')")
@Log(title = "收藏信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(favoriteService.deleteFavoriteByIds(ids));
}
// @PreAuthorize("@ss.hasPermi('system:favorite:list2')")
@Anonymous
@GetMapping("/list2")
public TableDataInfo list2(Favorite favorite)
{
startPage();
List<Favorite> list = favoriteService.selectFavoriteList2(favorite);
return getDataTable(list);
}
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -22,10 +24,10 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 订单Controller
* 订单信息Controller
*
* @author ruoyi
* @date 2024-12-18
* @date 2024-12-20
*/
@RestController
@RequestMapping("/system/order")
@ -35,7 +37,7 @@ public class OrderController extends BaseController
private IOrderService orderService;
/**
* 查询订单列表
* 查询订单信息列表
*/
@PreAuthorize("@ss.hasPermi('system:order:list')")
@GetMapping("/list")
@ -47,20 +49,20 @@ public class OrderController extends BaseController
}
/**
* 导出订单列表
* 导出订单信息列表
*/
@PreAuthorize("@ss.hasPermi('system:order:export')")
@Log(title = "订单", businessType = BusinessType.EXPORT)
@Log(title = "订单信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Order order)
{
List<Order> list = orderService.selectOrderList(order);
ExcelUtil<Order> util = new ExcelUtil<Order>(Order.class);
util.exportExcel(response, list, "订单数据");
util.exportExcel(response, list, "订单信息数据");
}
/**
* 获取订单详细信息
* 获取订单信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:order:query')")
@GetMapping(value = "/{id}")
@ -70,10 +72,10 @@ public class OrderController extends BaseController
}
/**
* 新增订单
* 新增订单信息
*/
@PreAuthorize("@ss.hasPermi('system:order:add')")
@Log(title = "订单", businessType = BusinessType.INSERT)
@Log(title = "订单信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Order order)
{
@ -81,10 +83,10 @@ public class OrderController extends BaseController
}
/**
* 修改订单
* 修改订单信息
*/
@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "订单", businessType = BusinessType.UPDATE)
@Log(title = "订单信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Order order)
{
@ -92,21 +94,23 @@ public class OrderController extends BaseController
}
/**
* 删除订单
* 删除订单信息
*/
@PreAuthorize("@ss.hasPermi('system:order:remove')")
@Log(title = "订单", businessType = BusinessType.DELETE)
@Log(title = "订单信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(orderService.deleteOrderByIds(ids));
}
@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "订单", businessType = BusinessType.UPDATE)
@PutMapping("/updateStatus")
public AjaxResult updateStatus(@RequestBody Order order)
// @PreAuthorize("@ss.hasPermi('system:order:list2')")
@Anonymous
@GetMapping("/list2")
public TableDataInfo list2(Order order)
{
return toAjax(orderService.updateOrder(order));
startPage();
List<Order> list = orderService.selectOrderList2(order);
return getDataTable(list);
}
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -37,7 +39,8 @@ public class PersonController extends BaseController
/**
* 查询用户信息列表
*/
@PreAuthorize("@ss.hasPermi('system:person:list')")
// @PreAuthorize("@ss.hasPermi('system:person:list')")
@Anonymous
@GetMapping("/list")
public TableDataInfo list(Person person)
{

View File

@ -0,0 +1,97 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 评论信息对象 comment
*
* @author ruoyi
* @date 2024-12-21
*/
public class Comment extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long personid;
private String name;
private String picture;
/** 评论内容 */
@Excel(name = "评论内容")
private String content;
/** 评论时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "评论时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPersonid() {
return personid;
}
public void setPersonid(Long personid) {
this.personid = personid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("personid", getPersonid())
.append("content", getContent())
.append("time", getTime())
.toString();
}
}

View File

@ -0,0 +1,153 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 商品信息对象 commodity
*
* @author ruoyi
* @date 2024-12-20
*/
public class Commodity extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 张三 */
@Excel(name = "张三")
private String name;
/** 卖家id */
@Excel(name = "卖家id")
private Long sellerid;
/** 价格 */
@Excel(name = "价格")
private BigDecimal price;
/** 分类 */
@Excel(name = "分类")
private String classification;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 图片 */
@Excel(name = "图片")
private String picture;
/** 状态 */
@Excel(name = "状态")
private String state;
/** 上架时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上架时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date time;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setSellerid(Long sellerid)
{
this.sellerid = sellerid;
}
public Long getSellerid()
{
return sellerid;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setClassification(String classification)
{
this.classification = classification;
}
public String getClassification()
{
return classification;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setPicture(String picture)
{
this.picture = picture;
}
public String getPicture()
{
return picture;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setTime(Date time)
{
this.time = time;
}
public Date getTime()
{
return time;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("sellerid", getSellerid())
.append("price", getPrice())
.append("classification", getClassification())
.append("description", getDescription())
.append("picture", getPicture())
.append("state", getState())
.append("time", getTime())
.toString();
}
}

View File

@ -0,0 +1,164 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 收藏信息对象 favorite
*
* @author ruoyi
* @date 2024-12-20
*/
public class Favorite extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long personid;
private String personname;
private String personpicture;
/** 商品id */
@Excel(name = "商品id")
private Long commodityid;
private String commodityname;
private String commoditypicture;
private Long sellerid;
private BigDecimal price;
private String classification;
private String description;
private String state;
private Date time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPersonid() {
return personid;
}
public void setPersonid(Long personid) {
this.personid = personid;
}
public String getPersonname() {
return personname;
}
public void setPersonname(String personname) {
this.personname = personname;
}
public String getPersonpicture() {
return personpicture;
}
public void setPersonpicture(String personpicture) {
this.personpicture = personpicture;
}
public Long getCommodityid() {
return commodityid;
}
public void setCommodityid(Long commodityid) {
this.commodityid = commodityid;
}
public String getCommodityname() {
return commodityname;
}
public void setCommodityname(String commodityname) {
this.commodityname = commodityname;
}
public String getCommoditypicture() {
return commoditypicture;
}
public void setCommoditypicture(String commoditypicture) {
this.commoditypicture = commoditypicture;
}
public Long getSellerid() {
return sellerid;
}
public void setSellerid(Long sellerid) {
this.sellerid = sellerid;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getClassification() {
return classification;
}
public void setClassification(String classification) {
this.classification = classification;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("personid", getPersonid())
.append("commodityid", getCommodityid())
.toString();
}
}

View File

@ -8,94 +8,134 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 订单对象 order
* 订单信息对象 order
*
* @author ruoyi
* @date 2024-12-18
* @date 2024-12-20
*/
public class Order extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Person person;
private Shangpin shangpin;
/** id */
private Long id;
/** 商品id */
@Excel(name = "商品id")
private Long shangpinid;
private Long commodityid;
private String commodityname;
private String commoditypicture;
private String price;
/** 买家id */
@Excel(name = "买家id")
private Long personid;
private Long buyerid;
/** 购买日期 */
private String buyername;
private String buyerpicture;
/** 购买时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "购买日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date purchasedate;
@Excel(name = "购买时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date time;
public Person getPerson() {
return person;
/** 状态 */
@Excel(name = "状态")
private String status;
public Long getId() {
return id;
}
public Shangpin getShangpin() {
return shangpin;
}
public void setPerson(Person person) {
this.person = person;
}
public void setShangpin(Shangpin shangpin) {
this.shangpin = shangpin;
}
public void setId(Long id)
{
public void setId(Long id) {
this.id = id;
}
public Long getId()
{
return id;
}
public void setShangpinid(Long shangpinid)
{
this.shangpinid = shangpinid;
public Long getCommodityid() {
return commodityid;
}
public Long getShangpinid()
{
return shangpinid;
}
public void setPersonid(Long personid)
{
this.personid = personid;
public void setCommodityid(Long commodityid) {
this.commodityid = commodityid;
}
public Long getPersonid()
{
return personid;
}
public void setPurchasedate(Date purchasedate)
{
this.purchasedate = purchasedate;
public String getCommodityname() {
return commodityname;
}
public Date getPurchasedate()
{
return purchasedate;
public void setCommodityname(String commodityname) {
this.commodityname = commodityname;
}
public String getCommoditypicture() {
return commoditypicture;
}
public void setCommoditypicture(String commoditypicture) {
this.commoditypicture = commoditypicture;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public Long getBuyerid() {
return buyerid;
}
public void setBuyerid(Long buyerid) {
this.buyerid = buyerid;
}
public String getBuyername() {
return buyername;
}
public void setBuyername(String buyername) {
this.buyername = buyername;
}
public String getBuyerpicture() {
return buyerpicture;
}
public void setBuyerpicture(String buyerpicture) {
this.buyerpicture = buyerpicture;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("shangpinid", getShangpinid())
.append("personid", getPersonid())
.append("purchasedate", getPurchasedate())
.append("commodityid", getCommodityid())
.append("buyerid", getBuyerid())
.append("time", getTime())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,6 +1,5 @@
package com.ruoyi.system.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -19,36 +18,37 @@ public class Person extends BaseEntity
/** id */
private Long id;
/** 张三 */
@Excel(name = "张三")
private String name;
/** 图片 */
@Excel(name = "图片")
private String image;
/** 昵称 */
@Excel(name = "昵称")
private String name;
private String picture;
/** 性别 */
@Excel(name = "性别")
private String xingbie;
private String gender;
/** 年龄 */
@Excel(name = "年龄")
private Long age;
/** 电话 */
@Excel(name = "电话")
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 学院 */
@Excel(name = "学院")
private String xueyuan;
/** 密码 */
@Excel(name = "密码")
private String password;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 专业 */
@Excel(name = "专业")
private String zhuanye;
/** 用户地址信息 */
private List<Address> addressList;
private String major;
public void setId(Long id)
{
@ -59,15 +59,6 @@ public class Person extends BaseEntity
{
return id;
}
public void setImage(String image)
{
this.image = image;
}
public String getImage()
{
return image;
}
public void setName(String name)
{
this.name = name;
@ -77,14 +68,23 @@ public class Person extends BaseEntity
{
return name;
}
public void setXingbie(String xingbie)
public void setPicture(String picture)
{
this.xingbie = xingbie;
this.picture = picture;
}
public String getXingbie()
public String getPicture()
{
return xingbie;
return picture;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setAge(Long age)
{
@ -104,47 +104,46 @@ public class Person extends BaseEntity
{
return phone;
}
public void setXueyuan(String xueyuan)
public void setPassword(String password)
{
this.xueyuan = xueyuan;
this.password = password;
}
public String getXueyuan()
public String getPassword()
{
return xueyuan;
return password;
}
public void setZhuanye(String zhuanye)
public void setAddress(String address)
{
this.zhuanye = zhuanye;
this.address = address;
}
public String getZhuanye()
public String getAddress()
{
return zhuanye;
return address;
}
public void setMajor(String major)
{
this.major = major;
}
public List<Address> getAddressList()
public String getMajor()
{
return addressList;
}
public void setAddressList(List<Address> addressList)
{
this.addressList = addressList;
return major;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("image", getImage())
.append("name", getName())
.append("xingbie", getXingbie())
.append("picture", getPicture())
.append("gender", getGender())
.append("age", getAge())
.append("phone", getPhone())
.append("xueyuan", getXueyuan())
.append("zhuanye", getZhuanye())
.append("addressList", getAddressList())
.append("password", getPassword())
.append("address", getAddress())
.append("major", getMajor())
.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Comment;
/**
* 评论信息Mapper接口
*
* @author ruoyi
* @date 2024-12-21
*/
public interface CommentMapper
{
/**
* 查询评论信息
*
* @param id 评论信息主键
* @return 评论信息
*/
public Comment selectCommentById(Long id);
/**
* 查询评论信息列表
*
* @param comment 评论信息
* @return 评论信息集合
*/
public List<Comment> selectCommentList(Comment comment);
/**
* 新增评论信息
*
* @param comment 评论信息
* @return 结果
*/
public int insertComment(Comment comment);
/**
* 修改评论信息
*
* @param comment 评论信息
* @return 结果
*/
public int updateComment(Comment comment);
/**
* 删除评论信息
*
* @param id 评论信息主键
* @return 结果
*/
public int deleteCommentById(Long id);
/**
* 批量删除评论信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommentByIds(Long[] ids);
public List<Comment> selectCommentList2(Comment comment);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Commodity;
/**
* 商品信息Mapper接口
*
* @author ruoyi
* @date 2024-12-20
*/
public interface CommodityMapper
{
/**
* 查询商品信息
*
* @param id 商品信息主键
* @return 商品信息
*/
public Commodity selectCommodityById(Long id);
/**
* 查询商品信息列表
*
* @param commodity 商品信息
* @return 商品信息集合
*/
public List<Commodity> selectCommodityList(Commodity commodity);
/**
* 新增商品信息
*
* @param commodity 商品信息
* @return 结果
*/
public int insertCommodity(Commodity commodity);
/**
* 修改商品信息
*
* @param commodity 商品信息
* @return 结果
*/
public int updateCommodity(Commodity commodity);
/**
* 删除商品信息
*
* @param id 商品信息主键
* @return 结果
*/
public int deleteCommodityById(Long id);
/**
* 批量删除商品信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommodityByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Favorite;
/**
* 收藏信息Mapper接口
*
* @author ruoyi
* @date 2024-12-20
*/
public interface FavoriteMapper
{
/**
* 查询收藏信息
*
* @param id 收藏信息主键
* @return 收藏信息
*/
public Favorite selectFavoriteById(Long id);
/**
* 查询收藏信息列表
*
* @param favorite 收藏信息
* @return 收藏信息集合
*/
public List<Favorite> selectFavoriteList(Favorite favorite);
/**
* 新增收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
public int insertFavorite(Favorite favorite);
/**
* 修改收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
public int updateFavorite(Favorite favorite);
/**
* 删除收藏信息
*
* @param id 收藏信息主键
* @return 结果
*/
public int deleteFavoriteById(Long id);
/**
* 批量删除收藏信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteFavoriteByIds(Long[] ids);
public List<Favorite> selectFavoriteList2(Favorite favorite);
}

View File

@ -4,59 +4,60 @@ import java.util.List;
import com.ruoyi.system.domain.Order;
/**
* 订单Mapper接口
* 订单信息Mapper接口
*
* @author ruoyi
* @date 2024-12-18
* @date 2024-12-20
*/
public interface OrderMapper
{
/**
* 查询订单
* 查询订单信息
*
* @param id 订单主键
* @return 订单
* @param id 订单信息主键
* @return 订单信息
*/
public Order selectOrderById(Long id);
/**
* 查询订单列表
* 查询订单信息列表
*
* @param order 订单
* @return 订单集合
* @param order 订单信息
* @return 订单信息集合
*/
public List<Order> selectOrderList(Order order);
/**
* 新增订单
* 新增订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
public int insertOrder(Order order);
/**
* 修改订单
* 修改订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
public int updateOrder(Order order);
/**
* 删除订单
* 删除订单信息
*
* @param id 订单主键
* @param id 订单信息主键
* @return 结果
*/
public int deleteOrderById(Long id);
/**
* 批量删除订单
* 批量删除订单信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOrderByIds(Long[] ids);
public List<Order> selectOrderList2(Order order);
}

View File

@ -2,7 +2,6 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Person;
import com.ruoyi.system.domain.Address;
/**
* 用户信息Mapper接口
@ -59,29 +58,4 @@ public interface PersonMapper
* @return 结果
*/
public int deletePersonByIds(Long[] ids);
/**
* 批量删除用户地址
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAddressByPersonids(Long[] ids);
/**
* 批量新增用户地址
*
* @param addressList 用户地址列表
* @return 结果
*/
public int batchAddress(List<Address> addressList);
/**
* 通过用户信息主键删除用户地址信息
*
* @param id 用户信息ID
* @return 结果
*/
public int deleteAddressByPersonid(Long id);
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Comment;
/**
* 评论信息Service接口
*
* @author ruoyi
* @date 2024-12-21
*/
public interface ICommentService
{
/**
* 查询评论信息
*
* @param id 评论信息主键
* @return 评论信息
*/
public Comment selectCommentById(Long id);
/**
* 查询评论信息列表
*
* @param comment 评论信息
* @return 评论信息集合
*/
public List<Comment> selectCommentList(Comment comment);
/**
* 新增评论信息
*
* @param comment 评论信息
* @return 结果
*/
public int insertComment(Comment comment);
/**
* 修改评论信息
*
* @param comment 评论信息
* @return 结果
*/
public int updateComment(Comment comment);
/**
* 批量删除评论信息
*
* @param ids 需要删除的评论信息主键集合
* @return 结果
*/
public int deleteCommentByIds(Long[] ids);
/**
* 删除评论信息信息
*
* @param id 评论信息主键
* @return 结果
*/
public int deleteCommentById(Long id);
public List<Comment> selectCommentList2(Comment comment);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Commodity;
/**
* 商品信息Service接口
*
* @author ruoyi
* @date 2024-12-20
*/
public interface ICommodityService
{
/**
* 查询商品信息
*
* @param id 商品信息主键
* @return 商品信息
*/
public Commodity selectCommodityById(Long id);
/**
* 查询商品信息列表
*
* @param commodity 商品信息
* @return 商品信息集合
*/
public List<Commodity> selectCommodityList(Commodity commodity);
/**
* 新增商品信息
*
* @param commodity 商品信息
* @return 结果
*/
public int insertCommodity(Commodity commodity);
/**
* 修改商品信息
*
* @param commodity 商品信息
* @return 结果
*/
public int updateCommodity(Commodity commodity);
/**
* 批量删除商品信息
*
* @param ids 需要删除的商品信息主键集合
* @return 结果
*/
public int deleteCommodityByIds(Long[] ids);
/**
* 删除商品信息信息
*
* @param id 商品信息主键
* @return 结果
*/
public int deleteCommodityById(Long id);
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Favorite;
/**
* 收藏信息Service接口
*
* @author ruoyi
* @date 2024-12-20
*/
public interface IFavoriteService
{
/**
* 查询收藏信息
*
* @param id 收藏信息主键
* @return 收藏信息
*/
public Favorite selectFavoriteById(Long id);
/**
* 查询收藏信息列表
*
* @param favorite 收藏信息
* @return 收藏信息集合
*/
public List<Favorite> selectFavoriteList(Favorite favorite);
/**
* 新增收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
public int insertFavorite(Favorite favorite);
/**
* 修改收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
public int updateFavorite(Favorite favorite);
/**
* 批量删除收藏信息
*
* @param ids 需要删除的收藏信息主键集合
* @return 结果
*/
public int deleteFavoriteByIds(Long[] ids);
/**
* 删除收藏信息信息
*
* @param id 收藏信息主键
* @return 结果
*/
public int deleteFavoriteById(Long id);
public List<Favorite> selectFavoriteList2(Favorite favorite);
}

View File

@ -4,58 +4,60 @@ import java.util.List;
import com.ruoyi.system.domain.Order;
/**
* 订单Service接口
* 订单信息Service接口
*
* @author ruoyi
* @date 2024-12-18
* @date 2024-12-20
*/
public interface IOrderService
{
/**
* 查询订单
* 查询订单信息
*
* @param id 订单主键
* @return 订单
* @param id 订单信息主键
* @return 订单信息
*/
public Order selectOrderById(Long id);
/**
* 查询订单列表
* 查询订单信息列表
*
* @param order 订单
* @return 订单集合
* @param order 订单信息
* @return 订单信息集合
*/
public List<Order> selectOrderList(Order order);
/**
* 新增订单
* 新增订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
public int insertOrder(Order order);
/**
* 修改订单
* 修改订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
public int updateOrder(Order order);
/**
* 批量删除订单
* 批量删除订单信息
*
* @param ids 需要删除的订单主键集合
* @param ids 需要删除的订单信息主键集合
* @return 结果
*/
public int deleteOrderByIds(Long[] ids);
/**
* 删除订单信息
* 删除订单信息信息
*
* @param id 订单主键
* @param id 订单信息主键
* @return 结果
*/
public int deleteOrderById(Long id);
public List<Order> selectOrderList2(Order order);
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CommentMapper;
import com.ruoyi.system.domain.Comment;
import com.ruoyi.system.service.ICommentService;
/**
* 评论信息Service业务层处理
*
* @author ruoyi
* @date 2024-12-21
*/
@Service
public class CommentServiceImpl implements ICommentService
{
@Autowired
private CommentMapper commentMapper;
/**
* 查询评论信息
*
* @param id 评论信息主键
* @return 评论信息
*/
@Override
public Comment selectCommentById(Long id)
{
return commentMapper.selectCommentById(id);
}
/**
* 查询评论信息列表
*
* @param comment 评论信息
* @return 评论信息
*/
@Override
public List<Comment> selectCommentList(Comment comment)
{
return commentMapper.selectCommentList(comment);
}
/**
* 新增评论信息
*
* @param comment 评论信息
* @return 结果
*/
@Override
public int insertComment(Comment comment)
{
return commentMapper.insertComment(comment);
}
/**
* 修改评论信息
*
* @param comment 评论信息
* @return 结果
*/
@Override
public int updateComment(Comment comment)
{
return commentMapper.updateComment(comment);
}
/**
* 批量删除评论信息
*
* @param ids 需要删除的评论信息主键
* @return 结果
*/
@Override
public int deleteCommentByIds(Long[] ids)
{
return commentMapper.deleteCommentByIds(ids);
}
/**
* 删除评论信息信息
*
* @param id 评论信息主键
* @return 结果
*/
@Override
public int deleteCommentById(Long id)
{
return commentMapper.deleteCommentById(id);
}
@Override
public List<Comment> selectCommentList2(Comment comment)
{
return commentMapper.selectCommentList2(comment);
}
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CommodityMapper;
import com.ruoyi.system.domain.Commodity;
import com.ruoyi.system.service.ICommodityService;
/**
* 商品信息Service业务层处理
*
* @author ruoyi
* @date 2024-12-20
*/
@Service
public class CommodityServiceImpl implements ICommodityService
{
@Autowired
private CommodityMapper commodityMapper;
/**
* 查询商品信息
*
* @param id 商品信息主键
* @return 商品信息
*/
@Override
public Commodity selectCommodityById(Long id)
{
return commodityMapper.selectCommodityById(id);
}
/**
* 查询商品信息列表
*
* @param commodity 商品信息
* @return 商品信息
*/
@Override
public List<Commodity> selectCommodityList(Commodity commodity)
{
return commodityMapper.selectCommodityList(commodity);
}
/**
* 新增商品信息
*
* @param commodity 商品信息
* @return 结果
*/
@Override
public int insertCommodity(Commodity commodity)
{
return commodityMapper.insertCommodity(commodity);
}
/**
* 修改商品信息
*
* @param commodity 商品信息
* @return 结果
*/
@Override
public int updateCommodity(Commodity commodity)
{
return commodityMapper.updateCommodity(commodity);
}
/**
* 批量删除商品信息
*
* @param ids 需要删除的商品信息主键
* @return 结果
*/
@Override
public int deleteCommodityByIds(Long[] ids)
{
return commodityMapper.deleteCommodityByIds(ids);
}
/**
* 删除商品信息信息
*
* @param id 商品信息主键
* @return 结果
*/
@Override
public int deleteCommodityById(Long id)
{
return commodityMapper.deleteCommodityById(id);
}
}

View File

@ -0,0 +1,98 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FavoriteMapper;
import com.ruoyi.system.domain.Favorite;
import com.ruoyi.system.service.IFavoriteService;
/**
* 收藏信息Service业务层处理
*
* @author ruoyi
* @date 2024-12-20
*/
@Service
public class FavoriteServiceImpl implements IFavoriteService
{
@Autowired
private FavoriteMapper favoriteMapper;
/**
* 查询收藏信息
*
* @param id 收藏信息主键
* @return 收藏信息
*/
@Override
public Favorite selectFavoriteById(Long id)
{
return favoriteMapper.selectFavoriteById(id);
}
/**
* 查询收藏信息列表
*
* @param favorite 收藏信息
* @return 收藏信息
*/
@Override
public List<Favorite> selectFavoriteList(Favorite favorite)
{
return favoriteMapper.selectFavoriteList(favorite);
}
/**
* 新增收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
@Override
public int insertFavorite(Favorite favorite)
{
return favoriteMapper.insertFavorite(favorite);
}
/**
* 修改收藏信息
*
* @param favorite 收藏信息
* @return 结果
*/
@Override
public int updateFavorite(Favorite favorite)
{
return favoriteMapper.updateFavorite(favorite);
}
/**
* 批量删除收藏信息
*
* @param ids 需要删除的收藏信息主键
* @return 结果
*/
@Override
public int deleteFavoriteByIds(Long[] ids)
{
return favoriteMapper.deleteFavoriteByIds(ids);
}
/**
* 删除收藏信息信息
*
* @param id 收藏信息主键
* @return 结果
*/
@Override
public int deleteFavoriteById(Long id)
{
return favoriteMapper.deleteFavoriteById(id);
}
@Override
public List<Favorite> selectFavoriteList2(Favorite favorite){
return favoriteMapper.selectFavoriteList2(favorite);
}
}

View File

@ -8,10 +8,10 @@ import com.ruoyi.system.domain.Order;
import com.ruoyi.system.service.IOrderService;
/**
* 订单Service业务层处理
* 订单信息Service业务层处理
*
* @author ruoyi
* @date 2024-12-18
* @date 2024-12-20
*/
@Service
public class OrderServiceImpl implements IOrderService
@ -20,10 +20,10 @@ public class OrderServiceImpl implements IOrderService
private OrderMapper orderMapper;
/**
* 查询订单
* 查询订单信息
*
* @param id 订单主键
* @return 订单
* @param id 订单信息主键
* @return 订单信息
*/
@Override
public Order selectOrderById(Long id)
@ -32,10 +32,10 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 查询订单列表
* 查询订单信息列表
*
* @param order 订单
* @return 订单
* @param order 订单信息
* @return 订单信息
*/
@Override
public List<Order> selectOrderList(Order order)
@ -44,9 +44,9 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 新增订单
* 新增订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
@Override
@ -56,9 +56,9 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 修改订单
* 修改订单信息
*
* @param order 订单
* @param order 订单信息
* @return 结果
*/
@Override
@ -68,9 +68,9 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 批量删除订单
* 批量删除订单信息
*
* @param ids 需要删除的订单主键
* @param ids 需要删除的订单信息主键
* @return 结果
*/
@Override
@ -80,9 +80,9 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 删除订单信息
* 删除订单信息信息
*
* @param id 订单主键
* @param id 订单信息主键
* @return 结果
*/
@Override
@ -90,4 +90,9 @@ public class OrderServiceImpl implements IOrderService
{
return orderMapper.deleteOrderById(id);
}
@Override
public List<Order> selectOrderList2(Order order){
return orderMapper.selectOrderList2(order);
}
}

View File

@ -3,10 +3,6 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.system.domain.Address;
import com.ruoyi.system.mapper.PersonMapper;
import com.ruoyi.system.domain.Person;
import com.ruoyi.system.service.IPersonService;
@ -53,13 +49,10 @@ public class PersonServiceImpl implements IPersonService
* @param person 用户信息
* @return 结果
*/
@Transactional
@Override
public int insertPerson(Person person)
{
int rows = personMapper.insertPerson(person);
insertAddress(person);
return rows;
return personMapper.insertPerson(person);
}
/**
@ -68,12 +61,9 @@ public class PersonServiceImpl implements IPersonService
* @param person 用户信息
* @return 结果
*/
@Transactional
@Override
public int updatePerson(Person person)
{
personMapper.deleteAddressByPersonid(person.getId());
insertAddress(person);
return personMapper.updatePerson(person);
}
@ -83,11 +73,9 @@ public class PersonServiceImpl implements IPersonService
* @param ids 需要删除的用户信息主键
* @return 结果
*/
@Transactional
@Override
public int deletePersonByIds(Long[] ids)
{
personMapper.deleteAddressByPersonids(ids);
return personMapper.deletePersonByIds(ids);
}
@ -97,35 +85,9 @@ public class PersonServiceImpl implements IPersonService
* @param id 用户信息主键
* @return 结果
*/
@Transactional
@Override
public int deletePersonById(Long id)
{
personMapper.deleteAddressByPersonid(id);
return personMapper.deletePersonById(id);
}
/**
* 新增用户地址信息
*
* @param person 用户信息对象
*/
public void insertAddress(Person person)
{
List<Address> addressList = person.getAddressList();
Long id = person.getId();
if (StringUtils.isNotNull(addressList))
{
List<Address> list = new ArrayList<Address>();
for (Address address : addressList)
{
address.setPersonid(id);
list.add(address);
}
if (list.size() > 0)
{
personMapper.batchAddress(list);
}
}
}
}

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.CommentMapper">
<resultMap type="Comment" id="CommentResult">
<result property="id" column="id" />
<result property="personid" column="personid" />
<result property="content" column="content" />
<result property="time" column="time" />
</resultMap>
<sql id="selectCommentVo">
select id, personid, content, time from comment
</sql>
<select id="selectCommentList" parameterType="Comment" resultMap="CommentResult">
<include refid="selectCommentVo"/>
<where>
<if test="personid != null "> and personid = #{personid}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="time != null "> and time = #{time}</if>
</where>
</select>
<select id="selectCommentById" parameterType="Long" resultMap="CommentResult">
<include refid="selectCommentVo"/>
where id = #{id}
</select>
<insert id="insertComment" parameterType="Comment" useGeneratedKeys="true" keyProperty="id">
insert into comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personid != null">personid,</if>
<if test="content != null">content,</if>
<if test="time != null">time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="personid != null">#{personid},</if>
<if test="content != null">#{content},</if>
<if test="time != null">#{time},</if>
</trim>
</insert>
<update id="updateComment" parameterType="Comment">
update comment
<trim prefix="SET" suffixOverrides=",">
<if test="personid != null">personid = #{personid},</if>
<if test="content != null">content = #{content},</if>
<if test="time != null">time = #{time},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCommentById" parameterType="Long">
delete from comment where id = #{id}
</delete>
<delete id="deleteCommentByIds" parameterType="String">
delete from comment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCommentList2" parameterType="Comment" resultType="Comment">
SELECT
`comment`.id AS id,
personid,
`name`,
picture,
content,
`time`
FROM
`comment`,
person
WHERE
`comment`.personid = person.id
</select>
</mapper>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.CommodityMapper">
<resultMap type="Commodity" id="CommodityResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sellerid" column="sellerid" />
<result property="price" column="price" />
<result property="classification" column="classification" />
<result property="description" column="description" />
<result property="picture" column="picture" />
<result property="state" column="state" />
<result property="time" column="time" />
</resultMap>
<sql id="selectCommodityVo">
select id, name, sellerid, price, classification, description, picture, state, time from commodity
</sql>
<select id="selectCommodityList" parameterType="Commodity" resultMap="CommodityResult">
<include refid="selectCommodityVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sellerid != null "> and sellerid = #{sellerid}</if>
<if test="price != null "> and price = #{price}</if>
<if test="classification != null and classification != ''"> and classification = #{classification}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="picture != null and picture != ''"> and picture = #{picture}</if>
<if test="state != null and state != ''"> and state = #{state}</if>
<if test="time != null "> and time = #{time}</if>
</where>
</select>
<select id="selectCommodityById" parameterType="Long" resultMap="CommodityResult">
<include refid="selectCommodityVo"/>
where id = #{id}
</select>
<insert id="insertCommodity" parameterType="Commodity" useGeneratedKeys="true" keyProperty="id">
insert into commodity
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="sellerid != null">sellerid,</if>
<if test="price != null">price,</if>
<if test="classification != null">classification,</if>
<if test="description != null">description,</if>
<if test="picture != null">picture,</if>
<if test="state != null">state,</if>
<if test="time != null">time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="sellerid != null">#{sellerid},</if>
<if test="price != null">#{price},</if>
<if test="classification != null">#{classification},</if>
<if test="description != null">#{description},</if>
<if test="picture != null">#{picture},</if>
<if test="state != null">#{state},</if>
<if test="time != null">#{time},</if>
</trim>
</insert>
<update id="updateCommodity" parameterType="Commodity">
update commodity
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="sellerid != null">sellerid = #{sellerid},</if>
<if test="price != null">price = #{price},</if>
<if test="classification != null">classification = #{classification},</if>
<if test="description != null">description = #{description},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="state != null">state = #{state},</if>
<if test="time != null">time = #{time},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCommodityById" parameterType="Long">
delete from commodity where id = #{id}
</delete>
<delete id="deleteCommodityByIds" parameterType="String">
delete from commodity where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.FavoriteMapper">
<resultMap type="Favorite" id="FavoriteResult">
<result property="id" column="id" />
<result property="personid" column="personid" />
<result property="commodityid" column="commodityid" />
</resultMap>
<sql id="selectFavoriteVo">
select id, personid, commodityid from favorite
</sql>
<select id="selectFavoriteList" parameterType="Favorite" resultMap="FavoriteResult">
<include refid="selectFavoriteVo"/>
<where>
<if test="personid != null "> and personid = #{personid}</if>
<if test="commodityid != null "> and commodityid = #{commodityid}</if>
</where>
</select>
<select id="selectFavoriteById" parameterType="Long" resultMap="FavoriteResult">
<include refid="selectFavoriteVo"/>
where id = #{id}
</select>
<insert id="insertFavorite" parameterType="Favorite" useGeneratedKeys="true" keyProperty="id">
insert into favorite
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personid != null">personid,</if>
<if test="commodityid != null">commodityid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="personid != null">#{personid},</if>
<if test="commodityid != null">#{commodityid},</if>
</trim>
</insert>
<update id="updateFavorite" parameterType="Favorite">
update favorite
<trim prefix="SET" suffixOverrides=",">
<if test="personid != null">personid = #{personid},</if>
<if test="commodityid != null">commodityid = #{commodityid},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFavoriteById" parameterType="Long">
delete from favorite where id = #{id}
</delete>
<delete id="deleteFavoriteByIds" parameterType="String">
delete from favorite where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectFavoriteList2" parameterType="Long" resultType="Favorite">
SELECT
favorite.id AS id,
person.`name` AS personname,
person.picture AS personpicture,
commodity.`name` AS commodityname,
sellerid,
price,
classification,
description,
commodity.picture AS commoditypicture,
state,
time
FROM
favorite,
commodity,
person
WHERE
personid = #{personid}
AND favorite.commodityid = commodity.id
AND favorite.personid = person.id
</select>
</mapper>

View File

@ -6,51 +6,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="Order" id="OrderResult">
<result property="id" column="id" />
<result property="shangpinid" column="shangpinid" />
<result property="personid" column="personid" />
<result property="purchasedate" column="purchasedate" />
<association property="person" javaType="Person" column="personid">
<result property="image" column="image" />
<result property="name" column="name" />
</association>
<association property="shangpin" javaType="Shangpin" column="shangpinid">
<result property="productimage" column="productimage" />
<result property="price" column="price" />
<result property="producttype" column="producttype" />
</association>
<result property="commodityid" column="commodityid" />
<result property="buyerid" column="buyerid" />
<result property="time" column="time" />
<result property="status" column="status" />
</resultMap>
<sql id="selectOrderVo">
SELECT
o.id,
p.image,
p.name username,
s.productimage,
s.name,
s.price,
o.purchasedate,
o.orderzhuangtai
FROM
`person` p
-- 使用 INNER JOIN 关联 order 表
INNER JOIN
`order` o ON p.id = o.personid
-- 再使用 INNER JOIN 关联 shangpin 表
INNER JOIN
`shangpin` s ON o.shangpinid = s.id;
select id, commodityid, buyerid, time, status from `order`
</sql>
<select id="selectOrderList" parameterType="Order" resultMap="OrderResult">
<include refid="selectOrderVo"/>
<where>
<if test="shangpinid!= null "> and shangpinid = #{shangpinid}</if>
<if test="personid!= null "> and personid = #{personid}</if>
<if test="purchasedate!= null "> and purchasedate = #{purchasedate}</if>
<where>
<if test="commodityid != null "> and commodityid = #{commodityid}</if>
<if test="buyerid != null "> and buyerid = #{buyerid}</if>
<if test="time != null "> and time = #{time}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectOrderById" parameterType="Long" resultMap="OrderResult">
<include refid="selectOrderVo"/>
where id = #{id}
@ -59,23 +34,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shangpinid != null">shangpinid,</if>
<if test="personid != null">personid,</if>
<if test="purchasedate != null">purchasedate,</if>
<if test="commodityid != null">commodityid,</if>
<if test="buyerid != null">buyerid,</if>
<if test="time != null">time,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shangpinid != null">#{shangpinid},</if>
<if test="personid != null">#{personid},</if>
<if test="purchasedate != null">#{purchasedate},</if>
<if test="commodityid != null">#{commodityid},</if>
<if test="buyerid != null">#{buyerid},</if>
<if test="time != null">#{time},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateOrder" parameterType="Order">
update order
<trim prefix="SET" suffixOverrides=",">
<if test="shangpinid != null">shangpinid = #{shangpinid},</if>
<if test="personid != null">personid = #{personid},</if>
<if test="purchasedate != null">purchasedate = #{purchasedate},</if>
<if test="commodityid != null">commodityid = #{commodityid},</if>
<if test="buyerid != null">buyerid = #{buyerid},</if>
<if test="time != null">time = #{time},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
@ -91,6 +69,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectOrderList2" parameterType="Order" resultType="Order">
SELECT
`order`.id AS id,
person.`name` AS buyername,
person.picture AS buyerpicture,
commodity.`name` AS commodityname,
commodity.picture AS commoditypicture,
commodity.price AS price,
`order`.time AS time
FROM
`order`,
person,
commodity
WHERE
`order`.buyerid = person.id
AND `order`.commodityid = commodity.id
</select>
</mapper>

View File

@ -6,86 +6,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="Person" id="PersonResult">
<result property="id" column="id" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="xingbie" column="xingbie" />
<result property="picture" column="picture" />
<result property="gender" column="gender" />
<result property="age" column="age" />
<result property="phone" column="phone" />
<result property="xueyuan" column="xueyuan" />
<result property="zhuanye" column="zhuanye" />
</resultMap>
<resultMap id="PersonAddressResult" type="Person" extends="PersonResult">
<collection property="addressList" ofType="Address" column="id" select="selectAddressList" />
</resultMap>
<resultMap type="Address" id="AddressResult">
<result property="id" column="id" />
<result property="personid" column="personid" />
<result property="place" column="place" />
<result property="password" column="password" />
<result property="address" column="address" />
<result property="major" column="major" />
</resultMap>
<sql id="selectPersonVo">
select id, image, name, xingbie, age, phone, xueyuan, zhuanye from person
select id, name, picture, gender, age, phone, password, address, major from person
</sql>
<select id="selectPersonList" parameterType="Person" resultMap="PersonResult">
<include refid="selectPersonVo"/>
<where>
<if test="image != null and image != ''"> and image = #{image}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="xingbie != null and xingbie != ''"> and xingbie = #{xingbie}</if>
<if test="picture != null and picture != ''"> and picture = #{picture}</if>
<if test="gender != null and gender != ''"> and gender = #{gender}</if>
<if test="age != null "> and age = #{age}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="xueyuan != null and xueyuan != ''"> and xueyuan = #{xueyuan}</if>
<if test="zhuanye != null and zhuanye != ''"> and zhuanye = #{zhuanye}</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="major != null and major != ''"> and major = #{major}</if>
</where>
</select>
<select id="selectPersonById" parameterType="Long" resultMap="PersonAddressResult">
select id, image, name, xingbie, age, phone, xueyuan, zhuanye
from person
<select id="selectPersonById" parameterType="Long" resultMap="PersonResult">
<include refid="selectPersonVo"/>
where id = #{id}
</select>
<select id="selectAddressList" resultMap="AddressResult">
select id, personid, place
from address
where personid = #{personid}
</select>
<insert id="insertPerson" parameterType="Person" useGeneratedKeys="true" keyProperty="id">
insert into person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="image != null">image,</if>
<if test="name != null">name,</if>
<if test="xingbie != null">xingbie,</if>
<if test="picture != null">picture,</if>
<if test="gender != null">gender,</if>
<if test="age != null">age,</if>
<if test="phone != null">phone,</if>
<if test="xueyuan != null">xueyuan,</if>
<if test="zhuanye != null">zhuanye,</if>
<if test="password != null">password,</if>
<if test="address != null">address,</if>
<if test="major != null">major,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="image != null">#{image},</if>
<if test="name != null">#{name},</if>
<if test="xingbie != null">#{xingbie},</if>
<if test="picture != null">#{picture},</if>
<if test="gender != null">#{gender},</if>
<if test="age != null">#{age},</if>
<if test="phone != null">#{phone},</if>
<if test="xueyuan != null">#{xueyuan},</if>
<if test="zhuanye != null">#{zhuanye},</if>
<if test="password != null">#{password},</if>
<if test="address != null">#{address},</if>
<if test="major != null">#{major},</if>
</trim>
</insert>
<update id="updatePerson" parameterType="Person">
update person
<trim prefix="SET" suffixOverrides=",">
<if test="image != null">image = #{image},</if>
<if test="name != null">name = #{name},</if>
<if test="xingbie != null">xingbie = #{xingbie},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="age != null">age = #{age},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="xueyuan != null">xueyuan = #{xueyuan},</if>
<if test="zhuanye != null">zhuanye = #{zhuanye},</if>
<if test="password != null">password = #{password},</if>
<if test="address != null">address = #{address},</if>
<if test="major != null">major = #{major},</if>
</trim>
where id = #{id}
</update>
@ -100,22 +88,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteAddressByPersonids" parameterType="String">
delete from address where personid in
<foreach item="personid" collection="array" open="(" separator="," close=")">
#{personid}
</foreach>
</delete>
<delete id="deleteAddressByPersonid" parameterType="Long">
delete from address where personid = #{personid}
</delete>
<insert id="batchAddress">
insert into address( id, personid, place) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.personid}, #{item.place})
</foreach>
</insert>
</mapper>