package org.jeecg.modules.mdc.controller; import com.alibaba.fastjson.JSONObject; 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.commons.lang3.StringUtils; 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.modules.mdc.entity.MdcShift; import org.jeecg.modules.mdc.service.IMdcShiftService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; /** * @Description: 班制表(主表) * @Author: Sake * @Date: 2023-04-03 14:40 */ @Slf4j @Api(tags = "班制表(主表)") @RestController @RequestMapping("/mdc/mdcMdcShift") public class MdcShiftController extends JeecgController { @Resource private IMdcShiftService mdcShiftService; /** * 班制表(主表)-分页查询 * * @param mdcShift * @param pageNo * @param pageSize * @return */ @AutoLog("班制表(主表)-分页查询") @ApiOperation(value = "班制表(主表)-分页查询", notes = "班制表(主表)-分页查询") @GetMapping("/queryPageList") public Result queryPageList(MdcShift mdcShift, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { Page page = new Page(pageNo, pageSize); IPage mdcShiftIPage = mdcShiftService.queryPageList(page, mdcShift); return Result.OK(mdcShiftIPage); } /** * 班制表(主表)-新增(班制名重复校验/状态默认为启用) * * @param mdcShift * @return */ @AutoLog("班制表(主表)-新增") @ApiOperation(value = "班制表(主表)-新增(班制名重复校验/状态默认为启用)", notes = "班制表(主表)-新增(班制名重复校验/状态默认为启用)") @PostMapping("/addShift") public Result addShift(@RequestBody MdcShift mdcShift) { Boolean flag = mdcShiftService.addShift(mdcShift); return flag ? Result.OK("新增成功") : Result.error("班制名重复"); } /** * 班制表(主表)-修改 * * @param mdcShift * @return */ @AutoLog("班制表(主表)-修改") @ApiOperation(value = "班制表(主表)-修改", notes = "班制表(主表)-修改") @PutMapping("/editShift") public Result editShift(@RequestBody MdcShift mdcShift) { Boolean flag = mdcShiftService.editShift(mdcShift); return flag ? Result.OK("修改成功") : Result.error("数据库无该数据"); } /** * 根据id修改 * * @param * @return */ @AutoLog("班制表(主表)-根据id修改状态") @ApiOperation(value = "班制表(主表)-根据id修改状态", notes = "班制表(主表)-根据id修改状态") @PutMapping("/changeStatus") public Result changeStatus(@RequestBody JSONObject jsonObject) { Boolean flag = mdcShiftService.changeStatus(jsonObject); return flag ? Result.OK("修改成功") : Result.error("数据库无该数据"); } /** * 班制表(主表)-根据id删除 * * @param id * @return */ @AutoLog("班制表(主表)-根据id删除") @ApiOperation(value = "班制表(主表)-根据id删除", notes = "班制表(主表)-根据id删除") @DeleteMapping("/deleteShift") public Result deleteShift(@RequestParam(name = "id", required = true) String id) { return mdcShiftService.deleteShift(id); } /** * 班制表(主表)-加载班制下拉选项 */ @AutoLog("班制表(主表)-加载班制下拉选项") @ApiOperation(value = "班制表(主表)-加载班制下拉选项", notes = "班制表(主表)-加载班制下拉选项") @GetMapping("/initShiftList") public Result>> initShiftList() { List> result = mdcShiftService.initShiftList(); return Result.OK(result); } /** * 设置默认班制 * * @param id * @return */ @AutoLog("班制表(主表)-设置默认班制") @ApiOperation(value = "班制表(主表)-设置默认班制", notes = "班制表(主表)-设置默认班制") @PostMapping("/changeDefaultShift") public Result changeDefaultShift(@RequestParam(name = "id", required = true) String id) { boolean result = mdcShiftService.changeDefaultShift(id); return result ? Result.OK("设置成功!") : Result.error("设置失败!"); } }