| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.annotation.AuthHandler; |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateInstrumentDto; |
| | | import com.yuanchu.limslaboratory.service.InstrumentService; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | * @author 江苏鵷雏网络科技有限公司 |
| | | * @since 2023-07-20 |
| | | */ |
| | | @Api(tags = "实验室-->设备台账-->2、仪器模块") |
| | | @Api(tags = "实验室-->1、设备台账-->2、仪器模块") |
| | | @RestController |
| | | @RequestMapping("/instrument") |
| | | public class InstrumentController { |
| | |
| | | |
| | | @ApiOperation("添加仪器设备") |
| | | @PostMapping("/add") |
| | | public Result<?> addInstrumentInformation(@RequestBody Instrument instrument) { |
| | | @AuthHandler |
| | | public Result<?> addInstrumentInformation(@RequestHeader("X-Token") String token, @RequestBody Instrument instrument) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | instrument.setCreateUserId((Integer) unmarshal.get("id")); |
| | | Integer isInsertSuccess = instrumentService.addInstrumentInformation(instrument); |
| | | if (isInsertSuccess == 1){ |
| | | return Result.success("添加【" + instrument.getEquipmentName() + "】成功!"); |
| | |
| | | @ApiImplicitParam(name = "whetherWhether", value = "是否已过期", dataTypeClass = Boolean.class), |
| | | @ApiImplicitParam(name = "numberOrNameOrSpecifications", value = "编号/设备名称/规格型号", dataTypeClass = String.class) |
| | | }) |
| | | @AuthHandler |
| | | public Result<?> getListInstrumentInformation(Integer pageNo, |
| | | Integer pageSize, |
| | | Integer conditions, |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "instrumentId", value = "仪器Id", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @AuthHandler |
| | | public Result<?> deleteInstrumentInformation(String instrumentId) { |
| | | Boolean isDeleteSuccess = instrumentService.deleteInstrumentInformation(instrumentId); |
| | | if (isDeleteSuccess){ |
| | |
| | | |
| | | @ApiOperation("添加仪器时保管人下拉框数据") |
| | | @GetMapping("/get_user") |
| | | @AuthHandler |
| | | public Result<?> getMapUserInformation() { |
| | | return Result.success(userService.getUserNameAndId()); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "InstrumentId", value = "分类Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/get_instrument") |
| | | @AuthHandler |
| | | public Result<?> getIdInstrumentInformation(Integer InstrumentId) { |
| | | Instrument idInstrumentInformation = instrumentService.getIdInstrumentInformation(InstrumentId); |
| | | return Result.success(idInstrumentInformation); |
| | | return Result.success(instrumentService.getIdInstrumentInformation(InstrumentId)); |
| | | } |
| | | |
| | | @ApiOperation("根据仪器Id更新数据") |
| | | @PutMapping("/update") |
| | | @AuthHandler |
| | | public Result<?> updateEquipmentPointInformation(@RequestBody UpdateInstrumentDto updateInstrumentDto) throws Exception { |
| | | Instrument instrument = JackSonUtil.unmarshal(JackSonUtil.marshal(updateInstrumentDto), Instrument.class); |
| | | Integer isUpdateSuccess = instrumentService.updateEquipmentPointInformation(instrument); |