Merge remote-tracking branch 'origin/main'

main
wanglei 6 months ago
commit bafa4301c7

@ -4,6 +4,7 @@ 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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -80,6 +81,21 @@ public class KhItemsController extends BaseController
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 javax.servlet.http.HttpServletResponse;
import com.ruoyi.kaohe.domain.KhItems;
import org.springframework.security.access.prepost.PreAuthorize;
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.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -80,6 +83,21 @@ public class KhTemItemController extends BaseController
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();
}*/
/**
*
*/

@ -1,9 +1,15 @@
package com.ruoyi.kaohe.controller;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.kaohe.domain.KhItems;
import com.ruoyi.kaohe.domain.KhTemItem;
import com.ruoyi.kaohe.service.IKhTemItemService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -33,6 +39,8 @@ public class KhTemplateController extends BaseController
{
@Autowired
private IKhTemplateService khTemplateService;
@Autowired
private IKhTemItemService temItemService;
/**
*
@ -75,20 +83,52 @@ public class KhTemplateController extends BaseController
@PreAuthorize("@ss.hasPermi('kaohe:template:add')")
@Log(title = "考核模板", businessType = BusinessType.INSERT)
@PostMapping
@Transactional
public AjaxResult add(@RequestBody KhTemplate khTemplate)
{
return toAjax(khTemplateService.insertKhTemplate(khTemplate));
khTemplateService.insertKhTemplate(khTemplate);
List<KhItems> items = khTemplate.getItems();
if(items !=null&& items.size()>0){
for(KhItems item:items){
KhTemItem temItem = new KhTemItem();
temItem.setTemName(khTemplate.getTemName());
temItem.setTemId(khTemplate.getId());
temItem.setItemName(item.getItemName());
temItem.setKhitemId(item.getId());
temItemService.insertKhTemItem(temItem);
}
}
return AjaxResult.success();
}
/**
*
*
*/
@PreAuthorize("@ss.hasPermi('kaohe:template:edit')")
@Log(title = "考核模板", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional
public AjaxResult edit(@RequestBody KhTemplate khTemplate)
{
return toAjax(khTemplateService.updateKhTemplate(khTemplate));
khTemplateService.updateKhTemplate(khTemplate);
List<KhItems> items = khTemplate.getItems();
if(items !=null&& items.size()>0){
//删除原来关联
KhTemItem query = new KhTemItem();
query.setTemId(khTemplate.getId());
List<KhTemItem> temItems = temItemService.selectKhTemItemList(query);
List<Long> ids = temItems.stream().map(KhTemItem::getId).collect(Collectors.toList());
temItemService.deleteKhTemItemByIds(ids.toArray(new Long[ids.size()]));
for(KhItems item:items){
KhTemItem temItem = new KhTemItem();
temItem.setTemName(khTemplate.getTemName());
temItem.setTemId(khTemplate.getId());
temItem.setItemName(item.getItemName());
temItem.setKhitemId(item.getId());
temItemService.insertKhTemItem(temItem);
}
}
return AjaxResult.success();
}
/**

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
/**
* kh_template
*
@ -30,7 +32,19 @@ public class KhTemplate extends BaseEntity
@Excel(name = "考核项名称")
private String itemName;
public void setId(Long id)
/** 考核项名称 */
@Excel(name = "考核项名称")
private List<KhItems> items;
public List<KhItems> getItems() {
return items;
}
public void setItems(List<KhItems> items) {
this.items = items;
}
public void setId(Long id)
{
this.id = id;
}
@ -50,7 +64,7 @@ public class KhTemplate extends BaseEntity
return temName;
}
public void setKhitemId(Long khitemId)
public void setKhitemId(Long khitemId)
{
this.khitemId = khitemId;
}
@ -77,6 +91,7 @@ public class KhTemplate extends BaseEntity
.append("temName", getTemName())
.append("khitemId", getKhitemId())
.append("itemName", getItemName())
.append("items",getItems())
.toString();
}
}

