add(activiti): 添加实验申请信息关联时间功能

- 新增 ExperimentRequestRelation 实体类
- 添加 ExperimentRequestRelationMapper 接口及 XML 配置
- 实现 ExperimentRequestRelationServiceImpl 服务类
- 定义 IExperimentRequestRelationService 服务接口
master
zch 4 days ago
parent bccee4d6dd
commit 672a653ea5

@ -0,0 +1,75 @@
package com.haiwei.activiti.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.haiwei.common.annotation.Excel;
import com.haiwei.common.core.domain.BaseEntity;
/**
* experiment_request_relation
*
* @author zangch
* @date 2025-01-02
*/
public class ExperimentRequestRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long objId;
/** 绑定项目主键 */
@Excel(name = "绑定项目主键")
private Long pojectId;
/** 实验状态 */
@Excel(name = "实验状态")
private Long status;
private String content;
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setPojectId(Long pojectId)
{
this.pojectId = pojectId;
}
public Long getPojectId()
{
return pojectId;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("pojectId", getPojectId())
.append("updateTime", getUpdateTime())
.append("status", getStatus())
.append("content", getContent())
.toString();
}
}

@ -0,0 +1,66 @@
package com.haiwei.activiti.mapper;
import java.util.List;
import com.haiwei.activiti.domain.ExperimentRequestRelation;
/**
* Mapper
*
* @author zangch
* @date 2025-01-02
*/
public interface ExperimentRequestRelationMapper
{
/**
*
*
* @param objId ID
* @return
*/
public ExperimentRequestRelation selectExperimentRequestRelationById(Long objId);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public List<ExperimentRequestRelation> selectExperimentRequestRelationList(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public int insertExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public int updateExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param objId ID
* @return
*/
public int deleteExperimentRequestRelationById(Long objId);
/**
*
*
* @param objIds ID
* @return
*/
public int deleteExperimentRequestRelationByIds(String[] objIds);
public int deleteExperimentRequestRelationByProjectIds(String[] projectIds);
public int deleteExperimentRequestRelationByProjectId(Long projectId);
}

@ -0,0 +1,61 @@
package com.haiwei.activiti.service;
import java.util.List;
import com.haiwei.activiti.domain.ExperimentRequestRelation;
/**
* Service
*
* @author zangch
* @date 2025-01-02
*/
public interface IExperimentRequestRelationService
{
/**
*
*
* @param objId ID
* @return
*/
public ExperimentRequestRelation selectExperimentRequestRelationById(Long objId);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public List<ExperimentRequestRelation> selectExperimentRequestRelationList(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public int insertExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param experimentRequestRelation
* @return
*/
public int updateExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation);
/**
*
*
* @param ids ID
* @return
*/
public int deleteExperimentRequestRelationByIds(String ids);
/**
*
*
* @param objId ID
* @return
*/
public int deleteExperimentRequestRelationById(Long objId);
}

@ -0,0 +1,118 @@
package com.haiwei.activiti.service.impl;
import java.util.List;
import com.haiwei.activiti.domain.ExperimentRequest;
import com.haiwei.activiti.mapper.ExperimentRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.haiwei.activiti.mapper.ExperimentRequestRelationMapper;
import com.haiwei.activiti.domain.ExperimentRequestRelation;
import com.haiwei.activiti.service.IExperimentRequestRelationService;
import com.haiwei.common.core.text.Convert;
/**
* Service
*
* @author zangch
* @date 2025-01-02
*/
@Service
public class ExperimentRequestRelationServiceImpl implements IExperimentRequestRelationService
{
@Autowired
private ExperimentRequestRelationMapper experimentRequestRelationMapper;
@Autowired
private ExperimentRequestMapper experimentRequestMapper;
/**
*
*
* @param objId ID
* @return
*/
@Override
public ExperimentRequestRelation selectExperimentRequestRelationById(Long objId)
{
return experimentRequestRelationMapper.selectExperimentRequestRelationById(objId);
}
/**
*
*
* @param experimentRequestRelation
* @return
*/
@Override
public List<ExperimentRequestRelation> selectExperimentRequestRelationList(ExperimentRequestRelation experimentRequestRelation)
{
List<ExperimentRequestRelation> experimentRequestRelations = experimentRequestRelationMapper
.selectExperimentRequestRelationList(experimentRequestRelation);
for (ExperimentRequestRelation requestRelation : experimentRequestRelations) {
Long ObjId = requestRelation.getPojectId();
ExperimentRequest experimentRequest = experimentRequestMapper.selectExperimentRequestById(ObjId);
if (requestRelation.getStatus() == 1L){
requestRelation.setContent(experimentRequest.getExperimentContent());
}else if (requestRelation.getStatus() == 2L){
requestRelation.setContent(experimentRequest.getExperimentDesc());
}else if (requestRelation.getStatus() == 3L){
requestRelation.setContent(experimentRequest.getPreparationTools());
}else if (requestRelation.getStatus() == 4L){
requestRelation.setContent(experimentRequest.getCommunicationContent());
}
}
return experimentRequestRelations;
}
/**
*
*
* @param experimentRequestRelation
* @return
*/
@Override
public int insertExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation)
{
return experimentRequestRelationMapper.insertExperimentRequestRelation(experimentRequestRelation);
}
/**
*
*
* @param experimentRequestRelation
* @return
*/
@Override
public int updateExperimentRequestRelation(ExperimentRequestRelation experimentRequestRelation)
{
return experimentRequestRelationMapper.updateExperimentRequestRelation(experimentRequestRelation);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteExperimentRequestRelationByIds(String ids)
{
return experimentRequestRelationMapper.deleteExperimentRequestRelationByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param objId ID
* @return
*/
@Override
public int deleteExperimentRequestRelationById(Long objId)
{
return experimentRequestRelationMapper.deleteExperimentRequestRelationById(objId);
}
}

@ -0,0 +1,81 @@
<?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.haiwei.activiti.mapper.ExperimentRequestRelationMapper">
<resultMap type="ExperimentRequestRelation" id="ExperimentRequestRelationResult">
<result property="objId" column="objId" />
<result property="pojectId" column="poject_id" />
<result property="updateTime" column="update_time" />
<result property="status" column="status" />
</resultMap>
<sql id="selectExperimentRequestRelationVo">
select objId, poject_id, update_time, status from experiment_request_relation
</sql>
<select id="selectExperimentRequestRelationList" parameterType="ExperimentRequestRelation" resultMap="ExperimentRequestRelationResult">
<include refid="selectExperimentRequestRelationVo"/>
<where>
<if test="pojectId != null "> and poject_id = #{pojectId}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
ORDER BY update_time DESC
</select>
<select id="selectExperimentRequestRelationById" parameterType="Long" resultMap="ExperimentRequestRelationResult">
<include refid="selectExperimentRequestRelationVo"/>
where objId = #{objId}
</select>
<insert id="insertExperimentRequestRelation" parameterType="ExperimentRequestRelation">
insert into experiment_request_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">objId,</if>
<if test="pojectId != null">poject_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="pojectId != null">#{pojectId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateExperimentRequestRelation" parameterType="ExperimentRequestRelation">
update experiment_request_relation
<trim prefix="SET" suffixOverrides=",">
<if test="pojectId != null">poject_id = #{pojectId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="status != null">status = #{status},</if>
</trim>
where objId = #{objId}
</update>
<delete id="deleteExperimentRequestRelationById" parameterType="Long">
delete from experiment_request_relation where objId = #{objId}
</delete>
<delete id="deleteExperimentRequestRelationByIds" parameterType="String">
delete from experiment_request_relation where objId in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
<delete id="deleteExperimentRequestRelationByProjectIds" parameterType="String">
delete from experiment_request_relation where poject_id in
<foreach item="pojectId" collection="array" open="(" separator="," close=")">
#{pojectId}
</foreach>
</delete>
<delete id="deleteExperimentRequestRelationByProjectId" parameterType="Long">
delete from experiment_request_relation where poject_id = #{pojectId}
</delete>
</mapper>
Loading…
Cancel
Save