FIRSTCOMMIT

master
20918 12 months ago
parent ac6c0de90c
commit 7ac2684f31

@ -0,0 +1,116 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TdExamnum;
import com.ruoyi.system.service.ITdExamnumService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-04-10
*/
@Controller
@RequestMapping("/system/examnum")
public class TdExamnumController extends BaseController
{
private String prefix = "system/examnum";
@Autowired
private ITdExamnumService tdExamnumService;
@RequiresPermissions("system:examnum:view")
@GetMapping()
public String examnum()
{
return prefix + "/examnum";
}
/**
*
*/
@RequiresPermissions("system:examnum:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TdExamnum tdExamnum)
{
startPage();
List<TdExamnum> list = tdExamnumService.selectTdExamnumList(tdExamnum);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:examnum:export")
@Log(title = "考试结果", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TdExamnum tdExamnum)
{
List<TdExamnum> list = tdExamnumService.selectTdExamnumList(tdExamnum);
ExcelUtil<TdExamnum> util = new ExcelUtil<TdExamnum>(TdExamnum.class);
return util.exportExcel(list, "考试结果数据");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("system:examnum:add")
@Log(title = "考试结果", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSaveNew(TdExamnum tdExamnum)
{
return toAjax(tdExamnumService.insertTdExamnum(tdExamnum));
}
/**
*
*/
@RequiresPermissions("system:examnum:add")
@Log(title = "考试结果", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TdExamnum tdExamnum)
{
return toAjax(tdExamnumService.insertTdExamnum(tdExamnum));
}
/**
*
*/
@RequiresPermissions("system:examnum:edit")
@Log(title = "考试结果", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TdExamnum tdExamnum)
{
return toAjax(tdExamnumService.updateTdExamnum(tdExamnum));
}
}

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('考试结果列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>考试姓名:</label>
<input type="text" name="userName"/>
</li>
<li>
<label>单位名称:</label>
<input type="text" name="dept"/>
</li>
<li>
<label>试题类型:</label>
<select name="tyep" th:with="type=${@dict.getType('td_question_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:examnum:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:examnum:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:examnum:remove')}]];
var tyepDatas = [[${@dict.getType('td_question_type')}]];
var prefix = ctx + "system/examnum";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "考试结果",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'userName',
title: '考试姓名'
},
{
field: 'examResult',
title: '考试分数'
},
{
field: 'startTime',
title: '开始时间'
},
{
field: 'endTime',
title: '结束时间'
},
{
field: 'dept',
title: '单位名称'
},
{
field: 'tyep',
title: '试题类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(tyepDatas, value);
}
},
{
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
}]
};
$.table.init(options);
});
</script>
</body>
</html>

