1.增加mybatisplus依赖

This commit is contained in:
2024-08-20 17:03:51 +08:00
parent 796f43299f
commit d8027c92b2
3 changed files with 78 additions and 38 deletions

34
pom.xml
View File

@@ -69,11 +69,10 @@
<version>1.9.4</version> <version>1.9.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.5.7</version> <version>2.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId> <artifactId>mybatis-generator-core</artifactId>
@@ -186,6 +185,33 @@
<version>2.2.0</version> <version>2.2.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.3.1</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<!-- <profiles>--> <!-- <profiles>-->
<!-- <profile>--> <!-- <profile>-->

View File

@@ -141,10 +141,10 @@ public class OrderService {
if ((StrUtil.isNotBlank(tableId))) { if ((StrUtil.isNotBlank(tableId))) {
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>() TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, tableId) .eq(TbShopTable::getQrcode, tableId)
.eq(TbShopTable::getStatus, "opening")); .in(TbShopTable::getStatus, "idle", "opening"));
if (shopTable == null) { if (shopTable == null) {
return Result.fail("台桌不存在或未开台"); return Result.fail("台桌不处于开台或空闲状态");
} }
} }
@@ -389,14 +389,19 @@ public class OrderService {
} }
int orderId = 0; int orderId = 0;
String uuid = ""; String uuid = "";
ArrayList<Integer> ids = new ArrayList<>();
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) { if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
orderId = Integer.parseInt(cashierCart.getOrderId()); orderId = Integer.parseInt(cashierCart.getOrderId());
} }
cashierCart.setStatus("create"); cashierCart.setStatus("create");
ids.add(cashierCart.getId());
} }
mpCashierCartMapper.insertOrUpdate(list); // mpCashierCartMapper.insertOrUpdate(list);
// cashierCartMapper.updateStatusByMaster(Integer.valueOf(shopId), masterId, "create", day, uuid); // cashierCartMapper.updateStatusByMaster(Integer.valueOf(shopId), masterId, "create", day, uuid);
mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
.set(TbCashierCart::getStatus, "create")
.in(TbCashierCart::getId, ids));
if (orderId > 0) { if (orderId > 0) {
tbOrderInfoMapper.updateStatusById(orderId, "cancelled"); tbOrderInfoMapper.updateStatusById(orderId, "cancelled");
orderDetailMapper.updateStatusByOrderId(orderId, "cancelled"); orderDetailMapper.updateStatusByOrderId(orderId, "cancelled");
@@ -908,13 +913,19 @@ public class OrderService {
return Result.fail(CodeEnum.CARTJH); return Result.fail(CodeEnum.CARTJH);
} }
int orderId = 0; int orderId = 0;
ArrayList<Integer> ids = new ArrayList<>();
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) { if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
orderId = Integer.parseInt(cashierCart.getOrderId()); orderId = Integer.parseInt(cashierCart.getOrderId());
} }
cashierCart.setStatus("create"); ids.add(cashierCart.getId());
// cashierCart.setStatus("create");
// }
} }
mpCashierCartMapper.insertOrUpdate(list); mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
.set(TbCashierCart::getStatus, "create")
.in(TbCashierCart::getId, ids));
// cashierCartMapper.updateStatusByMaster(shopId, masterId, "create", day, uuid); // cashierCartMapper.updateStatusByMaster(shopId, masterId, "create", day, uuid);
if (orderId > 0) { if (orderId > 0) {
tbOrderInfoMapper.updateStatusById(orderId, "cancelled"); tbOrderInfoMapper.updateStatusById(orderId, "cancelled");

View File

@@ -57,5 +57,8 @@ wx:
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0 warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
mybatis-plus:
global-config:
db-config:
id-type: auto