添加白名单功能及修改bug

This commit is contained in:
yangjun 2024-03-07 15:37:27 +08:00
parent 50ab1a41fe
commit 79c9bdb60e
16 changed files with 763 additions and 0 deletions

View File

@ -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<IPage<KcTingkeBmd>> queryPageList(KcTingkeBmd kcTingkeBmd,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcTingkeBmd> queryWrapper = QueryGenerator.initQueryWrapper(kcTingkeBmd, req.getParameterMap());
Page<KcTingkeBmd> page = new Page<KcTingkeBmd>(pageNo, pageSize);
IPage<KcTingkeBmd> pageList = kcTingkeBmdService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param kcTingkeBmdPage
* @return
*/
@AutoLog(value = "听课白名单教师信息-添加")
@ApiOperation(value="听课白名单教师信息-添加", notes="听课白名单教师信息-添加")
@PostMapping(value = "/add")
public Result<String> 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<String> 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<String> 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<String> 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<KcTingkeBmd> 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<List<KcTingkeBmdKcxx>> queryKcTingkeBmdKcxxListByMainId(@RequestParam(name="id",required=true) String id) {
List<KcTingkeBmdKcxx> 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<KcTingkeBmd> queryWrapper = QueryGenerator.initQueryWrapper(kcTingkeBmd, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//配置选中数据查询条件
String selections = request.getParameter("selections");
if(oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
//Step.2 获取导出数据
List<KcTingkeBmd> kcTingkeBmdList = kcTingkeBmdService.list(queryWrapper);
// Step.3 组装pageList
List<KcTingkeBmdPage> pageList = new ArrayList<KcTingkeBmdPage>();
for (KcTingkeBmd main : kcTingkeBmdList) {
KcTingkeBmdPage vo = new KcTingkeBmdPage();
BeanUtils.copyProperties(main, vo);
List<KcTingkeBmdKcxx> 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<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象
MultipartFile file = entity.getValue();
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<KcTingkeBmdPage> 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("文件导入失败!");
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<KcTingkeBmdKcxx> {
/**
* 通过主表id删除子表数据
*
* @param mainId 主表id
* @return boolean
*/
public boolean deleteByMainId(@Param("mainId") String mainId);
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<KcTingkeBmdKcxx>
*/
public List<KcTingkeBmdKcxx> selectByMainId(@Param("mainId") String mainId);
}

View File

@ -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<KcTingkeBmd> {
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdKcxxMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM kc_tingke_bmd_kcxx
WHERE
bmd_id = #{mainId} </delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.kc.kcTingkeBmd.entity.KcTingkeBmdKcxx">
SELECT *
FROM kc_tingke_bmd_kcxx
WHERE
bmd_id = #{mainId} </select>
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.kcTingkeBmd.mapper.KcTingkeBmdMapper">
</mapper>

View File

@ -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<KcTingkeBmdKcxx> {
/**
* 通过主表id查询子表数据
*
* @param mainId 主表id
* @return List<KcTingkeBmdKcxx>
*/
public List<KcTingkeBmdKcxx> selectByMainId(String mainId);
}

View File

@ -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<KcTingkeBmd> {
/**
* 添加一对多
*
* @param kcTingkeBmd
* @param kcTingkeBmdKcxxList
*/
public void saveMain(KcTingkeBmd kcTingkeBmd,List<KcTingkeBmdKcxx> kcTingkeBmdKcxxList) ;
/**
* 修改一对多
*
* @param kcTingkeBmd
* @param kcTingkeBmdKcxxList
*/
public void updateMain(KcTingkeBmd kcTingkeBmd,List<KcTingkeBmdKcxx> kcTingkeBmdKcxxList);
/**
* 删除一对多
*
* @param id
*/
public void delMain (String id);
/**
* 批量删除一对多
*
* @param idList
*/
public void delBatchMain (Collection<? extends Serializable> idList);
}

View File

@ -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<KcTingkeBmdKcxxMapper, KcTingkeBmdKcxx> implements IKcTingkeBmdKcxxService {
@Autowired
private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper;
@Override
public List<KcTingkeBmdKcxx> selectByMainId(String mainId) {
return kcTingkeBmdKcxxMapper.selectByMainId(mainId);
}
}

View File

@ -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<KcTingkeBmdMapper, KcTingkeBmd> implements IKcTingkeBmdService {
@Autowired
private KcTingkeBmdMapper kcTingkeBmdMapper;
@Autowired
private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(KcTingkeBmd kcTingkeBmd, List<KcTingkeBmdKcxx> 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<KcTingkeBmdKcxx> 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<? extends Serializable> idList) {
for(Serializable id:idList) {
kcTingkeBmdKcxxMapper.deleteByMainId(id.toString());
kcTingkeBmdMapper.deleteById(id);
}
}
}

View File

@ -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<KcTingkeBmdKcxx> kcTingkeBmdKcxxList;
}

View File

@ -132,6 +132,12 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
queryWrapper.ge("skrq",getBxqStartTime());//<=
queryWrapper.le("skrq",getBxqEndTime());//>=
}
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<KcKetangbiao> page = new Page<KcKetangbiao>(pageNo, pageSize);

View File

@ -324,4 +324,6 @@ public class KcKetangbiao implements Serializable {
@TableField(exist = false)
private String zhjs;
@TableField(exist = false)
private String bmdId;
}

View File

@ -99,6 +99,9 @@
<if test="kcKetangbiao.sftkb!=null and kcKetangbiao.sftkb!=''">
and IF(tkxx.kcmc is null,'0','1') = 0
</if>
<if test="kcKetangbiao.bmdId !=null and kcKetangbiao.bmdId !=''">
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}))
</if>
</where>
order by ktb.hh asc,kkdw.id asc,IF(tkxx.kcmc is null,'0','1') asc
</select>

View File

@ -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<KcKetangbiaoMapper, KcKetangbiao> implements IKcKetangbiaoService {
@Autowired
private KcTingkeBmdMapper kcTingkeBmdMapper;
@Autowired
private KcTingkeBmdKcxxMapper kcTingkeBmdKcxxMapper;
@Override
public IPage<KcKetangbiao> getKclblist(Page<KcKetangbiao> page, KcKetangbiao kcKetangbiao) {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//获取当前用户是否有白名单权限
QueryWrapper<KcTingkeBmd> kcTingkeBmdQueryWrapper = new QueryWrapper<>();
kcTingkeBmdQueryWrapper.eq("jgh",user.getUsername());
List<KcTingkeBmd> 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);
}