skyouc
2024-12-21 c635d78b479510ebe2556a420948effcd30a0731
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/statistics/ViewInOutController.java
@@ -1,49 +1,49 @@
package com.zy.asrs.wms.asrs.controller.statistics;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wms.asrs.entity.statistics.ViewInOut;
import com.zy.asrs.wms.asrs.mapper.statistics.ViewInOutMapper;
import com.zy.asrs.wms.common.annotation.CacheData;
import com.zy.asrs.wms.common.domain.BaseParam;
import com.zy.asrs.wms.common.domain.PageParam;
import com.zy.asrs.wms.system.controller.BaseController;
import com.zy.asrs.wms.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class ViewInOutController extends BaseController {
    @Autowired
    private ViewInOutMapper viewInOutMapper;
    @PreAuthorize("hasAuthority('asrs:viewInOut:list')")
    @PostMapping("/viewInOut/page")
    @CacheData(tableName = {"view_in_out", "man_task", "man_task_log"})
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<ViewInOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewInOut.class);
        QueryWrapper<ViewInOut> queryWrapper = pageParam.buildWrapper(true);
        PageParam<ViewInOut, BaseParam> page = viewInOutMapper.selectPage(pageParam, queryWrapper);
        return R.ok().add(page);
    }
    @PreAuthorize("hasAuthority('asrs:viewInOut:list')")
    @PostMapping("/viewInOut/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<ViewInOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewInOut.class);
        QueryWrapper<ViewInOut> queryWrapper = pageParam.buildWrapper(true);
        ExcelUtil.build(ExcelUtil.create(viewInOutMapper.selectList(queryWrapper), ViewInOut.class), response);
    }
}
package com.zy.asrs.wms.asrs.controller.statistics;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wms.asrs.entity.statistics.ViewInOut;
import com.zy.asrs.wms.asrs.mapper.statistics.ViewInOutMapper;
import com.zy.asrs.wms.common.annotation.CacheData;
import com.zy.asrs.wms.common.domain.BaseParam;
import com.zy.asrs.wms.common.domain.PageParam;
import com.zy.asrs.wms.system.controller.BaseController;
import com.zy.asrs.wms.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class ViewInOutController extends BaseController {
    @Autowired
    private ViewInOutMapper viewInOutMapper;
    @PreAuthorize("hasAuthority('asrs:viewInOut:list')")
    @PostMapping("/viewInOut/page")
    @CacheData(tableName = {"view_in_out", "man_task", "man_task_log"})
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<ViewInOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewInOut.class);
        QueryWrapper<ViewInOut> queryWrapper = pageParam.buildWrapper(true);
        PageParam<ViewInOut, BaseParam> page = viewInOutMapper.selectPage(pageParam, queryWrapper);
        return R.ok().add(page);
    }
    @PreAuthorize("hasAuthority('asrs:viewInOut:list')")
    @PostMapping("/viewInOut/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<ViewInOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewInOut.class);
        QueryWrapper<ViewInOut> queryWrapper = pageParam.buildWrapper(true);
        ExcelUtil.build(ExcelUtil.create(viewInOutMapper.selectList(queryWrapper), ViewInOut.class), response);
    }
}