添加查询语句

This commit is contained in:
yangjun 2024-05-13 20:13:46 +08:00
parent 327f102b65
commit eaf943a0bd
15 changed files with 149 additions and 36 deletions

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import java.util.List;
/**
* @Description: 同步数据表bks
* @Author: jeecg-boot
@ -19,4 +21,6 @@ public interface XxhbbksMapper extends BaseMapper<Xxhbbks> {
Xxhbbks getSumnum();
IPage<Xxhbbks> getXsxkbList(Page<Xxhbbks> page,@Param(Constants.WRAPPER) QueryWrapper<Xxhbbks> queryWrapper);
List<Xxhbbks> getXsxkbAllList(@Param(Constants.WRAPPER) QueryWrapper<Xxhbbks> queryWrapper);
}

View File

@ -14,4 +14,8 @@
</select>
<select id="getXsxkbAllList" resultType="org.jeecg.modules.kc.grab.imports.entity.Xxhbbks">
select a.* from xxhbbks a ,xxhbxsxkb b
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import java.util.Collection;
import java.util.List;
/**
* @Description: 同步数据表bks
@ -34,4 +35,6 @@ public interface IXxhbbksService extends IService<Xxhbbks> {
Xxhbbks getSumnum();
IPage<Xxhbbks> getXsxkbList(Page<Xxhbbks> page, QueryWrapper<Xxhbbks> queryWrapper);
List<Xxhbbks> getXsxkbAllList(QueryWrapper<Xxhbbks> queryWrapper);
}

View File

@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List;
/**
* @Description: 同步数据表bks
@ -46,4 +47,9 @@ public class XxhbbksServiceImpl extends ServiceImpl<XxhbbksMapper, Xxhbbks> impl
public IPage<Xxhbbks> getXsxkbList(Page<Xxhbbks> page, QueryWrapper<Xxhbbks> queryWrapper) {
return baseMapper.getXsxkbList(page, queryWrapper);
}
@Override
public List<Xxhbbks> getXsxkbAllList(QueryWrapper<Xxhbbks> queryWrapper) {
return baseMapper.getXsxkbAllList(queryWrapper);
}
}

View File

@ -12,10 +12,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
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.DateUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbbks;
import org.jeecg.modules.kc.grab.imports.service.IXxhbbksService;
import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig;
import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService;
import org.jeecg.modules.kc.kcXqxnHistory.entity.KcXqxnHistory;
@ -30,6 +34,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent;
import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -60,11 +66,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
@Autowired
private IZyInfoService zyInfoService;
@Autowired
private IKcSysConfigService kcSysConfigService;
@Autowired
private IKcKechengbiaoService kcKechengbiaoService;
@Autowired
private IXxhbbksService xxhbbksService;
@Autowired
private IZyInfoStudentService zyInfoStudentService;
/**
* 分页列表查询
*
@ -81,15 +90,7 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyInfo> queryWrapper = QueryGenerator.initQueryWrapper(zyInfo, req.getParameterMap());
if(StringUtils.isNotEmpty(zyInfo.getSflssj())){
String date = DateUtils.formatDate(new Date(),"yyyy-MM-dd");
if(StringUtils.equals("0",zyInfo.getSflssj())){//不是历史
queryWrapper.ge("end_time",date);
}else{//历史作业
queryWrapper.lt("end_time",date);
}
}
QueryWrapper<ZyInfo> queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfo, req.getParameterMap());
Page<ZyInfo> page = new Page<ZyInfo>(pageNo, pageSize);
IPage<ZyInfo> pageList = zyInfoService.page(page, queryWrapper);
return Result.OK(pageList);
@ -132,6 +133,28 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
return Result.OK("编辑成功!");
}
@ApiOperation(value="作业发布-通过id查询", notes="作业发布-通过id查询")
@GetMapping(value = "/editStudent")
public Result<ZyInfo> editStudent(@RequestParam(name="id",required=true) String id) {
ZyInfo zyInfo = zyInfoService.getById(id);
if(zyInfo!=null) {
zyInfo = zyInfoService.getById(zyInfo.getId());
QueryWrapper<Xxhbbks> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("a.xh = b.xh");
queryWrapper.eq("b.KCAPZBBH",zyInfo.getRwbh());
List<Xxhbbks> list = xxhbbksService.getXsxkbAllList(queryWrapper);
zyInfoStudentService.deleteMainId(zyInfo.getId());
for(Xxhbbks xxhbbks:list){
ZyInfoStudent zyInfoStudent = new ZyInfoStudent();
zyInfoStudent.setMainId(zyInfo.getId());
zyInfoStudent.setCreateBy(xxhbbks.getXh());
zyInfoStudent.setStudentName(xxhbbks.getXm());
zyInfoStudentService.save(zyInfoStudent);
}
}
return Result.OK(zyInfo);
}
/**
* 通过id删除
*
@ -203,4 +226,20 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
return super.importExcel(request, response, ZyInfo.class);
}
@ApiOperation(value="作业发布-分页列表查询", notes="作业发布-分页列表查询")
@GetMapping(value = "/stuList")
public Result<IPage<ZyInfo>> stuList(ZyInfo zyInfo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyInfo> queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfo, req.getParameterMap());
Page<ZyInfo> page = new Page<ZyInfo>(pageNo, pageSize);
queryWrapper.apply("a.id = b.main_id ");
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("b.create_by",sysUser.getUsername());
IPage<ZyInfo> pageList = zyInfoService.stuList(page, queryWrapper);
return Result.OK(pageList);
}
}

View File

@ -119,4 +119,15 @@ public class ZyInfo implements Serializable {
@TableField(exist = false)
private String sflssj;//是否历史数据
@TableField(exist = false)
private String stuId;
@TableField(exist = false)
private String stuFilePath;
@TableField(exist = false)
private String score;
@TableField(exist = false)
private String wtjnum;
@TableField(exist = false)
private String ytjnum;
}

View File

@ -2,6 +2,10 @@ package org.jeecg.modules.kc.zyInfo.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.kc.zyInfo.entity.ZyInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ZyInfoMapper extends BaseMapper<ZyInfo> {
IPage<ZyInfo> stuList(Page<ZyInfo> page,@Param(Constants.WRAPPER) QueryWrapper<ZyInfo> queryWrapper);
}

View File

@ -2,4 +2,23 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.zyInfo.mapper.ZyInfoMapper">
<select id="stuList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfo">
select a.*,b.id as stuId ,b.file_path as stuFilePath,b.score
from zy_info a ,zy_info_student b
${ew.customSqlSegment}
</select>
<select id="selectPage" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfo">
SELECT
id, create_by, create_time, update_by, update_time, title, zy_type,
content, start_time, end_time, zy_status, xnxq,
wwcc, wwtgl, nwcc, nwtgl, aigccc, aigctgl, rwbh, file_path, xkxs,
b.num as wtjnum,c.num as ytjnum
FROM
zy_info a
left join (select count(*) as num,main_id from zy_info_student where file_path is null GROUP BY main_id ) b on a.id = b.main_id
left join (select count(*) as num,main_id from zy_info_student where file_path is not null GROUP BY main_id) c on a.id = c.main_id
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -1,5 +1,8 @@
package org.jeecg.modules.kc.zyInfo.service;
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.jeecg.modules.kc.zyInfo.entity.ZyInfo;
import com.baomidou.mybatisplus.extension.service.IService;
@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IZyInfoService extends IService<ZyInfo> {
IPage<ZyInfo> stuList(Page<ZyInfo> page, QueryWrapper<ZyInfo> queryWrapper);
}

View File

@ -1,5 +1,8 @@
package org.jeecg.modules.kc.zyInfo.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.jeecg.modules.kc.zyInfo.entity.ZyInfo;
import org.jeecg.modules.kc.zyInfo.mapper.ZyInfoMapper;
import org.jeecg.modules.kc.zyInfo.service.IZyInfoService;
@ -16,4 +19,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> implements IZyInfoService {
@Override
public IPage<ZyInfo> stuList(Page<ZyInfo> page, QueryWrapper<ZyInfo> queryWrapper) {
return baseMapper.stuList(page, queryWrapper);
}
}

View File

@ -83,6 +83,7 @@ public class ZyInfoStudent implements Serializable {
@ApiModelProperty(value = "aigc是否通过")
private java.lang.String aigcsftg;
private java.lang.String studentName;
private java.lang.String score;
@TableField(exist = false)
private String catename;

View File

@ -14,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ZyInfoStudentMapper extends BaseMapper<ZyInfoStudent> {
void deleteMainId(@Param("mainId") String id);
}

View File

@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.zyInfoStudent.mapper.ZyInfoStudentMapper">
<delete id="deleteMainId">
delete from zy_info_student where main_id = #{mainId}
</delete>
</mapper>

View File

@ -12,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface IZyInfoStudentService extends IService<ZyInfoStudent> {
public boolean save(ZyInfoStudent zyInfoStudent);
void deleteMainId(String id);
}

View File

@ -82,34 +82,38 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
zyInfoStudent.setStudentName(sysUser.getRealname());
baseMapper.insert(zyInfoStudent);
ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId());
String rwbh = zyInfo.getRwbh();
// KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("xqxn",zyInfo.getXnxq());
kcKechengbiaoQueryWrapper.eq("rwbh",rwbh);
kcKechengbiaoQueryWrapper.last("limit 1");
KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
String cateid = kcKechengbiao.getKcbh()+""+kcKechengbiao.getKcmc();
String catename = kcKechengbiao.getKcmc();
zyInfoStudent.setCateid(cateid);
zyInfoStudent.setCatename(catename);
//外网查重及提交检测
if(StringUtils.equals(zyInfo.getWwcc(),"1")){
wwccSave(zyInfoStudent);
}
//内网查重及提交检测
if(StringUtils.equals(zyInfo.getNwcc(),"1")){
nwccSave(zyInfoStudent);
}
//aigc查重及提交检测
if(StringUtils.equals(zyInfo.getAigccc(),"1")){
aigcSave(zyInfoStudent);
}
// ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId());
//
// String rwbh = zyInfo.getRwbh();
// QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
// kcKechengbiaoQueryWrapper.eq("xqxn",zyInfo.getXnxq());
// kcKechengbiaoQueryWrapper.eq("rwbh",rwbh);
// kcKechengbiaoQueryWrapper.last("limit 1");
// KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
// String cateid = kcKechengbiao.getKcbh()+""+kcKechengbiao.getKcmc();
// String catename = kcKechengbiao.getKcmc();
// zyInfoStudent.setCateid(cateid);
// zyInfoStudent.setCatename(catename);
// //外网查重及提交检测
// if(StringUtils.equals(zyInfo.getWwcc(),"1")){
// wwccSave(zyInfoStudent);
// }
// //内网查重及提交检测
// if(StringUtils.equals(zyInfo.getNwcc(),"1")){
// nwccSave(zyInfoStudent);
// }
// //aigc查重及提交检测
// if(StringUtils.equals(zyInfo.getAigccc(),"1")){
// aigcSave(zyInfoStudent);
// }
return true;
}
@Override
public void deleteMainId(String id) {
baseMapper.deleteMainId(id);
}
//aigc提交
private void aigcSave(ZyInfoStudent zyInfoStudent) {
String url = "https://vims.fanyu.com/tool/AIGCCheck/paperSubmit";