申领任务删除
This commit is contained in:
parent
4524eb173f
commit
2f6f9ec862
|
|
@ -50,6 +50,18 @@ public class TmTaskController extends BaseController {
|
|||
return toAjax(tmTaskService.updateLeaseTaskAuditInfo(task));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据任务id删除任务表及任务信息
|
||||
*/
|
||||
@Log(title = "删除任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{taskId}")
|
||||
public AjaxResult deleteTaskInfoByTaskId(@PathVariable String taskId) {
|
||||
if (StringUtils.isEmpty(taskId)) {
|
||||
return AjaxResult.error("参数错误,删除失败!");
|
||||
}
|
||||
return tmTaskService.deleteByPrimaryKey(taskId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 往来单位提交工程领用机具信息
|
||||
|
|
@ -217,6 +229,33 @@ public class TmTaskController extends BaseController {
|
|||
return AjaxResult.success(getDataTable(leaseAuditList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务信息
|
||||
*/
|
||||
@Log(title = "修改任务信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TmTask task) {
|
||||
if (StringUtils.isNull(task)) {
|
||||
return AjaxResult.error("参数错误,传入信息为空!");
|
||||
}
|
||||
try {
|
||||
// 任务编号
|
||||
String taskId = task.getId();
|
||||
// 任务类型
|
||||
Integer taskType = task.getTaskType();
|
||||
// 任务状态
|
||||
Integer taskStatus = task.getTaskStatus();
|
||||
int taskResult = tmTaskService.updateByPrimaryKeySelective(task);
|
||||
if (taskResult > 0) {
|
||||
return AjaxResult.success("任务表修改成功");
|
||||
} else {
|
||||
return AjaxResult.error("任务表修改失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("修改失败,异常信息:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ public interface TmTaskMapper {
|
|||
/** 更新leaseApplyDetails审批信息 */
|
||||
int updateLeaseApplyDetailsAuditInfo(@Param("record") LeaseApplyDetails record);
|
||||
|
||||
int deleteByPrimaryKey(Long taskId);
|
||||
int deleteTaskByPrimaryKey(String taskId);
|
||||
|
||||
int deleteTaskInfoByTaskId(String taskId);
|
||||
|
||||
int insert(TmTask record);
|
||||
|
||||
|
|
@ -51,6 +53,11 @@ public interface TmTaskMapper {
|
|||
|
||||
TmTask selectByPrimaryKey(Long taskId);
|
||||
|
||||
/**
|
||||
* 修改Tm_task任务表
|
||||
* @param record 参数对象
|
||||
* @return 结果
|
||||
*/
|
||||
int updateByPrimaryKeySelective(TmTask record);
|
||||
|
||||
int updateByPrimaryKey(TmTask record);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.bonus.sgzb.app.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.bonus.sgzb.base.api.domain.TmTask;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +23,7 @@ public interface TmTaskService{
|
|||
|
||||
String genderLeaseCode();
|
||||
|
||||
int deleteByPrimaryKey(Long taskId);
|
||||
AjaxResult deleteByPrimaryKey(String taskId);
|
||||
|
||||
int createTask(TmTask record);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
|
|||
import com.bonus.sgzb.base.api.domain.TmTask;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -110,8 +111,16 @@ public class TmTaskServiceImpl implements TmTaskService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Long taskId) {
|
||||
return tmTaskMapper.deleteByPrimaryKey(taskId);
|
||||
public AjaxResult deleteByPrimaryKey(String taskId) {
|
||||
boolean taskFlag = tmTaskMapper.deleteTaskByPrimaryKey(taskId) > 0;
|
||||
boolean infoFlag = tmTaskMapper.deleteTaskInfoByTaskId(taskId) > 0;
|
||||
if (taskFlag && infoFlag) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else if (taskFlag || infoFlag) {
|
||||
return AjaxResult.error("删除失败,任务表或信息表未删除!");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败,请检查任务ID是否正确!!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,14 +27,20 @@
|
|||
from tm_task
|
||||
where task_id = #{taskId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="selectTaskNumByMonth" resultType="java.lang.Integer">
|
||||
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from tm_task
|
||||
<update id="deleteTaskByPrimaryKey" parameterType="java.lang.Long">
|
||||
update tm_task set `status` = '0'
|
||||
where task_id = #{taskId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<update id="deleteTaskInfoByTaskId" parameterType="java.lang.Long">
|
||||
update lease_apply_info set `status` = '0'
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<insert id="insert" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
|
||||
insert into tm_task (task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id)
|
||||
|
|
@ -101,7 +107,6 @@
|
|||
</insert>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sgzb.base.api.domain.TmTask">
|
||||
<!--@mbg.generated-->
|
||||
update tm_task
|
||||
<set>
|
||||
<if test="taskType != null">
|
||||
|
|
@ -110,15 +115,6 @@
|
|||
<if test="taskStatus != null">
|
||||
task_status = #{taskStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -128,9 +124,6 @@
|
|||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="companyId != null">
|
||||
company_id = #{companyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where task_id = #{taskId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
|
@ -457,7 +450,7 @@
|
|||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
|
||||
WHERE
|
||||
tt.task_type = '29'
|
||||
tt.task_type = '29' and tt.status = '1'
|
||||
<if test="record.taskId != null and record.taskId != '' ">
|
||||
AND tt.task_id = #{record.taskId}
|
||||
</if>
|
||||
|
|
@ -469,7 +462,7 @@
|
|||
FROM
|
||||
lease_apply_info lai
|
||||
WHERE
|
||||
lai.task_id = #{record.taskId} AND lai.`code` = #{record.code}
|
||||
lai.task_id = #{record.taskId} AND lai.`code` = #{record.code} AND lai.status = '1'
|
||||
</select>
|
||||
|
||||
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
|
||||
|
|
|
|||
Loading…
Reference in New Issue