fix: restore apitest commodities
Some checks failed
Build and Push Backend / docker (push) Has been cancelled
Some checks failed
Build and Push Backend / docker (push) Has been cancelled
This commit is contained in:
@@ -16,6 +16,7 @@ import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelGroupInfoEntity;
|
||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
||||
import com.starry.admin.modules.shop.mapper.PlayClerkGiftInfoMapper;
|
||||
import com.starry.admin.modules.shop.mapper.PlayCommodityInfoMapper;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayClerkGiftInfoEntity;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCommodityAndLevelInfoEntity;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCommodityInfoEntity;
|
||||
@@ -88,6 +89,7 @@ public class ApiTestDataSeeder implements CommandLineRunner {
|
||||
private final IPlayGiftInfoService giftInfoService;
|
||||
private final IPlayClerkCommodityService clerkCommodityService;
|
||||
private final PlayClerkUserInfoMapper clerkUserInfoMapper;
|
||||
private final PlayCommodityInfoMapper commodityInfoMapper;
|
||||
private final IPlayClerkGiftInfoService playClerkGiftInfoService;
|
||||
private final IPlayCustomUserInfoService customUserInfoService;
|
||||
private final IPlayCustomGiftInfoService playCustomGiftInfoService;
|
||||
@@ -109,6 +111,7 @@ public class ApiTestDataSeeder implements CommandLineRunner {
|
||||
IPlayGiftInfoService giftInfoService,
|
||||
IPlayClerkCommodityService clerkCommodityService,
|
||||
PlayClerkUserInfoMapper clerkUserInfoMapper,
|
||||
PlayCommodityInfoMapper commodityInfoMapper,
|
||||
IPlayClerkGiftInfoService playClerkGiftInfoService,
|
||||
IPlayCustomUserInfoService customUserInfoService,
|
||||
IPlayCustomGiftInfoService playCustomGiftInfoService,
|
||||
@@ -128,6 +131,7 @@ public class ApiTestDataSeeder implements CommandLineRunner {
|
||||
this.giftInfoService = giftInfoService;
|
||||
this.clerkCommodityService = clerkCommodityService;
|
||||
this.clerkUserInfoMapper = clerkUserInfoMapper;
|
||||
this.commodityInfoMapper = commodityInfoMapper;
|
||||
this.playClerkGiftInfoService = playClerkGiftInfoService;
|
||||
this.customUserInfoService = customUserInfoService;
|
||||
this.playCustomGiftInfoService = playCustomGiftInfoService;
|
||||
@@ -275,6 +279,17 @@ public class ApiTestDataSeeder implements CommandLineRunner {
|
||||
|
||||
private PlayCommodityInfoEntity seedCommodityHierarchy() {
|
||||
PlayCommodityInfoEntity parent = commodityInfoService.getById(DEFAULT_COMMODITY_PARENT_ID);
|
||||
if (parent == null) {
|
||||
PlayCommodityInfoEntity existingParent = commodityInfoMapper
|
||||
.selectByIdIncludingDeleted(DEFAULT_COMMODITY_PARENT_ID);
|
||||
if (existingParent != null) {
|
||||
commodityInfoMapper.restoreCommodity(DEFAULT_COMMODITY_PARENT_ID, DEFAULT_TENANT_ID);
|
||||
parent = commodityInfoService.getById(DEFAULT_COMMODITY_PARENT_ID);
|
||||
if (parent == null) {
|
||||
parent = existingParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parent == null) {
|
||||
parent = new PlayCommodityInfoEntity();
|
||||
parent.setId(DEFAULT_COMMODITY_PARENT_ID);
|
||||
@@ -311,6 +326,17 @@ public class ApiTestDataSeeder implements CommandLineRunner {
|
||||
}
|
||||
|
||||
PlayCommodityInfoEntity child = commodityInfoService.getById(DEFAULT_COMMODITY_ID);
|
||||
if (child == null) {
|
||||
PlayCommodityInfoEntity existingChild = commodityInfoMapper
|
||||
.selectByIdIncludingDeleted(DEFAULT_COMMODITY_ID);
|
||||
if (existingChild != null) {
|
||||
commodityInfoMapper.restoreCommodity(DEFAULT_COMMODITY_ID, DEFAULT_TENANT_ID);
|
||||
child = commodityInfoService.getById(DEFAULT_COMMODITY_ID);
|
||||
if (child == null) {
|
||||
child = existingChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (child != null) {
|
||||
boolean childNeedsUpdate = false;
|
||||
if (!DEFAULT_COMMODITY_PARENT_ID.equals(child.getPId())) {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.starry.admin.modules.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCommodityInfoEntity;
|
||||
import com.starry.admin.modules.shop.module.vo.PlayCommodityInfoVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 服务项目Mapper接口
|
||||
@@ -34,4 +37,12 @@ public interface PlayCommodityInfoMapper extends MPJBaseMapper<PlayCommodityInfo
|
||||
@Select("select t.id as commodityId,t3.price as commodityPrice,t.item_name as serviceDuration,t1.item_name as commodityName from play_commodity_info t left join play_commodity_info t1 on t.p_id = t1.id left join play_commodity_and_level_info t3 ON t3.commodity_id = t.id where t3.price is not null and t.id = #{id} and t3.level_id = #{levelId} limit 1")
|
||||
PlayCommodityInfoVo queryCommodityInfo(String id, String levelId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
@Select("SELECT id, tenant_id, deleted FROM play_commodity_info WHERE id = #{id} LIMIT 1")
|
||||
PlayCommodityInfoEntity selectByIdIncludingDeleted(@Param("id") String id);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
@Update("UPDATE play_commodity_info SET deleted = 0, tenant_id = #{tenantId}, enable_stace = '1' WHERE id = #{id}")
|
||||
int restoreCommodity(@Param("id") String id, @Param("tenantId") String tenantId);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user