| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.apache.shiro.SecurityUtils; |
| | | 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.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<MdcEquipmentOvertime> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipmentOvertime, req.getParameterMap()); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | Page<MdcEquipmentOvertime> page = new Page<MdcEquipmentOvertime>(pageNo, pageSize); |
| | | IPage<MdcEquipmentOvertime> pageList = mdcEquipmentOvertimeService.page(page, queryWrapper); |
| | | IPage<MdcEquipmentOvertime> pageList = mdcEquipmentOvertimeService.pageList(userId, page, mdcEquipmentOvertime, req); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "设备加班管理-添加", notes = "设备加班管理-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | mdcEquipmentOvertimeService.save(mdcEquipmentOvertime); |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(mdcEquipmentOvertime.getEquipmentId())) { |
| | | return Result.error("未选择设备,请排查!"); |
| | | } |
| | | boolean result = mdcEquipmentOvertimeService.addOvertime(mdcEquipmentOvertime); |
| | | if (!result) { |
| | | return Result.error("添加失败!"); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | return super.exportXls(request, mdcEquipmentOvertime, MdcEquipmentOvertime.class, "设备加班管理"); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | return mdcEquipmentOvertimeService.exportXls(userId, mdcEquipmentOvertime); |
| | | } |
| | | |
| | | /** |