@ -9,9 +9,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* kh_vote
*
*
* @author hs
* @date 2025-06-17
* @date 2025-06-18
*/
public class KhVote extends BaseEntity
{
@ -20,6 +20,22 @@ public class KhVote extends BaseEntity
/** 主键 */
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 = "投票主题")
private String voteTitle;
@ -42,80 +58,139 @@ public class KhVote extends BaseEntity
@Excel(name = "最大投票数")
private Long maxNum;
public void setId(Long id)
/** 状态(0 未开始 1 进行中 2 完成) */
@Excel(name = "状态(0 未开始 1 进行中 2 完成)")
private String state;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setVoteTitle(String voteTitle)
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)
{
this.voteTitle = voteTitle;
}
public String getVoteTitle()
public String getVoteTitle()
{
return voteTitle;
}
public void setvDescription(String vDescription)
public void setvDescription(String vDescription)
{
this.vDescription = vDescription;
}
public String getvDescription()
public String getvDescription()
{
return vDescription;
}
public void setsTime(Date sTime)
public void setsTime(Date sTime)
{
this.sTime = sTime;
}
public Date getsTime()
public Date getsTime()
{
return sTime;
}
public void seteTime(Date eTime)
public void seteTime(Date eTime)
{
this.eTime = eTime;
}
public Date geteTime()
public Date geteTime()
{
return eTime;
}
public void setMaxNum(Long maxNum)
public void setMaxNum(Long maxNum)
{
this.maxNum = maxNum;
}
public Long getMaxNum()
public Long getMaxNum()
{
return maxNum;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("voteTitle", getVoteTitle())
.append("vDescription", getvDescription())
.append("sTime", getsTime())
.append("eTime", geteTime())
.append("maxNum", getMaxNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
.append("id", getId())
.append("pingceId", getPingceId())
.append("pingceName", getPingceName())
.append("khitemId", getKhitemId())
.append("khitemName", getKhitemName())
.append("voteTitle", getVoteTitle())
.append("vDescription", getvDescription())
.append("sTime", getsTime())
.append("eTime", geteTime())
.append("maxNum", getMaxNum())
.append("state", getState())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -7,8 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="KhTemplate" id="KhTemplateResult">
<result property="id" column="id" />
<result property="temName" column="tem_name" />
<result property="khitemId" column="khitem_id" />
<result property="itemName" column="item_name" />
<!-- <result property="khitemId" column="khitem_id" />
<result property="itemName" column="item_name" />-->
<collection property="items" ofType="KhItems">
<result property="id" column="itemId" />
<result property="itemName" column="khitemName" />
</collection >
</resultMap>
<sql id="selectKhTemplateVo">
@ -16,17 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectKhTemplateList" parameterType="KhTemplate" resultMap="KhTemplateResult">
<include refid="selectKhTemplateVo"/>
select t.*,ti.khitem_id itemId ,ti.item_name khitemName from kh_template t left join kh_tem_item ti on t.id=ti.tem_id
<where>
<if test="temName != null and temName != ''"> and tem_name like concat('%', #{temName}, '%')</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="khitemId != null "> and khitem_id = #{khitemId}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>-->
</where>
</select>
<select id="selectKhTemplateById" parameterType="Long" resultMap="KhTemplateResult">
<include refid="selectKhTemplateVo"/>
where id = #{id}
select t.*,ti.khitem_id itemId ,ti.item_name khitemName from kh_template t left join kh_tem_item ti on t.id=ti.tem_id
where t.id = #{id}
</select>
<insert id="insertKhTemplate" parameterType="KhTemplate" useGeneratedKeys="true" keyProperty="id">

@ -1,16 +1,21 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.kaohe.mapper.KhVoteMapper">
<resultMap type="KhVote" id="KhVoteResult">
<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="vDescription" column="v_description" />
<result property="sTime" column="s_time" />
<result property="eTime" column="e_time" />
<result property="maxNum" column="max_num" />
<result property="state" column="state" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@ -19,20 +24,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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>
<select id="selectKhVoteList" parameterType="KhVote" resultMap="KhVoteResult">
<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="vDescription != null and vDescription != ''"> and v_description = #{vDescription}</if>
<if test="sTime != null "> and s_time = #{sTime}</if>
<if test="eTime != null "> and e_time = #{eTime}</if>
<if test="maxNum != null "> and max_num = #{maxNum}</if>
<if test="state != null and state != ''"> and state = #{state}</if>
</where>
</select>
<select id="selectKhVoteById" parameterType="Long" resultMap="KhVoteResult">
<include refid="selectKhVoteVo"/>
where id = #{id}
@ -41,39 +51,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertKhVote" parameterType="KhVote" useGeneratedKeys="true" keyProperty="id">
insert into kh_vote
<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="vDescription != null">v_description,</if>
<if test="sTime != null">s_time,</if>
<if test="eTime != null">e_time,</if>
<if test="maxNum != null">max_num,</if>
<if test="state != null">state,</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>
<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="vDescription != null">#{vDescription},</if>
<if test="sTime != null">#{sTime},</if>
<if test="eTime != null">#{eTime},</if>
<if test="maxNum != null">#{maxNum},</if>
<if test="state != null">#{state},</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>
</trim>
</insert>
<update id="updateKhVote" parameterType="KhVote">
update kh_vote
<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="vDescription != null">v_description = #{vDescription},</if>
<if test="sTime != null">s_time = #{sTime},</if>
<if test="eTime != null">e_time = #{eTime},</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="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@ -88,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteKhVoteByIds" parameterType="String">
delete from kh_vote where id in
delete from kh_vote where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

Loading…
Cancel
Save