opt:需求单删除优化为逻辑删除
This commit is contained in:
@@ -56,6 +56,9 @@ public class PmDemand extends Model<PmDemand> {
|
||||
@TableField("production_line")
|
||||
private String production_line;
|
||||
|
||||
@TableField("is_deleted")
|
||||
private Integer is_deleted;
|
||||
|
||||
private String sn;
|
||||
|
||||
@TableField("create_at")
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<result property="targetArea" column="target_area"/>
|
||||
<result property="targetHouseCode" column="target_house_code"/>
|
||||
<result property="carrierType" column="carrier_type"/>
|
||||
<result property="isDeleted" column="is_deleted"/>
|
||||
<result property="productionLine" column="production_line"/>
|
||||
<result property="sn" column="sn"/>
|
||||
<result property="createAt" column="create_at"/>
|
||||
@@ -26,7 +27,7 @@
|
||||
<select id="queryPage" resultMap="DemandDtoMap">
|
||||
select *
|
||||
from pm_demand
|
||||
<where>
|
||||
where is_deleted = 0
|
||||
<if test="query.id != null and query.id != ''">
|
||||
and id = #{query.id}
|
||||
</if>
|
||||
@@ -54,7 +55,6 @@
|
||||
<if test="query.endTime != null and query.endTime != ''">
|
||||
and create_time <= #{query.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by priority desc, create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -27,4 +27,5 @@ public class PmDemandDto implements Serializable {
|
||||
private String sn;
|
||||
private String createAt;
|
||||
private String inventoryDis;
|
||||
private Integer isDeleted;
|
||||
}
|
||||
|
||||
@@ -112,15 +112,18 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
demand.setCarrier_type(param.getCarrierType());
|
||||
demand.setProduction_line(param.getProductionLine());
|
||||
demand.setSn(param.getSn());
|
||||
demand.setIs_deleted(0);
|
||||
demand.setCreate_at(DateUtil.now());
|
||||
this.save(demand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreate(List<PmDemandParam> param) {
|
||||
final List<String> collect = param.stream().map(PmDemandParam::getId).collect(Collectors.toList());
|
||||
final List<PmDemand> pmDemands = this.listByIds(collect);
|
||||
if (!CollectionUtils.isEmpty(pmDemands)){
|
||||
final List<String> orders = param.stream().map(PmDemandParam::getWorkOrder).collect(Collectors.toList());
|
||||
final int count = this.count(new LambdaQueryWrapper<PmDemand>()
|
||||
.in(PmDemand::getWork_order, orders)
|
||||
.eq(PmDemand::getIs_deleted,0));
|
||||
if (count>0){
|
||||
throw new BadRequestException("MES推送需求单失败,需求单已存在");
|
||||
}
|
||||
for (PmDemandParam pmDemandParam : param) {
|
||||
@@ -158,7 +161,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
this.removeByIds(ids);
|
||||
this.update(new LambdaUpdateWrapper<PmDemand>().in(PmDemand::getId,ids)
|
||||
.set(PmDemand::getIs_deleted,1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user