批量新增接口、投票评测添加字段

main 002
hshansha 6 months ago
parent a8fc16aa83
commit a0395570bf

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@ -79,6 +80,20 @@ public class KhItemsController extends BaseController
{ {
return toAjax(khItemsService.insertKhItems(khItems)); return toAjax(khItemsService.insertKhItems(khItems));
} }
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:items:add')")
@Log(title = "考核项", businessType = BusinessType.INSERT)
@PostMapping("/adds")
@Transactional
public AjaxResult adds(@RequestBody List<KhItems> khItems)
{
for(KhItems item:khItems){
khItemsService.insertKhItems(item);
}
return AjaxResult.success();
}
/** /**
* *

@ -2,8 +2,11 @@ package com.ruoyi.kaohe.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.kaohe.domain.KhItems;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@ -80,6 +83,21 @@ public class KhTemItemController extends BaseController
return toAjax(khTemItemService.insertKhTemItem(khTemItem)); return toAjax(khTemItemService.insertKhTemItem(khTemItem));
} }
/**
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:tem_item:add')")
@Log(title = "模板考核项关联", businessType = BusinessType.INSERT)
@PostMapping("/adds")
@Transactional
public AjaxResult adds(@RequestBody List<KhTemItem> khTemItems)
{
for(KhTemItem khTemItem:khTemItems){
khTemItemService.insertKhTemItem(khTemItem);
}
return AjaxResult.success();
}
/** /**
* *
*/ */

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
/** /**
* kh_template * kh_template
* *
@ -22,13 +24,25 @@ public class KhTemplate extends BaseEntity
@Excel(name = "模板名称") @Excel(name = "模板名称")
private String temName; private String temName;
/** 考核项id */ /* *//** 考核项id *//*
@Excel(name = "考核项id") @Excel(name = "考核项id")
private Long khitemId; private Long khitemId;
*//** 考核项名称 *//*
@Excel(name = "考核项名称")
private String itemName;*/
/** 考核项名称 */ /** 考核项名称 */
@Excel(name = "考核项名称") @Excel(name = "考核项名称")
private String itemName; private List<KhItems> itemList;
public List<KhItems> getItems() {
return itemList;
}
public void setItems(List<KhItems> itemList) {
this.itemList = itemList;
}
public void setId(Long id) public void setId(Long id)
{ {
@ -50,7 +64,7 @@ public class KhTemplate extends BaseEntity
return temName; return temName;
} }
public void setKhitemId(Long khitemId) /* public void setKhitemId(Long khitemId)
{ {
this.khitemId = khitemId; this.khitemId = khitemId;
} }
@ -68,15 +82,15 @@ public class KhTemplate extends BaseEntity
public String getItemName() public String getItemName()
{ {
return itemName; return itemName;
} }*/
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("temName", getTemName()) .append("temName", getTemName())
.append("khitemId", getKhitemId()) /* .append("khitemId", getKhitemId())
.append("itemName", getItemName()) .append("itemName", getItemName())*/
.toString(); .toString();
} }
} }

