| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TSysInspection; |
| | | import com.ruoyi.system.service.TCrmClinicService; |
| | | import com.ruoyi.system.service.TSysInspectionService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-08-20 |
| | | */ |
| | | @Api(tags = "用户检测信息管理") |
| | | @RestController |
| | | @RequestMapping("/t-sys-inspection") |
| | | public class TSysInspectionController { |
| | | |
| | | private final TSysInspectionService sysInspectionService; |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | @Autowired |
| | | public TSysInspectionController(TSysInspectionService sysInspectionService, TokenService tokenService, TCrmClinicService crmClinicService) { |
| | | this.sysInspectionService = sysInspectionService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | } |
| | | |
| | | // /** |
| | | // * 获取用户检测信息管理管理列表 |
| | | // */ |
| | | // @ApiOperation(value = "获取用户检测信息管理分页列表") |
| | | // @PostMapping(value = "/pageList") |
| | | // public R<PageInfo<TSysInspection>> pageList(@RequestBody TSysInspectionQuery query) { |
| | | // return R.ok(sysInspectionService.pageList(query)); |
| | | // } |
| | | |
| | | /** |
| | | * 获取用户检测信息管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取用户检测信息管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TSysInspection>> list() { |
| | | return R.ok(sysInspectionService.list(Wrappers.lambdaQuery(TSysInspection.class).orderByDesc(TSysInspection::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加用户检测信息管理管理 |
| | | */ |
| | | @Log(title = "用户检测信息管理信息-新增用户检测信息管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加用户检测信息管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TSysInspection dto) { |
| | | dto.setIsPay(1); |
| | | String checkTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); |
| | | dto.setCheckTime(checkTime); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | dto.setClinicId(crmClinic.getId()); |
| | | return R.ok(sysInspectionService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户检测信息管理 |
| | | */ |
| | | @Log(title = "用户检测信息管理信息-修改用户检测信息管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改用户检测信息管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TSysInspection dto) { |
| | | return R.ok(sysInspectionService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看用户检测信息管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看用户检测信息管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysInspection> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysInspectionService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户检测信息管理 |
| | | */ |
| | | @Log(title = "用户检测信息管理信息-删除用户检测信息管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除用户检测信息管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(sysInspectionService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除用户检测信息管理 |
| | | */ |
| | | @Log(title = "用户检测信息管理信息-删除用户检测信息管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除用户检测信息管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(sysInspectionService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |