Commit f0f22a27 by 吕明尚

新增套餐管理

parent f95e8668
...@@ -16,8 +16,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,8 +16,9 @@ import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log; import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.system.domain.Pack; import share.system.domain.SPack;
import share.system.service.IPackService; import share.system.service.IPackService;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
...@@ -39,21 +40,30 @@ public class PackController extends BaseController { ...@@ -39,21 +40,30 @@ public class PackController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:pack:list')") @PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Pack pack) { public TableDataInfo list(SPack SPack) {
startPage(); startPage();
List<Pack> list = packService.selectPackList(pack); List<SPack> list = packService.selectPackList(SPack);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/query")
public R<List<SPack>> query() {
return R.ok(packService.selectPackList(new SPack()));
}
/**
* 导出套餐列表 * 导出套餐列表
*/ */
@PreAuthorize("@ss.hasPermi('system:pack:export')") @PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT) @Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Pack pack) { public void export(HttpServletResponse response, SPack SPack) {
List<Pack> list = packService.selectPackList(pack); List<SPack> list = packService.selectPackList(SPack);
ExcelUtil<Pack> util = new ExcelUtil<Pack>(Pack.class); ExcelUtil<SPack> util = new ExcelUtil<SPack>(SPack.class);
util.exportExcel(response, list, "套餐数据"); util.exportExcel(response, list, "套餐数据");
} }
...@@ -72,8 +82,8 @@ public class PackController extends BaseController { ...@@ -72,8 +82,8 @@ public class PackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:add')") @PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT) @Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Pack pack) { public AjaxResult add(@RequestBody SPack SPack) {
return toAjax(packService.insertPack(pack)); return toAjax(packService.insertPack(SPack));
} }
/** /**
...@@ -82,8 +92,8 @@ public class PackController extends BaseController { ...@@ -82,8 +92,8 @@ public class PackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:edit')") @PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE) @Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Pack pack) { public AjaxResult edit(@RequestBody SPack SPack) {
return toAjax(packService.updatePack(pack)); return toAjax(packService.updatePack(SPack));
} }
/** /**
......
...@@ -17,7 +17,7 @@ import share.common.annotation.Log; ...@@ -17,7 +17,7 @@ import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
import share.system.service.IRoomPackService; import share.system.service.IRoomPackService;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
...@@ -39,9 +39,9 @@ public class RoomPackController extends BaseController { ...@@ -39,9 +39,9 @@ public class RoomPackController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:pack:list')") @PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RoomPack roomPack) { public TableDataInfo list(SRoomPack SRoomPack) {
startPage(); startPage();
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack); List<SRoomPack> list = roomPackService.selectRoomPackList(SRoomPack);
return getDataTable(list); return getDataTable(list);
} }
...@@ -51,9 +51,9 @@ public class RoomPackController extends BaseController { ...@@ -51,9 +51,9 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:export')") @PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "包房套餐关系", businessType = BusinessType.EXPORT) @Log(title = "包房套餐关系", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, RoomPack roomPack) { public void export(HttpServletResponse response, SRoomPack SRoomPack) {
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack); List<SRoomPack> list = roomPackService.selectRoomPackList(SRoomPack);
ExcelUtil<RoomPack> util = new ExcelUtil<RoomPack>(RoomPack.class); ExcelUtil<SRoomPack> util = new ExcelUtil<SRoomPack>(SRoomPack.class);
util.exportExcel(response, list, "包房套餐关系数据"); util.exportExcel(response, list, "包房套餐关系数据");
} }
...@@ -72,8 +72,8 @@ public class RoomPackController extends BaseController { ...@@ -72,8 +72,8 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:add')") @PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "包房套餐关系", businessType = BusinessType.INSERT) @Log(title = "包房套餐关系", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody RoomPack roomPack) { public AjaxResult add(@RequestBody SRoomPack SRoomPack) {
return toAjax(roomPackService.insertRoomPack(roomPack)); return toAjax(roomPackService.insertRoomPack(SRoomPack));
} }
/** /**
...@@ -82,8 +82,8 @@ public class RoomPackController extends BaseController { ...@@ -82,8 +82,8 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:edit')") @PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "包房套餐关系", businessType = BusinessType.UPDATE) @Log(title = "包房套餐关系", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody RoomPack roomPack) { public AjaxResult edit(@RequestBody SRoomPack SRoomPack) {
return toAjax(roomPackService.updateRoomPack(roomPack)); return toAjax(roomPackService.updateRoomPack(SRoomPack));
} }
/** /**
......
package share.common.enums; package share.common.enums;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Author wwl * @Author wwl
* @Date 2023/10/19 17:06 * @Date 2023/10/19 17:06
*/ */
public enum CouponTypeEnum { public enum CouponTypeEnum {
//1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额,6:套餐劵
DISCOUNT(1,"1","折扣券"), DISCOUNT(1,"1","折扣券"),
CASH(2,"2","满减券(现金券)"), CASH(2,"2","满减券(现金券)"),
DURATION(3,"3","时长券"); DURATION(3, "3", "时长券"),
VERIFICATION(4, "4", "核销券"),
RECHARGE(5, "5", "充值送金额"),
PACKAGE(6, "6", "套餐劵"),
;
private Integer code; private Integer code;
private String value; private String value;
......
...@@ -9,7 +9,7 @@ import share.common.core.domain.AjaxResult; ...@@ -9,7 +9,7 @@ import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.system.domain.Pack; import share.system.domain.SPack;
import share.system.service.IPackService; import share.system.service.IPackService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -32,9 +32,9 @@ public class PackController extends BaseController { ...@@ -32,9 +32,9 @@ public class PackController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:pack:list')") @PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Pack pack) { public TableDataInfo list(SPack SPack) {
startPage(); startPage();
List<Pack> list = packService.selectPackList(pack); List<SPack> list = packService.selectPackList(SPack);
return getDataTable(list); return getDataTable(list);
} }
...@@ -44,9 +44,9 @@ public class PackController extends BaseController { ...@@ -44,9 +44,9 @@ public class PackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:export')") @PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT) @Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Pack pack) { public void export(HttpServletResponse response, SPack SPack) {
List<Pack> list = packService.selectPackList(pack); List<SPack> list = packService.selectPackList(SPack);
ExcelUtil<Pack> util = new ExcelUtil<Pack>(Pack.class); ExcelUtil<SPack> util = new ExcelUtil<SPack>(SPack.class);
util.exportExcel(response, list, "套餐数据"); util.exportExcel(response, list, "套餐数据");
} }
...@@ -65,8 +65,8 @@ public class PackController extends BaseController { ...@@ -65,8 +65,8 @@ public class PackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:add')") @PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT) @Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Pack pack) { public AjaxResult add(@RequestBody SPack SPack) {
return toAjax(packService.insertPack(pack)); return toAjax(packService.insertPack(SPack));
} }
/** /**
...@@ -75,8 +75,8 @@ public class PackController extends BaseController { ...@@ -75,8 +75,8 @@ public class PackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:edit')") @PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE) @Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Pack pack) { public AjaxResult edit(@RequestBody SPack SPack) {
return toAjax(packService.updatePack(pack)); return toAjax(packService.updatePack(SPack));
} }
/** /**
......
...@@ -17,7 +17,7 @@ import share.common.annotation.Log; ...@@ -17,7 +17,7 @@ import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
import share.system.service.IRoomPackService; import share.system.service.IRoomPackService;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
...@@ -39,9 +39,9 @@ public class RoomPackController extends BaseController { ...@@ -39,9 +39,9 @@ public class RoomPackController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:pack:list')") @PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RoomPack roomPack) { public TableDataInfo list(SRoomPack SRoomPack) {
startPage(); startPage();
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack); List<SRoomPack> list = roomPackService.selectRoomPackList(SRoomPack);
return getDataTable(list); return getDataTable(list);
} }
...@@ -51,9 +51,9 @@ public class RoomPackController extends BaseController { ...@@ -51,9 +51,9 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:export')") @PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "包房套餐关系", businessType = BusinessType.EXPORT) @Log(title = "包房套餐关系", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, RoomPack roomPack) { public void export(HttpServletResponse response, SRoomPack SRoomPack) {
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack); List<SRoomPack> list = roomPackService.selectRoomPackList(SRoomPack);
ExcelUtil<RoomPack> util = new ExcelUtil<RoomPack>(RoomPack.class); ExcelUtil<SRoomPack> util = new ExcelUtil<SRoomPack>(SRoomPack.class);
util.exportExcel(response, list, "包房套餐关系数据"); util.exportExcel(response, list, "包房套餐关系数据");
} }
...@@ -72,8 +72,8 @@ public class RoomPackController extends BaseController { ...@@ -72,8 +72,8 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:add')") @PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "包房套餐关系", businessType = BusinessType.INSERT) @Log(title = "包房套餐关系", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody RoomPack roomPack) { public AjaxResult add(@RequestBody SRoomPack SRoomPack) {
return toAjax(roomPackService.insertRoomPack(roomPack)); return toAjax(roomPackService.insertRoomPack(SRoomPack));
} }
/** /**
...@@ -82,8 +82,8 @@ public class RoomPackController extends BaseController { ...@@ -82,8 +82,8 @@ public class RoomPackController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:pack:edit')") @PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "包房套餐关系", businessType = BusinessType.UPDATE) @Log(title = "包房套餐关系", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody RoomPack roomPack) { public AjaxResult edit(@RequestBody SRoomPack SRoomPack) {
return toAjax(roomPackService.updateRoomPack(roomPack)); return toAjax(roomPackService.updateRoomPack(SRoomPack));
} }
/** /**
......
...@@ -3,25 +3,19 @@ package share.web.controller.system; ...@@ -3,25 +3,19 @@ package share.web.controller.system;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R; import share.common.core.domain.R;
import share.common.enums.BusinessType; import share.system.domain.SPack;
import share.system.domain.Pack;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.vo.RoomStatusVo; import share.system.domain.vo.RoomStatusVo;
import share.system.domain.vo.SRoomVo; import share.system.domain.vo.SRoomVo;
import share.system.service.ISRoomService; import share.system.service.ISRoomService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.system.service.RoomStatusService; import share.system.service.RoomStatusService;
...@@ -92,7 +86,7 @@ public class SRoomController extends BaseController { ...@@ -92,7 +86,7 @@ public class SRoomController extends BaseController {
*/ */
@ApiOperation(value = "通过房间ID查询套餐") @ApiOperation(value = "通过房间ID查询套餐")
@RequestMapping(value = "/roomId", method = RequestMethod.GET) @RequestMapping(value = "/roomId", method = RequestMethod.GET)
public R<List<Pack>> getPackByRoomId(@RequestParam("id") Long id) { public R<List<SPack>> getPackByRoomId(@RequestParam("id") Long id) {
return R.ok(sRoomService.getPackByRoomId(id)); return R.ok(sRoomService.getPackByRoomId(id));
} }
......
...@@ -6,8 +6,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder; ...@@ -6,8 +6,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity; import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
/** /**
...@@ -17,7 +15,7 @@ import lombok.Data; ...@@ -17,7 +15,7 @@ import lombok.Data;
* @date 2023-10-31 * @date 2023-10-31
*/ */
@Data @Data
public class Pack extends BaseEntity { public class SPack extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
......
...@@ -76,9 +76,9 @@ public class SRoom extends BaseEntity ...@@ -76,9 +76,9 @@ public class SRoom extends BaseEntity
private String params2; private String params2;
/** /**
* 套餐ID数组 * 套餐ID
*/ */
@TableField(exist = false) @TableField(exist = false)
private Long[] packIds; private String packIds;
} }
...@@ -4,8 +4,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder; ...@@ -4,8 +4,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity; import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
/** /**
...@@ -15,7 +13,7 @@ import lombok.Data; ...@@ -15,7 +13,7 @@ import lombok.Data;
* @date 2023-10-31 * @date 2023-10-31
*/ */
@Data @Data
public class RoomPack extends BaseEntity { public class SRoomPack extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
......
package share.system.domain.vo; package share.system.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -81,6 +82,12 @@ public class SRoomVo extends BaseEntity ...@@ -81,6 +82,12 @@ public class SRoomVo extends BaseEntity
@ApiModelProperty(value = "其他可能硬件接入参数(备用2)") @ApiModelProperty(value = "其他可能硬件接入参数(备用2)")
private String params2; private String params2;
/**
* 套餐ID
*/
@TableField(exist = false)
private String packIds;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -3,7 +3,7 @@ package share.system.mapper; ...@@ -3,7 +3,7 @@ package share.system.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Pack; import share.system.domain.SPack;
/** /**
* 套餐Mapper接口 * 套餐Mapper接口
...@@ -11,38 +11,38 @@ import share.system.domain.Pack; ...@@ -11,38 +11,38 @@ import share.system.domain.Pack;
* @author wuwenlong * @author wuwenlong
* @date 2023-10-31 * @date 2023-10-31
*/ */
public interface PackMapper extends BaseMapper<Pack> { public interface PackMapper extends BaseMapper<SPack> {
/** /**
* 查询套餐 * 查询套餐
* *
* @param id 套餐主键 * @param id 套餐主键
* @return 套餐 * @return 套餐
*/ */
public Pack selectPackById(Long id); public SPack selectPackById(Long id);
/** /**
* 查询套餐列表 * 查询套餐列表
* *
* @param pack 套餐 * @param SPack 套餐
* @return 套餐集合 * @return 套餐集合
*/ */
public List<Pack> selectPackList(Pack pack); public List<SPack> selectPackList(SPack SPack);
/** /**
* 新增套餐 * 新增套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
public int insertPack(Pack pack); public int insertPack(SPack SPack);
/** /**
* 修改套餐 * 修改套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
public int updatePack(Pack pack); public int updatePack(SPack SPack);
/** /**
* 删除套餐 * 删除套餐
......
...@@ -3,7 +3,7 @@ package share.system.mapper; ...@@ -3,7 +3,7 @@ package share.system.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
/** /**
* 包房套餐关系Mapper接口 * 包房套餐关系Mapper接口
...@@ -11,38 +11,38 @@ import share.system.domain.RoomPack; ...@@ -11,38 +11,38 @@ import share.system.domain.RoomPack;
* @author wuwenlong * @author wuwenlong
* @date 2023-10-31 * @date 2023-10-31
*/ */
public interface RoomPackMapper extends BaseMapper<RoomPack> { public interface RoomPackMapper extends BaseMapper<SRoomPack> {
/** /**
* 查询包房套餐关系 * 查询包房套餐关系
* *
* @param id 包房套餐关系主键 * @param id 包房套餐关系主键
* @return 包房套餐关系 * @return 包房套餐关系
*/ */
public RoomPack selectRoomPackById(Long id); public SRoomPack selectRoomPackById(Long id);
/** /**
* 查询包房套餐关系列表 * 查询包房套餐关系列表
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 包房套餐关系集合 * @return 包房套餐关系集合
*/ */
public List<RoomPack> selectRoomPackList(RoomPack roomPack); public List<SRoomPack> selectRoomPackList(SRoomPack SRoomPack);
/** /**
* 新增包房套餐关系 * 新增包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
public int insertRoomPack(RoomPack roomPack); public int insertRoomPack(SRoomPack SRoomPack);
/** /**
* 修改包房套餐关系 * 修改包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
public int updateRoomPack(RoomPack roomPack); public int updateRoomPack(SRoomPack SRoomPack);
/** /**
* 删除包房套餐关系 * 删除包房套餐关系
......
...@@ -3,7 +3,7 @@ package share.system.service; ...@@ -3,7 +3,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Pack; import share.system.domain.SPack;
/** /**
* 套餐Service接口 * 套餐Service接口
...@@ -11,38 +11,38 @@ import share.system.domain.Pack; ...@@ -11,38 +11,38 @@ import share.system.domain.Pack;
* @author wuwenlong * @author wuwenlong
* @date 2023-10-31 * @date 2023-10-31
*/ */
public interface IPackService extends IService<Pack> { public interface IPackService extends IService<SPack> {
/** /**
* 查询套餐 * 查询套餐
* *
* @param id 套餐主键 * @param id 套餐主键
* @return 套餐 * @return 套餐
*/ */
public Pack selectPackById(Long id); public SPack selectPackById(Long id);
/** /**
* 查询套餐列表 * 查询套餐列表
* *
* @param pack 套餐 * @param SPack 套餐
* @return 套餐集合 * @return 套餐集合
*/ */
public List<Pack> selectPackList(Pack pack); public List<SPack> selectPackList(SPack SPack);
/** /**
* 新增套餐 * 新增套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
public int insertPack(Pack pack); public int insertPack(SPack SPack);
/** /**
* 修改套餐 * 修改套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
public int updatePack(Pack pack); public int updatePack(SPack SPack);
/** /**
* 批量删除套餐 * 批量删除套餐
...@@ -60,5 +60,5 @@ public interface IPackService extends IService<Pack> { ...@@ -60,5 +60,5 @@ public interface IPackService extends IService<Pack> {
*/ */
public int deletePackById(Long id); public int deletePackById(Long id);
List<Pack> selectPackListByIds(List<Long> packIds); List<SPack> selectPackListByIds(List<Long> packIds);
} }
...@@ -3,7 +3,7 @@ package share.system.service; ...@@ -3,7 +3,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
/** /**
* 包房套餐关系Service接口 * 包房套餐关系Service接口
...@@ -11,38 +11,38 @@ import share.system.domain.RoomPack; ...@@ -11,38 +11,38 @@ import share.system.domain.RoomPack;
* @author wuwenlong * @author wuwenlong
* @date 2023-10-31 * @date 2023-10-31
*/ */
public interface IRoomPackService extends IService<RoomPack> { public interface IRoomPackService extends IService<SRoomPack> {
/** /**
* 查询包房套餐关系 * 查询包房套餐关系
* *
* @param id 包房套餐关系主键 * @param id 包房套餐关系主键
* @return 包房套餐关系 * @return 包房套餐关系
*/ */
public RoomPack selectRoomPackById(Long id); public SRoomPack selectRoomPackById(Long id);
/** /**
* 查询包房套餐关系列表 * 查询包房套餐关系列表
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 包房套餐关系集合 * @return 包房套餐关系集合
*/ */
public List<RoomPack> selectRoomPackList(RoomPack roomPack); public List<SRoomPack> selectRoomPackList(SRoomPack SRoomPack);
/** /**
* 新增包房套餐关系 * 新增包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
public int insertRoomPack(RoomPack roomPack); public int insertRoomPack(SRoomPack SRoomPack);
/** /**
* 修改包房套餐关系 * 修改包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
public int updateRoomPack(RoomPack roomPack); public int updateRoomPack(SRoomPack SRoomPack);
/** /**
* 批量删除包房套餐关系 * 批量删除包房套餐关系
......
...@@ -3,7 +3,7 @@ package share.system.service; ...@@ -3,7 +3,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Pack; import share.system.domain.SPack;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo; import share.system.domain.vo.SRoomVo;
...@@ -85,5 +85,5 @@ public interface ISRoomService extends IService<SRoom> ...@@ -85,5 +85,5 @@ public interface ISRoomService extends IService<SRoom>
String openDoor(Long id); String openDoor(Long id);
List<Pack> getPackByRoomId(Long id); List<SPack> getPackByRoomId(Long id);
} }
...@@ -2,12 +2,13 @@ package share.system.service.impl; ...@@ -2,12 +2,13 @@ package share.system.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.system.mapper.PackMapper; import share.system.mapper.PackMapper;
import share.system.domain.Pack; import share.system.domain.SPack;
import share.system.service.IPackService; import share.system.service.IPackService;
/** /**
...@@ -17,7 +18,7 @@ import share.system.service.IPackService; ...@@ -17,7 +18,7 @@ import share.system.service.IPackService;
* @date 2023-10-31 * @date 2023-10-31
*/ */
@Service @Service
public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IPackService { public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements IPackService {
@Autowired @Autowired
private PackMapper packMapper; private PackMapper packMapper;
...@@ -28,43 +29,43 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IP ...@@ -28,43 +29,43 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IP
* @return 套餐 * @return 套餐
*/ */
@Override @Override
public Pack selectPackById(Long id) { public SPack selectPackById(Long id) {
return packMapper.selectPackById(id); return packMapper.selectPackById(id);
} }
/** /**
* 查询套餐列表 * 查询套餐列表
* *
* @param pack 套餐 * @param SPack 套餐
* @return 套餐 * @return 套餐
*/ */
@Override @Override
public List<Pack> selectPackList(Pack pack) { public List<SPack> selectPackList(SPack SPack) {
return packMapper.selectPackList(pack); return packMapper.selectPackList(SPack);
} }
/** /**
* 新增套餐 * 新增套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertPack(Pack pack) { public int insertPack(SPack SPack) {
pack.setCreateTime(DateUtils.getNowDate()); SPack.setCreateTime(DateUtils.getNowDate());
return packMapper.insertPack(pack); return packMapper.insertPack(SPack);
} }
/** /**
* 修改套餐 * 修改套餐
* *
* @param pack 套餐 * @param SPack 套餐
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updatePack(Pack pack) { public int updatePack(SPack SPack) {
pack.setUpdateTime(DateUtils.getNowDate()); SPack.setUpdateTime(DateUtils.getNowDate());
return packMapper.updatePack(pack); return packMapper.updatePack(SPack);
} }
/** /**
...@@ -90,7 +91,9 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IP ...@@ -90,7 +91,9 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IP
} }
@Override @Override
public List<Pack> selectPackListByIds(List<Long> packIds) { public List<SPack> selectPackListByIds(List<Long> packIds) {
return packMapper.selectBatchIds(packIds); LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SPack::getId, packIds);
return packMapper.selectList(queryWrapper);
} }
} }
package share.system.service.impl; package share.system.service.impl;
import java.sql.Wrapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.system.domain.SCleanRecords;
import share.system.mapper.RoomPackMapper; import share.system.mapper.RoomPackMapper;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
import share.system.service.IRoomPackService; import share.system.service.IRoomPackService;
/** /**
...@@ -21,7 +18,7 @@ import share.system.service.IRoomPackService; ...@@ -21,7 +18,7 @@ import share.system.service.IRoomPackService;
* @date 2023-10-31 * @date 2023-10-31
*/ */
@Service @Service
public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> implements IRoomPackService { public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, SRoomPack> implements IRoomPackService {
@Autowired @Autowired
private RoomPackMapper roomPackMapper; private RoomPackMapper roomPackMapper;
...@@ -32,43 +29,43 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> i ...@@ -32,43 +29,43 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> i
* @return 包房套餐关系 * @return 包房套餐关系
*/ */
@Override @Override
public RoomPack selectRoomPackById(Long id) { public SRoomPack selectRoomPackById(Long id) {
return roomPackMapper.selectRoomPackById(id); return roomPackMapper.selectRoomPackById(id);
} }
/** /**
* 查询包房套餐关系列表 * 查询包房套餐关系列表
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 包房套餐关系 * @return 包房套餐关系
*/ */
@Override @Override
public List<RoomPack> selectRoomPackList(RoomPack roomPack) { public List<SRoomPack> selectRoomPackList(SRoomPack SRoomPack) {
return roomPackMapper.selectRoomPackList(roomPack); return roomPackMapper.selectRoomPackList(SRoomPack);
} }
/** /**
* 新增包房套餐关系 * 新增包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertRoomPack(RoomPack roomPack) { public int insertRoomPack(SRoomPack SRoomPack) {
roomPack.setCreateTime(DateUtils.getNowDate()); SRoomPack.setCreateTime(DateUtils.getNowDate());
return roomPackMapper.insertRoomPack(roomPack); return roomPackMapper.insertRoomPack(SRoomPack);
} }
/** /**
* 修改包房套餐关系 * 修改包房套餐关系
* *
* @param roomPack 包房套餐关系 * @param SRoomPack 包房套餐关系
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateRoomPack(RoomPack roomPack) { public int updateRoomPack(SRoomPack SRoomPack) {
roomPack.setUpdateTime(DateUtils.getNowDate()); SRoomPack.setUpdateTime(DateUtils.getNowDate());
return roomPackMapper.updateRoomPack(roomPack); return roomPackMapper.updateRoomPack(SRoomPack);
} }
/** /**
...@@ -100,8 +97,8 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> i ...@@ -100,8 +97,8 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> i
@Override @Override
public int deleteRoomPackByRoomId(Long id) { public int deleteRoomPackByRoomId(Long id) {
LambdaQueryWrapper<RoomPack> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SRoomPack> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RoomPack::getRoomId, id); queryWrapper.eq(SRoomPack::getRoomId, id);
return roomPackMapper.delete(queryWrapper); return roomPackMapper.delete(queryWrapper);
} }
} }
...@@ -11,8 +11,8 @@ import share.common.enums.RoleTypeEnum; ...@@ -11,8 +11,8 @@ import share.common.enums.RoleTypeEnum;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.system.domain.Pack; import share.system.domain.SPack;
import share.system.domain.RoomPack; import share.system.domain.SRoomPack;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SRoomVo; import share.system.domain.vo.SRoomVo;
...@@ -54,6 +54,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements ...@@ -54,6 +54,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
public SRoomVo selectSRoomById(Long id) public SRoomVo selectSRoomById(Long id)
{ {
SRoom sRoom = sRoomMapper.selectSRoomById(id); SRoom sRoom = sRoomMapper.selectSRoomById(id);
sRoom.setPackIds(roomPackService.selectPackListByRoomId(id).stream().map(String::valueOf).collect(Collectors.joining(",")));
if(Objects.nonNull(sRoom)&&sRoom.getId()!=null){ if(Objects.nonNull(sRoom)&&sRoom.getId()!=null){
return convertVoList(new ArrayList<SRoom>(){{add(sRoom);}}).get(0); return convertVoList(new ArrayList<SRoom>(){{add(sRoom);}}).get(0);
} }
...@@ -70,6 +71,9 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements ...@@ -70,6 +71,9 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
public List<SRoomVo> selectSRoomList(SRoom sRoom) public List<SRoomVo> selectSRoomList(SRoom sRoom)
{ {
List<SRoom> roomList = sRoomMapper.selectSRoomList(sRoom); List<SRoom> roomList = sRoomMapper.selectSRoomList(sRoom);
roomList.forEach(o -> {
o.setPackIds(roomPackService.selectPackListByRoomId(o.getId()).stream().map(String::valueOf).collect(Collectors.joining(",")));
});
return convertVoList(roomList); return convertVoList(roomList);
} }
...@@ -101,25 +105,32 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements ...@@ -101,25 +105,32 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Override @Override
public int insertSRoom(SRoom sRoom) public int insertSRoom(SRoom sRoom)
{ {
int i = 0;
try {
sRoom.setCreateTime(DateUtils.getNowDate());
i = sRoomMapper.insertSRoom(sRoom);
//判断套餐ID //判断套餐ID
if (sRoom.getPackIds().length > 0) { if (!sRoom.getPackIds().isEmpty()) {
List<Pack> packList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds())); //String 转Long
if (CollectionUtils.isEmpty(packList)) { List<SPack> SPackList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(SPackList)) {
throw new RuntimeException("套餐不存在"); throw new RuntimeException("套餐不存在");
} }
List<Long> list = Arrays.asList(sRoom.getPackIds()); List<Long> list = Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList());
List<RoomPack> roomPackList = new ArrayList<>(); List<SRoomPack> SRoomPackList = new ArrayList<>();
list.stream().forEach(o -> { list.stream().forEach(o -> {
RoomPack roomPack = new RoomPack(); SRoomPack SRoomPack = new SRoomPack();
roomPack.setPackId(o); SRoomPack.setPackId(o);
roomPack.setRoomId(sRoom.getId()); SRoomPack.setRoomId(sRoom.getId());
roomPack.setCreateTime(DateUtils.getNowDate()); SRoomPack.setCreateTime(DateUtils.getNowDate());
roomPackList.add(roomPack); SRoomPackList.add(SRoomPack);
}); });
roomPackService.saveBatch(roomPackList); roomPackService.saveBatch(SRoomPackList);
} }
sRoom.setCreateTime(DateUtils.getNowDate()); } catch (Exception e) {
return sRoomMapper.insertSRoom(sRoom); throw new RuntimeException("新增房间失败");
}
return i;
} }
/** /**
...@@ -132,24 +143,24 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements ...@@ -132,24 +143,24 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
public int updateSRoom(SRoom sRoom) public int updateSRoom(SRoom sRoom)
{ {
//判断套餐ID //判断套餐ID
if (sRoom.getPackIds().length > 0) { if (!sRoom.getPackIds().isEmpty()) {
//判断套餐ID //判断套餐ID
List<Pack> packList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds())); List<SPack> SPackList = packService.selectPackListByIds(Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(packList)) { if (CollectionUtils.isEmpty(SPackList)) {
throw new RuntimeException("套餐不存在"); throw new RuntimeException("套餐不存在");
} }
//删除原有套餐 //删除原有套餐
roomPackService.deleteRoomPackByRoomId(sRoom.getId()); roomPackService.deleteRoomPackByRoomId(sRoom.getId());
List<Long> list = Arrays.asList(sRoom.getPackIds()); List<Long> list = Arrays.asList(sRoom.getPackIds().split(",")).stream().map(Long::valueOf).collect(Collectors.toList());
List<RoomPack> roomPackList = new ArrayList<>(); List<SRoomPack> SRoomPackList = new ArrayList<>();
list.stream().forEach(o -> { list.stream().forEach(o -> {
RoomPack roomPack = new RoomPack(); SRoomPack SRoomPack = new SRoomPack();
roomPack.setPackId(o); SRoomPack.setPackId(o);
roomPack.setRoomId(sRoom.getId()); SRoomPack.setRoomId(sRoom.getId());
roomPack.setCreateTime(DateUtils.getNowDate()); SRoomPack.setCreateTime(DateUtils.getNowDate());
roomPackList.add(roomPack); SRoomPackList.add(SRoomPack);
}); });
roomPackService.saveBatch(roomPackList); roomPackService.saveBatch(SRoomPackList);
} }
sRoom.setUpdateTime(DateUtils.getNowDate()); sRoom.setUpdateTime(DateUtils.getNowDate());
return sRoomMapper.updateSRoom(sRoom); return sRoomMapper.updateSRoom(sRoom);
...@@ -223,7 +234,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements ...@@ -223,7 +234,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
} }
@Override @Override
public List<Pack> getPackByRoomId(Long id) { public List<SPack> getPackByRoomId(Long id) {
List<Long> packIds = roomPackService.selectPackListByRoomId(id); List<Long> packIds = roomPackService.selectPackListByRoomId(id);
return packService.selectPackListByIds(packIds); return packService.selectPackListByIds(packIds);
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.PackMapper"> <mapper namespace="share.system.mapper.PackMapper">
<resultMap type="Pack" id="PackResult"> <resultMap type="SPack" id="PackResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="duration" column="duration"/> <result property="duration" column="duration"/>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
from s_pack from s_pack
</sql> </sql>
<select id="selectPackList" parameterType="Pack" resultMap="PackResult"> <select id="selectPackList" parameterType="SPack" resultMap="PackResult">
<include refid="selectPackVo"/> <include refid="selectPackVo"/>
<where> <where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertPack" parameterType="Pack" useGeneratedKeys="true" keyProperty="id"> <insert id="insertPack" parameterType="SPack" useGeneratedKeys="true" keyProperty="id">
insert into s_pack insert into s_pack
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if> <if test="name != null">name,</if>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
</trim> </trim>
</insert> </insert>
<update id="updatePack" parameterType="Pack"> <update id="updatePack" parameterType="SPack">
update s_pack update s_pack
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if> <if test="name != null">name = #{name},</if>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.RoomPackMapper"> <mapper namespace="share.system.mapper.RoomPackMapper">
<resultMap type="RoomPack" id="RoomPackResult"> <resultMap type="SRoomPack" id="RoomPackResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="roomId" column="room_id"/> <result property="roomId" column="room_id"/>
<result property="packId" column="pack_id"/> <result property="packId" column="pack_id"/>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
from s_room_pack from s_room_pack
</sql> </sql>
<select id="selectRoomPackList" parameterType="RoomPack" resultMap="RoomPackResult"> <select id="selectRoomPackList" parameterType="SRoomPack" resultMap="RoomPackResult">
<include refid="selectRoomPackVo"/> <include refid="selectRoomPackVo"/>
<where> <where>
<if test="roomId != null ">and room_id = #{roomId}</if> <if test="roomId != null ">and room_id = #{roomId}</if>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
where room_id = #{roomId} where room_id = #{roomId}
</select> </select>
<insert id="insertRoomPack" parameterType="RoomPack" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRoomPack" parameterType="SRoomPack" useGeneratedKeys="true" keyProperty="id">
insert into s_room_pack insert into s_room_pack
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roomId != null">room_id,</if> <if test="roomId != null">room_id,</if>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</trim> </trim>
</insert> </insert>
<update id="updateRoomPack" parameterType="RoomPack"> <update id="updateRoomPack" parameterType="SRoomPack">
update s_room_pack update s_room_pack
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="roomId != null">room_id = #{roomId},</if> <if test="roomId != null">room_id = #{roomId},</if>
......
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