guohongjin
2024-05-01 1901fceb6ddaa56a57f3131191454554c3e77e68
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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.CounsellingReservationRecord;
import cn.stylefeng.guns.modular.business.service.ICounsellingReservationRecordService;
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.core.conditions.update.LambdaUpdateWrapper;
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 CounsellingReservationRecordController  {
 
    @Resource
    private ICounsellingReservationRecordService counsellingReservationRecordService;
 
    /**
     * 添加咨询记录信息
     */
    @ApiOperation("添加咨询记录信息")
    @PostResource(name = "添加咨询记录信息", path = "/counsellingReservationRecord/add")
    @BusinessLog
    public ResponseData<?> add(@RequestBody CounsellingReservationRecord counsellingReservationRecord) {
        this.counsellingReservationRecordService.save(counsellingReservationRecord);
        return new SuccessResponseData<>();
    }
 
    /**
     * 删除咨询记录信息
     */
    @ApiOperation("删除咨询记录信息")
    @PostResource(name = "删除咨询记录信息", path = "/counsellingReservationRecord/delete")
    @BusinessLog
    public ResponseData<?> delete(@RequestParam String ids) {
        if (StrUtil.isBlank(ids)){
            return new ErrorResponseData<>("500","id不能为空");
        }
        LambdaUpdateWrapper<CounsellingReservationRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingReservationRecord>().set(CounsellingReservationRecord::getIsDelete,true);
        lambdaUpdateWrapper.in(CounsellingReservationRecord::getId, ListUtil.toList(ids.split(",")));
        this.counsellingReservationRecordService.update(lambdaUpdateWrapper);
        return new SuccessResponseData<>();
    }
 
    /**
     * 修改咨询记录信息
     */
    @ApiOperation("修改咨询记录信息")
    @PostResource(name = "修改咨询记录信息", path = "/counsellingReservationRecord/edit")
    @BusinessLog
    public ResponseData<?> edit(@RequestBody CounsellingReservationRecord counsellingReservationRecord) {
        this.counsellingReservationRecordService.updateById(counsellingReservationRecord);
        return new SuccessResponseData<>();
    }
 
    /**
     * 修改咨询记录信息状态
     */
    @ApiOperation("修改咨询记录信息状态")
    @PostResource(name = "修改咨询记录信息状态", path = "/counsellingReservationRecord/updateStatus")
    @BusinessLog
    public ResponseData<?> updateStatus(String ids, Integer status) {
        if (StrUtil.isBlank(ids)){
            return new ErrorResponseData<>("500","id不能为空");
        }
        LambdaUpdateWrapper<CounsellingReservationRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingReservationRecord>();
        lambdaUpdateWrapper.in(CounsellingReservationRecord::getId, ListUtil.toList(ids.split(",")));
        this.counsellingReservationRecordService.update(lambdaUpdateWrapper);
        return new SuccessResponseData<>();
    }
 
    /**
     * 获取咨询记录信息详情
     */
    @ApiOperation("获取咨询记录信息详情")
    @GetResource(name = "获取咨询记录信息详情", path = "/counsellingReservationRecord/detail/{id}", requiredPermission = false)
    public ResponseData<CounsellingReservationRecord> detail(@PathVariable("id") Long id) {
        CounsellingReservationRecord counsellingReservationRecord = this.counsellingReservationRecordService.getById(id);
        return new SuccessResponseData<>(counsellingReservationRecord);
    }
 
    /**
     * 获取咨询记录信息列表
     *
     */
    @ApiOperation("获取咨询记录信息列表")
    @GetResource(name = "获取咨询记录信息列表", path = "/counsellingReservationRecord/list", requiredPermission = false)
    public ResponseData<List<CounsellingReservationRecord>> list(CounsellingReservationRecord counsellingReservationRecord) {
          LambdaQueryWrapper<CounsellingReservationRecord> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingReservationRecord>().eq(CounsellingReservationRecord::getIsDelete,false)
                        .orderByDesc(CounsellingReservationRecord::getId);
        return new SuccessResponseData<>(counsellingReservationRecordService.list(lambdaQueryWrapper));
    }
 
    /**
     * 获取咨询记录信息列表(分页)
     */
    @ApiOperation("获取咨询记录信息列表(分页)")
    @GetResource(name = "获取咨询记录信息列表(分页)", path = "/counsellingReservationRecord/page", requiredPermission = false)
    public ResponseData<PageResult<CounsellingReservationRecord>> page(CounsellingReservationRecord counsellingReservationRecord) {
        LambdaQueryWrapper<CounsellingReservationRecord> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingReservationRecord>().eq(CounsellingReservationRecord::getIsDelete,false)
                    .orderByDesc(CounsellingReservationRecord::getId);
        Page<CounsellingReservationRecord> page = this.counsellingReservationRecordService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
        return new SuccessResponseData<>(PageResultFactory.createPageResult(page));
    }
 
}