Commit 890e49d4 by xuwenhao

11.30修改商品、商品规格、商品分类、站点、站点用户功能

parent b548905e
......@@ -5,14 +5,24 @@ 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.common.utils.StringUtils;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterGoodsImg;
import com.qianhe.system.domain.WaterGoodsType;
import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.service.IWaterGoodsImgService;
import com.qianhe.system.service.IWaterGoodsService;
import com.qianhe.system.service.IWaterGoodsTypeService;
import com.qianhe.system.service.IWaterStationService;
import com.qianhe.system.vo.WaterGoodsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -27,6 +37,12 @@ public class WaterGoodsController extends BaseController
{
@Autowired
private IWaterGoodsService waterGoodsService;
@Autowired
private IWaterGoodsImgService waterGoodsImgService;
@Autowired
private IWaterStationService waterStationService;
@Autowired
private IWaterGoodsTypeService waterGoodsTypeService;
/**
* 查询商品列表
......@@ -36,7 +52,73 @@ public class WaterGoodsController extends BaseController
{
startPage();
List<WaterGoods> list = waterGoodsService.selectWaterGoodsList(waterGoods);
return getDataTable(list);
//查询所有商品图片
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);
}
/**
......@@ -65,9 +147,9 @@ public class WaterGoodsController extends BaseController
*/
@Log(title = "商品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterGoods waterGoods)
public AjaxResult add(@RequestBody WaterGoodsVo waterGoodsVo)
{
return toAjax(waterGoodsService.insertWaterGoods(waterGoods));
return toAjax(waterGoodsService.insertWaterGoods(waterGoodsVo));
}
/**
......@@ -75,9 +157,9 @@ public class WaterGoodsController extends BaseController
*/
@Log(title = "商品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterGoods waterGoods)
public AjaxResult edit(@RequestBody WaterGoodsVo waterGoodsVo)
{
return toAjax(waterGoodsService.updateWaterGoods(waterGoods));
return toAjax(waterGoodsService.updateWaterGoods(waterGoodsVo));
}
/**
......
......@@ -8,6 +8,7 @@ import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.service.IWaterGoodsSpeService;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......@@ -69,9 +70,9 @@ public class WaterGoodsSpeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:spe:add')")
@Log(title = "商品关联规格", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterGoodsSpe waterGoodsSpe)
public AjaxResult add(@RequestBody WaterGoodsSpeVo waterGoodsSpeVo)
{
return toAjax(waterGoodsSpeService.insertWaterGoodsSpe(waterGoodsSpe));
return toAjax(waterGoodsSpeService.insertWaterGoodsSpe(waterGoodsSpeVo));
}
/**
......@@ -80,9 +81,9 @@ public class WaterGoodsSpeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:spe:edit')")
@Log(title = "商品关联规格", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterGoodsSpe waterGoodsSpe)
public AjaxResult edit(@RequestBody WaterGoodsSpeVo waterGoodsSpeVo)
{
return toAjax(waterGoodsSpeService.updateWaterGoodsSpe(waterGoodsSpe));
return toAjax(waterGoodsSpeService.updateWaterGoodsSpe(waterGoodsSpeVo));
}
/**
......
......@@ -89,4 +89,12 @@ public class WaterGoodsTypeController extends BaseController
{
return toAjax(waterGoodsTypeService.deleteWaterGoodsTypeByIds(ids));
}
/**
* 获取商品分类下拉框
*/
@GetMapping("/getGoodsTypeList")
public AjaxResult getGoodsTypeList(){
return AjaxResult.success(waterGoodsTypeService.selectWaterGoodsTypeList(new WaterGoodsType()));
}
}
......@@ -7,12 +7,16 @@ import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterSpe;
import com.qianhe.system.domain.WaterSpeVal;
import com.qianhe.system.service.IWaterSpeService;
import com.qianhe.system.vo.WaterSpeVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -31,19 +35,36 @@ public class WaterSpeController extends BaseController
/**
* 查询商品规格列表
*/
@PreAuthorize("@ss.hasPermi('system:spe:list')")
@GetMapping("/list")
public TableDataInfo list(WaterSpe waterSpe)
{
startPage();
List<WaterSpe> list = waterSpeService.selectWaterSpeList(waterSpe);
return getDataTable(list);
//返回的列表
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);
}
/**
* 导出商品规格列表
*/
@PreAuthorize("@ss.hasPermi('system:spe:export')")
@Log(title = "商品规格", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterSpe waterSpe)
......@@ -56,7 +77,6 @@ public class WaterSpeController extends BaseController
/**
* 获取商品规格详细信息
*/
@PreAuthorize("@ss.hasPermi('system:spe:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
......@@ -66,29 +86,26 @@ public class WaterSpeController extends BaseController
/**
* 新增商品规格
*/
@PreAuthorize("@ss.hasPermi('system:spe:add')")
@Log(title = "商品规格", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterSpe waterSpe)
public AjaxResult add(@RequestBody WaterSpeVo waterSpeVo)
{
return toAjax(waterSpeService.insertWaterSpe(waterSpe));
return toAjax(waterSpeService.insertWaterSpe(waterSpeVo));
}
/**
* 修改商品规格
*/
@PreAuthorize("@ss.hasPermi('system:spe:edit')")
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterSpe waterSpe)
public AjaxResult edit(@RequestBody WaterSpeVo waterSpeVo)
{
return toAjax(waterSpeService.updateWaterSpe(waterSpe));
return toAjax(waterSpeService.updateWaterSpe(waterSpeVo));
}
/**
* 删除商品规格
*/
@PreAuthorize("@ss.hasPermi('system:spe:remove')")
@Log(title = "商品规格", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
......
......@@ -7,12 +7,16 @@ import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.service.IWaterStationService;
import com.qianhe.system.service.IWaterStationUserService;
import com.qianhe.system.vo.WaterStationVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -27,6 +31,8 @@ public class WaterStationController extends BaseController
{
@Autowired
private IWaterStationService waterStationService;
@Autowired
private IWaterStationUserService waterStationUserService;
/**
* 查询站点列表
......@@ -35,8 +41,29 @@ public class WaterStationController extends BaseController
public TableDataInfo list(WaterStation waterStation)
{
startPage();
List<WaterStation> list = waterStationService.selectWaterStationList(waterStation);
return getDataTable(list);
List<WaterStation> waterStations = waterStationService.selectWaterStationList(waterStation);
List<WaterStationVo> waterStationVoList = new ArrayList<>();
//送水工列表
List<WaterStationUser> waterStationUsers = waterStationUserService.selectWaterStationUserList(new WaterStationUser());
for (WaterStation station : waterStations) {
//送水工集合
List<WaterStationUser> waterStationUserList = new ArrayList<>();
//转vo
WaterStationVo waterStationVo = new WaterStationVo();
BeanUtils.copyProperties(station,waterStationVo);
for (WaterStationUser waterStationUser : waterStationUsers) {
if (station.getId().equals(waterStationUser.getStationId())){
waterStationUserList.add(waterStationUser);
}
}
if(waterStationUserList.size() > 0){
waterStationVo.setWaterStationUserList(waterStationUserList);
}
waterStationVoList.add(waterStationVo);
}
return getDataTable(waterStationVoList);
}
/**
......@@ -81,6 +108,16 @@ public class WaterStationController extends BaseController
}
/**
* 修改站点是否营业
*/
@Log(title = "站点", businessType = BusinessType.UPDATE)
@PutMapping("/updateIsOpen")
public AjaxResult updateIsOpen(@RequestBody WaterStation waterStation)
{
return toAjax(waterStationService.updateIsOpen(waterStation));
}
/**
* 删除站点
*/
@Log(title = "站点", businessType = BusinessType.DELETE)
......@@ -89,4 +126,12 @@ public class WaterStationController extends BaseController
{
return toAjax(waterStationService.deleteWaterStationByIds(ids));
}
/**
* 查询站点下拉框
*/
@GetMapping("/getStationList")
public AjaxResult getStationList(){
return AjaxResult.success(waterStationService.getStationList());
}
}
......@@ -31,7 +31,6 @@ public class WaterStationUserController extends BaseController
/**
* 查询站点用户列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(WaterStationUser waterStationUser)
{
......@@ -43,7 +42,6 @@ public class WaterStationUserController extends BaseController
/**
* 导出站点用户列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "站点用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterStationUser waterStationUser)
......@@ -56,7 +54,6 @@ public class WaterStationUserController extends BaseController
/**
* 获取站点用户详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
......@@ -66,7 +63,6 @@ public class WaterStationUserController extends BaseController
/**
* 新增站点用户
*/
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "站点用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterStationUser waterStationUser)
......@@ -77,7 +73,6 @@ public class WaterStationUserController extends BaseController
/**
* 修改站点用户
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "站点用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterStationUser waterStationUser)
......@@ -88,7 +83,6 @@ public class WaterStationUserController extends BaseController
/**
* 删除站点用户
*/
@PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "站点用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
......
......@@ -71,7 +71,7 @@ public class WxLogin {
//根据code查询微信用户的openid和session_key
Map<String, String> wxLoginInfo = wxUserInfoUtils.getWxLoginInfo(code);
WxLoginBody wxLoginBody = new WxLoginBody();
wxLoginBody.setOpenId(wxLoginInfo.get("openId"));
wxLoginBody.setOpenId(wxLoginInfo.get("openid"));
MpLoginUser login = wxLoginService.login(wxLoginBody);
if (StringUtils.isNull(login)) {
return AjaxResult.error("login error");
......
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 商品对象 water_goods
*
* @author qianhe
* @date 2023-11-23
*/
public class WaterGoods extends BaseEntity
@Data
public class WaterGoods
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
......@@ -28,7 +35,7 @@ public class WaterGoods extends BaseEntity
/** 所属站点id */
@Excel(name = "所属站点id")
private Long belongStationId;
private String belongStationId;
/** 封面图 */
@Excel(name = "封面图")
......@@ -42,95 +49,14 @@ public class WaterGoods extends BaseEntity
@Excel(name = "价格")
private String price;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 状态(1上架0下架) */
@Excel(name = "状态", readConverterExp = "1=上架0下架")
private Long status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setGoodsTypeId(Long goodsTypeId)
{
this.goodsTypeId = goodsTypeId;
}
public Long getGoodsTypeId()
{
return goodsTypeId;
}
public void setBelongStationId(Long belongStationId)
{
this.belongStationId = belongStationId;
}
public Long getBelongStationId()
{
return belongStationId;
}
public void setCoverImg(String coverImg)
{
this.coverImg = coverImg;
}
public String getCoverImg()
{
return coverImg;
}
public void setDetailsImg(String detailsImg)
{
this.detailsImg = detailsImg;
}
public String getDetailsImg()
{
return detailsImg;
}
public void setPrice(String price)
{
this.price = price;
}
public String getPrice()
{
return price;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("goodsTypeId", getGoodsTypeId())
.append("belongStationId", getBelongStationId())
.append("coverImg", getCoverImg())
.append("detailsImg", getDetailsImg())
.append("price", getPrice())
.append("createTime", getCreateTime())
.append("status", getStatus())
.toString();
}
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -11,125 +14,34 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author qianhe
* @date 2023-11-23
*/
public class WaterGoodsImg extends BaseEntity
@Data
public class WaterGoodsImg
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
/** 图片名称 */
private String imgName;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
/** 类型 */
private String type;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
/** 大小 */
private String sizea;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
/** 路径 */
private String url;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String md5;
/** 图片类型(1商品封面图2商品详情图3主页轮播图) */
@Excel(name = "图片类型", readConverterExp = "1=商品封面图2商品详情图3主页轮播图")
@Excel(name = "图片类型", readConverterExp = "1=商品封面图,2=商品详情图,3=主页轮播图")
private Integer imgType;
/** 商品id */
@Excel(name = "商品id")
private Long goodsId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setImgName(String imgName)
{
this.imgName = imgName;
}
public String getImgName()
{
return imgName;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setSizea(String sizea)
{
this.sizea = sizea;
}
public String getSizea()
{
return sizea;
}
public void setUrl(String url)
{
this.url = url;
}
public String getUrl()
{
return url;
}
public void setMd5(String md5)
{
this.md5 = md5;
}
public String getMd5()
{
return md5;
}
public void setImgType(Integer imgType)
{
this.imgType = imgType;
}
public Integer getImgType()
{
return imgType;
}
public void setGoodsId(Long goodsId)
{
this.goodsId = goodsId;
}
public Long getGoodsId()
{
return goodsId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("imgName", getImgName())
.append("type", getType())
.append("sizea", getSizea())
.append("url", getUrl())
.append("md5", getMd5())
.append("imgType", getImgType())
.append("goodsId", getGoodsId())
.toString();
}
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 商品关联规格对象 water_goods_spe
*
* @author qianhe
* @date 2023-11-23
*/
public class WaterGoodsSpe extends BaseEntity
@Data
public class WaterGoodsSpe
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
@Excel(name = "标题")
private String speTitle;
/** 规格 */
@Excel(name = "规格")
private String spe;
/** 规格值 */
@Excel(name = "规格值")
private String speVal;
/** 商品id */
@Excel(name = "商品id")
private Long goodsId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSpeTitle(String speTitle)
{
this.speTitle = speTitle;
}
public String getSpeTitle()
{
return speTitle;
}
public void setSpe(String spe)
{
this.spe = spe;
}
public String getSpe()
{
return spe;
}
public void setSpeVal(String speVal)
{
this.speVal = speVal;
}
public String getSpeVal()
{
return speVal;
}
public void setGoodsId(Long goodsId)
{
this.goodsId = goodsId;
}
public Long getGoodsId()
{
return goodsId;
}
/** 创建人 */
private String createUser;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("speTitle", getSpeTitle())
.append("spe", getSpe())
.append("speVal", getSpeVal())
.append("goodsId", getGoodsId())
.append("createTime", getCreateTime())
.toString();
}
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.qianhe.common.annotation.Excel;
import lombok.Data;
@Data
public class WaterGoodsSpeVal {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 商品规格id */
private Long speId;
/** 规格 */
@Excel(name = "规格")
private String spe;
/** 规格值 */
private String speVal;
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 商品规格对象 water_spe
* 商品规格主表对象 water_spe
*
* @author qianhe
* @date 2023-11-23
*/
public class WaterSpe extends BaseEntity
@Data
public class WaterSpe
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
@Excel(name = "标题")
private String speTitle;
/** 规格 */
@Excel(name = "规格")
private String spe;
/** 规格值 */
@Excel(name = "规格值")
private String speVal;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSpeTitle(String speTitle)
{
this.speTitle = speTitle;
}
public String getSpeTitle()
{
return speTitle;
}
public void setSpe(String spe)
{
this.spe = spe;
}
public String getSpe()
{
return spe;
}
public void setSpeVal(String speVal)
{
this.speVal = speVal;
}
public String getSpeVal()
{
return speVal;
}
/** 创建人 */
private String createUser;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("speTitle", getSpeTitle())
.append("spe", getSpe())
.append("speVal", getSpeVal())
.append("createTime", getCreateTime())
.toString();
}
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.qianhe.common.annotation.Excel;
import lombok.Data;
/**
* 商品规格子表对象 water_spe_val
*
* @author qianhe
* @date 2023-11-23
*/
@Data
public class WaterSpeVal
{
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 商品规格id */
private Long speId;
/** 规格 */
@Excel(name = "规格")
private String spe;
/** 规格值 */
private String speVal;
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
......@@ -7,6 +10,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 站点对象 water_station
......@@ -15,11 +19,11 @@ import java.math.BigDecimal;
* @date 2023-11-23
*/
@Data
public class WaterStation extends BaseEntity
public class WaterStation
{
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 站点名称 */
......@@ -62,121 +66,7 @@ public class WaterStation extends BaseEntity
@Excel(name = "创建人")
private String createUser;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setStationName(String stationName)
{
this.stationName = stationName;
}
public String getStationName()
{
return stationName;
}
public void setPhoneNum(Long phoneNum)
{
this.phoneNum = phoneNum;
}
public Long getPhoneNum()
{
return phoneNum;
}
public void setStationAddress(String stationAddress)
{
this.stationAddress = stationAddress;
}
public String getStationAddress()
{
return stationAddress;
}
public void setStationLon(BigDecimal stationLon)
{
this.stationLon = stationLon;
}
public BigDecimal getStationLon()
{
return stationLon;
}
public void setStationLat(BigDecimal stationLat)
{
this.stationLat = stationLat;
}
public BigDecimal getStationLat()
{
return stationLat;
}
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 setIsOpen(Long isOpen)
{
this.isOpen = isOpen;
}
public Long getIsOpen()
{
return isOpen;
}
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("stationName", getStationName())
.append("phoneNum", getPhoneNum())
.append("stationAddress", getStationAddress())
.append("stationLon", getStationLon())
.append("stationLat", getStationLat())
.append("createTime", getCreateTime())
.append("province", getProvince())
.append("city", getCity())
.append("area", getArea())
.append("isOpen", getIsOpen())
.append("createUser", getCreateUser())
.toString();
}
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.qianhe.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 站点用户对象 water_station_user
*
* @author qianhe
* @date 2023-11-23
*/
public class WaterStationUser extends BaseEntity
@Data
public class WaterStationUser
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 姓名 */
......@@ -46,91 +53,7 @@ public class WaterStationUser extends BaseEntity
@Excel(name = "创建人")
private String createUser;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAge(Long age)
{
this.age = age;
}
public Long getAge()
{
return age;
}
public void setGender(Long gender)
{
this.gender = gender;
}
public Long getGender()
{
return gender;
}
public void setPhone(Long phone)
{
this.phone = phone;
}
public Long getPhone()
{
return phone;
}
public void setIdNum(String idNum)
{
this.idNum = idNum;
}
public String getIdNum()
{
return idNum;
}
public void setStationId(Long stationId)
{
this.stationId = stationId;
}
public Long getStationId()
{
return stationId;
}
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("name", getName())
.append("age", getAge())
.append("gender", getGender())
.append("phone", getPhone())
.append("idNum", getIdNum())
.append("stationId", getStationId())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.toString();
}
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterGoodsImg;
import com.qianhe.system.vo.WaterGoodsVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -31,18 +34,18 @@ public interface WaterGoodsMapper
/**
* 新增商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
public int insertWaterGoods(WaterGoods waterGoods);
public int insertWaterGoods(WaterGoodsVo waterGoodsVo);
/**
* 修改商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
public int updateWaterGoods(WaterGoods waterGoods);
public int updateWaterGoods(WaterGoodsVo waterGoodsVo);
/**
* 删除商品
......@@ -59,4 +62,42 @@ public interface WaterGoodsMapper
* @return 结果
*/
public int deleteWaterGoodsByIds(Long[] ids);
/**
* 删除商品图片
*
* @param id 商品主键
* @return 结果
*/
public int deleteWaterGoodsImgByGoodsId(Long id);
/**
* 批量删除商品图片
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWaterGoodsImgByGoodsIds(Long[] ids);
/**
* 删除商品关联规格
*
* @param id 商品主键
* @return 结果
*/
public int deleteWaterGoodsSpeByGoodsId(Long id);
/**
* 批量删除商品关联规格
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWaterGoodsSpeByGoodsIds(Long[] ids);
/**
* 批量新增图片
* @param list
*/
void batchInsertWaterGoodsImg(@Param("list") List<WaterGoodsImg> list);
}
package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import java.util.List;
......@@ -29,20 +31,28 @@ public interface WaterGoodsSpeMapper
public List<WaterGoodsSpe> selectWaterGoodsSpeList(WaterGoodsSpe waterGoodsSpe);
/**
* 查询商品关联规格值列表
*
* @param waterGoodsSpeVal 商品关联规格值
* @return 商品关联规格值集合
*/
public List<WaterGoodsSpeVal> selectWaterGoodsSpeValList(WaterGoodsSpeVal waterGoodsSpeVal);
/**
* 新增商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
public int insertWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe);
public int insertWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo);
/**
* 修改商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
public int updateWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe);
public int updateWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo);
/**
* 删除商品关联规格
......@@ -59,4 +69,27 @@ public interface WaterGoodsSpeMapper
* @return 结果
*/
public int deleteWaterGoodsSpeByIds(Long[] ids);
/**
* 删除商品关联规格值
*
* @param id 商品关联规格主键
* @return 结果
*/
public int deleteWaterGoodsSpeValBySpeId(Long id);
/**
* 批量删除商品关联规格值
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWaterGoodsSpeValBySpeIds(Long[] ids);
/**
* 批量新增商品关联规格值
* @param list
* @return
*/
int batchInsertWaterGoodsSpeVal(List<WaterGoodsSpeVal> list);
}
package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterSpe;
import com.qianhe.system.domain.WaterSpeVal;
import com.qianhe.system.vo.WaterSpeVo;
import java.util.List;
......@@ -29,20 +31,28 @@ public interface WaterSpeMapper
public List<WaterSpe> selectWaterSpeList(WaterSpe waterSpe);
/**
* 查询商品规格规格值列表
*
* @param waterSpeVal 商品规格规格值
* @return 商品规格集合
*/
public List<WaterSpeVal> selectWaterSpeValList(WaterSpeVal waterSpeVal);
/**
* 新增商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
public int insertWaterSpe(WaterSpe waterSpe);
public int insertWaterSpe(WaterSpeVo waterSpeVo);
/**
* 修改商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
public int updateWaterSpe(WaterSpe waterSpe);
public int updateWaterSpe(WaterSpeVo waterSpeVo);
/**
* 删除商品规格
......@@ -59,4 +69,26 @@ public interface WaterSpeMapper
* @return 结果
*/
public int deleteWaterSpeByIds(Long[] ids);
/**
* 删除商品规格规格值
*
* @param id 商品规格主键
* @return 结果
*/
public int deleteWaterSpeValBySpeId(Long id);
/**
* 批量删除商品规格规格值
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWaterSpeValBySpeIds(Long[] ids);
/**
* 批量新增商品规格规格值
* @param waterSpeVals
*/
void batchInsertWaterSpeVal(List<WaterSpeVal> waterSpeVals);
}
package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.vo.WaterStationVo;
import java.util.List;
import java.util.Map;
/**
* 站点Mapper接口
......@@ -29,6 +32,13 @@ public interface WaterStationMapper
public List<WaterStation> selectWaterStationList(WaterStation waterStation);
/**
* 查询站点下拉框
*
* @return 站点集合
*/
public List<Map<String,Object>> getStationList();
/**
* 新增站点
*
* @param waterStation 站点
......@@ -59,4 +69,23 @@ public interface WaterStationMapper
* @return 结果
*/
public int deleteWaterStationByIds(Long[] ids);
/**
* 批量新增站点用户
* @param waterStationUsers
* @return
*/
void batchInsertStationUser(List<WaterStationUser> waterStationUsers);
/**
* 删除站点用户
* @param id
*/
void deleteWaterStationUserByStationId(Long id);
/**
* 批量删除站点用户
* @param ids
*/
void deleteWaterStationUserByStationIds(Long[] ids);
}
package com.qianhe.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianhe.system.domain.WaterStationUser;
import java.util.List;
......@@ -10,7 +11,7 @@ import java.util.List;
* @author qianhe
* @date 2023-11-23
*/
public interface WaterStationUserMapper
public interface WaterStationUserMapper extends BaseMapper<WaterStationUser>
{
/**
* 查询站点用户
......
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.vo.WaterGoodsVo;
import java.util.List;
......@@ -18,7 +19,7 @@ public interface IWaterGoodsService
* @param id 商品主键
* @return 商品
*/
public WaterGoods selectWaterGoodsById(Long id);
public WaterGoodsVo selectWaterGoodsById(Long id);
/**
* 查询商品列表
......@@ -31,18 +32,18 @@ public interface IWaterGoodsService
/**
* 新增商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
public int insertWaterGoods(WaterGoods waterGoods);
public int insertWaterGoods(WaterGoodsVo waterGoodsVo);
/**
* 修改商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
public int updateWaterGoods(WaterGoods waterGoods);
public int updateWaterGoods(WaterGoodsVo waterGoodsVo);
/**
* 批量删除商品
......
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import java.util.List;
......@@ -31,18 +32,18 @@ public interface IWaterGoodsSpeService
/**
* 新增商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
public int insertWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe);
public int insertWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo);
/**
* 修改商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
public int updateWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe);
public int updateWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo);
/**
* 批量删除商品关联规格
......
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterSpe;
import com.qianhe.system.domain.WaterSpeVal;
import com.qianhe.system.vo.WaterSpeVo;
import java.util.List;
......@@ -18,7 +20,7 @@ public interface IWaterSpeService
* @param id 商品规格主键
* @return 商品规格
*/
public WaterSpe selectWaterSpeById(Long id);
public WaterSpeVo selectWaterSpeById(Long id);
/**
* 查询商品规格列表
......@@ -31,18 +33,18 @@ public interface IWaterSpeService
/**
* 新增商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
public int insertWaterSpe(WaterSpe waterSpe);
public int insertWaterSpe(WaterSpeVo waterSpeVo);
/**
* 修改商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
public int updateWaterSpe(WaterSpe waterSpe);
public int updateWaterSpe(WaterSpeVo waterSpeVo);
/**
* 批量删除商品规格
......@@ -59,4 +61,6 @@ public interface IWaterSpeService
* @return 结果
*/
public int deleteWaterSpeById(Long id);
List<WaterSpeVal> selectWaterSpeValList(WaterSpeVal waterSpeVal);
}
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.vo.WaterStationVo;
import java.util.List;
import java.util.Map;
/**
* 站点Service接口
......@@ -18,7 +20,7 @@ public interface IWaterStationService
* @param id 站点主键
* @return 站点
*/
public WaterStation selectWaterStationById(Long id);
public WaterStationVo selectWaterStationById(Long id);
/**
* 查询站点列表
......@@ -59,4 +61,18 @@ public interface IWaterStationService
* @return 结果
*/
public int deleteWaterStationById(Long id);
/**
* 修改是否营业
* @param waterStation
* @return
*/
int updateIsOpen(WaterStation waterStation);
/**
* 查询站点下拉框
*
* @return 站点集合
*/
public List<Map<String,Object>> getStationList();
}
package com.qianhe.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qianhe.system.domain.WaterStationUser;
import java.util.List;
......@@ -10,7 +11,7 @@ import java.util.List;
* @author qianhe
* @date 2023-11-23
*/
public interface IWaterStationUserService
public interface IWaterStationUserService extends IService<WaterStationUser>
{
/**
* 查询站点用户
......
package com.qianhe.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterGoodsImg;
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.vo.WaterGoodsSpeVo;
import com.qianhe.system.vo.WaterGoodsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -20,6 +32,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
{
@Autowired
private WaterGoodsMapper waterGoodsMapper;
@Autowired
private WaterGoodsSpeMapper waterGoodsSpeMapper;
@Autowired
private WaterGoodsImgMapper waterGoodsImgMapper;
/**
* 查询商品
......@@ -28,9 +44,58 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
* @return 商品
*/
@Override
public WaterGoods selectWaterGoodsById(Long id)
public WaterGoodsVo selectWaterGoodsById(Long id)
{
return waterGoodsMapper.selectWaterGoodsById(id);
WaterGoods waterGoods = waterGoodsMapper.selectWaterGoodsById(id);
//转vo
WaterGoodsVo waterGoodsVo = new WaterGoodsVo();
BeanUtils.copyProperties(waterGoods,waterGoodsVo);
//查询商品图片
WaterGoodsImg waterGoodsImg = new WaterGoodsImg();
waterGoodsImg.setGoodsId(id);
List<WaterGoodsImg> waterGoodsImgs = waterGoodsImgMapper.selectWaterGoodsImgList(waterGoodsImg);
//查询商品规格
WaterGoodsSpe waterGoodsSpe = new WaterGoodsSpe();
waterGoodsSpe.setGoodsId(id);
List<WaterGoodsSpe> waterGoodsSpes = waterGoodsSpeMapper.selectWaterGoodsSpeList(waterGoodsSpe);
List<WaterGoodsSpeVo> waterGoodsSpeVoList = new ArrayList<>();
if (waterGoodsSpes.size() > 0){
for (WaterGoodsSpe goodsSpe : waterGoodsSpes) {
//转vo
WaterGoodsSpeVo waterGoodsSpeVo = new WaterGoodsSpeVo();
BeanUtils.copyProperties(goodsSpe,waterGoodsSpeVo);
WaterGoodsSpeVal waterGoodsSpeVal = new WaterGoodsSpeVal();
waterGoodsSpeVal.setSpeId(goodsSpe.getId());
List<WaterGoodsSpeVal> waterGoodsSpeVals = waterGoodsSpeMapper.selectWaterGoodsSpeValList(waterGoodsSpeVal);
if (waterGoodsSpeVals.size() > 0){
waterGoodsSpeVo.setWaterGoodsSpeValList(waterGoodsSpeVals);
}
waterGoodsSpeVoList.add(waterGoodsSpeVo);
}
}
if (waterGoodsSpeVoList.size() > 0){
waterGoodsVo.setWaterGoodsSpe(waterGoodsSpeVoList.get(0));
}
List<WaterGoodsImg> coverImgs = new ArrayList<>();
List<WaterGoodsImg> detailsImgs = new ArrayList<>();
for (WaterGoodsImg waterGoodsImg1 : waterGoodsImgs) {
if (waterGoodsImg1.getImgType() == 1){
//商品封面图
coverImgs.add(waterGoodsImg1);
}
if (waterGoodsImg1.getImgType() == 2){
//商品详情图
detailsImgs.add(waterGoodsImg1);
}
}
if (coverImgs.size() > 0){
waterGoodsVo.setCoverImgs(coverImgs);
}
if (detailsImgs.size() > 0){
waterGoodsVo.setDetailsImgs(detailsImgs);
}
return waterGoodsVo;
}
/**
......@@ -48,26 +113,120 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
/**
* 新增商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
@Override
public int insertWaterGoods(WaterGoods waterGoods)
@Transactional
public int insertWaterGoods(WaterGoodsVo waterGoodsVo)
{
waterGoods.setCreateTime(DateUtils.getNowDate());
return waterGoodsMapper.insertWaterGoods(waterGoods);
waterGoodsVo.setCreateUser("管理员");
waterGoodsVo.setCreateTime(DateUtils.getNowDate());
int i = waterGoodsMapper.insertWaterGoods(waterGoodsVo);
//新增封面图
insertGoodsCoverImgs(waterGoodsVo);
//新增详情图
insertGoodsDetailsImgs(waterGoodsVo);
//新增商品关联规格
insertWaterGoodsSpe(waterGoodsVo);
return i;
}
/**
* 修改商品
*
* @param waterGoods 商品
* @param waterGoodsVo 商品
* @return 结果
*/
@Override
public int updateWaterGoods(WaterGoods waterGoods)
public int updateWaterGoods(WaterGoodsVo waterGoodsVo)
{
return waterGoodsMapper.updateWaterGoods(waterGoods);
//删除商品图片
waterGoodsMapper.deleteWaterGoodsImgByGoodsId(waterGoodsVo.getId());
//删除商品关联规格
waterGoodsMapper.deleteWaterGoodsSpeByGoodsId(waterGoodsVo.getId());
//新增封面图
insertGoodsCoverImgs(waterGoodsVo);
//新增详情图
insertGoodsDetailsImgs(waterGoodsVo);
//新增商品关联规格
insertWaterGoodsSpe(waterGoodsVo);
return waterGoodsMapper.updateWaterGoods(waterGoodsVo);
}
/**
* 新增商品关联规格
* @param waterGoodsVo
*/
private void insertWaterGoodsSpe(WaterGoodsVo waterGoodsVo) {
WaterGoodsSpeVo waterGoodsSpe = waterGoodsVo.getWaterGoodsSpe();
//新增商品关联规格
if (StringUtils.isNotNull(waterGoodsSpe)){
waterGoodsSpe.setGoodsId(waterGoodsVo.getId());
waterGoodsSpe.setCreateUser("管理员");
waterGoodsSpe.setCreateTime(DateUtils.getNowDate());
waterGoodsSpeMapper.insertWaterGoodsSpe(waterGoodsSpe);
}
List<WaterGoodsSpeVal> waterGoodsSpeValList = waterGoodsSpe.getWaterGoodsSpeValList();
List<WaterGoodsSpeVal> waterGoodsSpeVals = new ArrayList<>();
//商品关联规格主键id
Long speId = waterGoodsSpe.getId();
if (StringUtils.isNotNull(waterGoodsSpeValList)){
for (WaterGoodsSpeVal waterGoodsSpeVal : waterGoodsSpeValList) {
waterGoodsSpeVal.setSpeId(speId);
waterGoodsSpeVals.add(waterGoodsSpeVal);
}
}
if (waterGoodsSpeVals.size() > 0){
//批量新增商品关联规格值
waterGoodsSpeMapper.batchInsertWaterGoodsSpeVal(waterGoodsSpeVals);
}
}
/**
* 新增详情图
* @param waterGoodsVo
*/
private void insertGoodsDetailsImgs(WaterGoodsVo waterGoodsVo) {
List<WaterGoodsImg> detailsImgs = waterGoodsVo.getDetailsImgs();
List<WaterGoodsImg> detailsImgList = new ArrayList<>();
//商品主键id
Long id = waterGoodsVo.getId();
if (StringUtils.isNotNull(detailsImgs)){
for (WaterGoodsImg detailsImg : detailsImgs) {
detailsImg.setGoodsId(id);
detailsImg.setImgType(2);
detailsImgList.add(detailsImg);
}
}
if (detailsImgList.size() > 0){
//批量新增详情图
waterGoodsMapper.batchInsertWaterGoodsImg(detailsImgList);
}
}
/**
* 新增封面图
* @param waterGoodsVo
*/
private void insertGoodsCoverImgs(WaterGoodsVo waterGoodsVo) {
List<WaterGoodsImg> coverImgs = waterGoodsVo.getCoverImgs();
List<WaterGoodsImg> coverImgList = new ArrayList<>();
//商品主键id
Long id = waterGoodsVo.getId();
if (StringUtils.isNotNull(coverImgs)){
for (WaterGoodsImg coverImg : coverImgs) {
coverImg.setGoodsId(id);
coverImg.setImgType(1);
coverImgList.add(coverImg);
}
}
if (coverImgList.size() > 0){
//批量新增封面图
waterGoodsMapper.batchInsertWaterGoodsImg(coverImgList);
}
}
/**
......@@ -79,6 +238,10 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
@Override
public int deleteWaterGoodsByIds(Long[] ids)
{
//删除商品图片
waterGoodsMapper.deleteWaterGoodsImgByGoodsIds(ids);
//删除商品关联规格
waterGoodsMapper.deleteWaterGoodsSpeByGoodsIds(ids);
return waterGoodsMapper.deleteWaterGoodsByIds(ids);
}
......
......@@ -4,6 +4,7 @@ import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.mapper.WaterGoodsSpeMapper;
import com.qianhe.system.service.IWaterGoodsSpeService;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -48,26 +49,26 @@ public class WaterGoodsSpeServiceImpl implements IWaterGoodsSpeService
/**
* 新增商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
@Override
public int insertWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe)
public int insertWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo)
{
waterGoodsSpe.setCreateTime(DateUtils.getNowDate());
return waterGoodsSpeMapper.insertWaterGoodsSpe(waterGoodsSpe);
waterGoodsSpeVo.setCreateTime(DateUtils.getNowDate());
return waterGoodsSpeMapper.insertWaterGoodsSpe(waterGoodsSpeVo);
}
/**
* 修改商品关联规格
*
* @param waterGoodsSpe 商品关联规格
* @param waterGoodsSpeVo 商品关联规格
* @return 结果
*/
@Override
public int updateWaterGoodsSpe(WaterGoodsSpe waterGoodsSpe)
public int updateWaterGoodsSpe(WaterGoodsSpeVo waterGoodsSpeVo)
{
return waterGoodsSpeMapper.updateWaterGoodsSpe(waterGoodsSpe);
return waterGoodsSpeMapper.updateWaterGoodsSpe(waterGoodsSpeVo);
}
/**
......
package com.qianhe.system.service.impl;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterSpe;
import com.qianhe.system.domain.WaterSpeVal;
import com.qianhe.system.mapper.WaterSpeMapper;
import com.qianhe.system.service.IWaterSpeService;
import com.qianhe.system.vo.WaterSpeVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -28,9 +33,20 @@ public class WaterSpeServiceImpl implements IWaterSpeService
* @return 商品规格
*/
@Override
public WaterSpe selectWaterSpeById(Long id)
public WaterSpeVo selectWaterSpeById(Long id)
{
return waterSpeMapper.selectWaterSpeById(id);
WaterSpe waterSpe = waterSpeMapper.selectWaterSpeById(id);
//转vo
WaterSpeVo waterSpeVo = new WaterSpeVo();
BeanUtils.copyProperties(waterSpe,waterSpeVo);
//根据商品规格主键id查找商品规格规格值
WaterSpeVal waterSpeVal = new WaterSpeVal();
waterSpeVal.setSpeId(id);
List<WaterSpeVal> waterSpeVals = waterSpeMapper.selectWaterSpeValList(waterSpeVal);
if (waterSpeVals.size() > 0){
waterSpeVo.setWaterSpeValList(waterSpeVals);
}
return waterSpeVo;
}
/**
......@@ -48,26 +64,52 @@ public class WaterSpeServiceImpl implements IWaterSpeService
/**
* 新增商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
@Override
public int insertWaterSpe(WaterSpe waterSpe)
public int insertWaterSpe(WaterSpeVo waterSpeVo)
{
waterSpe.setCreateTime(DateUtils.getNowDate());
return waterSpeMapper.insertWaterSpe(waterSpe);
waterSpeVo.setCreateUser("管理员");
waterSpeVo.setCreateTime(DateUtils.getNowDate());
int i = waterSpeMapper.insertWaterSpe(waterSpeVo);
insertWaterSpeVal(waterSpeVo);
return i;
}
private void insertWaterSpeVal(WaterSpeVo waterSpeVo) {
//商品规格值列表
List<WaterSpeVal> waterSpeValList = waterSpeVo.getWaterSpeValList();
List<WaterSpeVal> waterSpeVals = new ArrayList<>();
//商品规格主表id
Long id = waterSpeVo.getId();
if (StringUtils.isNotNull(waterSpeValList)){
for (WaterSpeVal waterSpeVal : waterSpeValList) {
waterSpeVal.setSpeId(id);
waterSpeVals.add(waterSpeVal);
}
}
if (waterSpeVals.size() > 0){
//批量新增
waterSpeMapper.batchInsertWaterSpeVal(waterSpeVals);
}
}
/**
* 修改商品规格
*
* @param waterSpe 商品规格
* @param waterSpeVo 商品规格
* @return 结果
*/
@Override
public int updateWaterSpe(WaterSpe waterSpe)
public int updateWaterSpe(WaterSpeVo waterSpeVo)
{
return waterSpeMapper.updateWaterSpe(waterSpe);
//删除商品规格关联的规格规格值
waterSpeMapper.deleteWaterSpeValBySpeId(waterSpeVo.getId());
//新增规格规格值
insertWaterSpeVal(waterSpeVo);
return waterSpeMapper.updateWaterSpe(waterSpeVo);
}
/**
......@@ -79,6 +121,8 @@ public class WaterSpeServiceImpl implements IWaterSpeService
@Override
public int deleteWaterSpeByIds(Long[] ids)
{
//批量删除商品规格关联的规格规格值
waterSpeMapper.deleteWaterSpeValBySpeIds(ids);
return waterSpeMapper.deleteWaterSpeByIds(ids);
}
......@@ -91,6 +135,12 @@ public class WaterSpeServiceImpl implements IWaterSpeService
@Override
public int deleteWaterSpeById(Long id)
{
waterSpeMapper.deleteWaterSpeValBySpeId(id);
return waterSpeMapper.deleteWaterSpeById(id);
}
@Override
public List<WaterSpeVal> selectWaterSpeValList(WaterSpeVal waterSpeVal) {
return waterSpeMapper.selectWaterSpeValList(waterSpeVal);
}
}
package com.qianhe.system.service.impl;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.mapper.WaterStationMapper;
import com.qianhe.system.mapper.WaterStationUserMapper;
import com.qianhe.system.service.IWaterStationService;
import com.qianhe.system.vo.WaterStationVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 站点Service业务层处理
......@@ -20,6 +28,10 @@ public class WaterStationServiceImpl implements IWaterStationService
{
@Autowired
private WaterStationMapper waterStationMapper;
@Autowired
private WaterStationUserMapper waterStationUserMapper;
@Autowired
private WaterStationUserServiceImpl waterStationUserService;
/**
* 查询站点
......@@ -28,9 +40,19 @@ public class WaterStationServiceImpl implements IWaterStationService
* @return 站点
*/
@Override
public WaterStation selectWaterStationById(Long id)
public WaterStationVo selectWaterStationById(Long id)
{
return waterStationMapper.selectWaterStationById(id);
WaterStationVo waterStationVo = new WaterStationVo();
WaterStation waterStation = waterStationMapper.selectWaterStationById(id);
BeanUtils.copyProperties(waterStation,waterStationVo);
//查询站点用户
WaterStationUser waterStationUser = new WaterStationUser();
waterStationUser.setStationId(id);
List<WaterStationUser> waterStationUsers = waterStationUserMapper.selectWaterStationUserList(waterStationUser);
if (waterStationUsers.size() > 0){
waterStationVo.setWaterStationUserList(waterStationUsers);
}
return waterStationVo;
}
/**
......@@ -52,10 +74,13 @@ public class WaterStationServiceImpl implements IWaterStationService
* @return 结果
*/
@Override
@Transactional
public int insertWaterStation(WaterStation waterStation)
{
waterStation.setCreateUser("管理员");
waterStation.setCreateTime(DateUtils.getNowDate());
return waterStationMapper.insertWaterStation(waterStation);
int i = waterStationMapper.insertWaterStation(waterStation);
return i;
}
/**
......@@ -65,11 +90,35 @@ public class WaterStationServiceImpl implements IWaterStationService
* @return 结果
*/
@Override
@Transactional
public int updateWaterStation(WaterStation waterStation)
{
//删除该站点用户
waterStationMapper.deleteWaterStationUserByStationId(waterStation.getId());
return waterStationMapper.updateWaterStation(waterStation);
}
private void insertWaterStationUser(WaterStationVo waterStationVo) {
//送水工集合
List<WaterStationUser> waterStationUserList = waterStationVo.getWaterStationUserList();
List<WaterStationUser> waterStationUsers = new ArrayList<>();
//站点主键id
Long id = waterStationVo.getId();
if (StringUtils.isNotNull(waterStationUserList) && waterStationUserList.size() > 0){
for (WaterStationUser waterStationUser : waterStationUserList) {
waterStationUser.setStationId(id);
waterStationUser.setCreateTime(DateUtils.getNowDate());
waterStationUser.setCreateUser("管理员");
waterStationUsers.add(waterStationUser);
}
}
if (waterStationUsers.size() > 0){
//批量新增站点用户
waterStationMapper.batchInsertStationUser(waterStationUsers);
}
}
/**
* 批量删除站点
*
......@@ -77,8 +126,11 @@ public class WaterStationServiceImpl implements IWaterStationService
* @return 结果
*/
@Override
@Transactional
public int deleteWaterStationByIds(Long[] ids)
{
//批量删除站点用户
waterStationMapper.deleteWaterStationUserByStationIds(ids);
return waterStationMapper.deleteWaterStationByIds(ids);
}
......@@ -93,4 +145,23 @@ public class WaterStationServiceImpl implements IWaterStationService
{
return waterStationMapper.deleteWaterStationById(id);
}
/**
* 修改是否营业
* @param waterStation
* @return
*/
@Override
public int updateIsOpen(WaterStation waterStation) {
return waterStationMapper.updateWaterStation(waterStation);
}
/**
* 查询站点下拉框
* @return
*/
@Override
public List<Map<String, Object>> getStationList() {
return waterStationMapper.getStationList();
}
}
package com.qianhe.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.mapper.WaterStationUserMapper;
......@@ -16,7 +17,7 @@ import java.util.List;
* @date 2023-11-23
*/
@Service
public class WaterStationUserServiceImpl implements IWaterStationUserService
public class WaterStationUserServiceImpl extends ServiceImpl<WaterStationUserMapper,WaterStationUser> implements IWaterStationUserService
{
@Autowired
private WaterStationUserMapper waterStationUserMapper;
......@@ -54,6 +55,7 @@ public class WaterStationUserServiceImpl implements IWaterStationUserService
@Override
public int insertWaterStationUser(WaterStationUser waterStationUser)
{
waterStationUser.setCreateUser("管理员");
waterStationUser.setCreateTime(DateUtils.getNowDate());
return waterStationUserMapper.insertWaterStationUser(waterStationUser);
}
......
package com.qianhe.system.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class WaterGoodsSpeVo {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
@Excel(name = "标题")
private String speTitle;
/** 商品id */
@Excel(name = "商品id")
private Long goodsId;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 商品关联规格值集合 */
private List<WaterGoodsSpeVal> waterGoodsSpeValList;
}
package com.qianhe.system.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterGoodsImg;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class WaterGoodsVo {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 类型 */
@Excel(name = "类型")
private Long goodsTypeId;
/** 商品分类 */
@Excel(name = "商品分类")
private String goodsTypeName;
/** 所属站点id */
@Excel(name = "所属站点id")
private String belongStationId;
/** 所属站点名称 */
@Excel(name = "所属站点名称")
private String belongStationNames;
/** 封面图 */
@Excel(name = "封面图")
private String coverImg;
/** 详情图 */
@Excel(name = "详情图")
private String detailsImg;
/** 价格 */
@Excel(name = "价格")
private String price;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 状态(1上架0下架) */
@Excel(name = "状态", readConverterExp = "1=上架0下架")
private Long status;
/** 封面图集合 */
private List<WaterGoodsImg> coverImgs;
/** 详情图集合 */
private List<WaterGoodsImg> detailsImgs;
/** 商品关联规格集合 */
private WaterGoodsSpeVo waterGoodsSpe;
}
package com.qianhe.system.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterSpeVal;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class WaterSpeVo
{
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 标题 */
@Excel(name = "标题")
private String speTitle;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 商品规格子表集合 */
private List<WaterSpeVal> waterSpeValList;
}
package com.qianhe.system.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.system.domain.WaterStationUser;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class WaterStationVo {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 站点名称 */
@Excel(name = "站点名称")
private String stationName;
/** 电话 */
@Excel(name = "电话")
private Long phoneNum;
/** 详细地址 */
@Excel(name = "详细地址")
private String stationAddress;
/** 经度 */
@Excel(name = "经度")
private BigDecimal stationLon;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal stationLat;
/** 省份 */
@Excel(name = "省份")
private String province;
/** 城市 */
@Excel(name = "城市")
private String city;
/** 市区 */
@Excel(name = "市区")
private String area;
/** 是否打烊(1营业0打烊) */
@Excel(name = "是否打烊(1营业0打烊)")
private Long isOpen;
/** 创建人 */
@Excel(name = "创建人")
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 送水工集合 */
private List<WaterStationUser> waterStationUserList;
}
......@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterGoodsImgList" parameterType="WaterGoodsImg" resultMap="WaterGoodsImgResult">
<include refid="selectWaterGoodsImgVo"/>
<where>
del_flag = '0'
<if test="imgName != null and imgName != ''"> and img_name like concat('%', #{imgName}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="sizea != null and sizea != ''"> and sizea = #{sizea}</if>
......
......@@ -12,17 +12,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="coverImg" column="cover_img" />
<result property="detailsImg" column="details_img" />
<result property="price" column="price" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
</resultMap>
<sql id="selectWaterGoodsVo">
select id, title, goods_type_id, belong_station_id, cover_img, details_img, price, create_time, status from water_goods
select id, title, goods_type_id, belong_station_id, cover_img, details_img, price, create_user, create_time, status from water_goods
</sql>
<select id="selectWaterGoodsList" parameterType="WaterGoods" resultMap="WaterGoodsResult">
<include refid="selectWaterGoodsVo"/>
<where>
del_flag = '0'
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="goodsTypeId != null "> and goods_type_id = #{goodsTypeId}</if>
<if test="belongStationId != null "> and belong_station_id = #{belongStationId}</if>
......@@ -38,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<insert id="insertWaterGoods" parameterType="WaterGoods" useGeneratedKeys="true" keyProperty="id">
<insert id="insertWaterGoods" parameterType="com.qianhe.system.vo.WaterGoodsVo" useGeneratedKeys="true" keyProperty="id">
insert into water_goods
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
......@@ -47,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">cover_img,</if>
<if test="detailsImg != null">details_img,</if>
<if test="price != null">price,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
</trim>
......@@ -57,12 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">#{coverImg},</if>
<if test="detailsImg != null">#{detailsImg},</if>
<if test="price != null">#{price},</if>
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateWaterGoods" parameterType="WaterGoods">
<update id="updateWaterGoods" parameterType="com.qianhe.system.vo.WaterGoodsVo">
update water_goods
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
......@@ -71,20 +75,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="coverImg != null">cover_img = #{coverImg},</if>
<if test="detailsImg != null">details_img = #{detailsImg},</if>
<if test="price != null">price = #{price},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWaterGoodsById" parameterType="Long">
delete from water_goods where id = #{id}
</delete>
<update id="deleteWaterGoodsById" parameterType="Long">
update water_goods set del_flag = '1' where id = #{id}
</update>
<update id="deleteWaterGoodsByIds" parameterType="String">
update water_goods set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteWaterGoodsByIds" parameterType="String">
delete from water_goods where id in
<update id="deleteWaterGoodsImgByGoodsId" parameterType="Long">
update water_goods_img set del_flag = '1' where goods_id = #{id}
</update>
<update id="deleteWaterGoodsImgByGoodsIds" parameterType="String">
update water_goods_img set del_flag = '1' where goods_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
<update id="deleteWaterGoodsSpeByGoodsId" parameterType="Long">
update water_goods_spe set del_flag = '1' where goods_id = #{id}
</update>
<update id="deleteWaterGoodsSpeByGoodsIds" parameterType="String">
update water_goods_spe set del_flag = '1' where goods_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<insert id="batchInsertWaterGoodsImg" useGeneratedKeys="true" keyProperty="id">
<foreach collection="list" item="data" separator=";">
insert into water_goods_img
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="data.imgName != null">img_name,</if>
<if test="data.type != null">type,</if>
<if test="data.sizea != null">sizea,</if>
<if test="data.url != null">url,</if>
<if test="data.md5 != null">md5,</if>
<if test="data.imgType != null">img_type,</if>
<if test="data.goodsId != null">goods_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="data.imgName != null">#{data.imgName},</if>
<if test="data.type != null">#{data.type},</if>
<if test="data.sizea != null">#{data.sizea},</if>
<if test="data.url != null">#{data.url},</if>
<if test="data.md5 != null">#{data.md5},</if>
<if test="data.imgType != null">#{data.imgType},</if>
<if test="data.goodsId != null">#{data.goodsId},</if>
</trim>
</foreach>
</insert>
</mapper>
......@@ -7,69 +7,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="WaterGoodsSpe" id="WaterGoodsSpeResult">
<result property="id" column="id" />
<result property="speTitle" column="spe_title" />
<result property="spe" column="spe" />
<result property="speVal" column="spe_val" />
<result property="goodsId" column="goods_id" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWaterGoodsSpeVo">
select id, spe_title, spe, spe_val, goods_id, create_time from water_goods_spe
select id, spe_title, goods_id, create_user, create_time from water_goods_spe
</sql>
<select id="selectWaterGoodsSpeList" parameterType="WaterGoodsSpe" resultMap="WaterGoodsSpeResult">
<include refid="selectWaterGoodsSpeVo"/>
<where>
del_flag = '0'
<if test="speTitle != null and speTitle != ''"> and spe_title = #{speTitle}</if>
<if test="spe != null and spe != ''"> and spe = #{spe}</if>
<if test="speVal != null and speVal != ''"> and spe_val = #{speVal}</if>
<if test="goodsId != null "> and goods_id = #{goodsId}</if>
</where>
</select>
<select id="selectWaterGoodsSpeValList" parameterType="WaterGoodsSpeVal" resultType="WaterGoodsSpeVal">
select id, spe_id, spe, spe_val from water_goods_spe_val
<where>
del_flag = '0'
<if test="speId != null"> and spe_id = #{speId}</if>
</where>
</select>
<select id="selectWaterGoodsSpeById" parameterType="Long" resultMap="WaterGoodsSpeResult">
<include refid="selectWaterGoodsSpeVo"/>
where id = #{id}
</select>
<insert id="insertWaterGoodsSpe" parameterType="WaterGoodsSpe" useGeneratedKeys="true" keyProperty="id">
<insert id="insertWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo" useGeneratedKeys="true" keyProperty="id">
insert into water_goods_spe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="speTitle != null">spe_title,</if>
<if test="spe != null">spe,</if>
<if test="speVal != null">spe_val,</if>
<if test="goodsId != null">goods_id,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="speTitle != null">#{speTitle},</if>
<if test="spe != null">#{spe},</if>
<if test="speVal != null">#{speVal},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWaterGoodsSpe" parameterType="WaterGoodsSpe">
<update id="updateWaterGoodsSpe" parameterType="com.qianhe.system.vo.WaterGoodsSpeVo">
update water_goods_spe
<trim prefix="SET" suffixOverrides=",">
<if test="speTitle != null">spe_title = #{speTitle},</if>
<if test="spe != null">spe = #{spe},</if>
<if test="speVal != null">spe_val = #{speVal},</if>
<if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWaterGoodsSpeById" parameterType="Long">
delete from water_goods_spe where id = #{id}
</delete>
<update id="deleteWaterGoodsSpeById" parameterType="Long">
update water_goods_spe set del_flag = '1' where id = #{id}
</update>
<update id="deleteWaterGoodsSpeByIds" parameterType="String">
update water_goods_spe set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteWaterGoodsSpeValBySpeId" parameterType="Long">
update water_goods_spe_val set del_flag = '1' where spe_id = #{id}
</update>
<delete id="deleteWaterGoodsSpeByIds" parameterType="String">
delete from water_goods_spe where id in
<update id="deleteWaterGoodsSpeValBySpeIds" parameterType="String">
update water_goods_spe_val set del_flag = '1' where spe_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
<insert id="batchInsertWaterGoodsSpeVal">
insert into water_goods_spe_val(spe_id, spe, spe_val)
values
<foreach collection="list" item="item" separator=",">
(#{item.speId}, #{item.spe}, #{item.speVal})
</foreach>
</insert>
</mapper>
......@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterGoodsTypeList" parameterType="WaterGoodsType" resultMap="WaterGoodsTypeResult">
<include refid="selectWaterGoodsTypeVo"/>
<where>
del_flag = '0'
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
</where>
</select>
......@@ -47,14 +48,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteWaterGoodsTypeById" parameterType="Long">
delete from water_goods_type where id = #{id}
</delete>
<update id="deleteWaterGoodsTypeById" parameterType="Long">
update water_goods_type set del_flag = '1' where id = #{id}
</update>
<delete id="deleteWaterGoodsTypeByIds" parameterType="String">
delete from water_goods_type where id in
<update id="deleteWaterGoodsTypeByIds" parameterType="String">
update water_goods_type set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>
......@@ -7,21 +7,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="WaterSpe" id="WaterSpeResult">
<result property="id" column="id" />
<result property="speTitle" column="spe_title" />
<result property="spe" column="spe" />
<result property="speVal" column="spe_val" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWaterSpeVo">
select id, spe_title, spe, spe_val, create_time from water_spe
select id, spe_title, create_user, create_time from water_spe
</sql>
<select id="selectWaterSpeList" parameterType="WaterSpe" resultMap="WaterSpeResult">
<include refid="selectWaterSpeVo"/>
<where>
del_flag = '0'
<if test="speTitle != null and speTitle != ''"> and spe_title = #{speTitle}</if>
<if test="spe != null and spe != ''"> and spe = #{spe}</if>
<if test="speVal != null and speVal != ''"> and spe_val = #{speVal}</if>
</where>
</select>
<select id="selectWaterSpeValList" parameterType="WaterSpeVal" resultType="WaterSpeVal">
select id, spe_id, spe, spe_val from water_spe_val
<where>
del_flag = '0'
<if test="speId != null "> and spe_id = #{speId}</if>
</where>
</select>
......@@ -30,41 +36,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<insert id="insertWaterSpe" parameterType="WaterSpe" useGeneratedKeys="true" keyProperty="id">
<insert id="insertWaterSpe" parameterType="com.qianhe.system.vo.WaterSpeVo" useGeneratedKeys="true" keyProperty="id">
insert into water_spe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="speTitle != null">spe_title,</if>
<if test="spe != null">spe,</if>
<if test="speVal != null">spe_val,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="speTitle != null">#{speTitle},</if>
<if test="spe != null">#{spe},</if>
<if test="speVal != null">#{speVal},</if>
<if test="createUser != null and createUser != ''">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWaterSpe" parameterType="WaterSpe">
<update id="updateWaterSpe" parameterType="com.qianhe.system.vo.WaterSpeVo">
update water_spe
<trim prefix="SET" suffixOverrides=",">
<if test="speTitle != null">spe_title = #{speTitle},</if>
<if test="spe != null">spe = #{spe},</if>
<if test="speVal != null">spe_val = #{speVal},</if>
<if test="createUser != null and createUser != ''">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWaterSpeById" parameterType="Long">
delete from water_spe where id = #{id}
</delete>
<update id="deleteWaterSpeById" parameterType="Long">
update water_spe set del_flag = '1' where id = #{id}
</update>
<update id="deleteWaterSpeByIds" parameterType="String">
update water_spe set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteWaterSpeValBySpeId" parameterType="Long">
update water_spe_val set del_flag = '1' where spe_id = #{id}
</update>
<delete id="deleteWaterSpeByIds" parameterType="String">
delete from water_spe where id in
<update id="deleteWaterSpeValBySpeIds" parameterType="String">
update water_spe_val set del_flag = '1' where spe_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
<insert id="batchInsertWaterSpeVal">
insert into water_spe_val(spe_id, spe, spe_val)
values
<foreach collection="list" item="item" separator=",">
(#{item.speId}, #{item.spe}, #{item.speVal})
</foreach>
</insert>
</mapper>
......@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterStationList" parameterType="WaterStation" resultMap="WaterStationResult">
<include refid="selectWaterStationVo"/>
<where>
del_flag = '0'
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
<if test="phoneNum != null "> and phone_num = #{phoneNum}</if>
<if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if>
......@@ -39,12 +40,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getStationList" resultType="Map">
select id as stationId, station_name as stationName from water_station where del_flag = '0'
</select>
<select id="selectWaterStationById" parameterType="Long" resultMap="WaterStationResult">
<include refid="selectWaterStationVo"/>
where id = #{id}
</select>
<insert id="insertWaterStation" parameterType="WaterStation" useGeneratedKeys="true" keyProperty="id">
<insert id="insertWaterStation" parameterType="com.qianhe.system.domain.WaterStation" useGeneratedKeys="true" keyProperty="id">
insert into water_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationName != null">station_name,</if>
......@@ -74,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateWaterStation" parameterType="WaterStation">
<update id="updateWaterStation" parameterType="com.qianhe.system.domain.WaterStation">
update water_station
<trim prefix="SET" suffixOverrides=",">
<if test="stationName != null">station_name = #{stationName},</if>
......@@ -92,14 +97,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteWaterStationById" parameterType="Long">
delete from water_station where id = #{id}
</delete>
<update id="deleteWaterStationById" parameterType="Long">
update water_station set del_flag = '1' where id = #{id}
</update>
<update id="deleteWaterStationByIds" parameterType="String">
update water_station set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<insert id="batchInsertStationUser">
insert into water_station_user(name, age, gender, phone, id_num, station_id, create_time, create_user)
values
<foreach collection="list" item="item" separator=",">
(#{item.name}, #{item.age}, #{item.gender}, #{item.phone}, #{item.idNum}, #{item.stationId}, #{item.createTime}, #{item.createUser})
</foreach>
</insert>
<delete id="deleteWaterStationByIds" parameterType="String">
delete from water_station where id in
<update id="deleteWaterStationUserByStationId" parameterType="Long">
update water_station_user set del_flag = '1' where station_id = #{id}
</update>
<update id="deleteWaterStationUserByStationIds" parameterType="String">
update water_station_user set del_flag = '1' where station_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>
......@@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterStationUserList" parameterType="WaterStationUser" resultMap="WaterStationUserResult">
<include refid="selectWaterStationUserVo"/>
<where>
del_flag = '0'
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="age != null "> and age = #{age}</if>
<if test="gender != null "> and gender = #{gender}</if>
......@@ -77,14 +78,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteWaterStationUserById" parameterType="Long">
delete from water_station_user where id = #{id}
</delete>
<update id="deleteWaterStationUserById" parameterType="Long">
update water_station_user set del_flag = '1' where id = #{id}
</update>
<delete id="deleteWaterStationUserByIds" parameterType="String">
delete from water_station_user where id in
<update id="deleteWaterStationUserByIds" parameterType="String">
update water_station_user set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>
......@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterUserAddressList" parameterType="WaterUserAddress" resultMap="WaterUserAddressResult">
<include refid="selectWaterUserAddressVo"/>
<where>
del_flag = '0'
<if test="waterUserId != null "> and water_user_id = #{waterUserId}</if>
<if test="userAddress != null and userAddress != ''"> and user_address = #{userAddress}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
......
......@@ -97,22 +97,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where open_id = #{openId}
</update>
<delete id="deleteWaterUserById" parameterType="Long">
delete from water_user where id = #{id}
</delete>
<update id="deleteWaterUserById" parameterType="Long">
update water_user set status = 1 where id = #{id}
</update>
<update id="deleteWaterUserByIds" parameterType="String">
update water_user set status = '1' where id in
update water_user set status = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteWaterUserAddressByIds" parameterType="String">
delete from water_user_address where water_user_id in
<update id="deleteWaterUserAddressByIds" parameterType="String">
update water_user_address set del_flag = '1' where water_user_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>
......@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
<!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
</configuration>
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