@ -0,0 +1,125 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* td_examnum
*
* @author ruoyi
* @date 2024-04-10
*/
public class TdExamnum extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 考试姓名 */
@Excel(name = "考试姓名")
private String userName;
/** 考试分数 */
@Excel(name = "考试分数")
private Long examResult;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 单位名称 */
@Excel(name = "单位名称")
private String dept;
/** 试题类型 */
@Excel(name = "试题类型")
private String tyep;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setExamResult(Long examResult)
{
this.examResult = examResult;
}
public Long getExamResult()
{
return examResult;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setDept(String dept)
{
this.dept = dept;
}
public String getDept()
{
return dept;
}
public void setTyep(String tyep)
{
this.tyep = tyep;
}
public String getTyep()
{
return tyep;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userName", getUserName())
.append("examResult", getExamResult())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("dept", getDept())
.append("tyep", getTyep())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TdExamnum;
/**
* Mapper
*
* @author ruoyi
* @date 2024-04-10
*/
public interface TdExamnumMapper
{
/**
*
*
* @param id
* @return
*/
public TdExamnum selectTdExamnumById(Long id);
/**
*
*
* @param tdExamnum
* @return
*/
public List<TdExamnum> selectTdExamnumList(TdExamnum tdExamnum);
/**
*
*
* @param tdExamnum
* @return
*/
public int insertTdExamnum(TdExamnum tdExamnum);
/**
*
*
* @param tdExamnum
* @return
*/
public int updateTdExamnum(TdExamnum tdExamnum);
/**
*
*
* @param id
* @return
*/
public int deleteTdExamnumById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteTdExamnumByIds(String[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TdExamnum;
/**
* Service
*
* @author ruoyi
* @date 2024-04-10
*/
public interface ITdExamnumService
{
/**
*
*
* @param id
* @return
*/
public TdExamnum selectTdExamnumById(Long id);
/**
*
*
* @param tdExamnum
* @return
*/
public List<TdExamnum> selectTdExamnumList(TdExamnum tdExamnum);
/**
*
*
* @param tdExamnum
* @return
*/
public int insertTdExamnum(TdExamnum tdExamnum);
/**
*
*
* @param tdExamnum
* @return
*/
public int updateTdExamnum(TdExamnum tdExamnum);
/**
*
*
* @param ids
* @return
*/
public int deleteTdExamnumByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteTdExamnumById(Long id);
}

@ -0,0 +1,94 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TdExamnumMapper;
import com.ruoyi.system.domain.TdExamnum;
import com.ruoyi.system.service.ITdExamnumService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2024-04-10
*/
@Service
public class TdExamnumServiceImpl implements ITdExamnumService
{
@Autowired
private TdExamnumMapper tdExamnumMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TdExamnum selectTdExamnumById(Long id)
{
return tdExamnumMapper.selectTdExamnumById(id);
}
/**
*
*
* @param tdExamnum
* @return
*/
@Override
public List<TdExamnum> selectTdExamnumList(TdExamnum tdExamnum)
{
return tdExamnumMapper.selectTdExamnumList(tdExamnum);
}
/**
*
*
* @param tdExamnum
* @return
*/
@Override
public int insertTdExamnum(TdExamnum tdExamnum)
{
return tdExamnumMapper.insertTdExamnum(tdExamnum);
}
/**
*
*
* @param tdExamnum
* @return
*/
@Override
public int updateTdExamnum(TdExamnum tdExamnum)
{
return tdExamnumMapper.updateTdExamnum(tdExamnum);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTdExamnumByIds(String ids)
{
return tdExamnumMapper.deleteTdExamnumByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTdExamnumById(Long id)
{
return tdExamnumMapper.deleteTdExamnumById(id);
}
}

@ -0,0 +1,82 @@
<?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="com.ruoyi.system.mapper.TdExamnumMapper">
<resultMap type="TdExamnum" id="TdExamnumResult">
<result property="id" column="id" />
<result property="userName" column="userName" />
<result property="examResult" column="examResult" />
<result property="startTime" column="startTime" />
<result property="endTime" column="endTime" />
<result property="dept" column="dept" />
<result property="tyep" column="tyep" />
</resultMap>
<sql id="selectTdExamnumVo">
select id, userName, examResult, startTime, endTime, dept, tyep from td_examnum
</sql>
<select id="selectTdExamnumList" parameterType="TdExamnum" resultMap="TdExamnumResult">
<include refid="selectTdExamnumVo"/>
<where>
<if test="userName != null and userName != ''"> and userName like concat('%', #{userName}, '%')</if>
<if test="examResult != null "> and examResult = #{examResult}</if>
<if test="startTime != null "> and startTime = #{startTime}</if>
<if test="endTime != null "> and endTime = #{endTime}</if>
<if test="dept != null and dept != ''"> and dept = #{dept}</if>
<if test="tyep != null and tyep != ''"> and tyep = #{tyep}</if>
</where>
</select>
<select id="selectTdExamnumById" parameterType="Long" resultMap="TdExamnumResult">
<include refid="selectTdExamnumVo"/>
where id = #{id}
</select>
<insert id="insertTdExamnum" parameterType="TdExamnum" useGeneratedKeys="true" keyProperty="id">
insert into td_examnum
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null">userName,</if>
<if test="examResult != null">examResult,</if>
<if test="startTime != null">startTime,</if>
<if test="endTime != null">endTime,</if>
<if test="dept != null">dept,</if>
<if test="tyep != null">tyep,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null">#{userName},</if>
<if test="examResult != null">#{examResult},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="dept != null">#{dept},</if>
<if test="tyep != null">#{tyep},</if>
</trim>
</insert>
<update id="updateTdExamnum" parameterType="TdExamnum">
update td_examnum
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null">userName = #{userName},</if>
<if test="examResult != null">examResult = #{examResult},</if>
<if test="startTime != null">startTime = #{startTime},</if>
<if test="endTime != null">endTime = #{endTime},</if>
<if test="dept != null">dept = #{dept},</if>
<if test="tyep != null">tyep = #{tyep},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTdExamnumById" parameterType="Long">
delete from td_examnum where id = #{id}
</delete>
<delete id="deleteTdExamnumByIds" parameterType="String">
delete from td_examnum where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save