123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package com.ylx.web.controller.massage;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.ylx.common.core.controller.BaseController;
- import com.ylx.common.core.domain.model.WxLoginUser;
- import com.ylx.massage.domain.BusinessDevelopment;
- import com.ylx.massage.service.BusinessDevelopmentService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.*;
- import com.ylx.common.core.domain.R;
- import javax.annotation.Resource;
- import java.io.Serializable;
- import java.util.List;
- /**
- * 招商代理(BusinessDevelopment)表控制层
- *
- * @author makejava
- * @since 2024-07-29 16:42:47
- */
- @RestController
- @Api(tags = {"招商代理(BusinessDevelopment)表控制层"})
- @RequestMapping("businessDevelopment")
- public class BusinessDevelopmentController extends BaseController {
- /**
- * 服务对象
- */
- @Resource
- private BusinessDevelopmentService businessDevelopmentService;
- /**
- * 分页查询所有数据
- *
- * @param page 分页对象
- * @param businessDevelopment 查询实体
- * @return 所有数据
- */
- @GetMapping("selectAll")
- @ApiOperation("分页查询所有数据")
- public R selectAll(Page<BusinessDevelopment> page, BusinessDevelopment businessDevelopment) {
- return R.ok(this.businessDevelopmentService.page(page, new QueryWrapper<>(businessDevelopment)));
- }
- /**
- * 通过主键查询单条数据
- *
- * @param id 主键
- * @return 单条数据
- */
- @GetMapping("{id}")
- @ApiOperation("通过主键查询单条数据")
- public R selectOne(@PathVariable Serializable id) {
- return R.ok(this.businessDevelopmentService.getById(id));
- }
- /**
- * 新增数据
- *
- * @param businessDevelopment 实体对象
- * @return 新增结果
- */
- @PostMapping("add")
- @ApiOperation("新增数据")
- public R insert(@RequestBody BusinessDevelopment businessDevelopment) {
- WxLoginUser wxLoginUser = this.getWxLoginUser();
- LambdaQueryWrapper<BusinessDevelopment> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(BusinessDevelopment::getOpenId, wxLoginUser.getCOpenid());
- List<BusinessDevelopment> list = businessDevelopmentService.list(queryWrapper);
- if (!list.isEmpty()) {
- return R.fail("已提交过申请");
- }
- return R.ok(this.businessDevelopmentService.save(businessDevelopment));
- }
- /**
- * 修改数据
- *
- * @param businessDevelopment 实体对象
- * @return 修改结果
- */
- @PostMapping("update")
- @ApiOperation("修改数据")
- public R update(@RequestBody BusinessDevelopment businessDevelopment) {
- return R.ok(this.businessDevelopmentService.updateById(businessDevelopment));
- }
- /**
- * 删除数据
- *
- * @param idList 主键结合
- * @return 删除结果
- */
- @PostMapping("delete")
- @ApiOperation("删除数据")
- public R delete(@RequestBody List<String> idList) {
- return R.ok(this.businessDevelopmentService.removeByIds(idList));
- }
- }
|