Commit aef88495 by xuwenhao

12.4增加订水小程序相关功能

parent 890e49d4
package com.qianhe.system.controller;
import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.system.domain.WaterGoodsCart;
import com.qianhe.system.service.IWaterGoodsCartService;
import com.qianhe.system.vo.WaterGoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/system/cart")
public class WaterGoodsCartController extends BaseController {
@Autowired
private IWaterGoodsCartService waterGoodsCartService;
/**
* 查询购物车列表
* @param waterGoodsCart
* @return
*/
@GetMapping("/list")
public TableDataInfo list(WaterGoodsCart waterGoodsCart){
startPage();
List<WaterGoodsCart> list = waterGoodsCartService.selectWaterGoodsCartList(waterGoodsCart);
return getDataTable(list);
}
/**
* 查看详情
* @param id
* @return
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id){
return success(waterGoodsCartService.selectWaterGoodsCartById(id));
}
/**
* 新增购物车商品
*/
@PostMapping
public AjaxResult add(@RequestBody WaterGoodsCart waterGoodsCart)
{
return toAjax(waterGoodsCartService.insertWaterGoodsCart(waterGoodsCart));
}
/**
* 修改购物车商品
*/
@PutMapping
public AjaxResult edit(@RequestBody WaterGoodsCart WaterGoodsCart)
{
return toAjax(waterGoodsCartService.updateWaterGoodsCart(WaterGoodsCart));
}
/**
* 修改购物车商品数量
*/
@PostMapping("/updateGoods")
public AjaxResult updateGoods(@RequestBody WaterGoodsCart WaterGoodsCart)
{
return toAjax(waterGoodsCartService.updateWaterGoodsCart(WaterGoodsCart));
}
/**
* 删除购物车商品
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(waterGoodsCartService.deleteWaterGoodsCartByIds(ids));
}
}
...@@ -122,6 +122,82 @@ public class WaterGoodsController extends BaseController ...@@ -122,6 +122,82 @@ public class WaterGoodsController extends BaseController
} }
/** /**
* 查询首页商品列表(订水端小程序)
*/
@GetMapping("/syList")
public TableDataInfo syList(WaterGoods waterGoods)
{
List<WaterGoods> list = waterGoodsService.selectWaterGoodsList(waterGoods);
//查询所有商品图片
List<WaterGoodsImg> waterGoodsImgs = waterGoodsImgService.selectWaterGoodsImgList(new WaterGoodsImg());
//查询所有站点
List<WaterStation> waterStations = waterStationService.selectWaterStationList(new WaterStation());
//查询所有商品分类
List<WaterGoodsType> waterGoodsTypes = waterGoodsTypeService.selectWaterGoodsTypeList(new WaterGoodsType());
List<WaterGoodsVo> waterGoodsVos = new ArrayList<>();
if (list.size() > 0){
for (WaterGoods goods : list) {
//转vo
WaterGoodsVo waterGoodsVo = new WaterGoodsVo();
BeanUtils.copyProperties(goods,waterGoodsVo);
List<WaterGoodsImg> coverImgs = new ArrayList<>();
List<WaterGoodsImg> detailsImgs = new ArrayList<>();
for (WaterGoodsImg waterGoodsImg : waterGoodsImgs) {
if (goods.getId().equals(waterGoodsImg.getGoodsId()) && waterGoodsImg.getImgType() == 1){
//商品封面图
coverImgs.add(waterGoodsImg);
}
if (goods.getId().equals(waterGoodsImg.getGoodsId()) && waterGoodsImg.getImgType() == 2){
//商品详情图
detailsImgs.add(waterGoodsImg);
}
}
if (coverImgs.size() > 0){
waterGoodsVo.setCoverImgs(coverImgs);
}
if (detailsImgs.size() > 0){
waterGoodsVo.setDetailsImgs(detailsImgs);
}
//设置站点名称
if (StringUtils.isNotEmpty(goods.getBelongStationId())){
String[] split = goods.getBelongStationId().split(",");
String stationName = "";
if (split.length > 1){
for (int i = 0; i < split.length; i++) {
for (WaterStation waterStation : waterStations) {
if (split[i].equals(waterStation.getId().toString())){
if (i == split.length - 1){
stationName += waterStation.getStationName();
}else {
stationName += waterStation.getStationName() + ",";
}
}
}
}
}else {
for (WaterStation waterStation : waterStations) {
if (split[0].equals(waterStation.getId().toString())){
stationName = waterStation.getStationName();
}
}
}
waterGoodsVo.setBelongStationNames(stationName);
}
//设置商品分类名称
if (StringUtils.isNotNull(goods.getGoodsTypeId())){
for (WaterGoodsType waterGoodsType : waterGoodsTypes) {
if (goods.getGoodsTypeId().equals(waterGoodsType.getId())){
waterGoodsVo.setGoodsTypeName(waterGoodsType.getTypeName());
}
}
}
waterGoodsVos.add(waterGoodsVo);
}
}
return getDataTable(waterGoodsVos);
}
/**
* 导出商品列表 * 导出商品列表
*/ */
@Log(title = "商品", businessType = BusinessType.EXPORT) @Log(title = "商品", businessType = BusinessType.EXPORT)
......
...@@ -7,12 +7,17 @@ import com.qianhe.common.core.page.TableDataInfo; ...@@ -7,12 +7,17 @@ import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType; import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.poi.ExcelUtil; import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterOrder; import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.domain.WaterOrderGoods;
import com.qianhe.system.service.IWaterOrderGoodsService;
import com.qianhe.system.service.IWaterOrderService; import com.qianhe.system.service.IWaterOrderService;
import com.qianhe.system.vo.WaterOrderVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -27,16 +32,75 @@ public class WaterOrderController extends BaseController ...@@ -27,16 +32,75 @@ public class WaterOrderController extends BaseController
{ {
@Autowired @Autowired
private IWaterOrderService waterOrderService; private IWaterOrderService waterOrderService;
@Autowired
private IWaterOrderGoodsService waterOrderGoodsService;
/** /**
* 查询订单列表 * 查询订单列表(管理端)
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WaterOrder waterOrder) public TableDataInfo list(WaterOrderVo waterOrderVo)
{ {
startPage(); startPage();
List<WaterOrder> list = waterOrderService.selectWaterOrderList(waterOrder); List<WaterOrder> list = waterOrderService.selectWaterOrderList(waterOrderVo);
return getDataTable(list); //返回的订单列表
List<WaterOrderVo> waterOrderVoList = new ArrayList<>();
//查询所有订单商品
List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods());
if (list.size() > 0){
for (WaterOrder order : list) {
//转vo
WaterOrderVo waterOrderVo1 = new WaterOrderVo();
BeanUtils.copyProperties(order,waterOrderVo1);
List<WaterOrderGoods> waterOrderGoodsList = new ArrayList<>();
for (WaterOrderGoods waterOrderGood : waterOrderGoods) {
if (order.getId().equals(waterOrderGood.getOrderId())){
// waterOrderGoodsList.add(waterOrderGood);
waterOrderVo1.setWaterOrderGoods(waterOrderGood);
waterOrderVoList.add(waterOrderVo1);
}
}
// if (waterOrderGoodsList.size() > 0){
// waterOrderVo1.setWaterOrderGoodsList(waterOrderGoodsList);
// }
}
}
TableDataInfo tableDataInfo = getDataTable(waterOrderVoList);
tableDataInfo.setTotal(list.size());
return tableDataInfo;
}
/**
* 查询用户个人订单列表
*/
@GetMapping("/listGr")
public TableDataInfo listGr(WaterOrderVo waterOrderVo)
{
//返回的订单列表
List<WaterOrderVo> waterOrderVoList = new ArrayList<>();
List<WaterOrder> list = waterOrderService.selectWaterOrderList(waterOrderVo);
//查询所有订单商品
List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods());
if (list.size() > 0){
for (WaterOrder order : list) {
//转vo
WaterOrderVo waterOrderVo1 = new WaterOrderVo();
BeanUtils.copyProperties(order,waterOrderVo1);
List<WaterOrderGoods> waterOrderGoodsList = new ArrayList<>();
for (WaterOrderGoods waterOrderGood : waterOrderGoods) {
if (order.getId().equals(waterOrderGood.getOrderId())){
// waterOrderGoodsList.add(waterOrderGood);
waterOrderVo1.setWaterOrderGoods(waterOrderGood);
waterOrderVoList.add(waterOrderVo1);
}
}
// if (waterOrderGoodsList.size() > 0){
// waterOrderVo1.setWaterOrderGoodsList(waterOrderGoodsList);
// }
waterOrderVoList.add(waterOrderVo1);
}
}
return getDataTable(waterOrderVoList);
} }
/** /**
...@@ -44,9 +108,9 @@ public class WaterOrderController extends BaseController ...@@ -44,9 +108,9 @@ public class WaterOrderController extends BaseController
*/ */
@Log(title = "订单", businessType = BusinessType.EXPORT) @Log(title = "订单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterOrder waterOrder) public void export(HttpServletResponse response, WaterOrderVo waterOrderVo)
{ {
List<WaterOrder> list = waterOrderService.selectWaterOrderList(waterOrder); List<WaterOrder> list = waterOrderService.selectWaterOrderList(waterOrderVo);
ExcelUtil<WaterOrder> util = new ExcelUtil<WaterOrder>(WaterOrder.class); ExcelUtil<WaterOrder> util = new ExcelUtil<WaterOrder>(WaterOrder.class);
util.exportExcel(response, list, "订单数据"); util.exportExcel(response, list, "订单数据");
} }
...@@ -65,9 +129,9 @@ public class WaterOrderController extends BaseController ...@@ -65,9 +129,9 @@ public class WaterOrderController extends BaseController
*/ */
@Log(title = "订单", businessType = BusinessType.INSERT) @Log(title = "订单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WaterOrder waterOrder) public AjaxResult add(@RequestBody WaterOrderVo waterOrderVo)
{ {
return toAjax(waterOrderService.insertWaterOrder(waterOrder)); return toAjax(waterOrderService.insertWaterOrder(waterOrderVo));
} }
/** /**
...@@ -75,9 +139,9 @@ public class WaterOrderController extends BaseController ...@@ -75,9 +139,9 @@ public class WaterOrderController extends BaseController
*/ */
@Log(title = "订单", businessType = BusinessType.UPDATE) @Log(title = "订单", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WaterOrder waterOrder) public AjaxResult edit(@RequestBody WaterOrderVo waterOrderVo)
{ {
return toAjax(waterOrderService.updateWaterOrder(waterOrder)); return toAjax(waterOrderService.updateWaterOrder(waterOrderVo));
} }
/** /**
...@@ -89,4 +153,12 @@ public class WaterOrderController extends BaseController ...@@ -89,4 +153,12 @@ public class WaterOrderController extends BaseController
{ {
return toAjax(waterOrderService.deleteWaterOrderByIds(ids)); return toAjax(waterOrderService.deleteWaterOrderByIds(ids));
} }
/**
* 修改订单状态
*/
@PostMapping("/updateOrderState")
public AjaxResult updateOrderState(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.updateOrderState(waterOrderVo));
}
} }
...@@ -31,7 +31,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -31,7 +31,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 查询订单商品列表 * 查询订单商品列表
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WaterOrderGoods waterOrderGoods) public TableDataInfo list(WaterOrderGoods waterOrderGoods)
{ {
...@@ -43,7 +42,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -43,7 +42,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 导出订单商品列表 * 导出订单商品列表
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:export')")
@Log(title = "订单商品", businessType = BusinessType.EXPORT) @Log(title = "订单商品", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterOrderGoods waterOrderGoods) public void export(HttpServletResponse response, WaterOrderGoods waterOrderGoods)
...@@ -56,7 +54,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -56,7 +54,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 获取订单商品详细信息 * 获取订单商品详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -66,7 +63,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -66,7 +63,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 新增订单商品 * 新增订单商品
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:add')")
@Log(title = "订单商品", businessType = BusinessType.INSERT) @Log(title = "订单商品", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WaterOrderGoods waterOrderGoods) public AjaxResult add(@RequestBody WaterOrderGoods waterOrderGoods)
...@@ -77,7 +73,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -77,7 +73,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 修改订单商品 * 修改订单商品
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:edit')")
@Log(title = "订单商品", businessType = BusinessType.UPDATE) @Log(title = "订单商品", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WaterOrderGoods waterOrderGoods) public AjaxResult edit(@RequestBody WaterOrderGoods waterOrderGoods)
...@@ -88,7 +83,6 @@ public class WaterOrderGoodsController extends BaseController ...@@ -88,7 +83,6 @@ public class WaterOrderGoodsController extends BaseController
/** /**
* 删除订单商品 * 删除订单商品
*/ */
@PreAuthorize("@ss.hasPermi('system:goods:remove')")
@Log(title = "订单商品", businessType = BusinessType.DELETE) @Log(title = "订单商品", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
......
...@@ -63,6 +63,35 @@ public class WaterSpeController extends BaseController ...@@ -63,6 +63,35 @@ public class WaterSpeController extends BaseController
} }
/** /**
* 查询商品规格下拉框
*/
@GetMapping("/goodsSpelist")
public TableDataInfo goodsSpelist(WaterSpe waterSpe)
{
List<WaterSpe> list = waterSpeService.selectWaterSpeList(waterSpe);
//返回的列表
List<WaterSpeVo> waterSpeVoList = new ArrayList<>();
//商品规格规格值列表
List<WaterSpeVal> waterSpeVals = waterSpeService.selectWaterSpeValList(new WaterSpeVal());
for (WaterSpe spe : list) {
//转vo
WaterSpeVo waterSpeVo = new WaterSpeVo();
BeanUtils.copyProperties(spe,waterSpeVo);
List<WaterSpeVal> waterSpeValList = new ArrayList<>();
for (WaterSpeVal waterSpeVal : waterSpeVals) {
if (spe.getId().equals(waterSpeVal.getSpeId())){
waterSpeValList.add(waterSpeVal);
}
}
if (waterSpeValList.size() > 0){
waterSpeVo.setWaterSpeValList(waterSpeValList);
}
waterSpeVoList.add(waterSpeVo);
}
return getDataTable(waterSpeVoList);
}
/**
* 导出商品规格列表 * 导出商品规格列表
*/ */
@Log(title = "商品规格", businessType = BusinessType.EXPORT) @Log(title = "商品规格", businessType = BusinessType.EXPORT)
......
...@@ -31,11 +31,9 @@ public class WaterUserAddressController extends BaseController ...@@ -31,11 +31,9 @@ public class WaterUserAddressController extends BaseController
/** /**
* 查询用户地址列表 * 查询用户地址列表
*/ */
@PreAuthorize("@ss.hasPermi('system:address:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WaterUserAddress waterUserAddress) public TableDataInfo list(WaterUserAddress waterUserAddress)
{ {
startPage();
List<WaterUserAddress> list = waterUserAddressService.selectWaterUserAddressList(waterUserAddress); List<WaterUserAddress> list = waterUserAddressService.selectWaterUserAddressList(waterUserAddress);
return getDataTable(list); return getDataTable(list);
} }
...@@ -43,7 +41,6 @@ public class WaterUserAddressController extends BaseController ...@@ -43,7 +41,6 @@ public class WaterUserAddressController extends BaseController
/** /**
* 导出用户地址列表 * 导出用户地址列表
*/ */
@PreAuthorize("@ss.hasPermi('system:address:export')")
@Log(title = "用户地址", businessType = BusinessType.EXPORT) @Log(title = "用户地址", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterUserAddress waterUserAddress) public void export(HttpServletResponse response, WaterUserAddress waterUserAddress)
...@@ -56,7 +53,6 @@ public class WaterUserAddressController extends BaseController ...@@ -56,7 +53,6 @@ public class WaterUserAddressController extends BaseController
/** /**
* 获取用户地址详细信息 * 获取用户地址详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:address:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -64,9 +60,16 @@ public class WaterUserAddressController extends BaseController ...@@ -64,9 +60,16 @@ public class WaterUserAddressController extends BaseController
} }
/** /**
* 获取用户默认地址
*/
@GetMapping("/getUserDefaultAddress")
public AjaxResult getUserDefaultAddress(Long userId){
return success(waterUserAddressService.getUserDefaultAddress(userId));
}
/**
* 新增用户地址 * 新增用户地址
*/ */
@PreAuthorize("@ss.hasPermi('system:address:add')")
@Log(title = "用户地址", businessType = BusinessType.INSERT) @Log(title = "用户地址", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WaterUserAddress waterUserAddress) public AjaxResult add(@RequestBody WaterUserAddress waterUserAddress)
...@@ -77,7 +80,6 @@ public class WaterUserAddressController extends BaseController ...@@ -77,7 +80,6 @@ public class WaterUserAddressController extends BaseController
/** /**
* 修改用户地址 * 修改用户地址
*/ */
@PreAuthorize("@ss.hasPermi('system:address:edit')")
@Log(title = "用户地址", businessType = BusinessType.UPDATE) @Log(title = "用户地址", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WaterUserAddress waterUserAddress) public AjaxResult edit(@RequestBody WaterUserAddress waterUserAddress)
...@@ -88,11 +90,18 @@ public class WaterUserAddressController extends BaseController ...@@ -88,11 +90,18 @@ public class WaterUserAddressController extends BaseController
/** /**
* 删除用户地址 * 删除用户地址
*/ */
@PreAuthorize("@ss.hasPermi('system:address:remove')")
@Log(title = "用户地址", businessType = BusinessType.DELETE) @Log(title = "用户地址", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(waterUserAddressService.deleteWaterUserAddressByIds(ids)); return toAjax(waterUserAddressService.deleteWaterUserAddressByIds(ids));
} }
/**
* 修改用户默认地址
*/
@PostMapping("/updateDefaultAddress")
public AjaxResult updateDefaultAddress(@RequestBody WaterUserAddress waterUserAddress){
return toAjax(waterUserAddressService.updateDefaultAddress(waterUserAddress));
}
} }
...@@ -9,6 +9,7 @@ import lombok.Data; ...@@ -9,6 +9,7 @@ import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -47,7 +48,11 @@ public class WaterGoods ...@@ -47,7 +48,11 @@ public class WaterGoods
/** 价格 */ /** 价格 */
@Excel(name = "价格") @Excel(name = "价格")
private String price; private BigDecimal price;
/** 销量 */
@Excel(name = "销量")
private String volume;
/** 创建人 */ /** 创建人 */
private String createUser; private String createUser;
...@@ -58,5 +63,5 @@ public class WaterGoods ...@@ -58,5 +63,5 @@ public class WaterGoods
/** 状态(1上架0下架) */ /** 状态(1上架0下架) */
@Excel(name = "状态", readConverterExp = "1=上架0下架") @Excel(name = "状态", readConverterExp = "1=上架0下架")
private Long status; private Integer status;
} }
package com.qianhe.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class WaterGoodsCart {
/** 主键id */
private Long id;
/** 用户id */
private Long userId;
/** 商品id */
private Long goodsId;
/** 商品名称 */
private String goodsName;
/** 商品分类id */
private Long goodsTypeId;
/** 商品分类名称 */
private String goodsTypeName;
/** 商品规格id */
private Long goodsSpeId;
/** 商品规格值id */
private Long goodsSpeValId;
/** 商品规格详情 */
private String goodsSpeVal;
/** 商品价格 */
private BigDecimal goodsPrice;
/** 商品数量 */
private Integer goodsNum;
/** 商品总价 */
private BigDecimal goodsTotal;
/** 是否选中(1是,0否) */
private String isSelect;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
...@@ -25,6 +25,9 @@ public class WaterGoodsSpe ...@@ -25,6 +25,9 @@ public class WaterGoodsSpe
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** 商品规格主键id */
private Long waterSpeId;
/** 标题 */ /** 标题 */
@Excel(name = "标题") @Excel(name = "标题")
private String speTitle; private String speTitle;
......
...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.qianhe.common.annotation.Excel; import com.qianhe.common.annotation.Excel;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@Data @Data
public class WaterGoodsSpeVal { public class WaterGoodsSpeVal {
...@@ -20,4 +22,7 @@ public class WaterGoodsSpeVal { ...@@ -20,4 +22,7 @@ public class WaterGoodsSpeVal {
/** 规格值 */ /** 规格值 */
private String speVal; private String speVal;
/** 价格 */
private BigDecimal price;
} }
...@@ -3,6 +3,7 @@ package com.qianhe.system.domain; ...@@ -3,6 +3,7 @@ package com.qianhe.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel; import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity; import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -15,11 +16,11 @@ import java.util.Date; ...@@ -15,11 +16,11 @@ import java.util.Date;
* @author qianhe * @author qianhe
* @date 2023-11-23 * @date 2023-11-23
*/ */
public class WaterOrder extends BaseEntity @Data
public class WaterOrder
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id; private Long id;
/** 订单编号(生成规则当前年月日+当天下单0001开始+随机生成4位英文字母) */ /** 订单编号(生成规则当前年月日+当天下单0001开始+随机生成4位英文字母) */
...@@ -98,6 +99,9 @@ public class WaterOrder extends BaseEntity ...@@ -98,6 +99,9 @@ public class WaterOrder extends BaseEntity
@Excel(name = "银行返回支付成功code") @Excel(name = "银行返回支付成功code")
private String payNum; private String payNum;
/** 用户地址id */
private Long userAddressId;
/** 收货人名字 */ /** 收货人名字 */
@Excel(name = "收货人名字") @Excel(name = "收货人名字")
private String name; private String name;
...@@ -123,9 +127,8 @@ public class WaterOrder extends BaseEntity ...@@ -123,9 +127,8 @@ public class WaterOrder extends BaseEntity
private Long mobile; private Long mobile;
/** 送货时间 */ /** 送货时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "送货时间")
@Excel(name = "送货时间", width = 30, dateFormat = "yyyy-MM-dd") private String delieverTime;
private Date delieverTime;
/** 送水工名字 */ /** 送水工名字 */
@Excel(name = "送水工名字") @Excel(name = "送水工名字")
...@@ -135,28 +138,32 @@ public class WaterOrder extends BaseEntity ...@@ -135,28 +138,32 @@ public class WaterOrder extends BaseEntity
@Excel(name = "送水工电话") @Excel(name = "送水工电话")
private String delieverMobile; private String delieverMobile;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 创建人 */ /** 创建人 */
@Excel(name = "创建人") @Excel(name = "创建人")
private String createUser; private String createUser;
/** 送达时间 */ /** 送达时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "送达时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "送达时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date delieverOver; private Date delieverOver;
/** 收货时间 */ /** 收货时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "收货时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "收货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date takeTime; private Date takeTime;
/** 完成时间 */ /** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date finishTime; private Date finishTime;
/** 备注 */ /** 备注 */
@Excel(name = "备注") @Excel(name = "备注")
private String ramark; private String remark;
/** 商品总价 */ /** 商品总价 */
@Excel(name = "商品总价") @Excel(name = "商品总价")
...@@ -165,372 +172,4 @@ public class WaterOrder extends BaseEntity ...@@ -165,372 +172,4 @@ public class WaterOrder extends BaseEntity
/** 订单类型(1普通订单2退款订单) */ /** 订单类型(1普通订单2退款订单) */
@Excel(name = "订单类型", readConverterExp = "1=普通订单2退款订单") @Excel(name = "订单类型", readConverterExp = "1=普通订单2退款订单")
private Integer orderType; private Integer orderType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrderNum(String orderNum)
{
this.orderNum = orderNum;
}
public String getOrderNum()
{
return orderNum;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setUserPhone(Long userPhone)
{
this.userPhone = userPhone;
}
public Long getUserPhone()
{
return userPhone;
}
public void setUserProvince(String userProvince)
{
this.userProvince = userProvince;
}
public String getUserProvince()
{
return userProvince;
}
public void setUserCity(String userCity)
{
this.userCity = userCity;
}
public String getUserCity()
{
return userCity;
}
public void setUserArea(String userArea)
{
this.userArea = userArea;
}
public String getUserArea()
{
return userArea;
}
public void setUserAddress(String userAddress)
{
this.userAddress = userAddress;
}
public String getUserAddress()
{
return userAddress;
}
public void setStationId(Long stationId)
{
this.stationId = stationId;
}
public Long getStationId()
{
return stationId;
}
public void setStationName(String stationName)
{
this.stationName = stationName;
}
public String getStationName()
{
return stationName;
}
public void setStationPhone(Long stationPhone)
{
this.stationPhone = stationPhone;
}
public Long getStationPhone()
{
return stationPhone;
}
public void setStationProvince(String stationProvince)
{
this.stationProvince = stationProvince;
}
public String getStationProvince()
{
return stationProvince;
}
public void setStationCity(String stationCity)
{
this.stationCity = stationCity;
}
public String getStationCity()
{
return stationCity;
}
public void setStationArea(String stationArea)
{
this.stationArea = stationArea;
}
public String getStationArea()
{
return stationArea;
}
public void setStationAddress(String stationAddress)
{
this.stationAddress = stationAddress;
}
public String getStationAddress()
{
return stationAddress;
}
public void setOrderState(Integer orderState)
{
this.orderState = orderState;
}
public Integer getOrderState()
{
return orderState;
}
public void setPayState(Integer payState)
{
this.payState = payState;
}
public Integer getPayState()
{
return payState;
}
public void setPayType(Integer payType)
{
this.payType = payType;
}
public Integer getPayType()
{
return payType;
}
public void setPayNum(String payNum)
{
this.payNum = payNum;
}
public String getPayNum()
{
return payNum;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setProvince(String province)
{
this.province = province;
}
public String getProvince()
{
return province;
}
public void setCity(String city)
{
this.city = city;
}
public String getCity()
{
return city;
}
public void setArea(String area)
{
this.area = area;
}
public String getArea()
{
return area;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setMobile(Long mobile)
{
this.mobile = mobile;
}
public Long getMobile()
{
return mobile;
}
public void setDelieverTime(Date delieverTime)
{
this.delieverTime = delieverTime;
}
public Date getDelieverTime()
{
return delieverTime;
}
public void setDelieverName(String delieverName)
{
this.delieverName = delieverName;
}
public String getDelieverName()
{
return delieverName;
}
public void setDelieverMobile(String delieverMobile)
{
this.delieverMobile = delieverMobile;
}
public String getDelieverMobile()
{
return delieverMobile;
}
public void setCreateUser(String createUser)
{
this.createUser = createUser;
}
public String getCreateUser()
{
return createUser;
}
public void setDelieverOver(Date delieverOver)
{
this.delieverOver = delieverOver;
}
public Date getDelieverOver()
{
return delieverOver;
}
public void setTakeTime(Date takeTime)
{
this.takeTime = takeTime;
}
public Date getTakeTime()
{
return takeTime;
}
public void setFinishTime(Date finishTime)
{
this.finishTime = finishTime;
}
public Date getFinishTime()
{
return finishTime;
}
public void setRamark(String ramark)
{
this.ramark = ramark;
}
public String getRamark()
{
return ramark;
}
public void setGoodsVal(BigDecimal goodsVal)
{
this.goodsVal = goodsVal;
}
public BigDecimal getGoodsVal()
{
return goodsVal;
}
public void setOrderType(Integer orderType)
{
this.orderType = orderType;
}
public Integer getOrderType()
{
return orderType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderNum", getOrderNum())
.append("userId", getUserId())
.append("userName", getUserName())
.append("userPhone", getUserPhone())
.append("userProvince", getUserProvince())
.append("userCity", getUserCity())
.append("userArea", getUserArea())
.append("userAddress", getUserAddress())
.append("stationId", getStationId())
.append("stationName", getStationName())
.append("stationPhone", getStationPhone())
.append("stationProvince", getStationProvince())
.append("stationCity", getStationCity())
.append("stationArea", getStationArea())
.append("stationAddress", getStationAddress())
.append("orderState", getOrderState())
.append("payState", getPayState())
.append("payType", getPayType())
.append("payNum", getPayNum())
.append("name", getName())
.append("province", getProvince())
.append("city", getCity())
.append("area", getArea())
.append("address", getAddress())
.append("mobile", getMobile())
.append("delieverTime", getDelieverTime())
.append("delieverName", getDelieverName())
.append("delieverMobile", getDelieverMobile())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("delieverOver", getDelieverOver())
.append("takeTime", getTakeTime())
.append("finishTime", getFinishTime())
.append("ramark", getRamark())
.append("goodsVal", getGoodsVal())
.append("orderType", getOrderType())
.toString();
}
} }
...@@ -3,6 +3,7 @@ package com.qianhe.system.domain; ...@@ -3,6 +3,7 @@ package com.qianhe.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel; import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity; import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -15,11 +16,11 @@ import java.util.Date; ...@@ -15,11 +16,11 @@ import java.util.Date;
* @author qianhe * @author qianhe
* @date 2023-11-23 * @date 2023-11-23
*/ */
public class WaterOrderGoods extends BaseEntity @Data
public class WaterOrderGoods
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id; private Long id;
/** 订单id */ /** 订单id */
...@@ -28,11 +29,11 @@ public class WaterOrderGoods extends BaseEntity ...@@ -28,11 +29,11 @@ public class WaterOrderGoods extends BaseEntity
/** 订单编号 */ /** 订单编号 */
@Excel(name = "订单编号") @Excel(name = "订单编号")
private Long orderNum; private String orderNum;
/** 商品分类id */ /** 商品分类id */
@Excel(name = "商品分类id") @Excel(name = "商品分类id")
private String goodsTypeId; private Long goodsTypeId;
/** 商品分类 */ /** 商品分类 */
@Excel(name = "商品分类") @Excel(name = "商品分类")
...@@ -62,150 +63,15 @@ public class WaterOrderGoods extends BaseEntity ...@@ -62,150 +63,15 @@ public class WaterOrderGoods extends BaseEntity
@Excel(name = "商品总价") @Excel(name = "商品总价")
private BigDecimal goodsTotal; private BigDecimal goodsTotal;
/** 备注 */
private String remark;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date crateTime; private Date createTime;
/** 创建人 */ /** 创建人 */
@Excel(name = "创建人") @Excel(name = "创建人")
private String createUser; private String createUser;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setGoodsTypeId(String goodsTypeId)
{
this.goodsTypeId = goodsTypeId;
}
public String getGoodsTypeId()
{
return goodsTypeId;
}
public void setGoodsType(String goodsType)
{
this.goodsType = goodsType;
}
public String getGoodsType()
{
return goodsType;
}
public void setGoodsSpe(String goodsSpe)
{
this.goodsSpe = goodsSpe;
}
public String getGoodsSpe()
{
return goodsSpe;
}
public void setGoodsId(Long goodsId)
{
this.goodsId = goodsId;
}
public Long getGoodsId()
{
return goodsId;
}
public void setGoodsTitle(String goodsTitle)
{
this.goodsTitle = goodsTitle;
}
public String getGoodsTitle()
{
return goodsTitle;
}
public void setGoodsNum(BigDecimal goodsNum)
{
this.goodsNum = goodsNum;
}
public BigDecimal getGoodsNum()
{
return goodsNum;
}
public void setGoodsPrice(BigDecimal goodsPrice)
{
this.goodsPrice = goodsPrice;
}
public BigDecimal getGoodsPrice()
{
return goodsPrice;
}
public void setGoodsTotal(BigDecimal goodsTotal)
{
this.goodsTotal = goodsTotal;
}
public BigDecimal getGoodsTotal()
{
return goodsTotal;
}
public void setCrateTime(Date crateTime)
{
this.crateTime = crateTime;
}
public Date getCrateTime()
{
return crateTime;
}
public void setCreateUser(String createUser)
{
this.createUser = createUser;
}
public String getCreateUser()
{
return createUser;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("orderNum", getOrderNum())
.append("goodsTypeId", getGoodsTypeId())
.append("goodsType", getGoodsType())
.append("goodsSpe", getGoodsSpe())
.append("goodsId", getGoodsId())
.append("goodsTitle", getGoodsTitle())
.append("goodsNum", getGoodsNum())
.append("goodsPrice", getGoodsPrice())
.append("goodsTotal", getGoodsTotal())
.append("remark", getRemark())
.append("crateTime", getCrateTime())
.append("createUser", getCreateUser())
.toString();
}
} }
...@@ -43,4 +43,7 @@ public class WaterUserAddress ...@@ -43,4 +43,7 @@ public class WaterUserAddress
/** 收货人手机号 */ /** 收货人手机号 */
private Long phone; private Long phone;
/** 是否默认地址(1是,0否) */
private String isDefault;
} }
package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterGoodsCart;
import java.util.List;
public interface WaterGoodsCartMapper {
/**
* 查询购物车列表
* @param waterGoodsCart
* @return
*/
List<WaterGoodsCart> selectWaterGoodsCartList(WaterGoodsCart waterGoodsCart);
/**
* 查询详情
* @param id
* @return
*/
WaterGoodsCart selectWaterGoodsCartById(Long id);
/**
* 新增购物商品
* @param waterGoodsCart
* @return
*/
int insertWaterGoodsCart(WaterGoodsCart waterGoodsCart);
/**
* 修改购物车商品
* @param waterGoodsCart
* @return
*/
int updateWaterGoodsCart(WaterGoodsCart waterGoodsCart);
/**
* 删除购物车商品
* @param id
* @return
*/
int deleteWaterGoodsCartById(Long id);
/**
* 批量删除购物车商品
* @param ids
* @return
*/
int deleteWaterGoodsCartByIds(Long[] ids);
}
...@@ -100,4 +100,10 @@ public interface WaterGoodsMapper ...@@ -100,4 +100,10 @@ public interface WaterGoodsMapper
* @param list * @param list
*/ */
void batchInsertWaterGoodsImg(@Param("list") List<WaterGoodsImg> list); void batchInsertWaterGoodsImg(@Param("list") List<WaterGoodsImg> list);
/**
* 批量新增图片(修改)
* @param list
*/
void batchInsertWaterGoodsImgs(List<WaterGoodsImg> list);
} }
...@@ -23,6 +23,14 @@ public interface WaterGoodsSpeMapper ...@@ -23,6 +23,14 @@ public interface WaterGoodsSpeMapper
public WaterGoodsSpe selectWaterGoodsSpeById(Long id); public WaterGoodsSpe selectWaterGoodsSpeById(Long id);
/** /**
* 查询商品关联规格值
*
* @param id 商品关联规格值主键
* @return 商品关联规格值
*/
public WaterGoodsSpeVal selectWaterGoodsSpeValById(Long id);
/**
* 查询商品关联规格列表 * 查询商品关联规格列表
* *
* @param waterGoodsSpe 商品关联规格 * @param waterGoodsSpe 商品关联规格
......
package com.qianhe.system.mapper; package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterOrder; import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.domain.WaterOrderGoods;
import com.qianhe.system.vo.WaterOrderVo;
import java.util.List; import java.util.List;
/** /**
* 订单Mapper接口 * 订单Mapper接口
* *
* @author qianhe * @author qianhe
* @date 2023-11-23 * @date 2023-11-23
*/ */
public interface WaterOrderMapper public interface WaterOrderMapper
{ {
/** /**
* 查询订单 * 查询订单
* *
* @param id 订单主键 * @param id 订单主键
* @return 订单 * @return 订单
*/ */
public WaterOrder selectWaterOrderById(Long id); public WaterOrder selectWaterOrderById(Long id);
/** /**
* 根据订单编号查询订单
*
* @param orderNum 订单编号
* @return 订单
*/
public WaterOrder selectWaterOrderNumByOrderNum(String orderNum);
/**
* 查询订单列表 * 查询订单列表
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 订单集合 * @return 订单集合
*/ */
public List<WaterOrder> selectWaterOrderList(WaterOrder waterOrder); public List<WaterOrder> selectWaterOrderList(WaterOrderVo waterOrderVo);
/** /**
* 新增订单 * 新增订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
public int insertWaterOrder(WaterOrder waterOrder); public int insertWaterOrder(WaterOrderVo waterOrderVo);
/** /**
* 修改订单 * 修改订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
public int updateWaterOrder(WaterOrder waterOrder); public int updateWaterOrder(WaterOrderVo waterOrderVo);
/** /**
* 删除订单 * 删除订单
* *
* @param id 订单主键 * @param id 订单主键
* @return 结果 * @return 结果
*/ */
...@@ -54,9 +64,32 @@ public interface WaterOrderMapper ...@@ -54,9 +64,32 @@ public interface WaterOrderMapper
/** /**
* 批量删除订单 * 批量删除订单
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteWaterOrderByIds(Long[] ids); public int deleteWaterOrderByIds(Long[] ids);
/**
* 删除订单商品
*
* @param id 订单主键
* @return 结果
*/
public int deleteWaterOrderGoodsByOrderId(Long id);
/**
* 批量删除订单商品
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWaterOrderGoodsByOrderIds(Long[] ids);
/**
* 批量新增订单商品
* @param list
*/
void batchInsertWaterOrderGoods(List<WaterOrderGoods> list);
} }
...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper; ...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianhe.system.domain.WaterUserAddress; import com.qianhe.system.domain.WaterUserAddress;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -60,4 +61,15 @@ public interface WaterUserAddressMapper extends BaseMapper<WaterUserAddress> ...@@ -60,4 +61,15 @@ public interface WaterUserAddressMapper extends BaseMapper<WaterUserAddress>
* @return 结果 * @return 结果
*/ */
public int deleteWaterUserAddressByIds(Long[] ids); public int deleteWaterUserAddressByIds(Long[] ids);
/**
* 获取用户默认地址
* @return
*/
WaterUserAddress getUserDefaultAddress(@Param("userId") Long userId);
/**
* 修改用户默认地址
*/
int updateDefaultAddress(@Param("waterUserId") Long waterUserId);
} }
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterGoodsCart;
import java.util.List;
public interface IWaterGoodsCartService {
/**
* 查询购物车列表
* @param waterGoodsCart
* @return
*/
List<WaterGoodsCart> selectWaterGoodsCartList(WaterGoodsCart waterGoodsCart);
/**
* 查询详情
* @param id
* @return
*/
WaterGoodsCart selectWaterGoodsCartById(Long id);
/**
* 新增购物商品
* @param waterGoodsCart
* @return
*/
int insertWaterGoodsCart(WaterGoodsCart waterGoodsCart);
/**
* 修改购物车商品
* @param waterGoodsCart
* @return
*/
int updateWaterGoodsCart(WaterGoodsCart waterGoodsCart);
/**
* 批量删除购物车商品
* @param ids
* @return
*/
int deleteWaterGoodsCartByIds(Long[] ids);
}
package com.qianhe.system.service; package com.qianhe.system.service;
import com.qianhe.system.domain.WaterOrder; import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.vo.WaterOrderVo;
import java.util.List; import java.util.List;
/** /**
* 订单Service接口 * 订单Service接口
* *
* @author qianhe * @author qianhe
* @date 2023-11-23 * @date 2023-11-23
*/ */
public interface IWaterOrderService public interface IWaterOrderService
{ {
/** /**
* 查询订单 * 查询订单
* *
* @param id 订单主键 * @param id 订单主键
* @return 订单 * @return 订单
*/ */
public WaterOrder selectWaterOrderById(Long id); public WaterOrderVo selectWaterOrderById(Long id);
/** /**
* 查询订单列表 * 查询订单列表
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 订单集合 * @return 订单集合
*/ */
public List<WaterOrder> selectWaterOrderList(WaterOrder waterOrder); public List<WaterOrder> selectWaterOrderList(WaterOrderVo waterOrderVo);
/** /**
* 新增订单 * 新增订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
public int insertWaterOrder(WaterOrder waterOrder); public int insertWaterOrder(WaterOrderVo waterOrderVo);
/** /**
* 修改订单 * 修改订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
public int updateWaterOrder(WaterOrder waterOrder); public int updateWaterOrder(WaterOrderVo waterOrderVo);
/** /**
* 批量删除订单 * 批量删除订单
* *
* @param ids 需要删除的订单主键集合 * @param ids 需要删除的订单主键集合
* @return 结果 * @return 结果
*/ */
...@@ -54,9 +55,16 @@ public interface IWaterOrderService ...@@ -54,9 +55,16 @@ public interface IWaterOrderService
/** /**
* 删除订单信息 * 删除订单信息
* *
* @param id 订单主键 * @param id 订单主键
* @return 结果 * @return 结果
*/ */
public int deleteWaterOrderById(Long id); public int deleteWaterOrderById(Long id);
/**
* 修改订单状态
* @param waterOrderVo
* @return
*/
int updateOrderState(WaterOrderVo waterOrderVo);
} }
...@@ -60,4 +60,17 @@ public interface IWaterUserAddressService extends IService<WaterUserAddress> ...@@ -60,4 +60,17 @@ public interface IWaterUserAddressService extends IService<WaterUserAddress>
* @return 结果 * @return 结果
*/ */
public int deleteWaterUserAddressById(Long id); public int deleteWaterUserAddressById(Long id);
/**
* 获取用户默认地址
* @return
*/
WaterUserAddress getUserDefaultAddress(Long userId);
/**
* 修改用户默认地址
* @param waterUserAddress
* @return
*/
int updateDefaultAddress(WaterUserAddress waterUserAddress);
} }
package com.qianhe.system.service.impl;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterGoodsCart;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.mapper.WaterGoodsCartMapper;
import com.qianhe.system.mapper.WaterGoodsMapper;
import com.qianhe.system.mapper.WaterGoodsSpeMapper;
import com.qianhe.system.service.IWaterGoodsCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
@Service
public class WaterGoodsCartServiceImpl implements IWaterGoodsCartService {
@Autowired
private WaterGoodsCartMapper waterGoodsCartMapper;
@Autowired
private WaterGoodsMapper waterGoodsMapper;
@Autowired
private WaterGoodsSpeMapper waterGoodsSpeMapper;
/**
* 查询购物车列表
* @param waterGoodsCart
* @return
*/
@Override
public List<WaterGoodsCart> selectWaterGoodsCartList(WaterGoodsCart waterGoodsCart) {
return waterGoodsCartMapper.selectWaterGoodsCartList(waterGoodsCart);
}
/**
* 查询详情
* @param id
* @return
*/
@Override
public WaterGoodsCart selectWaterGoodsCartById(Long id) {
return waterGoodsCartMapper.selectWaterGoodsCartById(id);
}
/**
* 新增购物商品
* @param waterGoodsCart
* @return
*/
@Override
@Transactional
public int insertWaterGoodsCart(WaterGoodsCart waterGoodsCart) {
//根据商品id查询商品信息
WaterGoods waterGoods = waterGoodsMapper.selectWaterGoodsById(waterGoodsCart.getGoodsId());
//根据规格值id查询规格值
WaterGoodsSpeVal waterGoodsSpeVal = waterGoodsSpeMapper.selectWaterGoodsSpeValById(waterGoodsCart.getGoodsSpeValId());
waterGoodsCart.setGoodsName(waterGoods.getTitle());
waterGoodsCart.setGoodsTypeId(waterGoods.getGoodsTypeId());
waterGoodsCart.setGoodsSpeVal(waterGoodsSpeVal.getSpe() + ":" + waterGoodsSpeVal.getSpeVal());
waterGoodsCart.setGoodsPrice(waterGoodsSpeVal.getPrice());
waterGoodsCart.setGoodsTotal(BigDecimal.valueOf(waterGoodsSpeVal.getPrice().doubleValue() * waterGoodsCart.getGoodsNum()));
waterGoodsCart.setCreateUser(waterGoodsCart.getUserId().toString());
waterGoodsCart.setCreateTime(DateUtils.getNowDate());
return waterGoodsCartMapper.insertWaterGoodsCart(waterGoodsCart);
}
/**
* 修改购物车商品
* @param waterGoodsCart
* @return
*/
@Override
@Transactional
public int updateWaterGoodsCart(WaterGoodsCart waterGoodsCart)
{
if (StringUtils.isNotNull(waterGoodsCart.getGoodsNum())){
WaterGoodsCart waterGoodsCart1 = waterGoodsCartMapper.selectWaterGoodsCartById(waterGoodsCart.getId());
waterGoodsCart.setGoodsTotal(BigDecimal.valueOf(waterGoodsCart1.getGoodsPrice().doubleValue() * waterGoodsCart.getGoodsNum()));
}
return waterGoodsCartMapper.updateWaterGoodsCart(waterGoodsCart);
}
/**
* 批量删除购物车商品
* @param ids
* @return
*/
@Override
public int deleteWaterGoodsCartByIds(Long[] ids) {
return waterGoodsCartMapper.deleteWaterGoodsCartByIds(ids);
}
}
...@@ -3,13 +3,8 @@ package com.qianhe.system.service.impl; ...@@ -3,13 +3,8 @@ package com.qianhe.system.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.qianhe.common.utils.DateUtils; import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils; import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterGoods; import com.qianhe.system.domain.*;
import com.qianhe.system.domain.WaterGoodsImg; import com.qianhe.system.mapper.*;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.mapper.WaterGoodsImgMapper;
import com.qianhe.system.mapper.WaterGoodsMapper;
import com.qianhe.system.mapper.WaterGoodsSpeMapper;
import com.qianhe.system.service.IWaterGoodsService; import com.qianhe.system.service.IWaterGoodsService;
import com.qianhe.system.vo.WaterGoodsSpeVo; import com.qianhe.system.vo.WaterGoodsSpeVo;
import com.qianhe.system.vo.WaterGoodsVo; import com.qianhe.system.vo.WaterGoodsVo;
...@@ -36,6 +31,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -36,6 +31,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
private WaterGoodsSpeMapper waterGoodsSpeMapper; private WaterGoodsSpeMapper waterGoodsSpeMapper;
@Autowired @Autowired
private WaterGoodsImgMapper waterGoodsImgMapper; private WaterGoodsImgMapper waterGoodsImgMapper;
@Autowired
private WaterStationMapper waterStationMapper;
@Autowired
private WaterGoodsTypeMapper waterGoodsTypeMapper;
/** /**
* 查询商品 * 查询商品
...@@ -50,6 +49,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -50,6 +49,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
//转vo //转vo
WaterGoodsVo waterGoodsVo = new WaterGoodsVo(); WaterGoodsVo waterGoodsVo = new WaterGoodsVo();
BeanUtils.copyProperties(waterGoods,waterGoodsVo); BeanUtils.copyProperties(waterGoods,waterGoodsVo);
//查询所有站点
List<WaterStation> waterStations = waterStationMapper.selectWaterStationList(new WaterStation());
//查询所有商品分类
List<WaterGoodsType> waterGoodsTypes = waterGoodsTypeMapper.selectWaterGoodsTypeList(new WaterGoodsType());
//查询商品图片 //查询商品图片
WaterGoodsImg waterGoodsImg = new WaterGoodsImg(); WaterGoodsImg waterGoodsImg = new WaterGoodsImg();
waterGoodsImg.setGoodsId(id); waterGoodsImg.setGoodsId(id);
...@@ -95,6 +98,39 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -95,6 +98,39 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
if (detailsImgs.size() > 0){ if (detailsImgs.size() > 0){
waterGoodsVo.setDetailsImgs(detailsImgs); waterGoodsVo.setDetailsImgs(detailsImgs);
} }
//设置站点名称
if (StringUtils.isNotEmpty(waterGoods.getBelongStationId())){
String[] split = waterGoods.getBelongStationId().split(",");
String stationName = "";
if (split.length > 1){
for (int i = 0; i < split.length; i++) {
for (WaterStation waterStation : waterStations) {
if (split[i].equals(waterStation.getId().toString())){
if (i == split.length - 1){
stationName += waterStation.getStationName();
}else {
stationName += waterStation.getStationName() + ",";
}
}
}
}
}else {
for (WaterStation waterStation : waterStations) {
if (split[0].equals(waterStation.getId().toString())){
stationName = waterStation.getStationName();
}
}
}
waterGoodsVo.setBelongStationNames(stationName);
}
//设置商品分类名称
if (StringUtils.isNotNull(waterGoods.getGoodsTypeId())){
for (WaterGoodsType waterGoodsType : waterGoodsTypes) {
if (waterGoods.getGoodsTypeId().equals(waterGoodsType.getId())){
waterGoodsVo.setGoodsTypeName(waterGoodsType.getTypeName());
}
}
}
return waterGoodsVo; return waterGoodsVo;
} }
...@@ -202,7 +238,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -202,7 +238,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
} }
if (detailsImgList.size() > 0){ if (detailsImgList.size() > 0){
//批量新增详情图 //批量新增详情图
waterGoodsMapper.batchInsertWaterGoodsImg(detailsImgList); waterGoodsMapper.batchInsertWaterGoodsImgs(detailsImgList);
} }
} }
...@@ -225,7 +261,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService ...@@ -225,7 +261,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
} }
if (coverImgList.size() > 0){ if (coverImgList.size() > 0){
//批量新增封面图 //批量新增封面图
waterGoodsMapper.batchInsertWaterGoodsImg(coverImgList); waterGoodsMapper.batchInsertWaterGoodsImgs(coverImgList);
} }
} }
......
package com.qianhe.system.service.impl; package com.qianhe.system.service.impl;
import com.qianhe.common.utils.DateUtils; import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterOrder; import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.domain.WaterOrderGoods;
import com.qianhe.system.mapper.WaterGoodsMapper;
import com.qianhe.system.mapper.WaterOrderGoodsMapper;
import com.qianhe.system.mapper.WaterOrderMapper; import com.qianhe.system.mapper.WaterOrderMapper;
import com.qianhe.system.service.IWaterOrderService; import com.qianhe.system.service.IWaterOrderService;
import com.qianhe.system.vo.WaterOrderVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.List; import java.util.List;
import java.util.Random;
/** /**
* 订单Service业务层处理 * 订单Service业务层处理
...@@ -20,6 +31,10 @@ public class WaterOrderServiceImpl implements IWaterOrderService ...@@ -20,6 +31,10 @@ public class WaterOrderServiceImpl implements IWaterOrderService
{ {
@Autowired @Autowired
private WaterOrderMapper waterOrderMapper; private WaterOrderMapper waterOrderMapper;
@Autowired
private WaterOrderGoodsMapper waterOrderGoodsMapper;
@Autowired
private WaterGoodsMapper waterGoodsMapper;
/** /**
* 查询订单 * 查询订单
...@@ -28,46 +43,125 @@ public class WaterOrderServiceImpl implements IWaterOrderService ...@@ -28,46 +43,125 @@ public class WaterOrderServiceImpl implements IWaterOrderService
* @return 订单 * @return 订单
*/ */
@Override @Override
public WaterOrder selectWaterOrderById(Long id) public WaterOrderVo selectWaterOrderById(Long id)
{ {
return waterOrderMapper.selectWaterOrderById(id); WaterOrder waterOrder = waterOrderMapper.selectWaterOrderById(id);
//转vo
WaterOrderVo waterOrderVo = new WaterOrderVo();
BeanUtils.copyProperties(waterOrder,waterOrderVo);
//查询该订单商品
WaterOrderGoods waterOrderGoods = new WaterOrderGoods();
waterOrderGoods.setOrderId(id);
List<WaterOrderGoods> waterOrderGoodsList = waterOrderGoodsMapper.selectWaterOrderGoodsList(waterOrderGoods);
if (waterOrderGoodsList.size() > 0){
waterOrderVo.setWaterOrderGoodsList(waterOrderGoodsList);
}
return waterOrderVo;
} }
/** /**
* 查询订单列表 * 查询订单列表
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 订单 * @return 订单
*/ */
@Override @Override
public List<WaterOrder> selectWaterOrderList(WaterOrder waterOrder) public List<WaterOrder> selectWaterOrderList(WaterOrderVo waterOrderVo)
{ {
return waterOrderMapper.selectWaterOrderList(waterOrder); return waterOrderMapper.selectWaterOrderList(waterOrderVo);
} }
/** /**
* 新增订单 * 新增订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertWaterOrder(WaterOrder waterOrder) @Transactional
public int insertWaterOrder(WaterOrderVo waterOrderVo)
{ {
waterOrder.setCreateTime(DateUtils.getNowDate()); waterOrderVo.setCreateUser(waterOrderVo.getUserId().toString());
return waterOrderMapper.insertWaterOrder(waterOrder); waterOrderVo.setCreateTime(DateUtils.getNowDate());
waterOrderVo.setOrderNum(getOrerNum());
waterOrderVo.setOrderState(1);
waterOrderVo.setPayState(0);
waterOrderVo.setOrderType(1);
int i = waterOrderMapper.insertWaterOrder(waterOrderVo);
//新增订单商品
insertWaterOrderGoods(waterOrderVo);
return i;
}
/**
* 生成订单编号
* @return
*/
private String getOrerNum(){
String orderNum = "";
//获取当前年月日
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String today = format.format(DateUtils.getNowDate());
Long rqbh = Long.parseLong(today + "0001");
while (true){
WaterOrder waterOrder = new WaterOrder();
waterOrder.setOrderNum(rqbh.toString());
WaterOrder waterOrder1 = waterOrderMapper.selectWaterOrderNumByOrderNum(rqbh.toString());
if (StringUtils.isNotNull(waterOrder1)){
rqbh ++;
}else {
break;
}
}
//生成随机四位英文字母
Random random = new Random();
String randomletters = "";
for (int i = 0; i < 4; i++) {
int index = random.nextInt(26);
char letter = (char) ('A' + index);
randomletters += letter;
}
orderNum = rqbh + randomletters;
return orderNum;
}
private void insertWaterOrderGoods(WaterOrderVo waterOrderVo) {
List<WaterOrderGoods> waterOrderGoodsList = waterOrderVo.getWaterOrderGoodsList();
//商品订单主键id
Long id = waterOrderVo.getId();
//商品订单编号
String orderNum = waterOrderVo.getOrderNum();
if (StringUtils.isNotNull(waterOrderGoodsList)){
for (WaterOrderGoods waterOrderGoods : waterOrderGoodsList) {
//根据商品id查询商品信息
WaterGoods waterGoods = waterGoodsMapper.selectWaterGoodsById(waterOrderGoods.getGoodsId());
waterOrderGoods.setOrderId(id);
waterOrderGoods.setOrderNum(orderNum);
waterOrderGoods.setGoodsTypeId(waterGoods.getGoodsTypeId());
waterOrderGoods.setGoodsTitle(waterGoods.getTitle());
waterOrderGoods.setCreateUser(waterOrderVo.getUserId().toString());
waterOrderGoods.setCreateTime(DateUtils.getNowDate());
}
//批量新增订单商品
waterOrderMapper.batchInsertWaterOrderGoods(waterOrderGoodsList);
}
} }
/** /**
* 修改订单 * 修改订单
* *
* @param waterOrder 订单 * @param waterOrderVo 订单
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateWaterOrder(WaterOrder waterOrder) @Transactional
public int updateWaterOrder(WaterOrderVo waterOrderVo)
{ {
return waterOrderMapper.updateWaterOrder(waterOrder); //删除订单商品
waterOrderMapper.deleteWaterOrderGoodsByOrderId(waterOrderVo.getId());
//新增订单商品
insertWaterOrderGoods(waterOrderVo);
return waterOrderMapper.updateWaterOrder(waterOrderVo);
} }
/** /**
...@@ -79,6 +173,8 @@ public class WaterOrderServiceImpl implements IWaterOrderService ...@@ -79,6 +173,8 @@ public class WaterOrderServiceImpl implements IWaterOrderService
@Override @Override
public int deleteWaterOrderByIds(Long[] ids) public int deleteWaterOrderByIds(Long[] ids)
{ {
//批量删除订单商品
waterOrderMapper.deleteWaterOrderGoodsByOrderIds(ids);
return waterOrderMapper.deleteWaterOrderByIds(ids); return waterOrderMapper.deleteWaterOrderByIds(ids);
} }
...@@ -93,4 +189,14 @@ public class WaterOrderServiceImpl implements IWaterOrderService ...@@ -93,4 +189,14 @@ public class WaterOrderServiceImpl implements IWaterOrderService
{ {
return waterOrderMapper.deleteWaterOrderById(id); return waterOrderMapper.deleteWaterOrderById(id);
} }
/**
* 修改订单状态
* @param waterOrderVo
* @return
*/
@Override
public int updateOrderState(WaterOrderVo waterOrderVo) {
return waterOrderMapper.updateWaterOrder(waterOrderVo);
}
} }
...@@ -92,4 +92,26 @@ public class WaterUserAddressServiceImpl extends ServiceImpl<WaterUserAddressMap ...@@ -92,4 +92,26 @@ public class WaterUserAddressServiceImpl extends ServiceImpl<WaterUserAddressMap
{ {
return waterUserAddressMapper.deleteWaterUserAddressById(id); return waterUserAddressMapper.deleteWaterUserAddressById(id);
} }
/**
* 获取用户默认地址
* @return
*/
@Override
public WaterUserAddress getUserDefaultAddress(Long userId) {
return waterUserAddressMapper.getUserDefaultAddress(userId);
}
/**
* 修改用户默认地址
* @param waterUserAddress
* @return
*/
@Override
public int updateDefaultAddress(WaterUserAddress waterUserAddress) {
//将该用户所有默认地址设备不默认
waterUserAddressMapper.updateDefaultAddress(waterUserAddress.getWaterUserId());
//设置用户默认地址
return waterUserAddressMapper.updateWaterUserAddress(waterUserAddress);
}
} }
...@@ -16,6 +16,9 @@ public class WaterGoodsSpeVo { ...@@ -16,6 +16,9 @@ public class WaterGoodsSpeVo {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** 商品规格主键id */
private Long waterSpeId;
/** 标题 */ /** 标题 */
@Excel(name = "标题") @Excel(name = "标题")
private String speTitle; private String speTitle;
......
...@@ -7,6 +7,7 @@ import com.qianhe.common.annotation.Excel; ...@@ -7,6 +7,7 @@ import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterGoodsImg; import com.qianhe.system.domain.WaterGoodsImg;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -46,7 +47,11 @@ public class WaterGoodsVo { ...@@ -46,7 +47,11 @@ public class WaterGoodsVo {
/** 价格 */ /** 价格 */
@Excel(name = "价格") @Excel(name = "价格")
private String price; private BigDecimal price;
/** 销量 */
@Excel(name = "销量")
private String volume;
/** 创建人 */ /** 创建人 */
private String createUser; private String createUser;
...@@ -57,7 +62,7 @@ public class WaterGoodsVo { ...@@ -57,7 +62,7 @@ public class WaterGoodsVo {
/** 状态(1上架0下架) */ /** 状态(1上架0下架) */
@Excel(name = "状态", readConverterExp = "1=上架0下架") @Excel(name = "状态", readConverterExp = "1=上架0下架")
private Long status; private Integer status;
/** 封面图集合 */ /** 封面图集合 */
private List<WaterGoodsImg> coverImgs; private List<WaterGoodsImg> coverImgs;
......
package com.qianhe.system.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterOrderGoods;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class WaterOrderVo {
private Long id;
/** 订单编号(生成规则当前年月日+当天下单0001开始+随机生成4位英文字母) */
@Excel(name = "订单编号(生成规则当前年月日+当天下单0001开始+随机生成4位英文字母)")
private String orderNum;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 用户名字 */
@Excel(name = "用户名字")
private String userName;
/** 用户手机号 */
@Excel(name = "用户手机号")
private Long userPhone;
/** 用户省 */
@Excel(name = "用户省")
private String userProvince;
/** 用户城市 */
@Excel(name = "用户城市")
private String userCity;
/** 用户区 */
@Excel(name = "用户区")
private String userArea;
/** 用户详细地址 */
@Excel(name = "用户详细地址")
private String userAddress;
/** 站点id */
@Excel(name = "站点id")
private Long stationId;
/** 站点名字 */
@Excel(name = "站点名字")
private String stationName;
/** 站点手机号 */
@Excel(name = "站点手机号")
private Long stationPhone;
/** 站点省份 */
@Excel(name = "站点省份")
private String stationProvince;
/** 站点城市 */
@Excel(name = "站点城市")
private String stationCity;
/** 站点市区 */
@Excel(name = "站点市区")
private String stationArea;
/** 站点详细地址 */
@Excel(name = "站点详细地址")
private String stationAddress;
/** 订单状态(1待付款2待接单3进行中4已完成5已取消6已退款) */
@Excel(name = "订单状态(1待付款2待接单3进行中4已完成5已取消6已退款)")
private Integer orderState;
/** 付款状态(0未付款1已付款) */
@Excel(name = "付款状态(0未付款1已付款)")
private Integer payState;
/** 支付方式(1银行2水票) */
@Excel(name = "支付方式(1银行2水票)")
private Integer payType;
/** 银行返回支付成功code */
@Excel(name = "银行返回支付成功code")
private String payNum;
/** 用户地址id */
private Long userAddressId;
/** 收货人名字 */
@Excel(name = "收货人名字")
private String name;
/** 省 */
@Excel(name = "省")
private String province;
/** 市 */
@Excel(name = "市")
private String city;
/** 区 */
@Excel(name = "区")
private String area;
/** 详细地址 */
@Excel(name = "详细地址")
private String address;
/** 收货人手机号 */
@Excel(name = "收货人手机号")
private Long mobile;
/** 送货时间 */
@Excel(name = "送货时间")
private String delieverTime;
/** 送水工名字 */
@Excel(name = "送水工名字")
private String delieverName;
/** 送水工电话 */
@Excel(name = "送水工电话")
private String delieverMobile;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 创建人 */
@Excel(name = "创建人")
private String createUser;
/** 送达时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "送达时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date delieverOver;
/** 收货时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "收货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date takeTime;
/** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date finishTime;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 商品总价 */
@Excel(name = "商品总价")
private BigDecimal goodsVal;
/** 订单类型(1普通订单2退款订单) */
@Excel(name = "订单类型", readConverterExp = "1=普通订单2退款订单")
private Integer orderType;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 商品 */
private WaterOrderGoods waterOrderGoods;
/** 商品 */
private List<WaterOrderGoods> waterOrderGoodsList;
}
...@@ -131,6 +131,6 @@ xss: ...@@ -131,6 +131,6 @@ xss:
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
wx: wx:
appId: wxb51f4823578b94d3 appId: wxcabea5c944c4327c
appSecret: b9eaa65a8f2726710d0916e4b26936b6 appSecret: bd486fd54bd1ea5e9b198911d765ce6a
access-token-uri: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${wx.appId}&secret=${wx.appSecret} access-token-uri: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${wx.appId}&secret=${wx.appSecret}
<?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.qianhe.system.mapper.WaterGoodsCartMapper">
<resultMap type="WaterGoodsCart" id="WaterGoodsCartResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="goodsId" column="goods_id" />
<result property="goodsName" column="goods_name" />
<result property="goodsTypeId" column="goods_type_id" />
<result property="goodsTypeName" column="goods_type_name" />
<result property="goodsSpeId" column="goods_spe_id" />
<result property="goodsSpeValId" column="goods_spe_val_id" />
<result property="goodsSpeVal" column="goods_spe_val" />
<result property="goodsPrice" column="goods_price" />
<result property="goodsNum" column="goods_num" />
<result property="goodsTotal" column="goods_total" />
<result property="isSelect" column="is_select" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWaterGoodsCartVo">
select id, user_id, goods_id, goods_name, goods_type_id, goods_type_name,
goods_spe_id, goods_spe_val_id, goods_spe_val, goods_price, goods_num, goods_total, is_select, create_user, create_time
from water_goods_cart
</sql>
<select id="selectWaterGoodsCartList" parameterType="WaterGoodsCart" resultMap="WaterGoodsCartResult">
<include refid="selectWaterGoodsCartVo"/>
<where>
del_flag = '0'
<if test="userId != null"> and user_id = #{userId}</if>
<if test="goodsId != null "> and goods_id = #{goodsId}</if>
<if test="goodsName != null "> and goods_name like concat('%', #{goodsName}, '%')</if>
</where>
order by create_time DESC
</select>
<select id="selectWaterGoodsCartById" parameterType="Long" resultMap="WaterGoodsCartResult">
<include refid="selectWaterGoodsCartVo"/>
where id = #{id}
</select>
<insert id="insertWaterGoodsCart" parameterType="WaterGoodsCart" useGeneratedKeys="true" keyProperty="id">
insert into water_goods_cart
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="goodsId != null">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="goodsTypeId != null">goods_type_id,goods_type_name,</if>
<if test="goodsSpeId != null">goods_spe_id,</if>
<if test="goodsSpeValId != null">goods_spe_val_id,</if>
<if test="goodsSpeVal != null">goods_spe_val,</if>
<if test="goodsPrice != null">goods_price,</if>
<if test="goodsNum != null">goods_num,</if>
<if test="goodsTotal != null">goods_total,</if>
<if test="isSelect != null">is_select,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="goodsTypeId != null">#{goodsTypeId},(select type_name from water_goods_type where id = #{goodsTypeId}),</if>
<if test="goodsSpeId != null">#{goodsSpeId},</if>
<if test="goodsSpeValId != null">#{goodsSpeValId},</if>
<if test="goodsSpeVal != null">#{goodsSpeVal},</if>
<if test="goodsPrice != null">#{goodsPrice},</if>
<if test="goodsNum != null">#{goodsNum},</if>
<if test="goodsTotal != null">#{goodsTotal},</if>
<if test="isSelect != null">#{isSelect},</if>
<if test="createUser != null">(select nick_name from water_user where id = #{createUser}),</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWaterGoodsCart" parameterType="WaterGoodsCart">
update water_goods_cart
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="goodsTypeId != null">goods_type_id = #{goodsTypeId},goods_type_name = (select type_name from water_goods_type where id = #{goodsTypeId}),</if>
<if test="goodsSpeId != null">goods_spe_id = #{goodsSpeId},</if>
<if test="goodsSpeValId != null">goods_spe_val_id = #{goodsSpeValId},</if>
<if test="goodsSpeVal != null">goods_spe_val = #{goodsSpeVal},</if>
<if test="goodsPrice != null">goods_price = #{goodsPrice},</if>
<if test="goodsNum != null">goods_num = #{goodsNum},</if>
<if test="goodsTotal != null">goods_total = #{goodsTotal},</if>
<if test="isSelect != null">is_select = #{isSelect},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<update id="deleteWaterGoodsCartById" parameterType="Long">
update water_goods_cart set del_flag = '1' where id = #{id}
</update>
<update id="deleteWaterGoodsCartByIds" parameterType="String">
update water_goods_cart set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>
...@@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="coverImg" column="cover_img" /> <result property="coverImg" column="cover_img" />
<result property="detailsImg" column="details_img" /> <result property="detailsImg" column="details_img" />
<result property="price" column="price" /> <result property="price" column="price" />
<result property="volume" column="volume" />
<result property="createUser" column="create_user" /> <result property="createUser" column="create_user" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="status" column="status" /> <result property="status" column="status" />
</resultMap> </resultMap>
<sql id="selectWaterGoodsVo"> <sql id="selectWaterGoodsVo">
select id, title, goods_type_id, belong_station_id, cover_img, details_img, price, create_user, create_time, status from water_goods select id, title, goods_type_id, belong_station_id, cover_img, details_img, price, volume, create_user, create_time, status from water_goods
</sql> </sql>
<select id="selectWaterGoodsList" parameterType="WaterGoods" resultMap="WaterGoodsResult"> <select id="selectWaterGoodsList" parameterType="WaterGoods" resultMap="WaterGoodsResult">
...@@ -27,12 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -27,12 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
del_flag = '0' del_flag = '0'
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title = #{title}</if>
<if test="goodsTypeId != null "> and goods_type_id = #{goodsTypeId}</if> <if test="goodsTypeId != null "> and goods_type_id = #{goodsTypeId}</if>
<if test="belongStationId != null "> and belong_station_id = #{belongStationId}</if> <if test="belongStationId != null "> and belong_station_id like concat('%', #{belongStationId}, '%')</if>
<if test="coverImg != null and coverImg != ''"> and cover_img = #{coverImg}</if> <if test="coverImg != null and coverImg != ''"> and cover_img = #{coverImg}</if>
<if test="detailsImg != null and detailsImg != ''"> and details_img = #{detailsImg}</if> <if test="detailsImg != null and detailsImg != ''"> and details_img = #{detailsImg}</if>
<if test="price != null and price != ''"> and price = #{price}</if> <if test="price != null and price != ''"> and price = #{price}</if>
<if test="volume != null and volume != ''"> and volume = #{volume}</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult"> <select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult">
...@@ -49,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">cover_img,</if> <if test="coverImg != null">cover_img,</if>
<if test="detailsImg != null">details_img,</if> <if test="detailsImg != null">details_img,</if>
<if test="price != null">price,</if> <if test="price != null">price,</if>
<if test="volume != null">volume,</if>
<if test="createUser != null">create_user,</if> <if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
...@@ -60,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">#{coverImg},</if> <if test="coverImg != null">#{coverImg},</if>
<if test="detailsImg != null">#{detailsImg},</if> <if test="detailsImg != null">#{detailsImg},</if>
<if test="price != null">#{price},</if> <if test="price != null">#{price},</if>
<if test="volume != null">#{volume},</if>
<if test="createUser != null">#{createUser},</if> <if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
...@@ -75,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -75,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">cover_img = #{coverImg},</if> <if test="coverImg != null">cover_img = #{coverImg},</if>
<if test="detailsImg != null">details_img = #{detailsImg},</if> <if test="detailsImg != null">details_img = #{detailsImg},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="createUser != null">create_user = #{createUser},</if> <if test="createUser != null">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
...@@ -138,4 +144,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -138,4 +144,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertWaterGoodsImgs" useGeneratedKeys="true" keyProperty="id">
insert into water_goods_img(img_name, url, img_type, goods_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.imgName}, #{item.url}, #{item.imgType}, #{item.goodsId})
</foreach>
</insert>
</mapper> </mapper>
...@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="WaterGoodsSpe" id="WaterGoodsSpeResult"> <resultMap type="WaterGoodsSpe" id="WaterGoodsSpeResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="waterSpeId" column="water_spe_id" />
<result property="speTitle" column="spe_title" /> <result property="speTitle" column="spe_title" />
<result property="goodsId" column="goods_id" /> <result property="goodsId" column="goods_id" />
<result property="createUser" column="create_user" /> <result property="createUser" column="create_user" />
...@@ -13,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -13,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWaterGoodsSpeVo"> <sql id="selectWaterGoodsSpeVo">
select id, spe_title, goods_id, create_user, create_time from water_goods_spe select id, water_spe_id, spe_title, goods_id, create_user, create_time from water_goods_spe
</sql> </sql>
<select id="selectWaterGoodsSpeList" parameterType="WaterGoodsSpe" resultMap="WaterGoodsSpeResult"> <select id="selectWaterGoodsSpeList" parameterType="WaterGoodsSpe" resultMap="WaterGoodsSpeResult">
...@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectWaterGoodsSpeValList" parameterType="WaterGoodsSpeVal" resultType="WaterGoodsSpeVal"> <select id="selectWaterGoodsSpeValList" parameterType="WaterGoodsSpeVal" resultType="WaterGoodsSpeVal">
select id, spe_id, spe, spe_val from water_goods_spe_val select id, spe_id, spe, spe_val, price from water_goods_spe_val
<where> <where>
del_flag = '0' del_flag = '0'
<if test="speId != null"> and spe_id = #{speId}</if> <if test="speId != null"> and spe_id = #{speId}</if>
...@@ -38,15 +39,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,15 +39,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectWaterGoodsSpeValById" parameterType="Long" resultType="WaterGoodsSpeVal">
select id, spe_id, spe, spe_val, price from water_goods_spe_val
where id = #{id}
</select>
<insert id="insertWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo" useGeneratedKeys="true" keyProperty="id">
insert into water_goods_spe insert into water_goods_spe
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="waterSpeId != null">water_spe_id,</if>
<if test="speTitle != null">spe_title,</if> <if test="speTitle != null">spe_title,</if>
<if test="goodsId != null">goods_id,</if> <if test="goodsId != null">goods_id,</if>
<if test="createUser != null">create_user,</if> <if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="waterSpeId != null">#{waterSpeId},</if>
<if test="speTitle != null">#{speTitle},</if> <if test="speTitle != null">#{speTitle},</if>
<if test="goodsId != null">#{goodsId},</if> <if test="goodsId != null">#{goodsId},</if>
<if test="createUser != null">#{createUser},</if> <if test="createUser != null">#{createUser},</if>
...@@ -57,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo"> <update id="updateWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo">
update water_goods_spe update water_goods_spe
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="waterSpeId != null">water_spe_id = #{waterSpeId},</if>
<if test="speTitle != null">spe_title = #{speTitle},</if> <if test="speTitle != null">spe_title = #{speTitle},</if>
<if test="goodsId != null">goods_id = #{goodsId},</if> <if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="createUser != null">create_user = #{createUser},</if> <if test="createUser != null">create_user = #{createUser},</if>
...@@ -88,10 +97,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -88,10 +97,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<insert id="batchInsertWaterGoodsSpeVal"> <insert id="batchInsertWaterGoodsSpeVal">
insert into water_goods_spe_val(spe_id, spe, spe_val) insert into water_goods_spe_val(spe_id, spe, spe_val, price)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.speId}, #{item.spe}, #{item.speVal}) (#{item.speId}, #{item.spe}, #{item.speVal}, #{item.price})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
...@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
del_flag = '0' del_flag = '0'
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if> <if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterGoodsTypeById" parameterType="Long" resultMap="WaterGoodsTypeResult"> <select id="selectWaterGoodsTypeById" parameterType="Long" resultMap="WaterGoodsTypeResult">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qianhe.system.mapper.WaterOrderGoodsMapper"> <mapper namespace="com.qianhe.system.mapper.WaterOrderGoodsMapper">
<resultMap type="WaterOrderGoods" id="WaterOrderGoodsResult"> <resultMap type="WaterOrderGoods" id="WaterOrderGoodsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
...@@ -17,17 +17,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -17,17 +17,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsPrice" column="goods_price" /> <result property="goodsPrice" column="goods_price" />
<result property="goodsTotal" column="goods_total" /> <result property="goodsTotal" column="goods_total" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="crateTime" column="crate_time" /> <result property="createTime" column="create_time" />
<result property="createUser" column="create_user" /> <result property="createUser" column="create_user" />
</resultMap> </resultMap>
<sql id="selectWaterOrderGoodsVo"> <sql id="selectWaterOrderGoodsVo">
select id, order_id, order_num, goods_type_id, goods_type, goods_spe, goods_id, goods_title, goods_num, goods_price, goods_total, remark, crate_time, create_user from water_order_goods select id, order_id, order_num, goods_type_id, goods_type, goods_spe, goods_id, goods_title, goods_num, goods_price, goods_total, remark, create_time, create_user from water_order_goods
</sql> </sql>
<select id="selectWaterOrderGoodsList" parameterType="WaterOrderGoods" resultMap="WaterOrderGoodsResult"> <select id="selectWaterOrderGoodsList" parameterType="WaterOrderGoods" resultMap="WaterOrderGoodsResult">
<include refid="selectWaterOrderGoodsVo"/> <include refid="selectWaterOrderGoodsVo"/>
<where> <where>
del_flag = '0'
<if test="orderId != null "> and order_id = #{orderId}</if> <if test="orderId != null "> and order_id = #{orderId}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if> <if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="goodsTypeId != null and goodsTypeId != ''"> and goods_type_id = #{goodsTypeId}</if> <if test="goodsTypeId != null and goodsTypeId != ''"> and goods_type_id = #{goodsTypeId}</if>
...@@ -38,16 +39,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,16 +39,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsNum != null "> and goods_num = #{goodsNum}</if> <if test="goodsNum != null "> and goods_num = #{goodsNum}</if>
<if test="goodsPrice != null "> and goods_price = #{goodsPrice}</if> <if test="goodsPrice != null "> and goods_price = #{goodsPrice}</if>
<if test="goodsTotal != null "> and goods_total = #{goodsTotal}</if> <if test="goodsTotal != null "> and goods_total = #{goodsTotal}</if>
<if test="crateTime != null "> and crate_time = #{crateTime}</if> <if test="createTime != null "> and create_time = #{createTime}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if> <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
</where> </where>
</select> </select>
<select id="selectWaterOrderGoodsById" parameterType="Long" resultMap="WaterOrderGoodsResult"> <select id="selectWaterOrderGoodsById" parameterType="Long" resultMap="WaterOrderGoodsResult">
<include refid="selectWaterOrderGoodsVo"/> <include refid="selectWaterOrderGoodsVo"/>
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertWaterOrderGoods" parameterType="WaterOrderGoods" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWaterOrderGoods" parameterType="WaterOrderGoods" useGeneratedKeys="true" keyProperty="id">
insert into water_order_goods insert into water_order_goods
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -62,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsPrice != null">goods_price,</if> <if test="goodsPrice != null">goods_price,</if>
<if test="goodsTotal != null">goods_total,</if> <if test="goodsTotal != null">goods_total,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="crateTime != null">crate_time,</if> <if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if> <if test="createUser != null">create_user,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -77,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -77,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsPrice != null">#{goodsPrice},</if> <if test="goodsPrice != null">#{goodsPrice},</if>
<if test="goodsTotal != null">#{goodsTotal},</if> <if test="goodsTotal != null">#{goodsTotal},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="crateTime != null">#{crateTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if> <if test="createUser != null">#{createUser},</if>
</trim> </trim>
</insert> </insert>
...@@ -96,20 +97,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -96,20 +97,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsPrice != null">goods_price = #{goodsPrice},</if> <if test="goodsPrice != null">goods_price = #{goodsPrice},</if>
<if test="goodsTotal != null">goods_total = #{goodsTotal},</if> <if test="goodsTotal != null">goods_total = #{goodsTotal},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="crateTime != null">crate_time = #{crateTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if> <if test="createUser != null">create_user = #{createUser},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteWaterOrderGoodsById" parameterType="Long"> <update id="deleteWaterOrderGoodsById" parameterType="Long">
delete from water_order_goods where id = #{id} update water_order_goods set del_flag = '1' where id = #{id}
</delete> </update>
<delete id="deleteWaterOrderGoodsByIds" parameterType="String"> <update id="deleteWaterOrderGoodsByIds" parameterType="String">
delete from water_order_goods where id in update water_order_goods set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qianhe.system.mapper.WaterOrderMapper"> <mapper namespace="com.qianhe.system.mapper.WaterOrderMapper">
<resultMap type="WaterOrder" id="WaterOrderResult"> <resultMap type="WaterOrder" id="WaterOrderResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num" />
...@@ -39,19 +39,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -39,19 +39,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delieverOver" column="deliever_over" /> <result property="delieverOver" column="deliever_over" />
<result property="takeTime" column="take_time" /> <result property="takeTime" column="take_time" />
<result property="finishTime" column="finish_time" /> <result property="finishTime" column="finish_time" />
<result property="ramark" column="ramark" /> <result property="remark" column="remark" />
<result property="goodsVal" column="goods_val" /> <result property="goodsVal" column="goods_val" />
<result property="orderType" column="order_type" /> <result property="orderType" column="order_type" />
</resultMap> </resultMap>
<sql id="selectWaterOrderVo"> <sql id="selectWaterOrderVo">
select id, order_num, user_id, user_name, user_phone, user_province, user_city, user_area, user_address, station_id, station_name, station_phone, station_province, station_city, station_area, station_address, order_state, pay_state, pay_type, pay_num, name, province, city, area, address, mobile, deliever_time, deliever_name, deliever_mobile, create_time, create_user, deliever_over, take_time, finish_time, ramark, goods_val, order_type from water_order select id, order_num, user_id, user_name, user_phone, user_province, user_city, user_area, user_address, station_id, station_name, station_phone, station_province, station_city, station_area, station_address, order_state, pay_state, pay_type, pay_num, name, province, city, area, address, mobile, deliever_time, deliever_name, deliever_mobile, create_time, create_user, deliever_over, take_time, finish_time, remark, goods_val, order_type from water_order
</sql> </sql>
<select id="selectWaterOrderList" parameterType="WaterOrder" resultMap="WaterOrderResult"> <select id="selectWaterOrderList" parameterType="com.qianhe.system.vo.WaterOrderVo" resultMap="WaterOrderResult">
<include refid="selectWaterOrderVo"/> <include refid="selectWaterOrderVo"/>
<where> <where>
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum}</if> del_flag = '0'
<if test="orderNum != null and orderNum != ''"> and order_num like concat('%', #{orderNum}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if> <if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone != null "> and user_phone = #{userPhone}</if> <if test="userPhone != null "> and user_phone = #{userPhone}</if>
...@@ -83,45 +84,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -83,45 +84,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delieverOver != null "> and deliever_over = #{delieverOver}</if> <if test="delieverOver != null "> and deliever_over = #{delieverOver}</if>
<if test="takeTime != null "> and take_time = #{takeTime}</if> <if test="takeTime != null "> and take_time = #{takeTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if> <if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="ramark != null and ramark != ''"> and ramark = #{ramark}</if> <if test="remark != null and remark != ''"> and remark = #{remark}</if>
<if test="goodsVal != null "> and goods_val = #{goodsVal}</if> <if test="goodsVal != null "> and goods_val = #{goodsVal}</if>
<if test="orderType != null "> and order_type = #{orderType}</if> <if test="orderType != null "> and order_type = #{orderType}</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> and create_time BETWEEN #{startTime} AND #{endTime}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterOrderById" parameterType="Long" resultMap="WaterOrderResult"> <select id="selectWaterOrderById" parameterType="Long" resultMap="WaterOrderResult">
<include refid="selectWaterOrderVo"/> <include refid="selectWaterOrderVo"/>
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertWaterOrder" parameterType="WaterOrder" useGeneratedKeys="true" keyProperty="id"> <select id="selectWaterOrderNumByOrderNum" parameterType="String" resultMap="WaterOrderResult">
<include refid="selectWaterOrderVo"/>
where order_num like concat('%', #{orderNum}, '%')
</select>
<insert id="insertWaterOrder" parameterType="com.qianhe.system.vo.WaterOrderVo" useGeneratedKeys="true" keyProperty="id">
insert into water_order insert into water_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNum != null">order_num,</if> <if test="orderNum != null">order_num,</if>
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,user_name,user_phone,</if>
<if test="userName != null">user_name,</if>
<if test="userPhone != null">user_phone,</if>
<if test="userProvince != null">user_province,</if> <if test="userProvince != null">user_province,</if>
<if test="userCity != null">user_city,</if> <if test="userCity != null">user_city,</if>
<if test="userArea != null">user_area,</if> <if test="userArea != null">user_area,</if>
<if test="userAddress != null">user_address,</if> <if test="userAddress != null">user_address,</if>
<if test="stationId != null">station_id,</if> <if test="stationId != null">station_id,station_name,station_phone,station_province,station_city,station_area,station_address,</if>
<if test="stationName != null">station_name,</if>
<if test="stationPhone != null">station_phone,</if>
<if test="stationProvince != null">station_province,</if>
<if test="stationCity != null">station_city,</if>
<if test="stationArea != null">station_area,</if>
<if test="stationAddress != null">station_address,</if>
<if test="orderState != null">order_state,</if> <if test="orderState != null">order_state,</if>
<if test="payState != null">pay_state,</if> <if test="payState != null">pay_state,</if>
<if test="payType != null">pay_type,</if> <if test="payType != null">pay_type,</if>
<if test="payNum != null">pay_num,</if> <if test="payNum != null">pay_num,</if>
<if test="name != null">name,</if> <if test="userAddressId != null">user_address_id,name,province,city,area,address,mobile,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if>
<if test="area != null">area,</if>
<if test="address != null">address,</if>
<if test="mobile != null">mobile,</if>
<if test="delieverTime != null">deliever_time,</if> <if test="delieverTime != null">deliever_time,</if>
<if test="delieverName != null">deliever_name,</if> <if test="delieverName != null">deliever_name,</if>
<if test="delieverMobile != null">deliever_mobile,</if> <if test="delieverMobile != null">deliever_mobile,</if>
...@@ -130,78 +125,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -130,78 +125,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delieverOver != null">deliever_over,</if> <if test="delieverOver != null">deliever_over,</if>
<if test="takeTime != null">take_time,</if> <if test="takeTime != null">take_time,</if>
<if test="finishTime != null">finish_time,</if> <if test="finishTime != null">finish_time,</if>
<if test="ramark != null">ramark,</if> <if test="remark != null">remark,</if>
<if test="goodsVal != null">goods_val,</if> <if test="goodsVal != null">goods_val,</if>
<if test="orderType != null">order_type,</if> <if test="orderType != null">order_type,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNum != null">#{orderNum},</if> <if test="orderNum != null">#{orderNum},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">
<if test="userName != null">#{userName},</if> #{userId},(select nick_name from water_user where id = #{userId}),(select phone_num from water_user where id = #{userId}),
<if test="userPhone != null">#{userPhone},</if> </if>
<if test="userProvince != null">#{userProvince},</if> <if test="userProvince != null">#{userProvince},</if>
<if test="userCity != null">#{userCity},</if> <if test="userCity != null">#{userCity},</if>
<if test="userArea != null">#{userArea},</if> <if test="userArea != null">#{userArea},</if>
<if test="userAddress != null">#{userAddress},</if> <if test="userAddress != null">#{userAddress},</if>
<if test="stationId != null">#{stationId},</if> <if test="stationId != null">
<if test="stationName != null">#{stationName},</if> #{stationId},
<if test="stationPhone != null">#{stationPhone},</if> (select station_name from water_station where id = #{stationId}),
<if test="stationProvince != null">#{stationProvince},</if> (select phone_num from water_station where id = #{stationId}),
<if test="stationCity != null">#{stationCity},</if> (select province from water_station where id = #{stationId}),
<if test="stationArea != null">#{stationArea},</if> (select city from water_station where id = #{stationId}),
<if test="stationAddress != null">#{stationAddress},</if> (select area from water_station where id = #{stationId}),
(select station_address from water_station where id = #{stationId}),
</if>
<if test="orderState != null">#{orderState},</if> <if test="orderState != null">#{orderState},</if>
<if test="payState != null">#{payState},</if> <if test="payState != null">#{payState},</if>
<if test="payType != null">#{payType},</if> <if test="payType != null">#{payType},</if>
<if test="payNum != null">#{payNum},</if> <if test="payNum != null">#{payNum},</if>
<if test="name != null">#{name},</if> <if test="userAddressId != null">
<if test="province != null">#{province},</if> #{userAddressId},
<if test="city != null">#{city},</if> (select name from water_user_address where id = #{userAddressId}),
<if test="area != null">#{area},</if> (select province from water_user_address where id = #{userAddressId}),
<if test="address != null">#{address},</if> (select city from water_user_address where id = #{userAddressId}),
<if test="mobile != null">#{mobile},</if> (select area from water_user_address where id = #{userAddressId}),
(select user_address from water_user_address where id = #{userAddressId}),
(select phone from water_user_address where id = #{userAddressId}),
</if>
<if test="delieverTime != null">#{delieverTime},</if> <if test="delieverTime != null">#{delieverTime},</if>
<if test="delieverName != null">#{delieverName},</if> <if test="delieverName != null">#{delieverName},</if>
<if test="delieverMobile != null">#{delieverMobile},</if> <if test="delieverMobile != null">#{delieverMobile},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if> <if test="createUser != null">(select nick_name from water_user where id = #{createUser}),</if>
<if test="delieverOver != null">#{delieverOver},</if> <if test="delieverOver != null">#{delieverOver},</if>
<if test="takeTime != null">#{takeTime},</if> <if test="takeTime != null">#{takeTime},</if>
<if test="finishTime != null">#{finishTime},</if> <if test="finishTime != null">#{finishTime},</if>
<if test="ramark != null">#{ramark},</if> <if test="remark != null">#{remark},</if>
<if test="goodsVal != null">#{goodsVal},</if> <if test="goodsVal != null">#{goodsVal},</if>
<if test="orderType != null">#{orderType},</if> <if test="orderType != null">#{orderType},</if>
</trim> </trim>
</insert> </insert>
<update id="updateWaterOrder" parameterType="WaterOrder"> <update id="updateWaterOrder" parameterType="com.qianhe.system.vo.WaterOrderVo">
update water_order update water_order
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="orderNum != null">order_num = #{orderNum},</if> <if test="orderNum != null">order_num = #{orderNum},</if>
<if test="userId != null">user_id = #{userId},</if> <if test="userId != null">
<if test="userName != null">user_name = #{userName},</if> user_id = #{userId},
<if test="userPhone != null">user_phone = #{userPhone},</if> user_name = (select nick_name from water_user where id = #{userId}),
user_phone = (select phone_num from water_user where id = #{userId}),
</if>
<if test="userProvince != null">user_province = #{userProvince},</if> <if test="userProvince != null">user_province = #{userProvince},</if>
<if test="userCity != null">user_city = #{userCity},</if> <if test="userCity != null">user_city = #{userCity},</if>
<if test="userArea != null">user_area = #{userArea},</if> <if test="userArea != null">user_area = #{userArea},</if>
<if test="userAddress != null">user_address = #{userAddress},</if> <if test="userAddress != null">user_address = #{userAddress},</if>
<if test="stationId != null">station_id = #{stationId},</if> <if test="stationId != null">
<if test="stationName != null">station_name = #{stationName},</if> station_id = #{stationId},
<if test="stationPhone != null">station_phone = #{stationPhone},</if> station_name = (select station_name from water_station where id = #{stationId}),
<if test="stationProvince != null">station_province = #{stationProvince},</if> station_phone = (select phone_num from water_station where id = #{stationId}),
<if test="stationCity != null">station_city = #{stationCity},</if> station_province = (select province from water_station where id = #{stationId}),
<if test="stationArea != null">station_area = #{stationArea},</if> station_city = (select city from water_station where id = #{stationId}),
<if test="stationAddress != null">station_address = #{stationAddress},</if> station_area = (select area from water_station where id = #{stationId}),
station_address = (select station_address from water_station where id = #{stationId}),
</if>
<if test="orderState != null">order_state = #{orderState},</if> <if test="orderState != null">order_state = #{orderState},</if>
<if test="payState != null">pay_state = #{payState},</if> <if test="payState != null">pay_state = #{payState},</if>
<if test="payType != null">pay_type = #{payType},</if> <if test="payType != null">pay_type = #{payType},</if>
<if test="payNum != null">pay_num = #{payNum},</if> <if test="payNum != null">pay_num = #{payNum},</if>
<if test="name != null">name = #{name},</if> <if test="userAddressId != null">
<if test="province != null">province = #{province},</if> user_address_id = #{userAddressId},
<if test="city != null">city = #{city},</if> name = (select name from water_user_address where id = #{userAddressId}),
<if test="area != null">area = #{area},</if> province = (select province from water_user_address where id = #{userAddressId}),
<if test="address != null">address = #{address},</if> city = (select city from water_user_address where id = #{userAddressId}),
<if test="mobile != null">mobile = #{mobile},</if> area = (select area from water_user_address where id = #{userAddressId}),
address = (select user_address from water_user_address where id = #{userAddressId}),
mobile = (select phone from water_user_address where id = #{userAddressId}),
</if>
<if test="delieverTime != null">deliever_time = #{delieverTime},</if> <if test="delieverTime != null">deliever_time = #{delieverTime},</if>
<if test="delieverName != null">deliever_name = #{delieverName},</if> <if test="delieverName != null">deliever_name = #{delieverName},</if>
<if test="delieverMobile != null">deliever_mobile = #{delieverMobile},</if> <if test="delieverMobile != null">deliever_mobile = #{delieverMobile},</if>
...@@ -210,21 +217,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -210,21 +217,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delieverOver != null">deliever_over = #{delieverOver},</if> <if test="delieverOver != null">deliever_over = #{delieverOver},</if>
<if test="takeTime != null">take_time = #{takeTime},</if> <if test="takeTime != null">take_time = #{takeTime},</if>
<if test="finishTime != null">finish_time = #{finishTime},</if> <if test="finishTime != null">finish_time = #{finishTime},</if>
<if test="ramark != null">ramark = #{ramark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="goodsVal != null">goods_val = #{goodsVal},</if> <if test="goodsVal != null">goods_val = #{goodsVal},</if>
<if test="orderType != null">order_type = #{orderType},</if> <if test="orderType != null">order_type = #{orderType},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteWaterOrderById" parameterType="Long"> <update id="deleteWaterOrderById" parameterType="Long">
delete from water_order where id = #{id} update water_order set del_flag = '1' where id = #{id}
</delete> </update>
<update id="deleteWaterOrderByIds" parameterType="String">
update water_order set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteWaterOrderGoodsByOrderId" parameterType="Long">
update water_order_goods set del_flag = '1' where order_id = #{id}
</update>
<delete id="deleteWaterOrderByIds" parameterType="String"> <update id="deleteWaterOrderGoodsByOrderIds" parameterType="String">
delete from water_order where id in update water_order_goods set del_flag = '1' where order_id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
</mapper>
\ No newline at end of file <insert id="batchInsertWaterOrderGoods">
insert into water_order_goods(order_id, order_num, goods_type_id, goods_type, goods_spe, goods_id, goods_title,
goods_num, goods_price, goods_total, remark, create_time, create_user)
values
<foreach collection="list" item="item" separator=",">
(#{item.orderId}, #{item.orderNum}, #{item.goodsTypeId}, (select type_name from water_goods_type where id = #{item.goodsTypeId}),
#{item.goodsSpe}, #{item.goodsId}, #{item.goodsTitle}, #{item.goodsNum}, #{item.goodsPrice}, #{item.goodsTotal}
, #{item.remark}, #{item.createTime}, (select nick_name from water_user where id = #{item.createUser}))
</foreach>
</insert>
</mapper>
...@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
del_flag = '0' del_flag = '0'
<if test="speTitle != null and speTitle != ''"> and spe_title = #{speTitle}</if> <if test="speTitle != null and speTitle != ''"> and spe_title = #{speTitle}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterSpeValList" parameterType="WaterSpeVal" resultType="WaterSpeVal"> <select id="selectWaterSpeValList" parameterType="WaterSpeVal" resultType="WaterSpeVal">
......
...@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isOpen != null "> and is_open = #{isOpen}</if> <if test="isOpen != null "> and is_open = #{isOpen}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if> <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="getStationList" resultType="Map"> <select id="getStationList" resultType="Map">
......
...@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stationId != null "> and station_id = #{stationId}</if> <if test="stationId != null "> and station_id = #{stationId}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if> <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterStationUserById" parameterType="Long" resultMap="WaterStationUserResult"> <select id="selectWaterStationUserById" parameterType="Long" resultMap="WaterStationUserResult">
......
...@@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="area" column="area" /> <result property="area" column="area" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="isDefault" column="is_default" />
</resultMap> </resultMap>
<sql id="selectWaterUserAddressVo"> <sql id="selectWaterUserAddressVo">
select id, water_user_id, user_address, province, city, area, name, phone from water_user_address select id, water_user_id, user_address, province, city, area, name, phone, is_default from water_user_address
</sql> </sql>
<select id="selectWaterUserAddressList" parameterType="WaterUserAddress" resultMap="WaterUserAddressResult"> <select id="selectWaterUserAddressList" parameterType="WaterUserAddress" resultMap="WaterUserAddressResult">
...@@ -38,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="getUserDefaultAddress" parameterType="Long" resultMap="WaterUserAddressResult">
<include refid="selectWaterUserAddressVo"/>
where water_user_id = #{userId} and is_default = '1'
</select>
<insert id="insertWaterUserAddress" parameterType="WaterUserAddress" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWaterUserAddress" parameterType="WaterUserAddress" useGeneratedKeys="true" keyProperty="id">
insert into water_user_address insert into water_user_address
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -48,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -48,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="area != null">area,</if> <if test="area != null">area,</if>
<if test="name != null">name,</if> <if test="name != null">name,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="isDefault != null">is_default,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="waterUserId != null">#{waterUserId},</if> <if test="waterUserId != null">#{waterUserId},</if>
...@@ -57,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="area != null">#{area},</if> <if test="area != null">#{area},</if>
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="isDefault != null">#{isDefault},</if>
</trim> </trim>
</insert> </insert>
...@@ -70,18 +78,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -70,18 +78,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="area != null">area = #{area},</if> <if test="area != null">area = #{area},</if>
<if test="name != null">name = #{name},</if> <if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="isDefault != null">is_default = #{isDefault},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteWaterUserAddressById" parameterType="Long"> <update id="deleteWaterUserAddressById" parameterType="Long">
delete from water_user_address where id = #{id} update water_user_address set del_flag = '1' where id = #{id}
</delete> </update>
<delete id="deleteWaterUserAddressByIds" parameterType="String"> <update id="deleteWaterUserAddressByIds" parameterType="String">
delete from water_user_address where id in update water_user_address set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
<update id="updateDefaultAddress" parameterType="Long">
update water_user_address set is_default = '0' where water_user_id = #{waterUserId}
</update>
</mapper> </mapper>
...@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
<if test="openId != null and openId != ''"> and open_id = #{openId}</if> <if test="openId != null and openId != ''"> and open_id = #{openId}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterUserById" parameterType="Long" resultMap="WaterUserResult"> <select id="selectWaterUserById" parameterType="Long" resultMap="WaterUserResult">
......
...@@ -114,6 +114,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -114,6 +114,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/login", "/register", "/captchaImage").permitAll() .antMatchers("/login", "/register", "/captchaImage").permitAll()
//放行微信小程序相关接口 //放行微信小程序相关接口
.antMatchers("/wx/getWxLoginInfo/**", "/wx/login/**", "/wx/getPhoneNumber/**", "/wx/getUserInfo","/wx/updateUser").permitAll() .antMatchers("/wx/getWxLoginInfo/**", "/wx/login/**", "/wx/getPhoneNumber/**", "/wx/getUserInfo","/wx/updateUser").permitAll()
//通用接口放行
.antMatchers("/common/**").permitAll()
//测试放行所有接口 //测试放行所有接口
.antMatchers("/system/**").permitAll() .antMatchers("/system/**").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment