From 79c9bdb60e200d2f9e70ee83fc6e6a0890720d0d Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Thu, 7 Mar 2024 15:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=8A=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KcTingkeBmdController.java | 262 ++++++++++++++++++ .../kc/kcTingkeBmd/entity/KcTingkeBmd.java | 69 +++++ .../kcTingkeBmd/entity/KcTingkeBmdKcxx.java | 83 ++++++ .../mapper/KcTingkeBmdKcxxMapper.java | 31 +++ .../kcTingkeBmd/mapper/KcTingkeBmdMapper.java | 17 ++ .../mapper/xml/KcTingkeBmdKcxxMapper.xml | 16 ++ .../mapper/xml/KcTingkeBmdMapper.xml | 5 + .../service/IKcTingkeBmdKcxxService.java | 22 ++ .../service/IKcTingkeBmdService.java | 48 ++++ .../impl/KcTingkeBmdKcxxServiceImpl.java | 27 ++ .../service/impl/KcTingkeBmdServiceImpl.java | 78 ++++++ .../kc/kcTingkeBmd/vo/KcTingkeBmdPage.java | 70 +++++ .../controller/KcKetangbiaoController.java | 6 + .../modules/kc/ktgl/entity/KcKetangbiao.java | 2 + .../kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml | 3 + .../service/impl/KcKetangbiaoServiceImpl.java | 24 ++ 16 files changed, 763 insertions(+) create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/controller/KcTingkeBmdController.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmd.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmdKcxx.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdKcxxMapper.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdMapper.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdKcxxMapper.xml create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdMapper.xml create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdKcxxService.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdService.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdKcxxServiceImpl.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdServiceImpl.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/vo/KcTingkeBmdPage.java diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/controller/KcTingkeBmdController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/controller/KcTingkeBmdController.java new file mode 100644 index 00000000..ab7c4454 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/controller/KcTingkeBmdController.java @@ -0,0 +1,262 @@ +package org.jeecg.modules.kc.kcTingkeBmd.controller; + +import java.io.UnsupportedEncodingException; +import java.io.IOException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +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.vo.LoginUser; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import org.jeecg.modules.kc.kcTingkeBmd.vo.KcTingkeBmdPage; +import org.jeecg.modules.kc.kcTingkeBmd.service.IKcTingkeBmdService; +import org.jeecg.modules.kc.kcTingkeBmd.service.IKcTingkeBmdKcxxService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +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 com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + + /** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@Api(tags="听课白名单教师信息") +@RestController +@RequestMapping("/kcTingkeBmd/kcTingkeBmd") +@Slf4j +public class KcTingkeBmdController { + @Autowired + private IKcTingkeBmdService kcTingkeBmdService; + @Autowired + private IKcTingkeBmdKcxxService kcTingkeBmdKcxxService; + + /** + * 分页列表查询 + * + * @param kcTingkeBmd + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "听课白名单教师信息-分页列表查询") + @ApiOperation(value="听课白名单教师信息-分页列表查询", notes="听课白名单教师信息-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(KcTingkeBmd kcTingkeBmd, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(kcTingkeBmd, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = kcTingkeBmdService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param kcTingkeBmdPage + * @return + */ + @AutoLog(value = "听课白名单教师信息-添加") + @ApiOperation(value="听课白名单教师信息-添加", notes="听课白名单教师信息-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody KcTingkeBmdPage kcTingkeBmdPage) { + KcTingkeBmd kcTingkeBmd = new KcTingkeBmd(); + BeanUtils.copyProperties(kcTingkeBmdPage, kcTingkeBmd); + kcTingkeBmdService.saveMain(kcTingkeBmd, kcTingkeBmdPage.getKcTingkeBmdKcxxList()); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param kcTingkeBmdPage + * @return + */ + @AutoLog(value = "听课白名单教师信息-编辑") + @ApiOperation(value="听课白名单教师信息-编辑", notes="听课白名单教师信息-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody KcTingkeBmdPage kcTingkeBmdPage) { + KcTingkeBmd kcTingkeBmd = new KcTingkeBmd(); + BeanUtils.copyProperties(kcTingkeBmdPage, kcTingkeBmd); + KcTingkeBmd kcTingkeBmdEntity = kcTingkeBmdService.getById(kcTingkeBmd.getId()); + if(kcTingkeBmdEntity==null) { + return Result.error("未找到对应数据"); + } + kcTingkeBmdService.updateMain(kcTingkeBmd, kcTingkeBmdPage.getKcTingkeBmdKcxxList()); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "听课白名单教师信息-通过id删除") + @ApiOperation(value="听课白名单教师信息-通过id删除", notes="听课白名单教师信息-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + kcTingkeBmdService.delMain(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "听课白名单教师信息-批量删除") + @ApiOperation(value="听课白名单教师信息-批量删除", notes="听课白名单教师信息-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.kcTingkeBmdService.delBatchMain(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "听课白名单教师信息-通过id查询") + @ApiOperation(value="听课白名单教师信息-通过id查询", notes="听课白名单教师信息-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + KcTingkeBmd kcTingkeBmd = kcTingkeBmdService.getById(id); + if(kcTingkeBmd==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(kcTingkeBmd); + + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "分配的课程通过主表ID查询") + @ApiOperation(value="分配的课程主表ID查询", notes="分配的课程-通主表ID查询") + @GetMapping(value = "/queryKcTingkeBmdKcxxByMainId") + public Result> queryKcTingkeBmdKcxxListByMainId(@RequestParam(name="id",required=true) String id) { + List kcTingkeBmdKcxxList = kcTingkeBmdKcxxService.selectByMainId(id); + return Result.OK(kcTingkeBmdKcxxList); + } + + /** + * 导出excel + * + * @param request + * @param kcTingkeBmd + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, KcTingkeBmd kcTingkeBmd) { + // Step.1 组装查询条件查询数据 + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(kcTingkeBmd, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //配置选中数据查询条件 + String selections = request.getParameter("selections"); + if(oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + queryWrapper.in("id",selectionList); + } + //Step.2 获取导出数据 + List kcTingkeBmdList = kcTingkeBmdService.list(queryWrapper); + + // Step.3 组装pageList + List pageList = new ArrayList(); + for (KcTingkeBmd main : kcTingkeBmdList) { + KcTingkeBmdPage vo = new KcTingkeBmdPage(); + BeanUtils.copyProperties(main, vo); + List kcTingkeBmdKcxxList = kcTingkeBmdKcxxService.selectByMainId(main.getId()); + vo.setKcTingkeBmdKcxxList(kcTingkeBmdKcxxList); + pageList.add(vo); + } + + // Step.4 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "听课白名单教师信息列表"); + mv.addObject(NormalExcelConstants.CLASS, KcTingkeBmdPage.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("听课白名单教师信息数据", "导出人:"+sysUser.getRealname(), "听课白名单教师信息")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("kcTingkeBmd:kc_tingke_bmd:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + // 获取上传文件对象 + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), KcTingkeBmdPage.class, params); + for (KcTingkeBmdPage page : list) { + KcTingkeBmd po = new KcTingkeBmd(); + BeanUtils.copyProperties(page, po); + kcTingkeBmdService.saveMain(po, page.getKcTingkeBmdKcxxList()); + } + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + log.error(e.getMessage(),e); + return Result.error("文件导入失败:"+e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.OK("文件导入失败!"); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmd.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmd.java new file mode 100644 index 00000000..16ea3636 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmd.java @@ -0,0 +1,69 @@ +package org.jeecg.modules.kc.kcTingkeBmd.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@ApiModel(value="kc_tingke_bmd对象", description="听课白名单教师信息") +@Data +@TableName("kc_tingke_bmd") +public class KcTingkeBmd implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**sysOrgCode*/ + @ApiModelProperty(value = "sysOrgCode") + private java.lang.String sysOrgCode; + /**教工号*/ + @Excel(name = "教工号", width = 15) + @ApiModelProperty(value = "教工号") + private java.lang.String jgh; + /**教师姓名*/ + @Excel(name = "教师姓名", width = 15) + @ApiModelProperty(value = "教师姓名") + private java.lang.String jsxm; + /**所属学院*/ + @Excel(name = "所属学院", width = 15) + @ApiModelProperty(value = "所属学院") + private java.lang.String ssxy; + /**学年学期*/ + @Excel(name = "学年学期", width = 15) + @ApiModelProperty(value = "学年学期") + private java.lang.String xnxq; +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmdKcxx.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmdKcxx.java new file mode 100644 index 00000000..a67e5c6a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/entity/KcTingkeBmdKcxx.java @@ -0,0 +1,83 @@ +package org.jeecg.modules.kc.kcTingkeBmd.entity; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import java.util.Date; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.UnsupportedEncodingException; + +/** + * @Description: 分配的课程 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@ApiModel(value="kc_tingke_bmd_kcxx对象", description="分配的课程") +@Data +@TableName("kc_tingke_bmd_kcxx") +public class KcTingkeBmdKcxx implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**sysOrgCode*/ + @ApiModelProperty(value = "sysOrgCode") + private java.lang.String sysOrgCode; + /**白名单id*/ + @ApiModelProperty(value = "白名单id") + private java.lang.String bmdId; + /**课程名称*/ + @Excel(name = "课程名称", width = 15) + @ApiModelProperty(value = "课程名称") + private java.lang.String kcmc; + /**授课教师*/ + @Excel(name = "授课教师", width = 15) + @ApiModelProperty(value = "授课教师") + private java.lang.String skjs; + /**授课地点*/ + @Excel(name = "授课地点", width = 15) + @ApiModelProperty(value = "授课地点") + private java.lang.String skdd; + /**节次*/ + @Excel(name = "节次", width = 15) + @ApiModelProperty(value = "节次") + private java.lang.String hh; + /**授课日期*/ + @Excel(name = "授课日期", width = 15) + @ApiModelProperty(value = "授课日期") + private java.lang.String skrq; + /**学年学期*/ + @Excel(name = "学年学期", width = 15) + @ApiModelProperty(value = "学年学期") + private java.lang.String xnxq; + /**教工号*/ + @Excel(name = "教工号", width = 15) + @ApiModelProperty(value = "教工号") + private java.lang.String jgh; +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdKcxxMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdKcxxMapper.java new file mode 100644 index 00000000..2d857b2a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdKcxxMapper.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.kc.kcTingkeBmd.mapper; + +import java.util.List; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Description: 分配的课程 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +public interface KcTingkeBmdKcxxMapper extends BaseMapper { + + /** + * 通过主表id删除子表数据 + * + * @param mainId 主表id + * @return boolean + */ + public boolean deleteByMainId(@Param("mainId") String mainId); + + /** + * 通过主表id查询子表数据 + * + * @param mainId 主表id + * @return List + */ + public List selectByMainId(@Param("mainId") String mainId); +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdMapper.java new file mode 100644 index 00000000..0b969c1c --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/KcTingkeBmdMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.kc.kcTingkeBmd.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +public interface KcTingkeBmdMapper extends BaseMapper { + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdKcxxMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdKcxxMapper.xml new file mode 100644 index 00000000..1bc6ddd1 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdKcxxMapper.xml @@ -0,0 +1,16 @@ + + + + + + DELETE + FROM kc_tingke_bmd_kcxx + WHERE + bmd_id = #{mainId} + + + diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdMapper.xml new file mode 100644 index 00000000..3c8fcf10 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/mapper/xml/KcTingkeBmdMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdKcxxService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdKcxxService.java new file mode 100644 index 00000000..d626a6d6 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdKcxxService.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.kc.kcTingkeBmd.service; + +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 分配的课程 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +public interface IKcTingkeBmdKcxxService extends IService { + + /** + * 通过主表id查询子表数据 + * + * @param mainId 主表id + * @return List + */ + public List selectByMainId(String mainId); +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdService.java new file mode 100644 index 00000000..0e205871 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/IKcTingkeBmdService.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.kc.kcTingkeBmd.service; + +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import com.baomidou.mybatisplus.extension.service.IService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; + +/** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +public interface IKcTingkeBmdService extends IService { + + /** + * 添加一对多 + * + * @param kcTingkeBmd + * @param kcTingkeBmdKcxxList + */ + public void saveMain(KcTingkeBmd kcTingkeBmd,List kcTingkeBmdKcxxList) ; + + /** + * 修改一对多 + * + * @param kcTingkeBmd + * @param kcTingkeBmdKcxxList + */ + public void updateMain(KcTingkeBmd kcTingkeBmd,List kcTingkeBmdKcxxList); + + /** + * 删除一对多 + * + * @param id + */ + public void delMain (String id); + + /** + * 批量删除一对多 + * + * @param idList + */ + public void delBatchMain (Collection idList); + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdKcxxServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdKcxxServiceImpl.java new file mode 100644 index 00000000..aa6ebdee --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdKcxxServiceImpl.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.kc.kcTingkeBmd.service.impl; + +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdKcxxMapper; +import org.jeecg.modules.kc.kcTingkeBmd.service.IKcTingkeBmdKcxxService; +import org.springframework.stereotype.Service; +import java.util.List; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description: 分配的课程 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@Service +public class KcTingkeBmdKcxxServiceImpl extends ServiceImpl implements IKcTingkeBmdKcxxService { + + @Autowired + private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper; + + @Override + public List selectByMainId(String mainId) { + return kcTingkeBmdKcxxMapper.selectByMainId(mainId); + } +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdServiceImpl.java new file mode 100644 index 00000000..3800ac61 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/service/impl/KcTingkeBmdServiceImpl.java @@ -0,0 +1,78 @@ +package org.jeecg.modules.kc.kcTingkeBmd.service.impl; + +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdKcxxMapper; +import org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdMapper; +import org.jeecg.modules.kc.kcTingkeBmd.service.IKcTingkeBmdService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import java.io.Serializable; +import java.util.List; +import java.util.Collection; + +/** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@Service +public class KcTingkeBmdServiceImpl extends ServiceImpl implements IKcTingkeBmdService { + + @Autowired + private KcTingkeBmdMapper kcTingkeBmdMapper; + @Autowired + private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveMain(KcTingkeBmd kcTingkeBmd, List kcTingkeBmdKcxxList) { + kcTingkeBmdMapper.insert(kcTingkeBmd); + if(kcTingkeBmdKcxxList!=null && kcTingkeBmdKcxxList.size()>0) { + for(KcTingkeBmdKcxx entity:kcTingkeBmdKcxxList) { + //外键设置 + entity.setId(null); + entity.setBmdId(kcTingkeBmd.getId()); + kcTingkeBmdKcxxMapper.insert(entity); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateMain(KcTingkeBmd kcTingkeBmd,List kcTingkeBmdKcxxList) { + kcTingkeBmdMapper.updateById(kcTingkeBmd); + + //1.先删除子表数据 + kcTingkeBmdKcxxMapper.deleteByMainId(kcTingkeBmd.getId()); + + //2.子表数据重新插入 + if(kcTingkeBmdKcxxList!=null && kcTingkeBmdKcxxList.size()>0) { + for(KcTingkeBmdKcxx entity:kcTingkeBmdKcxxList) { + //外键设置 + entity.setBmdId(kcTingkeBmd.getId()); + kcTingkeBmdKcxxMapper.insert(entity); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delMain(String id) { + kcTingkeBmdKcxxMapper.deleteByMainId(id); + kcTingkeBmdMapper.deleteById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delBatchMain(Collection idList) { + for(Serializable id:idList) { + kcTingkeBmdKcxxMapper.deleteByMainId(id.toString()); + kcTingkeBmdMapper.deleteById(id); + } + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/vo/KcTingkeBmdPage.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/vo/KcTingkeBmdPage.java new file mode 100644 index 00000000..d67307a3 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcTingkeBmd/vo/KcTingkeBmdPage.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.kc.kcTingkeBmd.vo; + +import java.util.List; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelEntity; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 听课白名单教师信息 + * @Author: jeecg-boot + * @Date: 2024-03-07 + * @Version: V1.0 + */ +@Data +@ApiModel(value="kc_tingke_bmdPage对象", description="听课白名单教师信息") +public class KcTingkeBmdPage { + + /**id*/ + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**sysOrgCode*/ + @ApiModelProperty(value = "sysOrgCode") + private java.lang.String sysOrgCode; + /**教工号*/ + @Excel(name = "教工号", width = 15) + @ApiModelProperty(value = "教工号") + private java.lang.String jgh; + /**教师姓名*/ + @Excel(name = "教师姓名", width = 15) + @ApiModelProperty(value = "教师姓名") + private java.lang.String jsxm; + /**所属学院*/ + @Excel(name = "所属学院", width = 15) + @ApiModelProperty(value = "所属学院") + private java.lang.String ssxy; + /**学年学期*/ + @Excel(name = "学年学期", width = 15) + @ApiModelProperty(value = "学年学期") + private java.lang.String xnxq; + + @ExcelCollection(name="分配的课程") + @ApiModelProperty(value = "分配的课程") + private List kcTingkeBmdKcxxList; + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java index 6b380c68..e7cac616 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKetangbiaoController.java @@ -132,6 +132,12 @@ public class KcKetangbiaoController extends JeecgController= } + if(StringUtils.isNotEmpty(kcKetangbiao.getStartTime())){ + queryWrapper.ge("skrq",kcKetangbiao.getStartTime());//<= + } + if(StringUtils.isNotEmpty(kcKetangbiao.getEndTime())){ + queryWrapper.le("skrq",kcKetangbiao.getEndTime());//>= + } queryWrapper.apply(StringUtils.isNotBlank(kcKetangbiao.getYwmc())," (skjs like '%"+kcKetangbiao.getYwmc()+"%' or kcmc like '%"+kcKetangbiao.getYwmc()+"%')"); queryWrapper.ne(StringUtils.isNotBlank(kcKetangbiao.getYwskxs()),"skxs",kcKetangbiao.getYwskxs()); Page page = new Page(pageNo, pageSize); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java index b68817b4..213084d3 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/entity/KcKetangbiao.java @@ -324,4 +324,6 @@ public class KcKetangbiao implements Serializable { @TableField(exist = false) private String zhjs; + @TableField(exist = false) + private String bmdId; } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml index 44652411..709690cc 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml @@ -99,6 +99,9 @@ and IF(tkxx.kcmc is null,'0','1') = 0 + + and (ktb.kcmc,ktb.skjs,ktb.skdd,ktb.hh,ktb.skrq) in (select kcmc,skjs,skdd,hh,skrq from kc_tingke_bmd_kcxx where bmd_id in (${kcKetangbiao.bmdId})) + order by ktb.hh asc,kkdw.id asc,IF(tkxx.kcmc is null,'0','1') asc diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java index c678b85e..0608d154 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java @@ -3,10 +3,16 @@ package org.jeecg.modules.kc.ktgl.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmd; +import org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdKcxxMapper; +import org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdMapper; import org.jeecg.modules.kc.ktgl.entity.KcKetangbiao; import org.jeecg.modules.kc.ktgl.entity.KcKetangbiaoNum; import org.jeecg.modules.kc.ktgl.mapper.KcKetangbiaoMapper; import org.jeecg.modules.kc.ktgl.service.IKcKetangbiaoService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -23,8 +29,26 @@ import java.util.Map; @Service public class KcKetangbiaoServiceImpl extends ServiceImpl implements IKcKetangbiaoService { + @Autowired + private KcTingkeBmdMapper kcTingkeBmdMapper; + @Autowired + private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper; + @Override public IPage getKclblist(Page page, KcKetangbiao kcKetangbiao) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //获取当前用户是否有白名单权限 + QueryWrapper kcTingkeBmdQueryWrapper = new QueryWrapper<>(); + kcTingkeBmdQueryWrapper.eq("jgh",user.getUsername()); + List list = kcTingkeBmdMapper.selectList(kcTingkeBmdQueryWrapper); + String bmdId = ""; + for(int i = 0; i < list.size(); i++){ + bmdId = list.get(i).getId()+","; + } + if(bmdId.indexOf(",")>-1){ + bmdId = bmdId.substring(0,bmdId.length()-1); + } + kcKetangbiao.setBmdId(bmdId); return baseMapper.getKclblist(page,kcKetangbiao); }