feat(demand): 优化需求管理功能
- 修改需求插入接口,返回插入的需求对象 - 更新需求删除逻辑,采用逻辑删除方式- 优化查询接口,只返回状态为 0 的需求 - 调整工作日志查询,移除冗余的项目状态判断dev_1.2.0
parent
b5f0c88db3
commit
3cf0ba7d05
|
@ -48,7 +48,7 @@ public class ProjectDemandController extends BaseController {
|
|||
@PostMapping("/insert")
|
||||
@Log(title = "需求管理", businessType = BusinessType.INSERT)
|
||||
public AjaxResult add(@RequestBody ProjectDemand projectDemand) {
|
||||
return toAjax(projectDemandService.insert(projectDemand));
|
||||
return AjaxResult.success(projectDemandService.insert(projectDemand));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public interface ProjectDemandMapper {
|
|||
* 通过主键删除数据
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
int logicDeleteByIds(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 通过id批量删除
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface IProjectDemandService {
|
|||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
int insert(ProjectDemand projectDemand);
|
||||
ProjectDemand insert(ProjectDemand projectDemand);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package tech.unissense.pms.business.demand.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import tech.unissense.pms.business.demand.domain.ProjectDemand;
|
||||
import tech.unissense.pms.business.demand.mapper.ProjectDemandMapper;
|
||||
|
@ -50,7 +51,7 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
|
||||
|
||||
@Override
|
||||
public int insert(ProjectDemand projectDemand) {
|
||||
public ProjectDemand insert(ProjectDemand projectDemand) {
|
||||
verifyProjectState(projectDemand);
|
||||
if (projectDemand.getEndTime() == null) {
|
||||
//根据当前时间向上取整
|
||||
|
@ -64,7 +65,8 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
throw new ServiceException("结束时间不能早于当前时间");
|
||||
}
|
||||
}
|
||||
return projectDemandMapper.insert(projectDemand);
|
||||
int insert = projectDemandMapper.insert(projectDemand);
|
||||
return projectDemand;
|
||||
}
|
||||
|
||||
private void verifyProjectState(ProjectDemand projectDemand) {
|
||||
|
@ -105,9 +107,7 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
|
||||
@Override
|
||||
public int deleteById(Integer id) {
|
||||
ProjectDemand projectDemand = queryById(id);
|
||||
verifyProjectState(projectDemand);
|
||||
return projectDemandMapper.deleteById(id);
|
||||
return projectDemandMapper.logicDeleteByIds(new Integer[]{id});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,7 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
*/
|
||||
@Override
|
||||
public int batchRemove(Integer[] ids) {
|
||||
return projectDemandMapper.batchRemove(ids);
|
||||
return projectDemandMapper.logicDeleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
left join pms_project_version t2 on t1.version_id = t2.id
|
||||
left join sys_user t3 on t1.responsible_person = t3.user_id
|
||||
<where>
|
||||
state='0'
|
||||
<if test="id != null">
|
||||
and t1.id = #{id}
|
||||
</if>
|
||||
|
@ -96,7 +97,7 @@
|
|||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from pms_project_demand
|
||||
where version_id in
|
||||
where state='0' and version_id in
|
||||
<foreach collection="list" close=")" open="(" item="versionId" separator=",">
|
||||
#{versionId}
|
||||
</foreach>
|
||||
|
@ -172,12 +173,10 @@
|
|||
<update id="update">
|
||||
UPDATE pms_project_demand
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
version_id = #{versionId},
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="versionId != null and versionId != ''">
|
||||
version_id = #{versionId},
|
||||
</if>
|
||||
<if test="demandStatus != null and demandStatus != ''">
|
||||
demand_status = #{demandStatus},
|
||||
</if>
|
||||
|
@ -204,6 +203,14 @@
|
|||
set demand_status = '3'
|
||||
where end_time <![CDATA[<=]]> now()
|
||||
</update>
|
||||
<update id="logicDeleteByIds">
|
||||
update pms_project_demand
|
||||
set state = 1
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
,t3.project_name,t4.title ,t5.version_number,t4.version_id
|
||||
from pms_work_logger t1
|
||||
left join sys_user t2 on t1.user_id=t2.user_id
|
||||
inner join pms_project t3 on (t1.project_id=t3.project_id and t3.state=0)
|
||||
left join pms_project t3 on t1.project_id=t3.project_id
|
||||
left join pms_project_demand t4 on t1.demand_id=t4.id
|
||||
left join pms_project_version t5 on t4.version_id=t5.id
|
||||
<where>
|
||||
|
|
Loading…
Reference in New Issue