Commit 80f24fb4 by 吕明尚

增加标签管理,套餐增加是否固定结束时间

parent 9d4e1d56
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.Label;
import share.system.service.LabelService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 标签Controller
*
* @author ruoyi
* @date 2024-04-19
*/
@RestController
@RequestMapping("/system/label")
public class LabelController extends BaseController {
@Autowired
private LabelService labelService;
/**
* 查询标签列表
*/
@PreAuthorize("@ss.hasPermi('system:label:list')")
@GetMapping("/list")
public TableDataInfo list(Label label) {
startPage();
List<Label> list = labelService.selectLabelList(label);
return getDataTable(list);
}
/**
* 导出标签列表
*/
@PreAuthorize("@ss.hasPermi('system:label:export')")
@Log(title = "标签", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Label label) {
List<Label> list = labelService.selectLabelList(label);
ExcelUtil<Label> util = new ExcelUtil<Label>(Label.class);
util.exportExcel(response, list, "标签数据");
}
/**
* 获取标签详细信息
*/
@PreAuthorize("@ss.hasPermi('system:label:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(labelService.selectLabelById(id));
}
/**
* 新增标签
*/
@PreAuthorize("@ss.hasPermi('system:label:add')")
@Log(title = "标签", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Label label) {
return toAjax(labelService.insertLabel(label));
}
/**
* 修改标签
*/
@PreAuthorize("@ss.hasPermi('system:label:edit')")
@Log(title = "标签", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Label label) {
return toAjax(labelService.updateLabel(label));
}
/**
* 删除标签
*/
@PreAuthorize("@ss.hasPermi('system:label:remove')")
@Log(title = "标签", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(labelService.deleteLabelByIds(ids));
}
}
......@@ -78,8 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_schema = (select database())
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
AND CONVERT(table_name USING utf8) NOT LIKE 'qrtz_%'
AND CONVERT(table_name USING utf8) NOT LIKE 'gen_%'
AND CONVERT(table_name USING utf8) NOT IN (SELECT CONVERT(table_name USING utf8) FROM gen_table)
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
......
package share.system.domain;
import lombok.Data;
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_label
*
* @author ruoyi
* @date 2024-04-19
*/
@Data
public class Label extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 标签名称
*/
@Excel(name = "标签名称")
private String name;
/**
* 时长
*/
@Excel(name = "时长")
private String duration;
/**
* 套餐类型:0:预定,1:续费
*/
@Excel(name = "套餐类型:0:预定,1:续费")
private Long type;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("duration", getDuration())
.append("type", getType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 套餐对象 s_pack
......@@ -68,4 +66,10 @@ public class SPack extends BaseEntity {
@Excel(name = "排序")
private Integer sort;
@Excel(name = "套餐类型:0:标签,1:房间")
private Integer type;
@Excel(name = "是否固定结束时间:0否,1是")
private Integer isFixedEndTime;
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Label;
import java.util.List;
/**
* 标签Mapper接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface LabelMapper extends BaseMapper<Label> {
/**
* 查询标签
*
* @param id 标签主键
* @return 标签
*/
public Label selectLabelById(Long id);
/**
* 查询标签列表
*
* @param label 标签
* @return 标签集合
*/
public List<Label> selectLabelList(Label label);
/**
* 新增标签
*
* @param label 标签
* @return 结果
*/
public int insertLabel(Label label);
/**
* 修改标签
*
* @param label 标签
* @return 结果
*/
public int updateLabel(Label label);
/**
* 删除标签
*
* @param id 标签主键
* @return 结果
*/
public int deleteLabelById(Long id);
/**
* 批量删除标签
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteLabelByIds(Long[] ids);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Label;
import java.util.List;
/**
* 标签Service接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface LabelService extends IService<Label> {
/**
* 查询标签
*
* @param id 标签主键
* @return 标签
*/
public Label selectLabelById(Long id);
/**
* 查询标签列表
*
* @param label 标签
* @return 标签集合
*/
public List<Label> selectLabelList(Label label);
/**
* 新增标签
*
* @param label 标签
* @return 结果
*/
public int insertLabel(Label label);
/**
* 修改标签
*
* @param label 标签
* @return 结果
*/
public int updateLabel(Label label);
/**
* 批量删除标签
*
* @param ids 需要删除的标签主键集合
* @return 结果
*/
public int deleteLabelByIds(Long[] ids);
/**
* 删除标签信息
*
* @param id 标签主键
* @return 结果
*/
public int deleteLabelById(Long id);
}
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.Label;
import share.system.mapper.LabelMapper;
import share.system.service.LabelService;
import java.util.List;
/**
* 标签Service业务层处理
*
* @author ruoyi
* @date 2024-04-19
*/
@Service
public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements LabelService {
@Autowired
private LabelMapper labelMapper;
/**
* 查询标签
*
* @param id 标签主键
* @return 标签
*/
@Override
public Label selectLabelById(Long id) {
return labelMapper.selectLabelById(id);
}
/**
* 查询标签列表
*
* @param label 标签
* @return 标签
*/
@Override
public List<Label> selectLabelList(Label label) {
return labelMapper.selectLabelList(label);
}
/**
* 新增标签
*
* @param label 标签
* @return 结果
*/
@Override
public int insertLabel(Label label) {
label.setCreateTime(DateUtils.getNowDate());
return labelMapper.insertLabel(label);
}
/**
* 修改标签
*
* @param label 标签
* @return 结果
*/
@Override
public int updateLabel(Label label) {
label.setUpdateTime(DateUtils.getNowDate());
return labelMapper.updateLabel(label);
}
/**
* 批量删除标签
*
* @param ids 需要删除的标签主键
* @return 结果
*/
@Override
public int deleteLabelByIds(Long[] ids) {
return labelMapper.deleteLabelByIds(ids);
}
/**
* 删除标签信息
*
* @param id 标签主键
* @return 结果
*/
@Override
public int deleteLabelById(Long id) {
return labelMapper.deleteLabelById(id);
}
}
......@@ -1660,11 +1660,17 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// }
//更改订单状态,房间状态,开始时间,结束时间
sOrder.setStatus(OrderStatusEnum.INUSE.getCode());
sOrder.setStartDate(new Date());
//计算预约开始和结束时间时长
BigDecimal bigDecimal = DateUtils.differentHour(sOrder.getPreStartDate(), sOrder.getPreEndDate());
sOrder.setStartDate(new Date());
//结束时间为开始时间+预约时长
sOrder.setEndDate(DateUtils.addHours(new Date(), bigDecimal.intValue()));
if (!ObjectUtils.isEmpty(sOrder.getPackId())) {
SPack byId = packService.getById(sOrder.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsFixedEndTime().equals(YesNoEnum.yes.getIndex())) {
sOrder.setEndDate(sOrder.getPreEndDate());
}
}
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
......
<?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.LabelMapper">
<resultMap type="Label" id="LabelResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="duration" column="duration"/>
<result property="type" column="type"/>
<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="selectLabelVo">
select id,
name,
duration,
type,
create_by,
create_time,
update_by,
update_time,
remark
from s_label
</sql>
<select id="selectLabelList" parameterType="Label" resultMap="LabelResult">
<include refid="selectLabelVo"/>
<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="type != null ">and type = #{type}</if>
</where>
</select>
<select id="selectLabelById" parameterType="Long" resultMap="LabelResult">
<include refid="selectLabelVo"/>
where id = #{id}
</select>
<insert id="insertLabel" parameterType="Label" useGeneratedKeys="true" keyProperty="id">
insert into s_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="duration != null">duration,</if>
<if test="type != null">type,</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="type != null">#{type},</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="updateLabel" parameterType="Label">
update s_label
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="type != null">type = #{type},</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="deleteLabelById" parameterType="Long">
delete
from s_label
where id = #{id}
</delete>
<delete id="deleteLabelByIds" parameterType="String">
delete from s_label where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -13,6 +13,8 @@
<result property="packaStartPeriod" column="packa_start_period"/>
<result property="packaEndPeriod" column="packa_end_period"/>
<result property="firstOrderAvailable" column="first_order_available"/>
<result property="isFixedEndTime" column="is_fixed_end_time"/>
<result property="type" column="type"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
......@@ -29,6 +31,8 @@
packa_start_period,
packa_end_period,
first_order_available,
is_fixed_end_time,
type,
create_by,
create_time,
update_by,
......@@ -52,6 +56,10 @@
first_order_available =
#{firstOrderAvailable}
</if>
<if test="isFixedEndTime != null and isFixedEndTime != '' or isFixedEndTime==0">and is_fixed_end_time =
#{isFixedEndTime}
</if>
<if test="type != null and type != '' or type==0">and type = #{type}</if>
</where>
</select>
......@@ -69,6 +77,8 @@
<if test="packaStartPeriod != null">packa_start_period,</if>
<if test="packaEndPeriod != null">packa_end_period,</if>
<if test="firstOrderAvailable != null">first_order_available,</if>
<if test="isFixedEndTime != null">is_fixed_end_time,</if>
<if test="type != null">type,</if>
<if test="sort != null">sort,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
......@@ -83,6 +93,8 @@
<if test="packaStartPeriod != null">#{packaStartPeriod},</if>
<if test="packaEndPeriod != null">#{packaEndPeriod},</if>
<if test="firstOrderAvailable != null">#{firstOrderAvailable},</if>
<if test="isFixedEndTime != null">#{isFixedEndTime},</if>
<if test="type != null">#{type},</if>
<if test="sort != null">#{sort},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
......@@ -101,6 +113,8 @@
<if test="packaStartPeriod != null">packa_start_period = #{packaStartPeriod},</if>
<if test="packaEndPeriod != null">packa_end_period = #{packaEndPeriod},</if>
<if test="firstOrderAvailable != null">first_order_available = #{firstOrderAvailable},</if>
<if test="isFixedEndTime != null">is_fixed_end_time = #{isFixedEndTime},</if>
<if test="type != null">type = #{type},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</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