Commit 4695f84b by 吕明尚

新增接口,通过房间ID查询套餐

parent ab4b6f46
......@@ -29,7 +29,7 @@ import share.common.core.page.TableDataInfo;
* @date 2023-10-31
*/
@RestController
@RequestMapping("/system/pack")
@RequestMapping("/system/roomPack")
public class RoomPackController extends BaseController {
@Autowired
private IRoomPackService roomPackService;
......
......@@ -16,6 +16,7 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.enums.BusinessType;
import share.system.domain.Pack;
import share.system.domain.SRoom;
import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo;
......@@ -86,5 +87,14 @@ public class SRoomController extends BaseController {
return R.ok(sRoomService.openDoor(id));
}
/**
* 通过房间ID查询套餐
*/
@ApiOperation(value = "通过房间ID查询套餐")
@RequestMapping(value = "/roomId", method = RequestMethod.GET)
public R<List<Pack>> getPackByRoomId(@RequestParam("id") Long id) {
return R.ok(sRoomService.getPackByRoomId(id));
}
}
......@@ -71,6 +71,7 @@ public class WebConfig implements WebMvcConfigurer {
"/front/room/list",
"/front/room/info",
"/front/room/roomStatus",
"/front/room/roomId",
"**"
).addPathPatterns("/**");
}
......
......@@ -54,7 +54,7 @@ public class SCoupon extends BaseEntity
private String roomType;
/** 优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额) */
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额)")
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额,6:套餐劵)")
private Integer couponType;
/** 门槛时长 */
......
......@@ -59,4 +59,6 @@ public interface RoomPackMapper extends BaseMapper<RoomPack> {
* @return 结果
*/
public int deleteRoomPackByIds(Long[] ids);
List<Long> selectPackListByRoomId(Long id);
}
......@@ -59,4 +59,6 @@ public interface IPackService extends IService<Pack> {
* @return 结果
*/
public int deletePackById(Long id);
List<Pack> selectPackListByIds(List<Long> packIds);
}
......@@ -59,4 +59,6 @@ public interface IRoomPackService extends IService<RoomPack> {
* @return 结果
*/
public int deleteRoomPackById(Long id);
List<Long> selectPackListByRoomId(Long id);
}
......@@ -3,6 +3,7 @@ package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Pack;
import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
......@@ -83,4 +84,6 @@ public interface ISRoomService extends IService<SRoom>
String openDoor(Long id);
List<Pack> getPackByRoomId(Long id);
}
......@@ -88,4 +88,9 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IP
public int deletePackById(Long id) {
return packMapper.deletePackById(id);
}
@Override
public List<Pack> selectPackListByIds(List<Long> packIds) {
return packMapper.selectBatchIds(packIds);
}
}
......@@ -88,4 +88,9 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> i
public int deleteRoomPackById(Long id) {
return roomPackMapper.deleteRoomPackById(id);
}
@Override
public List<Long> selectPackListByRoomId(Long id) {
return roomPackMapper.selectPackListByRoomId(id);
}
}
......@@ -11,11 +11,14 @@ import share.common.enums.RoleTypeEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.Pack;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.SRoomMapper;
import share.system.domain.SRoom;
import share.system.service.IPackService;
import share.system.service.IRoomPackService;
import share.system.service.ISRoomService;
import share.system.service.ISStoreService;
......@@ -34,6 +37,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Autowired
private ISStoreService sStoreService;
@Autowired
private IPackService packService;
@Autowired
private IRoomPackService roomPackService;
/**
* 查询房间
*
......@@ -174,6 +183,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
}
}
@Override
public List<Pack> getPackByRoomId(Long id) {
List<Long> packIds = roomPackService.selectPackListByRoomId(id);
return packService.selectPackListByIds(packIds);
}
private List<SRoomVo> convertDoListToVoList(List<SRoom> roomList){
List<SRoomVo> voList = new ArrayList<>();
......
......@@ -266,7 +266,6 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
idList.forEach(item -> {
storeList.add(sStoreMapper.selectById(item));
});
//转换VO
storeList.forEach(item -> {
item.setRoolList(sRoomService.selectSroomListByStroeId(item.getId()));
});
......
......@@ -39,6 +39,11 @@
<include refid="selectRoomPackVo"/>
where id = #{id}
</select>
<select id="selectPackListByRoomId" resultType="java.lang.Long">
select pack_id
from s_room_pack
where room_id = #{roomId}
</select>
<insert id="insertRoomPack" parameterType="RoomPack" useGeneratedKeys="true" keyProperty="id">
insert into s_room_pack
......
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