Commit 47e0d8f5 by 吕明尚

删除原来的套餐对象

parent a1049165
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.STimeSlot;
import share.system.service.ISTimeSlotService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 套餐Controller
*
* @author ruoyi
* @date 2023-09-27
*/
@RestController
@RequestMapping("/system/slot")
public class STimeSlotController extends BaseController
{
@Autowired
private ISTimeSlotService sTimeSlotService;
/**
* 查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:slot:list')")
@GetMapping("/list")
public TableDataInfo list(STimeSlot sTimeSlot)
{
startPage();
List<STimeSlot> list = sTimeSlotService.selectSTimeSlotList(sTimeSlot);
return getDataTable(list);
}
/**
* 导出套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:slot:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, STimeSlot sTimeSlot)
{
List<STimeSlot> list = sTimeSlotService.selectSTimeSlotList(sTimeSlot);
ExcelUtil<STimeSlot> util = new ExcelUtil<STimeSlot>(STimeSlot.class);
util.exportExcel(response, list, "套餐数据");
}
/**
* 获取套餐详细信息
*/
@PreAuthorize("@ss.hasPermi('system:slot:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sTimeSlotService.selectSTimeSlotById(id));
}
/**
* 新增套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody STimeSlot sTimeSlot)
{
return toAjax(sTimeSlotService.insertSTimeSlot(sTimeSlot));
}
/**
* 修改套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody STimeSlot sTimeSlot)
{
return toAjax(sTimeSlotService.updateSTimeSlot(sTimeSlot));
}
/**
* 删除套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:remove')")
@Log(title = "套餐", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sTimeSlotService.deleteSTimeSlotByIds(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.STimeSlot;
import share.system.service.ISTimeSlotService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 套餐Controller
*
* @author ruoyi
* @date 2023-09-27
*/
@RestController
@RequestMapping("/system/slot")
public class STimeSlotController extends BaseController
{
@Autowired
private ISTimeSlotService sTimeSlotService;
/**
* 查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:slot:list')")
@GetMapping("/list")
public TableDataInfo list(STimeSlot sTimeSlot)
{
startPage();
List<STimeSlot> list = sTimeSlotService.selectSTimeSlotList(sTimeSlot);
return getDataTable(list);
}
/**
* 导出套餐列表
*/
@PreAuthorize("@ss.hasPermi('system:slot:export')")
@Log(title = "套餐", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, STimeSlot sTimeSlot)
{
List<STimeSlot> list = sTimeSlotService.selectSTimeSlotList(sTimeSlot);
ExcelUtil<STimeSlot> util = new ExcelUtil<STimeSlot>(STimeSlot.class);
util.exportExcel(response, list, "套餐数据");
}
/**
* 获取套餐详细信息
*/
@PreAuthorize("@ss.hasPermi('system:slot:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sTimeSlotService.selectSTimeSlotById(id));
}
/**
* 新增套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:add')")
@Log(title = "套餐", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody STimeSlot sTimeSlot)
{
return toAjax(sTimeSlotService.insertSTimeSlot(sTimeSlot));
}
/**
* 修改套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:edit')")
@Log(title = "套餐", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody STimeSlot sTimeSlot)
{
return toAjax(sTimeSlotService.updateSTimeSlot(sTimeSlot));
}
/**
* 删除套餐
*/
@PreAuthorize("@ss.hasPermi('system:slot:remove')")
@Log(title = "套餐", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sTimeSlotService.deleteSTimeSlotByIds(ids));
}
}
package share.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 套餐对象 s_time_slot
*
* @author ruoyi
* @date 2023-09-27
*/
public class STimeSlot extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 套餐ID */
private Long id;
/** 套餐名称 */
@Excel(name = "套餐名称")
private String name;
/** 时长 */
@Excel(name = "时长")
private Integer duration;
/** 总价 */
@Excel(name = "总价")
private BigDecimal totalPrice;
/** 单价(元/小时) */
private BigDecimal simplePrice;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setDuration(Integer duration)
{
this.duration = duration;
}
public Integer getDuration()
{
return duration;
}
public void setTotalPrice(BigDecimal totalPrice)
{
this.totalPrice = totalPrice;
}
public BigDecimal getTotalPrice()
{
return totalPrice;
}
public void setSimplePrice(BigDecimal simplePrice)
{
this.simplePrice = simplePrice;
}
public BigDecimal getSimplePrice()
{
return simplePrice;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public Date getEndDate()
{
return endDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("duration", getDuration())
.append("totalPrice", getTotalPrice())
.append("simplePrice", getSimplePrice())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.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 share.system.domain.STimeSlot;
/**
* 套餐Mapper接口
*
* @author ruoyi
* @date 2023-09-27
*/
public interface STimeSlotMapper
{
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
public STimeSlot selectSTimeSlotById(Long id);
/**
* 查询套餐列表
*
* @param sTimeSlot 套餐
* @return 套餐集合
*/
public List<STimeSlot> selectSTimeSlotList(STimeSlot sTimeSlot);
/**
* 新增套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
public int insertSTimeSlot(STimeSlot sTimeSlot);
/**
* 修改套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
public int updateSTimeSlot(STimeSlot sTimeSlot);
/**
* 删除套餐
*
* @param id 套餐主键
* @return 结果
*/
public int deleteSTimeSlotById(Long id);
/**
* 批量删除套餐
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSTimeSlotByIds(Long[] ids);
}
package share.system.service;
import java.util.List;
import share.system.domain.STimeSlot;
/**
* 套餐Service接口
*
* @author ruoyi
* @date 2023-09-27
*/
public interface ISTimeSlotService
{
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
public STimeSlot selectSTimeSlotById(Long id);
/**
* 查询套餐列表
*
* @param sTimeSlot 套餐
* @return 套餐集合
*/
public List<STimeSlot> selectSTimeSlotList(STimeSlot sTimeSlot);
/**
* 新增套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
public int insertSTimeSlot(STimeSlot sTimeSlot);
/**
* 修改套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
public int updateSTimeSlot(STimeSlot sTimeSlot);
/**
* 批量删除套餐
*
* @param ids 需要删除的套餐主键集合
* @return 结果
*/
public int deleteSTimeSlotByIds(Long[] ids);
/**
* 删除套餐信息
*
* @param id 套餐主键
* @return 结果
*/
public int deleteSTimeSlotById(Long id);
}
package share.system.service.impl;
import java.util.List;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.mapper.STimeSlotMapper;
import share.system.domain.STimeSlot;
import share.system.service.ISTimeSlotService;
/**
* 套餐Service业务层处理
*
* @author ruoyi
* @date 2023-09-27
*/
@Service
public class STimeSlotServiceImpl implements ISTimeSlotService
{
@Autowired
private STimeSlotMapper sTimeSlotMapper;
/**
* 查询套餐
*
* @param id 套餐主键
* @return 套餐
*/
@Override
public STimeSlot selectSTimeSlotById(Long id)
{
return sTimeSlotMapper.selectSTimeSlotById(id);
}
/**
* 查询套餐列表
*
* @param sTimeSlot 套餐
* @return 套餐
*/
@Override
public List<STimeSlot> selectSTimeSlotList(STimeSlot sTimeSlot)
{
return sTimeSlotMapper.selectSTimeSlotList(sTimeSlot);
}
/**
* 新增套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
@Override
public int insertSTimeSlot(STimeSlot sTimeSlot)
{
sTimeSlot.setCreateTime(DateUtils.getNowDate());
return sTimeSlotMapper.insertSTimeSlot(sTimeSlot);
}
/**
* 修改套餐
*
* @param sTimeSlot 套餐
* @return 结果
*/
@Override
public int updateSTimeSlot(STimeSlot sTimeSlot)
{
sTimeSlot.setUpdateTime(DateUtils.getNowDate());
return sTimeSlotMapper.updateSTimeSlot(sTimeSlot);
}
/**
* 批量删除套餐
*
* @param ids 需要删除的套餐主键
* @return 结果
*/
@Override
public int deleteSTimeSlotByIds(Long[] ids)
{
return sTimeSlotMapper.deleteSTimeSlotByIds(ids);
}
/**
* 删除套餐信息
*
* @param id 套餐主键
* @return 结果
*/
@Override
public int deleteSTimeSlotById(Long id)
{
return sTimeSlotMapper.deleteSTimeSlotById(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.STimeSlotMapper">
<resultMap type="STimeSlot" id="STimeSlotResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="duration" column="duration" />
<result property="totalPrice" column="total_price" />
<result property="simplePrice" column="simple_price" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<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="selectSTimeSlotVo">
select id, name, duration, total_price, simple_price, start_date, end_date, create_by, create_time, update_by, update_time, remark from s_time_slot
</sql>
<select id="selectSTimeSlotList" parameterType="STimeSlot" resultMap="STimeSlotResult">
<include refid="selectSTimeSlotVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="duration != null "> and duration = #{duration}</if>
<if test="totalPrice != null "> and total_price = #{totalPrice}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
</where>
</select>
<select id="selectSTimeSlotById" parameterType="Long" resultMap="STimeSlotResult">
<include refid="selectSTimeSlotVo"/>
where id = #{id}
</select>
<insert id="insertSTimeSlot" parameterType="STimeSlot" useGeneratedKeys="true" keyProperty="id">
insert into s_time_slot
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="duration != null">duration,</if>
<if test="totalPrice != null">total_price,</if>
<if test="simplePrice != null">simple_price,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</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 and name != ''">#{name},</if>
<if test="duration != null">#{duration},</if>
<if test="totalPrice != null">#{totalPrice},</if>
<if test="simplePrice != null">#{simplePrice},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</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="updateSTimeSlot" parameterType="STimeSlot">
update s_time_slot
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="totalPrice != null">total_price = #{totalPrice},</if>
<if test="simplePrice != null">simple_price = #{simplePrice},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</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="deleteSTimeSlotById" parameterType="Long">
delete from s_time_slot where id = #{id}
</delete>
<delete id="deleteSTimeSlotByIds" parameterType="String">
delete from s_time_slot 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