Merge branch 'FangShiBa'

master
fangzhe 2023-12-19 15:01:18 +08:00
commit 72adb54ab7
20 changed files with 679 additions and 0 deletions

View File

@ -4,7 +4,9 @@
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/bwie-buy/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-mq/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -0,0 +1,33 @@
package com.bwie.common.pojo.DTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class DTOGoods {
private Integer goodsId; //商品设备中间id
private Integer shopId; //商品id
private Integer facilityId; //设备id
private Integer goodsNum; //库存
private Integer goodsIsDelete; //上下架(逻辑字段: 0上架, 1下架)
private String shopName; //商品名称
private Double shopPrice; //商品价格
private Integer typeId; //商品类型id
private String facilityType; //设备类型
private String facilitySite; //设备地址
private Integer replenishmentUserId; //补货员工
private Integer maintainUserId; //维修员工
private String facilityStatic; //设备状态
private Integer delId; //删除状态
}

View File

@ -1,9 +1,21 @@
package com.bwie.common.pojo.DTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/16
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class DTOUser {
private Integer userId;
}

View File

@ -0,0 +1,28 @@
package com.bwie.common.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Facility {
private Integer facilityId; //设备编号
private String facilityType; //设备类型
private String facilitySite; //设备地址
private Integer replenishmentUserId; //补货员工
private Integer maintainUserId; //维修员工
private String facilityStatic; //设备状态
private Integer delId; //删除状态
}

View File

@ -0,0 +1,23 @@
package com.bwie.common.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Goods {
private Integer goodsId; //商品设备中间id
private Integer shopId; //商品id
private Integer facilityId; //设备id
private Integer goodsNum; //库存
private Integer goodsIsDelete; //上下架(逻辑字段: 0上架, 1下架)
}

View File

@ -0,0 +1,31 @@
package com.bwie.common.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author FangShiBa
* @date 2023/12/18
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Sell {
private Integer sellId;
private Integer shopId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date sellTime;
private Integer userId;
private Integer facilityId;
}

View File

@ -0,0 +1,23 @@
package com.bwie.common.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Shop {
private Integer shopId; //商品id
private String shopName; //商品名称
private Double shopPrice; //商品价格
private Integer typeId; //商品类型id
}

View File

@ -0,0 +1,27 @@
package com.bwie.common.pojo.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class VOGoods {
private Integer goodsId; //商品设备中间id
private Integer shopId; //商品id
private Integer facilityId; //设备id
private Integer goodsNum; //库存
private Integer goodsIsDelete; //上下架(逻辑字段: 0上架, 1下架)
private Double payForMoney; //支付金额
private Integer pageNum=1;
private Integer pageSize=3;
}

38
bwie-models/bwie-buy/.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bwie</groupId>
<artifactId>bwie-models</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>bwie-buy</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,18 @@
package com.bwie.buy;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@SpringBootApplication
@MapperScan("com.bwie.buy.dao")
public class BuyApplication {
public static void main(String[] args) {
SpringApplication.run(BuyApplication.class,args);
}
}

View File

