package cn.stylefeng.guns.modular.business.controller;
|
|
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.util.StrUtil;
|
import cn.stylefeng.guns.modular.business.entity.CounsellingSetMeal;
|
import cn.stylefeng.guns.modular.business.service.ICounsellingSetMealService;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
|
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ErrorResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* 咨询套餐信息管理类
|
* @author guo
|
*/
|
@RestController
|
@Api(tags = "咨询套餐信息管理类")
|
@ApiResource(name = "咨询套餐信息管理类", resBizType = ResBizTypeEnum.BUSINESS)
|
@RequestMapping("/business")
|
public class CounsellingSetMealController {
|
|
@Resource
|
private ICounsellingSetMealService counsellingSetMealService;
|
|
/**
|
* 添加咨询套餐信息
|
*/
|
@ApiOperation("添加咨询套餐信息")
|
@PostResource(name = "添加咨询套餐信息", path = "/counsellingSetMeal/add")
|
@BusinessLog
|
public ResponseData<?> add(@RequestBody CounsellingSetMeal counsellingSetMeal) {
|
this.counsellingSetMealService.save(counsellingSetMeal);
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 删除咨询套餐信息
|
*/
|
@ApiOperation("删除咨询套餐信息")
|
@PostResource(name = "删除咨询套餐信息", path = "/counsellingSetMeal/delete")
|
@BusinessLog
|
public ResponseData<?> delete(@RequestParam String ids) {
|
if (StrUtil.isBlank(ids)){
|
return new ErrorResponseData<>("500","id不能为空");
|
}
|
this.counsellingSetMealService.removeBatchByIds(ListUtil.toList(ids.split(",")));
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 修改咨询套餐信息
|
*/
|
@ApiOperation("修改咨询套餐信息")
|
@PostResource(name = "修改咨询套餐信息", path = "/counsellingSetMeal/edit")
|
@BusinessLog
|
public ResponseData<?> edit(@RequestBody CounsellingSetMeal counsellingSetMeal) {
|
this.counsellingSetMealService.updateById(counsellingSetMeal);
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 获取咨询套餐信息详情
|
*/
|
@ApiOperation("获取咨询套餐信息详情")
|
@GetResource(name = "获取咨询套餐信息详情", path = "/counsellingSetMeal/detail/{id}", requiredPermission = false)
|
public ResponseData<CounsellingSetMeal> detail(@PathVariable("id") Long id) {
|
CounsellingSetMeal counsellingSetMeal = this.counsellingSetMealService.getById(id);
|
return new SuccessResponseData<>(counsellingSetMeal);
|
}
|
|
/**
|
* 获取咨询套餐信息列表
|
*
|
*/
|
@ApiOperation("获取咨询套餐信息列表")
|
@GetResource(name = "获取咨询套餐信息列表", path = "/counsellingSetMeal/list", requiredPermission = false)
|
public ResponseData<List<CounsellingSetMeal>> list(CounsellingSetMeal counsellingSetMeal) {
|
LambdaQueryWrapper<CounsellingSetMeal> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingSetMeal>()
|
.orderByDesc(CounsellingSetMeal::getId);
|
return new SuccessResponseData<>(counsellingSetMealService.list(lambdaQueryWrapper));
|
}
|
|
/**
|
* 获取咨询套餐信息列表(分页)
|
*/
|
@ApiOperation("获取咨询套餐信息列表(分页)")
|
@GetResource(name = "获取咨询套餐信息列表(分页)", path = "/counsellingSetMeal/page", requiredPermission = false)
|
public ResponseData<PageResult<CounsellingSetMeal>> page(CounsellingSetMeal counsellingSetMeal) {
|
LambdaQueryWrapper<CounsellingSetMeal> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingSetMeal>()
|
.orderByDesc(CounsellingSetMeal::getId);
|
Page<CounsellingSetMeal> page = this.counsellingSetMealService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
|
return new SuccessResponseData<>(PageResultFactory.createPageResult(page));
|
}
|
|
}
|