package org.jeecg.modules.mdc.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.mdc.entity.MdcEquipmentType; import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService; import org.jeecg.modules.mdc.service.IMdcEquipmentTypeService; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * @Description: 设备类型 * @Author: Sake * @Date: 2023-03-28 15:32 */ @Slf4j @Api(tags = "设备类型") @RestController @RequestMapping("/mdc/mdcEquipmentType") public class MdcEquipmentTypeController extends JeecgController { @Resource private IMdcEquipmentTypeService mdcEquipmentTypeService; /** * 根据id查询 * @param id * @return */ @AutoLog(value = "设备类型-根据id查询") @ApiOperation(value = "设备类型-根据id查询", notes = "设备类型-根据id查询") @GetMapping("/queryById") public Result queryById(@RequestParam(name = "id", required = true) String id){ MdcEquipmentType mdcEquipmentType = mdcEquipmentTypeService.queryById(id); //查询不为空则返回数据 return null != mdcEquipmentType ? Result.OK(mdcEquipmentType) : Result.error("未找到对应数据"); } /** * 设备类型查询 * @return */ @AutoLog(value = "设备类型-设备类型查询") @ApiOperation(value = "设备类型-设备类型查询", notes = "设备类型-设备类型查询") @GetMapping("/queryEquipmentType") public Result queryEquipmentType(){ List mdcEquipmentTypes = mdcEquipmentTypeService.queryEquipmentType(); return Result.OK(mdcEquipmentTypes); } /** * 分页查询 * @param pageNo * @param pageSize * @param req * @return */ @AutoLog(value = "设备类型-分页查询") @ApiOperation(value = "设备类型-分页查询", notes = "设备类型-分页查询") @GetMapping("/queryWrapper") public Result queryWrapper(MdcEquipmentType mdcEquipmentType, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req){ Page page = new Page<>(pageNo, pageSize); IPage mdcEquipmentTypeIPage = mdcEquipmentTypeService.queryPageList(page, req); return Result.OK(mdcEquipmentTypeIPage); } /** * 新增 * @param mdcEquipmentType * @return */ @AutoLog(value = "设备类型-新增") @ApiOperation(value = "设备类型-新增", notes = "设备类型-新增") @PostMapping("/addEquipmentType") public Result addEquipmentType(@RequestBody MdcEquipmentType mdcEquipmentType){ boolean flag = mdcEquipmentTypeService.addEquipmentType(mdcEquipmentType); return flag ? Result.OK("新增成功") : Result.error("新增失败"); } /** * 编辑 * @param mdcEquipmentType * @return */ @AutoLog(value = "设备类型-编辑") @ApiOperation(value = "设备类型-编辑", notes = "设备类型-编辑") @PutMapping("/editEquipmentType") public Result editEquipmentType(@RequestBody MdcEquipmentType mdcEquipmentType){ boolean flag = mdcEquipmentTypeService.editEquipmentType(mdcEquipmentType); return flag ? Result.OK("修改成功") : Result.error("修改失败"); } /** * 根据id删除设备类型 * @param id * @return */ @AutoLog(value = "设备类型-根据id删除设备类型") @ApiOperation(value = "设备类型-根据id删除设备类型", notes = "设备类型-根据id删除设备类型") @DeleteMapping("/deleteEquipmentType") public Result deleteEquipmentType(@RequestParam(name = "id", required = true) String id){ boolean flag = mdcEquipmentTypeService.deleteEquipmentType(id); return flag ? Result.OK("删除成功") : Result.error("删除失败"); } /** * 批量删除 * * @param ids * @return */ @AutoLog(value = "设备类型-批量删除") @ApiOperation(value = "设备类型-批量删除", notes = "设备类型-批量删除") @DeleteMapping(value = "/deleteBatchEquipmentType") public Result deleteBatchEquipmentType(@RequestParam(name = "ids", required = true) String ids) { boolean flag = mdcEquipmentTypeService.deleteBatchEquipmentType(ids); return flag ? Result.OK("批量删除成功") : Result.error("删除失败"); } /** * 导出excel * @param request * @param mdcEquipmentType * @return */ @RequestMapping("/exportXls") public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentType mdcEquipmentType){ return super.exportXls(request, mdcEquipmentType, MdcEquipmentType.class, "设备类型导出"); } /** * 导入excel * @param request * @param response * @return */ @RequestMapping("/importExcel") public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, MdcEquipmentType.class); } }