@ -0,0 +1,60 @@
package com.bwie.buy.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.buy.service.BuyService;
import com.bwie.common.pojo.VO.VOGoods;
import com.bwie.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Log4j2
@RestController
@RequestMapping("/buy")
public class BuyController {
@Autowired
private BuyService service;
@Autowired
private HttpServletRequest request;
/*
,
*/
@PostMapping("/showGoodsList")
public Result showGoodsList(@RequestBody VOGoods voGoods){
log.info("功能:{商品列表展示}请求URI{},请求方法:{},请求参数:{}",
request.getRequestURI(), request.getMethod(),voGoods );
Result result=service.showGoodsList(voGoods);
log.info("功能:{商品列表展示}请求URI{},请求方法:{},响应参数:{}",
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
return result;
}
/*
*/
@PostMapping("/buyGood")
public Result buyGood(@RequestBody VOGoods voGoods){
log.info("功能:{购买商品}请求URI{},请求方法:{},请求参数:{}",
request.getRequestURI(), request.getMethod(),voGoods );
Result result=service.buyGood(voGoods);
log.info("功能:{购买商品}请求URI{},请求方法:{},响应参数:{}",
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,29 @@
package com.bwie.buy.dao;
import com.bwie.common.pojo.DTO.DTOGoods;
import com.bwie.common.pojo.Sell;
import com.bwie.common.pojo.Shop;
import com.bwie.common.pojo.VO.VOGoods;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Component
public interface BuyDao {
List<DTOGoods> showGoodsList(VOGoods voGoods);
Shop findById(@Param("shopId") Integer shopId);
void buyGood(VOGoods voGoods);
void addSell(Sell sell);
}

View File

@ -0,0 +1,15 @@
package com.bwie.buy.service;
import com.bwie.common.pojo.VO.VOGoods;
import com.bwie.common.result.Result;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
public interface BuyService {
Result buyGood(VOGoods voGoods);
Result showGoodsList(VOGoods voGoods);
}

View File

@ -0,0 +1,67 @@
package com.bwie.buy.service.impl;
import com.alibaba.fastjson.JSON;
import com.bwie.buy.dao.BuyDao;
import com.bwie.buy.service.BuyService;
import com.bwie.common.constants.JwtConstants;
import com.bwie.common.pojo.DTO.DTOGoods;
import com.bwie.common.pojo.DTO.DTOUser;
import com.bwie.common.pojo.Sell;
import com.bwie.common.pojo.Shop;
import com.bwie.common.pojo.VO.VOGoods;
import com.bwie.common.result.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author FangShiBa
* @date 2023/12/17
* @apiNote
*/
@Service
public class BuyServiceImp implements BuyService {
@Autowired
private BuyDao dao;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Autowired
private HttpServletRequest request;
@Override
public Result buyGood(VOGoods voGoods) {
if(null==voGoods.getFacilityId()||null==voGoods.getPayForMoney()){
return Result.error("输入的值有误或未输入");
}
Shop shop=dao.findById(voGoods.getShopId());
if(shop.getShopPrice()>voGoods.getPayForMoney()){
return Result.error("小老弟,钱不够");
}
//voGoods 参数有商品编号和售货机编号
dao.buyGood(voGoods);
String token = request.getHeader("token");
String s = redisTemplate.opsForValue().get(JwtConstants.LOGIN_TOKEN + token);
DTOUser dtoUser = JSON.parseObject(s, DTOUser.class);
Sell sell = new Sell();
sell.setFacilityId(voGoods.getFacilityId());
sell.setShopId(voGoods.getShopId());
sell.setUserId(dtoUser.getUserId());
dao.addSell(sell);
return Result.success("购买成功");
}
@Override
public Result showGoodsList(VOGoods voGoods) {
PageHelper.startPage(voGoods.getPageNum(),voGoods.getPageSize());
List<DTOGoods> list=dao.showGoodsList(voGoods);
PageInfo<DTOGoods> info = new PageInfo<>(list);
return Result.success(info);
}
}

View File

@ -0,0 +1,55 @@
package com.bwie.buy.util;
import org.springframework.stereotype.Component;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* @BelongsProject: 0107day02
* @BelongsPackage: com.bw.config
* @Author: zhupengfei
* @CreateTime: 2023-02-01 08:52
*/
@Component
public class FastUtil {
private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
@Resource
private FastFileStorageClient storageClient ;
/**
*
*/
public String upload(MultipartFile multipartFile) throws Exception{
String originalFilename = multipartFile.getOriginalFilename().
substring(multipartFile.getOriginalFilename().
lastIndexOf(".") + 1);
StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
multipartFile.getInputStream(),
multipartFile.getSize(),originalFilename , null);
return storePath.getFullPath() ;
}
/**
*
*/
public String deleteFile(String fileUrl) {
if (StringUtils.isEmpty(fileUrl)) {
log.info("fileUrl == >>文件路径为空...");
return "文件路径不能为空";
}
try {
StorePath storePath = StorePath.parseFromUrl(fileUrl);
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
} catch (Exception e) {
log.error(e.getMessage());
}
return "删除成功";
}
}

View File

@ -0,0 +1,41 @@
# Tomcat
server:
port: 9004
# Spring
spring:
main:
allow-circular-references: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
application:
# 应用名称
name: bwie-buy
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 110.42.214.8:8848
config:
# 配置中心地址
server-addr: 110.42.214.8:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
fdfs:
so-timeout: 1500 # socket 连接时长
connect-timeout: 600 # 连接 tracker 服务器超时时长
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
tracker-list: 110.42.214.8:22122
web-server-url: 110.42.214.8:8888
pool:
jmx-enabled: false
# 生成缩略图
thumb-image:
height: 500
width: 500

View File

@ -0,0 +1,29 @@
<?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.bwie.buy.dao.BuyDao">
<insert id="addSell">
INSERT INTO `shop_manage`.`t_sell`
(`shop_id`, `sell_time`, `user_id`, `facility_id`) VALUES
(#{shopId}, now(), #{userId}, #{facilityId});
</insert>
<update id="buyGood">
UPDATE `shop_manage`.`t_goods` SET
`goods_num` = (`goods_num`-1)
WHERE
`shop_id` = #{shopId} and
`facility_id` = #{facilityId}
</update>
<select id="showGoodsList" resultType="com.bwie.common.pojo.DTO.DTOGoods">
select * from t_goods g
left join t_shop s on g.shop_id=s.shop_id
left join t_facility f on g.facility_id=f.facility_id
WHERE f.facility_id=#{facilityId}
</select>
<select id="findById" resultType="com.bwie.common.pojo.Shop">
select * from t_shop
where shop_id=${shopId}
</select>
</mapper>

View File

@ -10,6 +10,10 @@
</parent>
<artifactId>bwie-models</artifactId>
<packaging>pom</packaging>
<modules>
<module>bwie-buy</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>