Merge remote-tracking branch 'origin/main'

main
wanglei 5 months ago
commit cef8e61bb9

@ -0,0 +1,165 @@
package com.ruoyi.kaohe.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
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.KhGather;
import com.ruoyi.kaohe.service.IKhGatherService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author hs
* @date 2025-07-10
*/
@RestController
@RequestMapping("/kaohe/gather")
public class KhGatherController extends BaseController
{
@Autowired
private IKhGatherService khGatherService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:list')")
@PostMapping("/generateSum")
public AjaxResult generateSum(JSONObject json)
{
String hz_name = json.getString("title");
JSONArray data = json.getJSONArray("data");
//----------------------------------------------------------------------------------------------
for (int i = 0; i < data.size(); i++) {
JSONObject jsonObject = data.getJSONObject(i);
String type1 = jsonObject.getString("type");
if(type1.equals("0")){
JSONArray data1 = jsonObject.getJSONArray("data");
}else{
}
}
/*{
"hz_name": "教学单位领导班子考核总分",
"data": [{
"type": 0,
"title": "二级单位目标管理与绩效考核成绩",
"zb": 0.7
"data": [{
"type": 1,
"title": "党建与行政目标任务",
"id": 1,
"zb": 0.1
},
{
"type": 1,
"title": "事业发展",
"id": 3,
"zb": 0.9
}
]
},
{
"type": 1,
"title": "民主测评",
"id": 2,
"zb": 0.3
},
{
"type": 1,
"title": "创新",
"id": 3
}
]
}*/
return AjaxResult.success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:list')")
@GetMapping("/list")
public TableDataInfo list(KhGather khGather)
{
startPage();
List<KhGather> list = khGatherService.selectKhGatherList(khGather);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:export')")
@Log(title = "生成汇总", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, KhGather khGather)
{
List<KhGather> list = khGatherService.selectKhGatherList(khGather);
ExcelUtil<KhGather> util = new ExcelUtil<KhGather>(KhGather.class);
util.exportExcel(response, list, "生成汇总数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(khGatherService.selectKhGatherById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:add')")
@Log(title = "生成汇总", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody KhGather khGather)
{
return toAjax(khGatherService.insertKhGather(khGather));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:edit')")
@Log(title = "生成汇总", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody KhGather khGather)
{
return toAjax(khGatherService.updateKhGather(khGather));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:gather:remove')")
@Log(title = "生成汇总", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(khGatherService.deleteKhGatherByIds(ids));
}
}

@ -0,0 +1,87 @@
package com.ruoyi.kaohe.domain;
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_gather
*
* @author hs
* @date 2025-07-10
*/
public class KhGather extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 一级标题 */
@Excel(name = "一级标题")
private String hzName;
/** 表头 */
@Excel(name = "表头")
private String tableHeader;
/** 表数据 */
@Excel(name = "表数据")
private String tableData;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setHzName(String hzName)
{
this.hzName = hzName;
}
public String getHzName()
{
return hzName;
}
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;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("hzName", getHzName())
.append("tableHeader", getTableHeader())
.append("tableData", getTableData())
.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.KhGather;
/**
* Mapper
*
* @author hs
* @date 2025-07-10
*/
public interface KhGatherMapper
{
/**
*
*
* @param id
* @return
*/
public KhGather selectKhGatherById(Long id);
/**
*
*
* @param khGather
* @return
*/
public List<KhGather> selectKhGatherList(KhGather khGather);
/**
*
*
* @param khGather
* @return
*/
public int insertKhGather(KhGather khGather);
/**
*
*
* @param khGather
* @return
*/
public int updateKhGather(KhGather khGather);
/**
*
*
* @param id
* @return
*/
public int deleteKhGatherById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteKhGatherByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.kaohe.service;
import java.util.List;
import com.ruoyi.kaohe.domain.KhGather;
/**
* Service
*
* @author hs
* @date 2025-07-10
*/
public interface IKhGatherService
{
/**
*
*
* @param id
* @return
*/
public KhGather selectKhGatherById(Long id);
/**
*
*
* @param khGather
* @return
*/
public List<KhGather> selectKhGatherList(KhGather khGather);
/**
*
*
* @param khGather
* @return
*/
public int insertKhGather(KhGather khGather);
/**
*
*
* @param khGather
* @return
*/
public int updateKhGather(KhGather khGather);
/**
*
*
* @param ids
* @return
*/
public int deleteKhGatherByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteKhGatherById(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.KhGatherMapper;
import com.ruoyi.kaohe.domain.KhGather;
import com.ruoyi.kaohe.service.IKhGatherService;
/**
* Service
*
* @author hs
* @date 2025-07-10
*/
@Service
public class KhGatherServiceImpl implements IKhGatherService
{
@Autowired
private KhGatherMapper khGatherMapper;
/**
*
*
* @param id
* @return
*/
@Override
public KhGather selectKhGatherById(Long id)
{
return khGatherMapper.selectKhGatherById(id);
}
/**
*
*
* @param khGather
* @return
*/
@Override
public List<KhGather> selectKhGatherList(KhGather khGather)
{
return khGatherMapper.selectKhGatherList(khGather);
}
/**
*
*
* @param khGather
* @return
*/
@Override
public int insertKhGather(KhGather khGather)
{
khGather.setCreateTime(DateUtils.getNowDate());
return khGatherMapper.insertKhGather(khGather);
}
/**
*
*
* @param khGather
* @return
*/
@Override
public int updateKhGather(KhGather khGather)
{
khGather.setUpdateTime(DateUtils.getNowDate());
return khGatherMapper.updateKhGather(khGather);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteKhGatherByIds(Long[] ids)
{
return khGatherMapper.deleteKhGatherByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteKhGatherById(Long id)
{
return khGatherMapper.deleteKhGatherById(id);
}
}

@ -0,0 +1,86 @@
<?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.KhGatherMapper">
<resultMap type="KhGather" id="KhGatherResult">
<result property="id" column="id" />
<result property="hzName" column="hz_name" />
<result property="tableHeader" column="table_header" />
<result property="tableData" column="table_data" />
<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="selectKhGatherVo">
select id, hz_name, table_header, table_data, create_by, create_time, update_by, update_time, remark from kh_gather
</sql>
<select id="selectKhGatherList" parameterType="KhGather" resultMap="KhGatherResult">
<include refid="selectKhGatherVo"/>
<where>
<if test="hzName != null and hzName != ''"> and hz_name like concat('%', #{hzName}, '%')</if>
<if test="tableHeader != null and tableHeader != ''"> and table_header = #{tableHeader}</if>
<if test="tableData != null and tableData != ''"> and table_data = #{tableData}</if>
</where>
</select>
<select id="selectKhGatherById" parameterType="Long" resultMap="KhGatherResult">
<include refid="selectKhGatherVo"/>
where id = #{id}
</select>
<insert id="insertKhGather" parameterType="KhGather" useGeneratedKeys="true" keyProperty="id">
insert into kh_gather
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hzName != null">hz_name,</if>
<if test="tableHeader != null">table_header,</if>
<if test="tableData != null">table_data,</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="hzName != null">#{hzName},</if>
<if test="tableHeader != null">#{tableHeader},</if>
<if test="tableData != null">#{tableData},</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="updateKhGather" parameterType="KhGather">
update kh_gather
<trim prefix="SET" suffixOverrides=",">
<if test="hzName != null">hz_name = #{hzName},</if>
<if test="tableHeader != null">table_header = #{tableHeader},</if>
<if test="tableData != null">table_data = #{tableData},</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="deleteKhGatherById" parameterType="Long">
delete from kh_gather where id = #{id}
</delete>
<delete id="deleteKhGatherByIds" parameterType="String">
delete from kh_gather 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 listGather(query) {
return request({
url: '/kaohe/gather/list',
method: 'get',
params: query
})
}
// 查询生成汇总详细
export function getGather(id) {
return request({
url: '/kaohe/gather/' + id,
method: 'get'
})
}
// 新增生成汇总
export function addGather(data) {
return request({
url: '/kaohe/gather',
method: 'post',
data: data
})
}
// 修改生成汇总
export function updateGather(data) {
return request({
url: '/kaohe/gather',
method: 'put',
data: data
})
}
// 删除生成汇总
export function delGather(id) {
return request({
url: '/kaohe/gather/' + id,
method: 'delete'
})
}

@ -0,0 +1,266 @@
<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="一级标题" prop="hzName">
<el-input
v-model="queryParams.hzName"
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:gather: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:gather: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:gather: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:gather:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="gatherList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="一级标题" align="center" prop="hzName" />
<el-table-column label="表头" align="center" prop="tableHeader" />
<el-table-column label="表数据" align="center" prop="tableData" />
<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:gather:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['kaohe:gather: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="一级标题" prop="hzName">
<el-input v-model="form.hzName" 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="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 { listGather, getGather, delGather, addGather, updateGather } from "@/api/kaohe/gather"
export default {
name: "Gather",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
gatherList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
hzName: null,
tableHeader: null,
tableData: null,
},
//
form: {},
//
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询生成汇总列表 */
getList() {
this.loading = true
listGather(this.queryParams).then(response => {
this.gatherList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
hzName: null,
tableHeader: null,
tableData: 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
getGather(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) {
updateGather(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addGather(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 delGather(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('kaohe/gather/export', {
...this.queryParams
}, `gather_${new Date().getTime()}.xlsx`)
}
}
}
</script>
Loading…
Cancel
Save