| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设备加班管理 |
| | |
| | | @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); |
| | | String[] calendarIdList = mdcEquipmentOvertime.getCalendarId().split(","); |
| | | List<MdcEquipmentOvertime> equipmentOvertimeList = new ArrayList<>(); |
| | | mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().in(MdcEquipmentOvertime::getCalendarId, Arrays.asList(calendarIdList))); |
| | | for (String calendarId : calendarIdList) { |
| | | MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime(); |
| | | equipmentOvertime.setCalendarId(calendarId); |
| | | equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime()); |
| | | equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime()); |
| | | equipmentOvertime.setRemark(mdcEquipmentOvertime.getRemark()); |
| | | equipmentOvertimeList.add(equipmentOvertime); |
| | | } |
| | | mdcEquipmentOvertimeService.saveBatch(equipmentOvertimeList); |
| | | 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); |
| | | } |
| | | |
| | | /** |