@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* kh_vote * kh_vote
* *
* @author hs * @author hs
* @date 2025-06-17 * @date 2025-06-18
*/ */
public class KhVote extends BaseEntity public class KhVote extends BaseEntity
{ {
@ -20,6 +20,22 @@ public class KhVote extends BaseEntity
/** 主键 */ /** 主键 */
private Long id; private Long id;
/** 评测id */
@Excel(name = "评测id")
private Long pingceId;
/** 评测名称 */
@Excel(name = "评测名称")
private String pingceName;
/** 考核项id */
@Excel(name = "考核项id")
private Long khitemId;
/** 考核项名称 */
@Excel(name = "考核项名称")
private String khitemName;
/** 投票主题 */ /** 投票主题 */
@Excel(name = "投票主题") @Excel(name = "投票主题")
private String voteTitle; private String voteTitle;
@ -42,6 +58,10 @@ public class KhVote extends BaseEntity
@Excel(name = "最大投票数") @Excel(name = "最大投票数")
private Long maxNum; private Long maxNum;
/** 状态(0 未开始 1 进行中 2 完成) */
@Excel(name = "状态(0 未开始 1 进行中 2 完成)")
private String state;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -52,6 +72,46 @@ public class KhVote extends BaseEntity
return id; return id;
} }
public void setPingceId(Long pingceId)
{
this.pingceId = pingceId;
}
public Long getPingceId()
{
return pingceId;
}
public void setPingceName(String pingceName)
{
this.pingceName = pingceName;
}
public String getPingceName()
{
return pingceName;
}
public void setKhitemId(Long khitemId)
{
this.khitemId = khitemId;
}
public Long getKhitemId()
{
return khitemId;
}
public void setKhitemName(String khitemName)
{
this.khitemName = khitemName;
}
public String getKhitemName()
{
return khitemName;
}
public void setVoteTitle(String voteTitle) public void setVoteTitle(String voteTitle)
{ {
this.voteTitle = voteTitle; this.voteTitle = voteTitle;
@ -102,15 +162,30 @@ public class KhVote extends BaseEntity
return maxNum; return maxNum;
} }
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("pingceId", getPingceId())
.append("pingceName", getPingceName())
.append("khitemId", getKhitemId())
.append("khitemName", getKhitemName())
.append("voteTitle", getVoteTitle()) .append("voteTitle", getVoteTitle())
.append("vDescription", getvDescription()) .append("vDescription", getvDescription())
.append("sTime", getsTime()) .append("sTime", getsTime())
.append("eTime", geteTime()) .append("eTime", geteTime())
.append("maxNum", getMaxNum()) .append("maxNum", getMaxNum())
.append("state", getState())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

