| | |
| | | package com.jilongda.manage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | 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> |
| | |
| | | * @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(); |
| | | } |
| | | } |
| | | |