| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.config.TenantContext; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.RedisUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.config.mybatis.MybatisPlusSaasConfig; |
| | | import org.jeecg.modules.dry.common.CacheConstants; |
| | | import org.jeecg.modules.dry.entity.DryEquipment; |
| | | import org.jeecg.modules.dry.service.IDryEqpTypeService; |
| | | import org.jeecg.modules.dry.service.IDryEquipmentService; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | @Autowired |
| | | private IDryEquipmentService dryEquipmentService; |
| | | |
| | | @Autowired |
| | | private IDryEqpTypeService dryEqpTypeService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | //------------------------------------------------------------------------------------------------ |
| | | QueryWrapper<DryEquipment> queryWrapper = QueryGenerator.initQueryWrapper(dryEquipment, req.getParameterMap()); |
| | | |
| | | queryWrapper.orderByAsc("code"); |
| | | List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper); |
| | | eqps.stream().forEach(item -> { |
| | | item.setType(dryEqpTypeService.getById(item.getType()).getName()); |
| | | }); |
| | | return Result.OK(eqps); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | @RequiresPermissions("dry:dry_equipment:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody DryEquipment dryEquipment) { |
| | | redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode()); |
| | | dryEquipmentService.updateById(dryEquipment); |
| | | |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("dry:dry_equipment:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode()); |
| | | dryEquipmentService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | |
| | | @RequiresPermissions("dry:dry_equipment:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode()); |
| | | this.dryEquipmentService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | |
| | | @GetMapping(value = "/queryById") |
| | | public Result<DryEquipment> queryById(@RequestParam(name="id",required=true) String id) { |
| | | DryEquipment dryEquipment = dryEquipmentService.getById(id); |
| | | dryEquipment.setType(dryEqpTypeService.getById(dryEquipment.getType()).getName()); |
| | | if(dryEquipment==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |