| | |
| | | public class EquipmentCategoryController extends JeecgController<EquipmentCategory, IEquipmentCategoryService> { |
| | | @Autowired |
| | | private IEquipmentCategoryService equipmentCategoryService; |
| | | |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | |
| | | equipmentCategoryService.save(equipmentCategory); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment_category:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody EquipmentCategory equipmentCategory) { |
| | | List<EquipmentCategory> equipmentCategories = equipmentCategory.getEquipmentCategoryDtlList(); |
| | | for(EquipmentCategory equipmentCategoryChild:equipmentCategories){ |
| | | equipmentCategoryChild.setEquipmentCategoryUda1(equipmentCategory.getEquipmentCategoryUda1()); |
| | | equipmentCategoryChild.setEquipmentCategoryUda2(equipmentCategory.getEquipmentCategoryUda2()); |
| | | } |
| | | equipmentCategoryService.saveOrUpdateBatch(equipmentCategories); |
| | | equipmentCategoryService.updateById(equipmentCategory); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | |
| | | equipmentCategoryService.updateById(equipmentCategory); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | |
| | | } |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment_category:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EquipmentCategory equipmentCategory) { |
| | | return super.exportXls(request, equipmentCategory, EquipmentCategory.class, "mom_eam_equipment_category"); |
| | | return super.exportXls(request, equipmentCategory, EquipmentCategory.class, "设备分类"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/loadTree") |
| | | public Result<?> loadTree(HttpServletRequest httpServletRequest) { |
| | | List<CommonGenericTree> list = equipmentCategoryService.loadTree(); |
| | | List<CommonGenericTree> list = equipmentCategoryService.loadTreeByRecurrence(); |
| | | return Result.ok(list); |
| | | } |
| | | @GetMapping(value = "/getAllChildren") |
| | | public Result<IPage<EquipmentCategory>> getAllChildren(EquipmentCategory equipmentCategory, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req){ |
| | | QueryWrapper<EquipmentCategory> queryWrapper = Wrappers.query(); |
| | | Page<EquipmentCategory> page = new Page<EquipmentCategory>(pageNo, pageSize); |
| | | IPage<EquipmentCategory> pageList = equipmentCategoryService.getAllChildren(page, equipmentCategory); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | } |