TConsumptionLogController.java 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.ylx.web.controller.massage;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.ylx.common.annotation.Log;
  5. import com.ylx.common.core.controller.BaseController;
  6. import com.ylx.common.enums.BusinessType;
  7. import com.ylx.massage.domain.TConsumptionLog;
  8. import com.ylx.massage.service.TConsumptionLogService;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.springframework.web.bind.annotation.*;
  12. import com.ylx.common.core.domain.R;
  13. import javax.annotation.Resource;
  14. import java.io.Serializable;
  15. import java.util.List;
  16. /**
  17. * 个人钱包记录表(TConsumptionLog)表控制层
  18. *
  19. * @author makejava
  20. * @since 2024-04-25 16:50:31
  21. */
  22. @RestController
  23. @RequestMapping("tConsumptionLog")
  24. @Api(tags = {"余额记录"})
  25. public class TConsumptionLogController extends BaseController {
  26. /**
  27. * 服务对象
  28. */
  29. @Resource
  30. private TConsumptionLogService tConsumptionLogService;
  31. /**
  32. * 分页查询所有数据
  33. *
  34. * @param page 分页对象
  35. * @param tConsumptionLog 查询实体
  36. * @return 所有数据
  37. */
  38. @GetMapping("selectAll")
  39. @ApiOperation("分页查询数据")
  40. @Log(title = "分页查询数据", businessType = BusinessType.OTHER)
  41. public R<Page<TConsumptionLog>> selectAll(Page<TConsumptionLog> page, TConsumptionLog tConsumptionLog) {
  42. LambdaQueryWrapper<TConsumptionLog> queryWrapper = new LambdaQueryWrapper<>();
  43. queryWrapper.eq(TConsumptionLog::getOpenId, tConsumptionLog.getOpenId())
  44. .eq(tConsumptionLog.getBillType() != null,TConsumptionLog::getBillType, tConsumptionLog.getBillType())
  45. .orderByDesc(TConsumptionLog::getCreateTime);
  46. return R.ok(this.tConsumptionLogService.page(page, queryWrapper));
  47. }
  48. /**
  49. * 通过主键查询单条数据
  50. *
  51. * @param id 主键
  52. * @return 单条数据
  53. */
  54. @GetMapping("{id}")
  55. public R selectOne(@PathVariable Serializable id) {
  56. return R.ok(this.tConsumptionLogService.getById(id));
  57. }
  58. /**
  59. * 新增数据
  60. *
  61. * @param tConsumptionLog 实体对象
  62. * @return 新增结果
  63. */
  64. @PostMapping
  65. public R insert(@RequestBody TConsumptionLog tConsumptionLog) {
  66. return R.ok(this.tConsumptionLogService.save(tConsumptionLog));
  67. }
  68. /**
  69. * 修改数据
  70. *
  71. * @param tConsumptionLog 实体对象
  72. * @return 修改结果
  73. */
  74. @PutMapping
  75. public R update(@RequestBody TConsumptionLog tConsumptionLog) {
  76. return R.ok(this.tConsumptionLogService.updateById(tConsumptionLog));
  77. }
  78. /**
  79. * 删除数据
  80. *
  81. * @param idList 主键结合
  82. * @return 删除结果
  83. */
  84. @DeleteMapping
  85. public R delete(@RequestParam("idList") List<Long> idList) {
  86. return R.ok(this.tConsumptionLogService.removeByIds(idList));
  87. }
  88. }