xuhy
2024-12-16 1734f2d56162a1fdb556632dc36fcef0ca57851c
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
package com.jilongda.manage.controller;
 
 
import com.jilongda.common.basic.ApiResult;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TLensSeries;
import com.jilongda.manage.model.TOptometrist;
import com.jilongda.manage.query.TLensSeriesQuery;
import com.jilongda.manage.query.TOptometristQuery;
import com.jilongda.manage.service.TLensSeriesService;
import com.jilongda.manage.vo.TLensSeriesVO;
import com.jilongda.manage.vo.TOptometristVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 * 镜片系列表 前端控制器
 * </p>
 *
 * @author 无关风月
 * @since 2024-12-09
 */
@Api(tags = "镜片系列管理")
@RestController
@RequestMapping("/t-lens-series")
public class TLensSeriesController {
    @Autowired
    private TLensSeriesService lensSeriesService;
    @ApiOperation(value = "镜片系列列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TLensSeriesVO>> pageList(@RequestBody TLensSeriesQuery query) {
        PageInfo<TLensSeriesVO> optometristVOPageInfo = lensSeriesService.pageList(query);
        return ApiResult.success(optometristVOPageInfo);
    }
    @ApiOperation(value = "镜片系列添加")
    @PostMapping(value = "/add")
    public ApiResult<String> add(@RequestBody TLensSeries dto) {
        lensSeriesService.save(dto);
        return ApiResult.success();
    }
    @ApiOperation(value = "镜片系列编辑")
    @PostMapping(value = "/update")
    public ApiResult<String> update(@RequestBody TLensSeries dto) {
        if (!StringUtils.hasLength(dto.getSphere())){
            dto.setSphere("");
        }
        if (!StringUtils.hasLength(dto.getAsphericSurface())){
            dto.setAsphericSurface("");
        }
        if (!StringUtils.hasLength(dto.getDoubleNon())){
            dto.setDoubleNon("");
        }
        lensSeriesService.updateById(dto);
        return ApiResult.success();
    }
    @ApiOperation(value = "镜片系列启用/禁用")
    @GetMapping(value = "/updateState")
    public ApiResult<String> update(Integer id) {
        TLensSeries byId = lensSeriesService.getById(id);
        if (byId.getStatus()==1){
            byId.setStatus(2);
        }else{
            byId.setStatus(1);
        }
        lensSeriesService.updateById(byId);
        return ApiResult.success();
    }
}