服务包
This commit is contained in:
parent
45b6fbc998
commit
1f5d32cbbf
|
@ -0,0 +1,73 @@
|
|||
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.service.MassagePackageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/massage/package")
|
||||
@Api(value = "服务包管理", tags = {"服务包管理"})
|
||||
public class MassagePackageController {
|
||||
|
||||
@Autowired
|
||||
private MassagePackageService service;
|
||||
|
||||
@GetMapping("/findPage")
|
||||
@ApiOperation("查询按服务包(分页)")
|
||||
public Result findPage(MassagePackage massagePackage){
|
||||
return service.findPage(massagePackage);
|
||||
}
|
||||
|
||||
@PostMapping("/updateSales")
|
||||
@ApiOperation("修改销量")
|
||||
public Result updateSales(MassagePackage massagePackage){
|
||||
service.updateSales(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updateEsteemRate")
|
||||
@ApiOperation("修改好评")
|
||||
public Result updateEsteemRate(MassagePackage massagePackage){
|
||||
service.updateEsteemRate(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateStatus")
|
||||
@ApiOperation("修改状态")
|
||||
public Result updateStatus(MassagePackage massagePackage){
|
||||
service.updateStatus(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("添加服务包")
|
||||
public Result add(MassagePackage massagePackage){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
massagePackage.setCreateTime(sdf.format(new Date()));
|
||||
service.save(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/modify")
|
||||
@ApiOperation("修改服务包")
|
||||
public Result modify(MassagePackage massagePackage){
|
||||
service.updateById(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除服务包")
|
||||
public Result delete(MassagePackage massagePackage){
|
||||
service.delete(massagePackage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
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.modules.bl.massage.entity.MassagePackage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface MassagePackageDao extends BaseMapper<MassagePackage> {
|
||||
|
||||
IPage<MassagePackage> findPage(Page<MassagePackage> page,@Param("params") MassagePackage massagePackage);
|
||||
int updateSales(MassagePackage massagePackage);
|
||||
int updateEsteemRate(MassagePackage massagePackage);
|
||||
int updateStatus(MassagePackage massagePackage);
|
||||
int delete(MassagePackage massagePackage);
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.sqx.modules.bl.massage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description massage_package
|
||||
* @author caolei
|
||||
* @date 2024-6-5
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_massage_package")
|
||||
public class MassagePackage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
/**
|
||||
* 服务包id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal oldPrice;
|
||||
|
||||
/**
|
||||
* 现价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String packageImg;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 详细内容
|
||||
*/
|
||||
private String contentImg;
|
||||
|
||||
/**
|
||||
* 状态 1上 2下
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 加钟次数
|
||||
*/
|
||||
private Integer addNum;
|
||||
|
||||
/**
|
||||
* 好评率
|
||||
*/
|
||||
private BigDecimal esteemRate;
|
||||
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
private Integer sales;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String labels;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
private Integer page;
|
||||
private Integer limit;
|
||||
|
||||
public MassagePackage() {}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
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 lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description massage_package
|
||||
* @author caolei
|
||||
* @date 2024-6-5
|
||||
*/
|
||||
@Data
|
||||
public class MassagePackageDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
/**
|
||||
* 服务包明细id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 按摩类型id
|
||||
*/
|
||||
private Long massageTypeId;
|
||||
|
||||
/**
|
||||
* 服务次数
|
||||
*/
|
||||
private Long serviceCount;
|
||||
|
||||
/**
|
||||
* 间隔天数
|
||||
*/
|
||||
private String intervalDays;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String massageImg;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 详细内容
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String contentImg;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal oldPrice;
|
||||
|
||||
/**
|
||||
* 现价
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 时长
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer sales;
|
||||
|
||||
/**
|
||||
* 是否限制性别 0不限制 1男 2女
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer isSex;
|
||||
|
||||
/**
|
||||
* 状态 1上 2下
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String city;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String labels;
|
||||
|
||||
/**
|
||||
* 适用人群
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String applyPeople;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String jianjie;
|
||||
|
||||
public MassagePackageDetail() {}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
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.MassagePackage;
|
||||
|
||||
public interface MassagePackageService extends IService<MassagePackage> {
|
||||
|
||||
Result findPage(MassagePackage massagePackage);
|
||||
int updateSales(MassagePackage massagePackage);
|
||||
int updateEsteemRate(MassagePackage massagePackage);
|
||||
int updateStatus(MassagePackage massagePackage);
|
||||
int delete(MassagePackage massagePackage);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
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.MassagePackageDao;
|
||||
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MassagePackageServiceImpl extends ServiceImpl<MassagePackageDao, MassagePackage> implements MassagePackageService {
|
||||
|
||||
@Override
|
||||
public Result findPage(MassagePackage massagePackage){
|
||||
Page<MassagePackage> pages=new Page<>(massagePackage.getPage(),massagePackage.getLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.findPage(pages,massagePackage)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateSales(MassagePackage massagePackage){
|
||||
return baseMapper.updateSales(massagePackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateEsteemRate(MassagePackage massagePackage){
|
||||
return baseMapper.updateEsteemRate(massagePackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(MassagePackage massagePackage){
|
||||
return baseMapper.updateStatus(massagePackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(MassagePackage massagePackage){
|
||||
return baseMapper.delete(massagePackage);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?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.MassagePackageDao">
|
||||
|
||||
<select id="findPage" resultType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||
select *
|
||||
from bl_massage_package m
|
||||
where 1=1
|
||||
<if test="params.status!=null and params.status!=0">
|
||||
and m.status=#{params.status}
|
||||
</if>
|
||||
<if test="params.type!=null and params.type!=''">
|
||||
and m.type=#{params.type}
|
||||
</if>
|
||||
<if test="params.city!=null and params.city!=''">
|
||||
and (m.city like concat('%',#{params.city},'%') or m.city='不限')
|
||||
</if>
|
||||
<if test="params.title!=null and params.title!=''">
|
||||
and m.title like concat('%',#{params.title},'%')
|
||||
</if>
|
||||
order by type
|
||||
</select>
|
||||
|
||||
<update id="updateSales" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||
update bl_massage_package set sales=#{sales} where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateEsteemRate" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||
update bl_massage_package set esteem_rate=#{esteemRate} where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatus" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||
update bl_massage_package set status=#{status} where id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||
delete from bl_massage_package where id=#{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue