From 0a66b4e946ebbe3ac09a193ad5a60cf7a95fe99d Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 26 六月 2025 14:14:48 +0800 Subject: [PATCH] art: 删除base模块无用代码 --- src/main/java/org/jeecg/modules/base/controller/ShiftController.java | 197 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 197 insertions(+), 0 deletions(-) diff --git a/src/main/java/org/jeecg/modules/base/controller/ShiftController.java b/src/main/java/org/jeecg/modules/base/controller/ShiftController.java new file mode 100644 index 0000000..3ad8028 --- /dev/null +++ b/src/main/java/org/jeecg/modules/base/controller/ShiftController.java @@ -0,0 +1,197 @@ +package org.jeecg.modules.base.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 com.alibaba.fastjson.JSONObject; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.base.entity.Shift; +import org.jeecg.modules.base.service.IShiftService; + +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-06-24 + * @Version: V1.0 + */ +@Api(tags="鐝") +@RestController +@RequestMapping("/base/shift") +@Slf4j +public class ShiftController extends JeecgController<Shift, IShiftService> { + @Autowired + private IShiftService shiftService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param shift + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "鐝-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value="鐝-鍒嗛〉鍒楄〃鏌ヨ", notes="鐝-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<Shift>> queryPageList(Shift shift, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<Shift> queryWrapper = QueryGenerator.initQueryWrapper(shift, req.getParameterMap()); + Page<Shift> page = new Page<Shift>(pageNo, pageSize); + IPage<Shift> pageList = shiftService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param shift + * @return + */ + @AutoLog(value = "鐝-娣诲姞") + @ApiOperation(value="鐝-娣诲姞", notes="鐝-娣诲姞") + //@RequiresPermissions("org.jeecg.modules:base_shift:add") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody Shift shift) { + shiftService.save(shift); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param shift + * @return + */ + @AutoLog(value = "鐝-缂栬緫") + @ApiOperation(value="鐝-缂栬緫", notes="鐝-缂栬緫") + //@RequiresPermissions("org.jeecg.modules:base_shift:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody Shift shift) { + shiftService.updateById(shift); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "鐝-閫氳繃id鍒犻櫎") + @ApiOperation(value="鐝-閫氳繃id鍒犻櫎", notes="鐝-閫氳繃id鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:base_shift:delete") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + shiftService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "鐝-鎵归噺鍒犻櫎") + @ApiOperation(value="鐝-鎵归噺鍒犻櫎", notes="鐝-鎵归噺鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:base_shift:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.shiftService.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<Shift> queryById(@RequestParam(name="id",required=true) String id) { + Shift shift = shiftService.getById(id); + if(shift==null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(shift); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param shift + */ + //@RequiresPermissions("org.jeecg.modules:base_shift:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Shift shift) { + return super.exportXls(request, shift, Shift.class, "鐝"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("base_shift:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Shift.class); + } + + /** + * 鐝琛�-鏍规嵁id淇敼鐘舵�� + * + * @param jsonObject + * @return + */ + @AutoLog(value = "鏍规嵁id淇敼鐘舵��") + @ApiOperation(value = "鏍规嵁id淇敼鐘舵��", notes = "鏍规嵁id淇敼鐘舵��") + @PutMapping("/updateStatusById") + public Result<?> updateSubStatusById(@RequestBody JSONObject jsonObject) { + String id = jsonObject.getString("id"); + String status = jsonObject.getString("status"); + Shift shift = shiftService.getById(id); + shift.setShiftStatus(status); + Boolean flag = shiftService.updateById(shift); + return flag ? Result.OK("淇敼鎴愬姛") : Result.error("淇敼澶辫触"); + } + +} -- Gitblit v1.9.3