¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.tms.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.tms.entity.OutStoreDetail; |
| | | import org.jeecg.modules.tms.entity.ToolLedger; |
| | | import org.jeecg.modules.tms.entity.vo.OutStoreDetailVo; |
| | | import org.jeecg.modules.tms.service.IOutStoreDetailService; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import com.alibaba.fastjson.JSON; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | * @Description: å·¥å
·åºåºæµæ°´ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-05-23 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="å·¥å
·åºåºæµæ°´") |
| | | @RestController |
| | | @RequestMapping("/tms/outStoreDetail") |
| | | @Slf4j |
| | | public class OutStoreDetailController extends JeecgController<OutStoreDetail, IOutStoreDetailService> { |
| | | @Autowired |
| | | private IOutStoreDetailService outStoreDetailService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param outStoreDetail |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "å·¥å
·åºåºæµæ°´-å页å表æ¥è¯¢") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-å页å表æ¥è¯¢", notes="å·¥å
·åºåºæµæ°´-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<OutStoreDetailVo>> queryPageList(OutStoreDetail outStoreDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | Map<String, String[]> parameterMap = req.getParameterMap(); |
| | | QueryWrapper<OutStoreDetail> queryWrapper = QueryGenerator.initQueryWrapper(outStoreDetail, parameterMap); |
| | | Page<OutStoreDetailVo> page = new Page<>(pageNo, pageSize); |
| | | IPage<OutStoreDetailVo> pageList = outStoreDetailService.queryPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param outStoreDetail |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å·¥å
·åºåºæµæ°´-æ·»å ") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-æ·»å ", notes="å·¥å
·åºåºæµæ°´-æ·»å ") |
| | | //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody OutStoreDetail outStoreDetail) { |
| | | outStoreDetailService.save(outStoreDetail); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param outStoreDetail |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å·¥å
·åºåºæµæ°´-ç¼è¾") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-ç¼è¾", notes="å·¥å
·åºåºæµæ°´-ç¼è¾") |
| | | //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody OutStoreDetail outStoreDetail) { |
| | | outStoreDetailService.updateById(outStoreDetail); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å·¥å
·åºåºæµæ°´-éè¿idå é¤") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-éè¿idå é¤", notes="å·¥å
·åºåºæµæ°´-éè¿idå é¤") |
| | | //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | outStoreDetailService.removeById(id); |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å·¥å
·åºåºæµæ°´-æ¹éå é¤") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-æ¹éå é¤", notes="å·¥å
·åºåºæµæ°´-æ¹éå é¤") |
| | | //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.outStoreDetailService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("æ¹éå 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "å·¥å
·åºåºæµæ°´-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value="å·¥å
·åºåºæµæ°´-éè¿idæ¥è¯¢", notes="å·¥å
·åºåºæµæ°´-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<OutStoreDetail> queryById(@RequestParam(name="id",required=true) String id) { |
| | | OutStoreDetail outStoreDetail = outStoreDetailService.getById(id); |
| | | if(outStoreDetail==null) { |
| | | return Result.error("æªæ¾å°å¯¹åºæ°æ®"); |
| | | } |
| | | return Result.OK(outStoreDetail); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request) { |
| | | // Step.1 ç»è£
æ¥è¯¢æ¡ä»¶ |
| | | Map<String, String[]> parameterMap = request.getParameterMap(); |
| | | Page<OutStoreDetailVo> page = new Page<>(1, 1000000); |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | // Step.2 è·åå¯¼åºæ°æ® |
| | | IPage<OutStoreDetailVo> pageList = outStoreDetailService.queryPageList(page, parameterMap); |
| | | List<OutStoreDetailVo> exportList = pageList.getRecords(); |
| | | |
| | | // Step.3 AutoPoi 导åºExcel |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | //æ¤å¤è®¾ç½®çfilenameæ æ ,å端ä¼éæ´æ°è®¾ç½®ä¸ä¸ |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "å·¥å
·åºåºæµæ°´"); |
| | | mv.addObject(NormalExcelConstants.CLASS, OutStoreDetailVo.class); |
| | | //update-begin--Author:liusq Date:20210126 forï¼å¾çå¯¼åºæ¥éï¼ImageBasePathæªè®¾ç½®-------------------- |
| | | ExportParams exportParams=new ExportParams("å·¥å
·åºåºæµæ°´" + "æ¥è¡¨", "导åºäºº:" + sysUser.getRealname(), "å·¥å
·åºåºæµæ°´"); |
| | | //update-end--Author:liusq Date:20210126 forï¼å¾çå¯¼åºæ¥éï¼ImageBasePathæªè®¾ç½®---------------------- |
| | | mv.addObject(NormalExcelConstants.PARAMS,exportParams); |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, exportList); |
| | | return mv; |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("tms_out_store_detail:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, OutStoreDetail.class); |
| | | } |
| | | |
| | | /** |
| | | * å·¥å
·å°è´¦-åºåºå页é¢å表æ¥è¯¢ |
| | | * |
| | | * @param outStoreDetail |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="å·¥å
·å°è´¦-åºåºå页é¢å表æ¥è¯¢", notes="å·¥å
·å°è´¦-åºåºå页é¢å表æ¥è¯¢") |
| | | @GetMapping(value = "/outStoreDetailList") |
| | | public Result<?> outStoreDetailList(OutStoreDetail outStoreDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | @RequestParam Map<String, String> query) { |
| | | IPage<Map<String, Object>> pageList = outStoreDetailService.outStoreDetailList(pageNo,pageSize, query); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | } |