添加查询

This commit is contained in:
yangjun 2024-05-15 21:12:20 +08:00
parent ab714fc389
commit 0c077de068
6 changed files with 85 additions and 21 deletions

View File

@ -255,6 +255,7 @@ public class KcKechengbiaoController extends JeecgController<KcKechengbiao, IKcK
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("jgh",sysUser.getUsername());
queryWrapper.eq("flag","0");
queryWrapper.orderByAsc("kcmc,week");
Page<KcKechengbiao> page = new Page<KcKechengbiao>(pageNo, pageSize);
IPage<KcKechengbiao> pageList = kcKechengbiaoService.getKechengbiaolist(page, queryWrapper);

View File

@ -28,4 +28,5 @@ public interface WjxDjxxMapper extends BaseMapper<WjxDjxx> {
List<WjxDjxxTmxx> findDjtmxx(@Param("vid")String vid,@Param("jid")String jid);
List<WjxDjxx> findDjjgsPage(Page<WjxDjxx> page, WjxDjxx params);
List<WjxDjxx> findUnDjjgsPage(Page<WjxDjxx> page, WjxDjxx params);
List<WjxDjxx> findAllDjjgsPage(Page<WjxDjxx> page, WjxDjxx params);
}

View File

@ -138,4 +138,17 @@
order by y.xh
</select>
<select id="findAllDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,y.xh as user_id,y.xm as user_name,b.open_time,b.commit_time,b.score,b.total_score,ifnull(b.answer_seconds,-1) as answer_seconds
from wjx_wjxx a
inner join (
select a.xh,a.xm,b.KCAPZBBH
from xxhbbks a
inner join xxhbxsxkb b on a.xh = b.xh and b.KCAPZBBH = #{params.rwbh}
) y
on y.KCAPZBBH = a.rwbh
left join wjx_djxx b on a.vid = b.vid and y.xh = b.user_id
where a.id = #{params.id}
order by b.total_score desc
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx;
@ -329,17 +330,27 @@ public class WjxDjxxServiceImpl extends ServiceImpl<WjxDjxxMapper, WjxDjxx> impl
@Override
public Page<WjxDjxx> findDjjgsPage(WjxDjxx wjxDjxx, Page<WjxDjxx> page){
if(wjxDjxx.getIsFinished().equals("1")){
if(StringUtils.equals("1",wjxDjxx.getIsFinished())){
//完成答卷的
List<WjxDjxx> list = baseMapper.findDjjgsPage(page,wjxDjxx);
for(WjxDjxx djxx:list){
djxx.setAnswerSfm(convertSecondsToHMS(djxx.getAnswerSeconds()));
}
page.setRecords(list);
}else{
}else if(StringUtils.equals("0",wjxDjxx.getIsFinished())){
//未完成答卷的
List<WjxDjxx> list = baseMapper.findUnDjjgsPage(page,wjxDjxx);
page.setRecords(list);
}else{
//全部
List<WjxDjxx> list = baseMapper.findAllDjjgsPage(page,wjxDjxx);
for(WjxDjxx djxx:list){
if(djxx.getAnswerSeconds()!=-1){
djxx.setAnswerSfm(convertSecondsToHMS(djxx.getAnswerSeconds()));
}
}
page.setRecords(list);
}
return page;
}

View File

@ -95,12 +95,12 @@ public class WjxWjxx implements Serializable {
@TableField(exist = false)
private Integer wwcrs;
@ApiModelProperty(value = "开始时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date startTime;
@ApiModelProperty(value = "结束时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date endTime;
@ApiModelProperty(value = "答卷状态标识")
@TableField(exist = false)
@ -111,4 +111,13 @@ public class WjxWjxx implements Serializable {
@ApiModelProperty(value = "答卷ID")
@TableField(exist = false)
private String djId;
@ApiModelProperty(value = "开始时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date zyStartTime;
@ApiModelProperty(value = "结束时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date zyEndTime;
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.kc.zyJxdg.controller;
import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -84,20 +85,6 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
@ApiOperation(value="教学大纲-添加", notes="教学大纲-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ZyJxdg zyJxdg) {
zyJxdgService.save(zyJxdg);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyJxdg
* @return
*/
@AutoLog(value = "教学大纲-编辑")
@ApiOperation(value="教学大纲-编辑", notes="教学大纲-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ZyJxdg zyJxdg) {
if(StringUtils.isNotEmpty(zyJxdg.getFilePath())){
@ -119,7 +106,49 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
}
}
zyJxdgService.updateById(zyJxdg);
zyJxdgService.save(zyJxdg);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyJxdg
* @return
*/
@AutoLog(value = "教学大纲-编辑")
@ApiOperation(value="教学大纲-编辑", notes="教学大纲-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ZyJxdg zyJxdg) {
UpdateWrapper<ZyJxdg> update = new UpdateWrapper<ZyJxdg>();
if(StringUtils.isNotEmpty(zyJxdg.getFilePath())){
String nameLast = zyJxdg.getFilePath().substring(zyJxdg.getFilePath().lastIndexOf(".")+1);
if(StringUtils.equals("pdf",nameLast)){
zyJxdg.setPdfPath(zyJxdg.getFilePath());
update.set("file_path",zyJxdg.getFilePath());
update.set("pdf_path",zyJxdg.getFilePath());
}else{
Global global = SpringContextHolder.getBean(Global.class);
FileUtil.mkdir(global.getContractDickPath());
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
String docPath = upLoadPath+ File.separator+ zyJxdg.getFilePath();
String namePath = dd + ".pdf";
String pdfPath = global.getContractDickPath() + namePath;
System.out.println("filPath:"+zyJxdg.getFilePath());
System.out.println("docPath:"+docPath);
System.out.println("pdfPath:"+pdfPath);
PDFUtil.office2PDF(docPath,pdfPath);
zyJxdg.setPdfPath("contract/"+namePath);
update.set("file_path",zyJxdg.getFilePath());
update.set("pdf_path",zyJxdg.getPdfPath());
}
}else{
update.set("kcjs",zyJxdg.getKcjs());
}
update.eq("id",zyJxdg.getId());
zyJxdgService.update(update);
return Result.OK("编辑成功!");
}