添加考核结果模块

main
hshansha 6 months ago
parent decfea6f01
commit 93087be053

@ -0,0 +1,104 @@
package com.ruoyi.kaohe.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kaohe.domain.KhKhrwResult;
import com.ruoyi.kaohe.service.IKhKhrwResultService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author hs
* @date 2025-07-05
*/
@RestController
@RequestMapping("/kaohe/kh_result")
public class KhKhrwResultController extends BaseController
{
@Autowired
private IKhKhrwResultService khKhrwResultService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:list')")
@GetMapping("/list")
public TableDataInfo list(KhKhrwResult khKhrwResult)
{
startPage();
List<KhKhrwResult> list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:export')")
@Log(title = "考核结果", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, KhKhrwResult khKhrwResult)
{
List<KhKhrwResult> list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult);
ExcelUtil<KhKhrwResult> util = new ExcelUtil<KhKhrwResult>(KhKhrwResult.class);
util.exportExcel(response, list, "考核结果数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(khKhrwResultService.selectKhKhrwResultById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:add')")
@Log(title = "考核结果", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody KhKhrwResult khKhrwResult)
{
return toAjax(khKhrwResultService.insertKhKhrwResult(khKhrwResult));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:edit')")
@Log(title = "考核结果", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody KhKhrwResult khKhrwResult)
{
return toAjax(khKhrwResultService.updateKhKhrwResult(khKhrwResult));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:remove')")
@Log(title = "考核结果", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(khKhrwResultService.deleteKhKhrwResultByIds(ids));
}
}

@ -0,0 +1,118 @@
package com.ruoyi.kaohe.domain;
import java.math.BigDecimal;
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;
/**
* kh_khrw_result
*
* @author hs
* @date 2025-07-05
*/
public class KhKhrwResult extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 考核任务id */
@Excel(name = "考核任务id")
private Long khrwId;
/** 考核任务名称 */
@Excel(name = "考核任务名称")
private String khrwName;
/** 表头 */
@Excel(name = "表头")
private String tableHeader;
/** 表数据 */
@Excel(name = "表数据")
private String tableData;
/** 得分 */
@Excel(name = "得分")
private BigDecimal endScore;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setKhrwId(Long khrwId)
{
this.khrwId = khrwId;
}
public Long getKhrwId()
{
return khrwId;
}
public void setKhrwName(String khrwName)
{
this.khrwName = khrwName;
}
public String getKhrwName()
{
return khrwName;
}
public void setTableHeader(String tableHeader)
{
this.tableHeader = tableHeader;
}
public String getTableHeader()
{
return tableHeader;
}
public void setTableData(String tableData)
{
this.tableData = tableData;
}
public String getTableData()
{
return tableData;
}
public void setEndScore(BigDecimal endScore)
{
this.endScore = endScore;
}
public BigDecimal getEndScore()
{
return endScore;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("khrwId", getKhrwId())
.append("khrwName", getKhrwName())
.append("tableHeader", getTableHeader())
.append("tableData", getTableData())
.append("endScore", getEndScore())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.kaohe.mapper;
import java.util.List;
import com.ruoyi.kaohe.domain.KhKhrwResult;
/**
* Mapper
*
* @author hs
* @date 2025-07-05
*/
public interface KhKhrwResultMapper
{
/**
*
*
* @param id
* @return
*/
public KhKhrwResult selectKhKhrwResultById(Long id);
/**
*
*
* @param khKhrwResult
* @return
*/
public List<KhKhrwResult> selectKhKhrwResultList(KhKhrwResult khKhrwResult);
/**
*
*
* @param khKhrwResult
* @return
*/
public int insertKhKhrwResult(KhKhrwResult khKhrwResult);
/**
*
*
* @param khKhrwResult
* @return
*/
public int updateKhKhrwResult(KhKhrwResult khKhrwResult);
/**
*
*
* @param id
* @return
*/
public int deleteKhKhrwResultById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteKhKhrwResultByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.kaohe.service;
import java.util.List;
import com.ruoyi.kaohe.domain.KhKhrwResult;
/**
* Service
*
* @author hs
* @date 2025-07-05
*/
public interface IKhKhrwResultService
{
/**
*
*
* @param id
* @return
*/
public KhKhrwResult selectKhKhrwResultById(Long id);
/**
*
*
* @param khKhrwResult
* @return
*/
public List<KhKhrwResult> selectKhKhrwResultList(KhKhrwResult khKhrwResult);
/**
*
*
* @param khKhrwResult
* @return
*/
public int insertKhKhrwResult(KhKhrwResult khKhrwResult);
/**
*
*
* @param khKhrwResult
* @return
*/
public int updateKhKhrwResult(KhKhrwResult khKhrwResult);
/**
*
*
* @param ids
* @return
*/
public int deleteKhKhrwResultByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteKhKhrwResultById(Long id);
}

@ -0,0 +1,96 @@
package com.ruoyi.kaohe.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kaohe.mapper.KhKhrwResultMapper;
import com.ruoyi.kaohe.domain.KhKhrwResult;
import com.ruoyi.kaohe.service.IKhKhrwResultService;
/**
* Service
*
* @author hs
* @date 2025-07-05
*/
@Service
public class KhKhrwResultServiceImpl implements IKhKhrwResultService
{
@Autowired
private KhKhrwResultMapper khKhrwResultMapper;
/**
*
*
* @param id
* @return
*/
@Override
public KhKhrwResult selectKhKhrwResultById(Long id)
{
return khKhrwResultMapper.selectKhKhrwResultById(id);
}
/**
*
*
* @param khKhrwResult
* @return
*/
@Override
public List<KhKhrwResult> selectKhKhrwResultList(KhKhrwResult khKhrwResult)
{
return khKhrwResultMapper.selectKhKhrwResultList(khKhrwResult);
}
/**
*
*
* @param khKhrwResult
* @return
*/
@Override
public int insertKhKhrwResult(KhKhrwResult khKhrwResult)
{
khKhrwResult.setCreateTime(DateUtils.getNowDate());
return khKhrwResultMapper.insertKhKhrwResult(khKhrwResult);
}
/**
*
*
* @param khKhrwResult
* @return
*/
@Override
public int updateKhKhrwResult(KhKhrwResult khKhrwResult)
{
khKhrwResult.setUpdateTime(DateUtils.getNowDate());
return khKhrwResultMapper.updateKhKhrwResult(khKhrwResult);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteKhKhrwResultByIds(Long[] ids)
{
return khKhrwResultMapper.deleteKhKhrwResultByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteKhKhrwResultById(Long id)
{
return khKhrwResultMapper.deleteKhKhrwResultById(id);
}
}

@ -0,0 +1,96 @@
<?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.kaohe.mapper.KhKhrwResultMapper">
<resultMap type="KhKhrwResult" id="KhKhrwResultResult">
<result property="id" column="id" />
<result property="khrwId" column="khrw_id" />
<result property="khrwName" column="khrw_name" />
<result property="tableHeader" column="table_header" />
<result property="tableData" column="table_data" />
<result property="endScore" column="end_score" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectKhKhrwResultVo">
select id, khrw_id, khrw_name, table_header, table_data, end_score, create_by, create_time, update_by, update_time, remark from kh_khrw_result
</sql>
<select id="selectKhKhrwResultList" parameterType="KhKhrwResult" resultMap="KhKhrwResultResult">
<include refid="selectKhKhrwResultVo"/>
<where>
<if test="khrwId != null "> and khrw_id = #{khrwId}</if>
<if test="khrwName != null and khrwName != ''"> and khrw_name like concat('%', #{khrwName}, '%')</if>
<if test="tableHeader != null and tableHeader != ''"> and table_header = #{tableHeader}</if>
<if test="tableData != null and tableData != ''"> and table_data = #{tableData}</if>
<if test="endScore != null "> and end_score = #{endScore}</if>
</where>
</select>
<select id="selectKhKhrwResultById" parameterType="Long" resultMap="KhKhrwResultResult">
<include refid="selectKhKhrwResultVo"/>
where id = #{id}
</select>
<insert id="insertKhKhrwResult" parameterType="KhKhrwResult" useGeneratedKeys="true" keyProperty="id">
insert into kh_khrw_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="khrwId != null">khrw_id,</if>
<if test="khrwName != null">khrw_name,</if>
<if test="tableHeader != null">table_header,</if>
<if test="tableData != null">table_data,</if>
<if test="endScore != null">end_score,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="khrwId != null">#{khrwId},</if>
<if test="khrwName != null">#{khrwName},</if>
<if test="tableHeader != null">#{tableHeader},</if>
<if test="tableData != null">#{tableData},</if>
<if test="endScore != null">#{endScore},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateKhKhrwResult" parameterType="KhKhrwResult">
update kh_khrw_result
<trim prefix="SET" suffixOverrides=",">
<if test="khrwId != null">khrw_id = #{khrwId},</if>
<if test="khrwName != null">khrw_name = #{khrwName},</if>
<if test="tableHeader != null">table_header = #{tableHeader},</if>
<if test="tableData != null">table_data = #{tableData},</if>
<if test="endScore != null">end_score = #{endScore},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteKhKhrwResultById" parameterType="Long">
delete from kh_khrw_result where id = #{id}
</delete>
<delete id="deleteKhKhrwResultByIds" parameterType="String">
delete from kh_khrw_result where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询考核结果列表
export function listKh_result(query) {
return request({
url: '/kaohe/kh_result/list',
method: 'get',
params: query
})
}
// 查询考核结果详细
export function getKh_result(id) {
return request({
url: '/kaohe/kh_result/' + id,
method: 'get'
})
}
// 新增考核结果
export function addKh_result(data) {
return request({
url: '/kaohe/kh_result',
method: 'post',
data: data
})
}
// 修改考核结果
export function updateKh_result(data) {
return request({
url: '/kaohe/kh_result',
method: 'put',
data: data
})
}
// 删除考核结果
export function delKh_result(id) {
return request({
url: '/kaohe/kh_result/' + id,
method: 'delete'
})
}

@ -0,0 +1,297 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="考核任务id" prop="khrwId">
<el-input
v-model="queryParams.khrwId"
placeholder="请输入考核任务id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="考核任务名称" prop="khrwName">
<el-input
v-model="queryParams.khrwName"
placeholder="请输入考核任务名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="得分" prop="endScore">
<el-input
v-model="queryParams.endScore"
placeholder="请输入得分"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['kaohe:kh_result:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['kaohe:kh_result:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['kaohe:kh_result:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['kaohe:kh_result:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="kh_resultList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="考核任务id" align="center" prop="khrwId" />
<el-table-column label="考核任务名称" align="center" prop="khrwName" />
<el-table-column label="表头" align="center" prop="tableHeader" />
<el-table-column label="表数据" align="center" prop="tableData" />
<el-table-column label="得分" align="center" prop="endScore" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['kaohe:kh_result:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['kaohe:kh_result:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改考核结果对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="考核任务id" prop="khrwId">
<el-input v-model="form.khrwId" placeholder="请输入考核任务id" />
</el-form-item>
<el-form-item label="考核任务名称" prop="khrwName">
<el-input v-model="form.khrwName" placeholder="请输入考核任务名称" />
</el-form-item>
<el-form-item label="表头" prop="tableHeader">
<el-input v-model="form.tableHeader" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="表数据" prop="tableData">
<el-input v-model="form.tableData" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="得分" prop="endScore">
<el-input v-model="form.endScore" placeholder="请输入得分" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listKh_result, getKh_result, delKh_result, addKh_result, updateKh_result } from "@/api/kaohe/kh_result"
export default {
name: "Kh_result",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
kh_resultList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
khrwId: null,
khrwName: null,
tableHeader: null,
tableData: null,
endScore: null,
},
//
form: {},
//
rules: {
khrwId: [
{ required: true, message: "考核任务id不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询考核结果列表 */
getList() {
this.loading = true
listKh_result(this.queryParams).then(response => {
this.kh_resultList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
khrwId: null,
khrwName: null,
tableHeader: null,
tableData: null,
endScore: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加考核结果"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getKh_result(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改考核结果"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateKh_result(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addKh_result(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除考核结果编号为"' + ids + '"的数据项?').then(function() {
return delKh_result(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('kaohe/kh_result/export', {
...this.queryParams
}, `kh_result_${new Date().getTime()}.xlsx`)
}
}
}
</script>
Loading…
Cancel
Save