Commit ab4b6f46 by 吕明尚

新增套餐类,房间套餐关联类

parent 31d9250f
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.Pack;
import share.system.service.IPackService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 套餐Controller
*
* @author wuwenlong
* @date 2023-10-31
*/
@RestController
@RequestMapping("/system/pack")
public class PackController extends BaseController {
@Autowired
private IPackService packService;
/**
* 查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list")
public TableDataInfo list(Pack pack) {
startPage();
List<Pack> list = packService.selectPackList(pack);
return getDataTable(list);
}
/**
* 导出套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Pack pack) {
List<Pack> list = packService.selectPackList(pack);
ExcelUtil<Pack> util = new ExcelUtil<Pack>(Pack.class);
util.exportExcel(response, list, "套餐数据");
}
/**
* 获取套餐详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pack:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(packService.selectPackById(id));
}
/**
* 新增套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Pack pack) {
return toAjax(packService.insertPack(pack));
}
/**
* 修改套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Pack pack) {
return toAjax(packService.updatePack(pack));
}
/**
* 删除套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:remove')")
@Log(title = "套餐", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(packService.deletePackByIds(ids));
}
}
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.RoomPack;
import share.system.service.IRoomPackService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 包房套餐关系Controller
*
* @author wuwenlong
* @date 2023-10-31
*/
@RestController
@RequestMapping("/system/pack")
public class RoomPackController extends BaseController {
@Autowired
private IRoomPackService roomPackService;
/**
* 查询包房套餐关系列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list")
public TableDataInfo list(RoomPack roomPack) {
startPage();
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack);
return getDataTable(list);
}
/**
* 导出包房套餐关系列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "包房套餐关系", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RoomPack roomPack) {
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack);
ExcelUtil<RoomPack> util = new ExcelUtil<RoomPack>(RoomPack.class);
util.exportExcel(response, list, "包房套餐关系数据");
}
/**
* 获取包房套餐关系详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pack:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(roomPackService.selectRoomPackById(id));
}
/**
* 新增包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "包房套餐关系", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RoomPack roomPack) {
return toAjax(roomPackService.insertRoomPack(roomPack));
}
/**
* 修改包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "包房套餐关系", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RoomPack roomPack) {
return toAjax(roomPackService.updateRoomPack(roomPack));
}
/**
* 删除包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:remove')")
@Log(title = "包房套餐关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(roomPackService.deleteRoomPackByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.Pack;
import share.system.service.IPackService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 套餐Controller
*
* @author wuwenlong
* @date 2023-10-31
*/
@RestController
@RequestMapping("/front/pack")
public class PackController extends BaseController {
@Autowired
private IPackService packService;
/**
* 查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list")
public TableDataInfo list(Pack pack) {
startPage();
List<Pack> list = packService.selectPackList(pack);
return getDataTable(list);
}
/**
* 导出套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Pack pack) {
List<Pack> list = packService.selectPackList(pack);
ExcelUtil<Pack> util = new ExcelUtil<Pack>(Pack.class);
util.exportExcel(response, list, "套餐数据");
}
/**
* 获取套餐详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pack:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(packService.selectPackById(id));
}
/**
* 新增套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Pack pack) {
return toAjax(packService.insertPack(pack));
}
/**
* 修改套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Pack pack) {
return toAjax(packService.updatePack(pack));
}
/**
* 删除套餐
*/
@PreAuthorize("@ss.hasPermi('system:pack:remove')")
@Log(title = "套餐", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(packService.deletePackByIds(ids));
}
}
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.RoomPack;
import share.system.service.IRoomPackService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 包房套餐关系Controller
*
* @author wuwenlong
* @date 2023-10-31
*/
@RestController
@RequestMapping("/system/pack")
public class RoomPackController extends BaseController {
@Autowired
private IRoomPackService roomPackService;
/**
* 查询包房套餐关系列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:list')")
@GetMapping("/list")
public TableDataInfo list(RoomPack roomPack) {
startPage();
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack);
return getDataTable(list);
}
/**
* 导出包房套餐关系列表
*/
@PreAuthorize("@ss.hasPermi('system:pack:export')")
@Log(title = "包房套餐关系", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RoomPack roomPack) {
List<RoomPack> list = roomPackService.selectRoomPackList(roomPack);
ExcelUtil<RoomPack> util = new ExcelUtil<RoomPack>(RoomPack.class);
util.exportExcel(response, list, "包房套餐关系数据");
}
/**
* 获取包房套餐关系详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pack:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(roomPackService.selectRoomPackById(id));
}
/**
* 新增包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:add')")
@Log(title = "包房套餐关系", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RoomPack roomPack) {
return toAjax(roomPackService.insertRoomPack(roomPack));
}
/**
* 修改包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:edit')")
@Log(title = "包房套餐关系", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RoomPack roomPack) {
return toAjax(roomPackService.updateRoomPack(roomPack));
}
/**
* 删除包房套餐关系
*/
@PreAuthorize("@ss.hasPermi('system:pack:remove')")
@Log(title = "包房套餐关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(roomPackService.deleteRoomPackByIds(ids));
}
}
......@@ -67,8 +67,10 @@ public class WebConfig implements WebMvcConfigurer {
"/front/login/login",
"/front/store/list",
"/front/store/listVo",
"/front/store//info/*",
"/front/room/**",
"/front/store//\\d+/",
"/front/room/list",
"/front/room/info",
"/front/room/roomStatus",
"**"
).addPathPatterns("/**");
}
......
package share.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/**
* 套餐对象 s_pack
*
* @author wuwenlong
* @date 2023-10-31
*/
@Data
public class Pack extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 套餐名称
*/
@Excel(name = "套餐名称")
private String name;
/**
* 时长
*/
@Excel(name = "时长")
private String duration;
/**
* 金额
*/
@Excel(name = "金额")
private BigDecimal price;
/**
* 套餐开始时段
*/
@Excel(name = "套餐开始时段")
private String packaStartPeriod;
/**
* 套餐结束时段
*/
@Excel(name = "套餐结束时段")
private String packaEndPeriod;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("duration", getDuration())
.append("price", getPrice())
.append("packaStartPeriod", getPackaStartPeriod())
.append("packaEndPeriod", getPackaEndPeriod())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/**
* 包房套餐关系对象 s_room_pack
*
* @author wuwenlong
* @date 2023-10-31
*/
@Data
public class RoomPack extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 房间id
*/
@Excel(name = "房间id")
private Long roomId;
/**
* 套餐id
*/
@Excel(name = "套餐id")
private Long packId;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("roomId", getRoomId())
.append("packId", getPackId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Pack;
/**
* 套餐Mapper接口
*
* @author wuwenlong
* @date 2023-10-31
*/
public interface PackMapper extends BaseMapper<Pack> {
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
public Pack selectPackById(Long id);
/**
* 查询套餐列表
*
* @param pack 套餐
* @return 套餐集合
*/
public List<Pack> selectPackList(Pack pack);
/**
* 新增套餐
*
* @param pack 套餐
* @return 结果
*/
public int insertPack(Pack pack);
/**
* 修改套餐
*
* @param pack 套餐
* @return 结果
*/
public int updatePack(Pack pack);
/**
* 删除套餐
*
* @param id 套餐主键
* @return 结果
*/
public int deletePackById(Long id);
/**
* 批量删除套餐
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePackByIds(Long[] ids);
}
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.RoomPack;
/**
* 包房套餐关系Mapper接口
*
* @author wuwenlong
* @date 2023-10-31
*/
public interface RoomPackMapper extends BaseMapper<RoomPack> {
/**
* 查询包房套餐关系
*
* @param id 包房套餐关系主键
* @return 包房套餐关系
*/
public RoomPack selectRoomPackById(Long id);
/**
* 查询包房套餐关系列表
*
* @param roomPack 包房套餐关系
* @return 包房套餐关系集合
*/
public List<RoomPack> selectRoomPackList(RoomPack roomPack);
/**
* 新增包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
public int insertRoomPack(RoomPack roomPack);
/**
* 修改包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
public int updateRoomPack(RoomPack roomPack);
/**
* 删除包房套餐关系
*
* @param id 包房套餐关系主键
* @return 结果
*/
public int deleteRoomPackById(Long id);
/**
* 批量删除包房套餐关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRoomPackByIds(Long[] ids);
}
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Pack;
/**
* 套餐Service接口
*
* @author wuwenlong
* @date 2023-10-31
*/
public interface IPackService extends IService<Pack> {
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
public Pack selectPackById(Long id);
/**
* 查询套餐列表
*
* @param pack 套餐
* @return 套餐集合
*/
public List<Pack> selectPackList(Pack pack);
/**
* 新增套餐
*
* @param pack 套餐
* @return 结果
*/
public int insertPack(Pack pack);
/**
* 修改套餐
*
* @param pack 套餐
* @return 结果
*/
public int updatePack(Pack pack);
/**
* 批量删除套餐
*
* @param ids 需要删除的套餐主键集合
* @return 结果
*/
public int deletePackByIds(Long[] ids);
/**
* 删除套餐信息
*
* @param id 套餐主键
* @return 结果
*/
public int deletePackById(Long id);
}
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.RoomPack;
/**
* 包房套餐关系Service接口
*
* @author wuwenlong
* @date 2023-10-31
*/
public interface IRoomPackService extends IService<RoomPack> {
/**
* 查询包房套餐关系
*
* @param id 包房套餐关系主键
* @return 包房套餐关系
*/
public RoomPack selectRoomPackById(Long id);
/**
* 查询包房套餐关系列表
*
* @param roomPack 包房套餐关系
* @return 包房套餐关系集合
*/
public List<RoomPack> selectRoomPackList(RoomPack roomPack);
/**
* 新增包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
public int insertRoomPack(RoomPack roomPack);
/**
* 修改包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
public int updateRoomPack(RoomPack roomPack);
/**
* 批量删除包房套餐关系
*
* @param ids 需要删除的包房套餐关系主键集合
* @return 结果
*/
public int deleteRoomPackByIds(Long[] ids);
/**
* 删除包房套餐关系信息
*
* @param id 包房套餐关系主键
* @return 结果
*/
public int deleteRoomPackById(Long id);
}
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.mapper.PackMapper;
import share.system.domain.Pack;
import share.system.service.IPackService;
/**
* 套餐Service业务层处理
*
* @author wuwenlong
* @date 2023-10-31
*/
@Service
public class PackServiceImpl extends ServiceImpl<PackMapper, Pack> implements IPackService {
@Autowired
private PackMapper packMapper;
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
@Override
public Pack selectPackById(Long id) {
return packMapper.selectPackById(id);
}
/**
* 查询套餐列表
*
* @param pack 套餐
* @return 套餐
*/
@Override
public List<Pack> selectPackList(Pack pack) {
return packMapper.selectPackList(pack);
}
/**
* 新增套餐
*
* @param pack 套餐
* @return 结果
*/
@Override
public int insertPack(Pack pack) {
pack.setCreateTime(DateUtils.getNowDate());
return packMapper.insertPack(pack);
}
/**
* 修改套餐
*
* @param pack 套餐
* @return 结果
*/
@Override
public int updatePack(Pack pack) {
pack.setUpdateTime(DateUtils.getNowDate());
return packMapper.updatePack(pack);
}
/**
* 批量删除套餐
*
* @param ids 需要删除的套餐主键
* @return 结果
*/
@Override
public int deletePackByIds(Long[] ids) {
return packMapper.deletePackByIds(ids);
}
/**
* 删除套餐信息
*
* @param id 套餐主键
* @return 结果
*/
@Override
public int deletePackById(Long id) {
return packMapper.deletePackById(id);
}
}
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.mapper.RoomPackMapper;
import share.system.domain.RoomPack;
import share.system.service.IRoomPackService;
/**
* 包房套餐关系Service业务层处理
*
* @author wuwenlong
* @date 2023-10-31
*/
@Service
public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, RoomPack> implements IRoomPackService {
@Autowired
private RoomPackMapper roomPackMapper;
/**
* 查询包房套餐关系
*
* @param id 包房套餐关系主键
* @return 包房套餐关系
*/
@Override
public RoomPack selectRoomPackById(Long id) {
return roomPackMapper.selectRoomPackById(id);
}
/**
* 查询包房套餐关系列表
*
* @param roomPack 包房套餐关系
* @return 包房套餐关系
*/
@Override
public List<RoomPack> selectRoomPackList(RoomPack roomPack) {
return roomPackMapper.selectRoomPackList(roomPack);
}
/**
* 新增包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
@Override
public int insertRoomPack(RoomPack roomPack) {
roomPack.setCreateTime(DateUtils.getNowDate());
return roomPackMapper.insertRoomPack(roomPack);
}
/**
* 修改包房套餐关系
*
* @param roomPack 包房套餐关系
* @return 结果
*/
@Override
public int updateRoomPack(RoomPack roomPack) {
roomPack.setUpdateTime(DateUtils.getNowDate());
return roomPackMapper.updateRoomPack(roomPack);
}
/**
* 批量删除包房套餐关系
*
* @param ids 需要删除的包房套餐关系主键
* @return 结果
*/
@Override
public int deleteRoomPackByIds(Long[] ids) {
return roomPackMapper.deleteRoomPackByIds(ids);
}
/**
* 删除包房套餐关系信息
*
* @param id 包房套餐关系主键
* @return 结果
*/
@Override
public int deleteRoomPackById(Long id) {
return roomPackMapper.deleteRoomPackById(id);
}
}
<?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="share.system.mapper.PackMapper">
<resultMap type="Pack" id="PackResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="duration" column="duration"/>
<result property="price" column="price"/>
<result property="packaStartPeriod" column="packa_start_period"/>
<result property="packaEndPeriod" column="packa_end_period"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPackVo">
select id,
name,
duration,
price,
packa_start_period,
packa_end_period,
create_by,
create_time,
update_by,
update_time,
remark
from s_pack
</sql>
<select id="selectPackList" parameterType="Pack" resultMap="PackResult">
<include refid="selectPackVo"/>
<where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if>
<if test="price != null ">and price = #{price}</if>
<if test="packaStartPeriod != null and packaStartPeriod != ''">and packa_start_period =
#{packaStartPeriod}
</if>
<if test="packaEndPeriod != null and packaEndPeriod != ''">and packa_end_period = #{packaEndPeriod}</if>
</where>
</select>
<select id="selectPackById" parameterType="Long" resultMap="PackResult">
<include refid="selectPackVo"/>
where id = #{id}
</select>
<insert id="insertPack" parameterType="Pack" useGeneratedKeys="true" keyProperty="id">
insert into s_pack
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="duration != null">duration,</if>
<if test="price != null">price,</if>
<if test="packaStartPeriod != null">packa_start_period,</if>
<if test="packaEndPeriod != null">packa_end_period,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="duration != null">#{duration},</if>
<if test="price != null">#{price},</if>
<if test="packaStartPeriod != null">#{packaStartPeriod},</if>
<if test="packaEndPeriod != null">#{packaEndPeriod},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePack" parameterType="Pack">
update s_pack
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="price != null">price = #{price},</if>
<if test="packaStartPeriod != null">packa_start_period = #{packaStartPeriod},</if>
<if test="packaEndPeriod != null">packa_end_period = #{packaEndPeriod},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePackById" parameterType="Long">
delete
from s_pack
where id = #{id}
</delete>
<delete id="deletePackByIds" parameterType="String">
delete from s_pack where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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="share.system.mapper.RoomPackMapper">
<resultMap type="RoomPack" id="RoomPackResult">
<result property="id" column="id"/>
<result property="roomId" column="room_id"/>
<result property="packId" column="pack_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectRoomPackVo">
select id,
room_id,
pack_id,
create_by,
create_time,
update_by,
update_time,
remark
from s_room_pack
</sql>
<select id="selectRoomPackList" parameterType="RoomPack" resultMap="RoomPackResult">
<include refid="selectRoomPackVo"/>
<where>
<if test="roomId != null ">and room_id = #{roomId}</if>
<if test="packId != null ">and pack_id = #{packId}</if>
</where>
</select>
<select id="selectRoomPackById" parameterType="Long" resultMap="RoomPackResult">
<include refid="selectRoomPackVo"/>
where id = #{id}
</select>
<insert id="insertRoomPack" parameterType="RoomPack" useGeneratedKeys="true" keyProperty="id">
insert into s_room_pack
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roomId != null">room_id,</if>
<if test="packId != null">pack_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roomId != null">#{roomId},</if>
<if test="packId != null">#{packId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateRoomPack" parameterType="RoomPack">
update s_room_pack
<trim prefix="SET" suffixOverrides=",">
<if test="roomId != null">room_id = #{roomId},</if>
<if test="packId != null">pack_id = #{packId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRoomPackById" parameterType="Long">
delete
from s_room_pack
where id = #{id}
</delete>
<delete id="deleteRoomPackByIds" parameterType="String">
delete from s_room_pack where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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