服务包增加服务项目
This commit is contained in:
parent
5b108d5091
commit
ef13601ff6
|
@ -0,0 +1,83 @@
|
|||
package com.sqx.modules.bl.massage.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackageDetail;
|
||||
import com.sqx.modules.bl.massage.service.MassagePackageDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/massage/packageDetail")
|
||||
@Api(value = "服务包详情管理", tags = {"服务包详情管理"})
|
||||
public class MassagePackageDetailController {
|
||||
|
||||
@Autowired
|
||||
private MassagePackageDetailService service;
|
||||
|
||||
@GetMapping("/findPage")
|
||||
@ApiOperation("查询按服务包详情(分页)")
|
||||
public Result findPage(MassagePackageDetail massagePackageDetail){
|
||||
return service.findPage(massagePackageDetail);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCount")
|
||||
@ApiOperation("修改次数")
|
||||
public Result updateCount(MassagePackageDetail massagePackageDetail){
|
||||
service.updateCount(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updateIntervalDays")
|
||||
@ApiOperation("修改时间间隔")
|
||||
public Result updateIntervalDays(MassagePackageDetail massagePackageDetail){
|
||||
service.updateIntervalDays(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateStatus")
|
||||
@ApiOperation("修改状态")
|
||||
public Result updateStatus(MassagePackageDetail massagePackageDetail){
|
||||
service.updateStatus(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("添加服务包详情")
|
||||
public Result add(MassagePackageDetail massagePackageDetail){
|
||||
service.save(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/insertDetail")
|
||||
@ApiOperation("添加项目与服务包详情")
|
||||
public Result insertDetail(MassagePackageDetail massagePackageDetail){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
massagePackageDetail.setCreateTime(sdf.format(new Date()));
|
||||
service.insertDetail(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/findMassagePage")
|
||||
@ApiOperation("查询按服务包详情(分页)")
|
||||
public Result findMassagePage(MassagePackageDetail massagePackageDetail){
|
||||
return service.findMassagePage(massagePackageDetail);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除服务包详情")
|
||||
public Result delete(MassagePackageDetail massagePackageDetail){
|
||||
service.delete(massagePackageDetail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sqx.modules.bl.massage.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackageDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface MassagePackageDetailDao extends BaseMapper<MassagePackageDetail> {
|
||||
|
||||
IPage<MassagePackageDetail> findPage(Page<MassagePackageDetail> page, @Param("params") MassagePackageDetail massagePackageDetail);
|
||||
int updateCount(MassagePackageDetail massagePackageDetail);
|
||||
int updateIntervalDays(MassagePackageDetail massagePackageDetail);
|
||||
int updateStatus(MassagePackageDetail massagePackageDetail);
|
||||
int addMassage(MassagePackageDetail massagePackageDetail);
|
||||
int addDetail(MassagePackageDetail massagePackageDetail);
|
||||
IPage<MassagePackageDetail> findMassagePage(Page<MassagePackageDetail> page, @Param("params") MassagePackageDetail massagePackageDetail);
|
||||
int delete(MassagePackageDetail massagePackageDetail);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.sqx.modules.bl.massage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
@ -33,7 +34,7 @@ public class MassagePackage implements Serializable {
|
|||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
|
@ -95,7 +96,10 @@ public class MassagePackage implements Serializable {
|
|||
*/
|
||||
private String createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer limit;
|
||||
|
||||
public MassagePackage() {}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.sqx.modules.bl.massage.entity;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -14,6 +15,7 @@ import java.math.BigDecimal;
|
|||
* @date 2024-6-5
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_massage_package_detail")
|
||||
public class MassagePackageDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -25,6 +27,11 @@ public class MassagePackageDetail implements Serializable {
|
|||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 主表id
|
||||
*/
|
||||
private Long mainId;
|
||||
|
||||
/**
|
||||
* 按摩类型id
|
||||
*/
|
||||
|
@ -52,6 +59,12 @@ public class MassagePackageDetail implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
|
@ -59,7 +72,7 @@ public class MassagePackageDetail implements Serializable {
|
|||
private String content;
|
||||
|
||||
/**
|
||||
* 详细内容
|
||||
* 详细图片
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String contentImg;
|
||||
|
@ -106,6 +119,9 @@ public class MassagePackageDetail implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String labels;
|
||||
|
||||
|
@ -121,5 +137,16 @@ public class MassagePackageDetail implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String jianjie;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
@TableField(exist = false)
|
||||
private Integer limit;
|
||||
|
||||
public MassagePackageDetail() {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.sqx.modules.bl.massage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackageDetail;
|
||||
|
||||
public interface MassagePackageDetailService extends IService<MassagePackageDetail> {
|
||||
|
||||
Result findPage(MassagePackageDetail massagePackageDetail);
|
||||
int updateCount(MassagePackageDetail massagePackageDetail);
|
||||
int updateIntervalDays(MassagePackageDetail massagePackageDetail);
|
||||
int updateStatus(MassagePackageDetail massagePackageDetail);
|
||||
int insertDetail(MassagePackageDetail massagePackageDetail);
|
||||
Result findMassagePage(MassagePackageDetail massagePackageDetail);
|
||||
int delete(MassagePackageDetail massagePackageDetail);
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.sqx.modules.bl.massage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.massage.dao.MassagePackageDetailDao;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackageDetail;
|
||||
import com.sqx.modules.bl.massage.service.MassagePackageDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MassagePackageServiceDetailImpl extends ServiceImpl<MassagePackageDetailDao, MassagePackageDetail> implements MassagePackageDetailService {
|
||||
|
||||
@Override
|
||||
public Result findPage(MassagePackageDetail massagePackageDetail){
|
||||
Page<MassagePackageDetail> pages=new Page<>(massagePackageDetail.getPage(),massagePackageDetail.getLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.findPage(pages,massagePackageDetail)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCount(MassagePackageDetail massagePackageDetail){
|
||||
return baseMapper.updateCount(massagePackageDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateIntervalDays(MassagePackageDetail massagePackageDetail){
|
||||
return baseMapper.updateIntervalDays(massagePackageDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(MassagePackageDetail massagePackageDetail){
|
||||
return baseMapper.updateStatus(massagePackageDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertDetail(MassagePackageDetail massagePackageDetail){
|
||||
baseMapper.addMassage(massagePackageDetail);
|
||||
return baseMapper.addDetail(massagePackageDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findMassagePage(MassagePackageDetail massagePackageDetail){
|
||||
Page<MassagePackageDetail> pages=new Page<>(massagePackageDetail.getPage(),massagePackageDetail.getLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.findMassagePage(pages,massagePackageDetail)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(MassagePackageDetail massagePackageDetail){
|
||||
return baseMapper.delete(massagePackageDetail);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
<?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="com.sqx.modules.bl.massage.dao.MassagePackageDetailDao">
|
||||
|
||||
<select id="findPage" resultType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
select
|
||||
a.id,
|
||||
a.main_id,
|
||||
a.massage_type_id,
|
||||
a.service_count,
|
||||
a.interval_days,
|
||||
b.massage_img,
|
||||
b.title,
|
||||
b.old_price,
|
||||
b.price,
|
||||
b.duration,
|
||||
b.status,
|
||||
b.classify_id as type
|
||||
from bl_massage_package_detail a inner join massage_type b on a.massage_type_id = b.massage_type_id
|
||||
order by a.id desc
|
||||
</select>
|
||||
|
||||
<update id="updateCount" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
update bl_massage_package_detail set service_count=#{serviceCount} where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateIntervalDays" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
update bl_massage_package_detail set interval_days=#{intervalDays} where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatus" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
update massage_type set status=#{status} where massage_type_id=#{massageTypeId}
|
||||
</update>
|
||||
|
||||
<insert id="addMassage" useGeneratedKeys="true" keyProperty="massageTypeId" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
insert into massage_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != massageImg and '' != massageImg">
|
||||
massage_img,
|
||||
</if>
|
||||
<if test="null != title and '' != title">
|
||||
title,
|
||||
</if>
|
||||
<if test="null != content and '' != content">
|
||||
content,
|
||||
</if>
|
||||
<if test="null != oldPrice">
|
||||
old_price,
|
||||
</if>
|
||||
<if test="null != price">
|
||||
price,
|
||||
</if>
|
||||
<if test="null != duration ">
|
||||
duration,
|
||||
</if>
|
||||
<if test="null != sales">
|
||||
sales,
|
||||
</if>
|
||||
<if test="null != isSex">
|
||||
is_sex,
|
||||
</if>
|
||||
<if test="null != status and '' != status">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != createTime and '' != createTime">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != city and '' != city">
|
||||
city,
|
||||
</if>
|
||||
<if test="null != contentImg and '' != contentImg">
|
||||
content_img,
|
||||
</if>
|
||||
<if test="null != labels and '' != labels">
|
||||
labels,
|
||||
</if>
|
||||
<if test="null != type">
|
||||
classify_id,
|
||||
</if>
|
||||
<if test="null != applyPeople and '' != applyPeople">
|
||||
apply_people,
|
||||
</if>
|
||||
<if test="null != jianjie and '' != jianjie">
|
||||
jianjie,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != massageImg and '' != massageImg">
|
||||
#{massageImg},
|
||||
</if>
|
||||
<if test="null != title and '' != title">
|
||||
#{title},
|
||||
</if>
|
||||
<if test="null != content and '' != content">
|
||||
#{content},
|
||||
</if>
|
||||
<if test="null != oldPrice">
|
||||
#{oldPrice},
|
||||
</if>
|
||||
<if test="null != price">
|
||||
#{price},
|
||||
</if>
|
||||
<if test="null != duration ">
|
||||
#{duration},
|
||||
</if>
|
||||
<if test="null != sales">
|
||||
#{sales},
|
||||
</if>
|
||||
<if test="null != isSex">
|
||||
#{isSex},
|
||||
</if>
|
||||
<if test="null != status and '' != status">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != createTime and '' != createTime">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != city and '' != city">
|
||||
#{city},
|
||||
</if>
|
||||
<if test="null != contentImg and '' != contentImg">
|
||||
#{contentImg},
|
||||
</if>
|
||||
<if test="null != labels and '' != labels">
|
||||
#{labels},
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != applyPeople and '' != applyPeople">
|
||||
#{applyPeople},
|
||||
</if>
|
||||
<if test="null != jianjie and '' != jianjie">
|
||||
#{jianjie},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="addDetail" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
insert into bl_massage_package_detail(main_id,massage_type_id,service_count,interval_days)
|
||||
values (#{mainId},#{massageTypeId},#{serviceCount},#{intervalDays})
|
||||
</insert>
|
||||
|
||||
<select id="findMassagePage" resultType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
select
|
||||
massage_type_id,
|
||||
massage_img,
|
||||
title,
|
||||
old_price,
|
||||
price,
|
||||
duration,
|
||||
status,
|
||||
classify_id as type
|
||||
from massage_type
|
||||
where 1=1
|
||||
<if test="params.type!=null and params.type!=''">
|
||||
and classify_id=#{params.type}
|
||||
</if>
|
||||
<if test="params.title!=null and params.title!=''">
|
||||
and title like concat('%',#{params.title},'%')
|
||||
</if>
|
||||
order by classify_id asc,massage_type_id
|
||||
</select>
|
||||
|
||||
<delete id="delete" parameterType="com.sqx.modules.bl.massage.entity.MassagePackageDetail">
|
||||
delete from bl_massage_package_detail where id=#{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue