删除领料明细接口提交

This commit is contained in:
syruan 2023-12-22 14:52:51 +08:00
parent 6d642b7edf
commit bf0c462853
9 changed files with 126 additions and 97 deletions

View File

@ -117,4 +117,10 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/**
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(value = "装备管理方式")
private int manageType;
}

View File

@ -67,9 +67,9 @@ public class TmTask implements Serializable {
private String phoneNumber;
/**
* 部门名称
* 部门名称 单位名称
*/
@ApiModelProperty(value="部门名称")
@ApiModelProperty(value="部门/单位名称")
private String deptName;
/**

View File

@ -63,6 +63,18 @@ public class TmTaskController extends BaseController {
return tmTaskService.deleteByPrimaryKey(taskId);
}
/**
* 根据id删除领料明细表
*/
@Log(title = "删除领料任务明细", businessType = BusinessType.DELETE)
@DeleteMapping("/deleteDetailsByTaskId/{id}")
public AjaxResult deleteDetailsByTaskId(@PathVariable String id) {
if (StringUtils.isEmpty(id)) {
return AjaxResult.error("参数错误,删除失败!");
}
return toAjax(tmTaskService.deleteDetailsByTaskId(id));
}
/**
* 往来单位提交工程领用机具信息
@ -261,15 +273,16 @@ public class TmTaskController extends BaseController {
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("任务表修改成功");
if (CollUtil.isNotEmpty(task.getLeaseApplyDetails())) {
for (LeaseApplyDetails leaseApplyDetails : task.getLeaseApplyDetails()) {
leaseApplyDetailsService.updateByPrimaryKeySelective(leaseApplyDetails);
}
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("任务表修改成功,但领料任务明细修改信息为空");
}
} else {
return AjaxResult.error("任务表修改失败");
}

View File

@ -1,10 +1,11 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Description: 领料任务详情Mapper接口
* @Author 阮世耀
@ -26,6 +27,11 @@ public interface LeaseApplyDetailsMapper {
LeaseApplyDetails selectByPrimaryKey(Integer id);
/**
* 根据主键更新实体属性不为null的列
* @param record 实体对象
* @return 影响行数
*/
int updateByPrimaryKeySelective(LeaseApplyDetails record);
int updateByPrimaryKey(LeaseApplyDetails record);

View File

@ -39,6 +39,12 @@ public interface TmTaskMapper {
/** 更新leaseApplyDetails审批信息 */
int updateLeaseApplyDetailsAuditInfo(@Param("record") LeaseApplyDetails record);
int deleteTaskByPrimaryKey(String taskId);
int deleteTaskInfoByTaskId(String taskId);
int deleteDetailsByTaskId(@Param("id") String id);
int insert(TmTask record);
int insertOrUpdate(TmTask record);
@ -68,13 +74,8 @@ public interface TmTaskMapper {
int insertAgreement(TmTask record);
int deleteTaskByPrimaryKey(String taskId);
int deleteTaskInfoByTaskId(String taskId);
int selectNumByMonth(Date nowDate);
TmTask getLeaseListTmTask(TmTask task);
LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);

View File

@ -25,6 +25,8 @@ public interface TmTaskService{
AjaxResult deleteByPrimaryKey(String taskId);
int deleteDetailsByTaskId(@Param("id") String id);
int createTask(TmTask record);
int insertOrUpdate(TmTask record);

View File

@ -142,6 +142,16 @@ public class TmTaskServiceImpl implements TmTaskService{
}
}
/**
* 根据id删除详情表配置的设备
* @param id 数据id
* @return 结果
*/
@Override
public int deleteDetailsByTaskId(String id) {
return tmTaskMapper.deleteDetailsByTaskId(id);
}
@Override
public int createTask(TmTask record) {
return tmTaskMapper.insert(record);

View File

@ -119,16 +119,10 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
<!--@mbg.generated-->
update lease_apply_details
<set>
<if test="parenntId != null">
parennt_id = #{parenntId,jdbcType=INTEGER},
</if>
<if test="typeId != null">
type_id = #{typeId,jdbcType=INTEGER},
</if>
<if test="preNum != null">
pre_num = #{preNum,jdbcType=FLOAT},
</if>
@ -138,12 +132,6 @@
<if test="status != null and status != ''">
`status` = #{status,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>

View File

@ -21,17 +21,6 @@
remark, company_id
</sql>
<update id="deleteTaskByPrimaryKey">
update tm_task set `status` = '0'
where task_id = #{taskId}
</update>
<update id="deleteTaskInfoByTaskId">
update lease_apply_info set `status` = '0'
where task_id = #{taskId}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
@ -43,6 +32,20 @@
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select>
<update id="deleteTaskByPrimaryKey" parameterType="java.lang.Long">
update tm_task set `status` = '0'
where task_id = #{taskId,jdbcType=BIGINT}
</update>
<update id="deleteTaskInfoByTaskId" parameterType="java.lang.Long">
update lease_apply_info set `status` = '0'
where task_id = #{taskId}
</update>
<delete id="deleteDetailsByTaskId" parameterType="java.lang.String">
delete from lease_apply_details where id = #{id}
</delete>
<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)
values (#{taskType,jdbcType=INTEGER}, #{taskStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
@ -93,7 +96,7 @@
<if test="updateBy != null and updateBy != ''">
#{updateBy,jdbcType=VARCHAR},
</if>
now(),
now(),
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
@ -436,24 +439,25 @@
</trim>
</insert>
<insert id="insertAgreement">
INSERT INTO tm_task_agreement ( `task_id`, `agreement_id`, `create_by`, `create_time`, `company_id` )
VALUES(#{id},#{agreementId},#{createBy},NOW(),#{companyId})
</insert>
<insert id="insertAgreement">
INSERT INTO tm_task_agreement ( `task_id`, `agreement_id`, `create_by`, `create_time`, `company_id` )
VALUES(#{id},#{agreementId},#{createBy},NOW(),#{companyId})
</insert>
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
SELECT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,
case when d.id = '30' then lai.company_audit_remark
when d.id = '31' then lai.dept_audit_remark
when d.id = '32' then lai.direct_audit_remark end examineStatus ,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
bpi.pro_id as proId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,
case when d.id = '30' then lai.company_audit_remark
when d.id = '31' then lai.dept_audit_remark
when d.id = '32' then lai.direct_audit_remark end examineStatus ,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
@ -463,28 +467,28 @@
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE
WHERE
tt.task_type = '29' and tt.status = '1'
<if test="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
AND tt.task_id = #{record.taskId}
</if>
<if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">
AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')
</if>
<if test="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<if test="record.unitId != null and record.unitId != ''">
AND bui.unit_id = #{record.unitId}
</if>
<if test="record.projectId != null and record.projectId != ''">
AND bpi.pro_id = #{record.projectId}
</if>
<if test="record.projectId != null and record.projectId != ''">
AND bpi.pro_id = #{record.projectId}
</if>
<if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if>
ORDER BY tt.update_time DESC
<if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if>
ORDER BY tt.update_time DESC
</select>
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
@ -498,7 +502,7 @@
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
SELECT
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
@ -507,23 +511,23 @@
lad.parennt_id = #{record.id} AND lad.company_id = #{record.companyId}
</select>
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') AND task_type='29'
</select>
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') AND task_type='29'
</select>
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId, bpi.pro_id as projectId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
tt.create_by as applyFor,d.`name` as taskName,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes,
bai.agreement_id as agreementId
FROM
tm_task tt
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId, bpi.pro_id as projectId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
tt.create_by as applyFor,d.`name` as taskName,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes,
bai.agreement_id as agreementId
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
@ -531,18 +535,17 @@
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE tt.task_id = #{taskId}
</select>
<select id="getLeaseListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT
lai.*
FROM
lease_apply_info lai
WHERE
lai.task_id = #{taskId}
</select>
WHERE tt.task_id = #{taskId}
</select>
<select id="getLeaseListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT
lai.*
FROM
lease_apply_info lai
WHERE
lai.task_id = #{taskId}
</select>
<update id="updateTmTaskAuditStatus">
UPDATE tm_task SET task_status = #{record.taskStatus} WHERE task_id = #{record.taskId}