@ -7,8 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="KhTemplate" id="KhTemplateResult"> <resultMap type="KhTemplate" id="KhTemplateResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="temName" column="tem_name" /> <result property="temName" column="tem_name" />
<result property="khitemId" column="khitem_id" /> <!-- <result property="khitemId" column="khitem_id" />
<result property="itemName" column="item_name" />-->
<collection property="itemList" ofType="KhItems">
<result property="id" column="id" />
<result property="itemName" column="item_name" /> <result property="itemName" column="item_name" />
</collection >
</resultMap> </resultMap>
<sql id="selectKhTemplateVo"> <sql id="selectKhTemplateVo">
@ -16,11 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectKhTemplateList" parameterType="KhTemplate" resultMap="KhTemplateResult"> <select id="selectKhTemplateList" parameterType="KhTemplate" resultMap="KhTemplateResult">
<include refid="selectKhTemplateVo"/> select t.*,ti.* from kh_template t join kh_tem_item ti on t.id=ti.tem_id
<where> <where>
<if test="temName != null and temName != ''"> and tem_name like concat('%', #{temName}, '%')</if> <if test="temName != null and temName != ''"> and tem_name like concat('%', #{temName}, '%')</if>
<if test="khitemId != null "> and khitem_id = #{khitemId}</if> <!-- <if test="khitemId != null "> and khitem_id = #{khitemId}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if> <if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>-->
</where> </where>
</select> </select>

@ -6,11 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="KhVote" id="KhVoteResult"> <resultMap type="KhVote" id="KhVoteResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="pingceId" column="pingce_id" />
<result property="pingceName" column="pingce_name" />
<result property="khitemId" column="khitem_id" />
<result property="khitemName" column="khitem_name" />
<result property="voteTitle" column="vote_title" /> <result property="voteTitle" column="vote_title" />
<result property="vDescription" column="v_description" /> <result property="vDescription" column="v_description" />
<result property="sTime" column="s_time" /> <result property="sTime" column="s_time" />
<result property="eTime" column="e_time" /> <result property="eTime" column="e_time" />
<result property="maxNum" column="max_num" /> <result property="maxNum" column="max_num" />
<result property="state" column="state" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -19,17 +24,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectKhVoteVo"> <sql id="selectKhVoteVo">
select id, vote_title, v_description, s_time, e_time, max_num, create_by, create_time, update_by, update_time, remark from kh_vote select id, pingce_id, pingce_name, khitem_id, khitem_name, vote_title, v_description, s_time, e_time, max_num, state, create_by, create_time, update_by, update_time, remark from kh_vote
</sql> </sql>
<select id="selectKhVoteList" parameterType="KhVote" resultMap="KhVoteResult"> <select id="selectKhVoteList" parameterType="KhVote" resultMap="KhVoteResult">
<include refid="selectKhVoteVo"/> <include refid="selectKhVoteVo"/>
<where> <where>
<if test="pingceId != null "> and pingce_id = #{pingceId}</if>
<if test="pingceName != null and pingceName != ''"> and pingce_name like concat('%', #{pingceName}, '%')</if>
<if test="khitemId != null "> and khitem_id = #{khitemId}</if>
<if test="khitemName != null and khitemName != ''"> and khitem_name like concat('%', #{khitemName}, '%')</if>
<if test="voteTitle != null and voteTitle != ''"> and vote_title = #{voteTitle}</if> <if test="voteTitle != null and voteTitle != ''"> and vote_title = #{voteTitle}</if>
<if test="vDescription != null and vDescription != ''"> and v_description = #{vDescription}</if> <if test="vDescription != null and vDescription != ''"> and v_description = #{vDescription}</if>
<if test="sTime != null "> and s_time = #{sTime}</if> <if test="sTime != null "> and s_time = #{sTime}</if>
<if test="eTime != null "> and e_time = #{eTime}</if> <if test="eTime != null "> and e_time = #{eTime}</if>
<if test="maxNum != null "> and max_num = #{maxNum}</if> <if test="maxNum != null "> and max_num = #{maxNum}</if>
<if test="state != null and state != ''"> and state = #{state}</if>
</where> </where>
</select> </select>
@ -41,11 +51,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertKhVote" parameterType="KhVote" useGeneratedKeys="true" keyProperty="id"> <insert id="insertKhVote" parameterType="KhVote" useGeneratedKeys="true" keyProperty="id">
insert into kh_vote insert into kh_vote
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pingceId != null">pingce_id,</if>
<if test="pingceName != null">pingce_name,</if>
<if test="khitemId != null">khitem_id,</if>
<if test="khitemName != null">khitem_name,</if>
<if test="voteTitle != null and voteTitle != ''">vote_title,</if> <if test="voteTitle != null and voteTitle != ''">vote_title,</if>
<if test="vDescription != null">v_description,</if> <if test="vDescription != null">v_description,</if>
<if test="sTime != null">s_time,</if> <if test="sTime != null">s_time,</if>
<if test="eTime != null">e_time,</if> <if test="eTime != null">e_time,</if>
<if test="maxNum != null">max_num,</if> <if test="maxNum != null">max_num,</if>
<if test="state != null">state,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -53,11 +68,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pingceId != null">#{pingceId},</if>
<if test="pingceName != null">#{pingceName},</if>
<if test="khitemId != null">#{khitemId},</if>
<if test="khitemName != null">#{khitemName},</if>
<if test="voteTitle != null and voteTitle != ''">#{voteTitle},</if> <if test="voteTitle != null and voteTitle != ''">#{voteTitle},</if>
<if test="vDescription != null">#{vDescription},</if> <if test="vDescription != null">#{vDescription},</if>
<if test="sTime != null">#{sTime},</if> <if test="sTime != null">#{sTime},</if>
<if test="eTime != null">#{eTime},</if> <if test="eTime != null">#{eTime},</if>
<if test="maxNum != null">#{maxNum},</if> <if test="maxNum != null">#{maxNum},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -69,11 +89,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateKhVote" parameterType="KhVote"> <update id="updateKhVote" parameterType="KhVote">
update kh_vote update kh_vote
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="pingceId != null">pingce_id = #{pingceId},</if>
<if test="pingceName != null">pingce_name = #{pingceName},</if>
<if test="khitemId != null">khitem_id = #{khitemId},</if>
<if test="khitemName != null">khitem_name = #{khitemName},</if>
<if test="voteTitle != null and voteTitle != ''">vote_title = #{voteTitle},</if> <if test="voteTitle != null and voteTitle != ''">vote_title = #{voteTitle},</if>
<if test="vDescription != null">v_description = #{vDescription},</if> <if test="vDescription != null">v_description = #{vDescription},</if>
<if test="sTime != null">s_time = #{sTime},</if> <if test="sTime != null">s_time = #{sTime},</if>
<if test="eTime != null">e_time = #{eTime},</if> <if test="eTime != null">e_time = #{eTime},</if>
<if test="maxNum != null">max_num = #{maxNum},</if> <if test="maxNum != null">max_num = #{maxNum},</if>
<if test="state != null">state = #{state},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>

Loading…
Cancel
Save