维护养护BUG修改
parent
2ed25aaea1
commit
f145875da0
|
|
@ -62,9 +62,9 @@ public class MentenceStController {
|
|||
|
||||
@Operation(summary = "列表")
|
||||
@GetMapping("/list")
|
||||
public List<MentenceSt> list() {
|
||||
public R<List<MentenceSt>> list() {
|
||||
List<MentenceSt> list = mentenceStService.lambdaQuery().orderByAsc(MentenceSt::getCreateTime).list();
|
||||
return list;
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -86,9 +86,9 @@ public class MentenceStController {
|
|||
|
||||
@Operation(summary = "维护项目列表")
|
||||
@GetMapping("/detail/list")
|
||||
public List<MentenceStDetail> detailList() {
|
||||
public R<List<MentenceStDetail>> detailList() {
|
||||
List<MentenceStDetail> list = mentenceStDetailService.lambdaQuery().orderByAsc(MentenceStDetail::getOrder).list();
|
||||
return list;
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -121,15 +121,15 @@ public class MentenceStController {
|
|||
//根据维护对象id,查询维护项目
|
||||
@Operation(summary = "根据维护对象id,查询维护项目")
|
||||
@PostMapping("/detail/page")
|
||||
public Page<MentenceStDetail> page(@RequestBody MentenceStPageSo dto) {
|
||||
return mentenceStDetailService.pageQuery(dto);
|
||||
public R<Page<MentenceStDetail>> page(@RequestBody MentenceStPageSo dto) {
|
||||
return R.ok(mentenceStDetailService.pageQuery(dto));
|
||||
}
|
||||
|
||||
//查询养护对象 (可根据 防治点查询,也可以根据防治部位查询)
|
||||
@Operation(summary = "查询防治部位(可根据 维护对象,也可以根据维护项目查询)")
|
||||
@PostMapping("/tree")
|
||||
public List<MentenceSt> tree(@RequestBody MentenceStPageSo dto) {
|
||||
public R<List<MentenceSt>> tree(@RequestBody MentenceStPageSo dto) {
|
||||
List<MentenceSt> res = mentenceStService.tree(dto);
|
||||
return res;
|
||||
return R.ok(res);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.gunshi.project.hsz.entity.so;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -12,9 +14,11 @@ public class MentenceFarmerRecordPageSo {
|
|||
private PageSo pageSo;
|
||||
|
||||
@Schema(description = "维护对象主键ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mentenceStId;
|
||||
|
||||
@Schema(description = "维护项目Id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mentenceStDetailId;
|
||||
|
||||
@Schema(description = "状态")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.gunshi.project.hsz.entity.so;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
|
@ -18,5 +20,6 @@ public class MentenceStPageSo {
|
|||
private String stDetailName;
|
||||
|
||||
@Schema(description = "维护对象id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long stId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.hsz.validate.markers.Insert;
|
||||
import com.gunshi.project.hsz.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -18,6 +20,7 @@ import java.util.List;
|
|||
@Schema(description = "维护养护-维护标准")
|
||||
public class MentenceSt {
|
||||
@TableId("id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField("st_name")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.gunshi.project.hsz.model;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.hsz.validate.markers.Insert;
|
||||
import com.gunshi.project.hsz.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -14,11 +16,13 @@ import lombok.Data;
|
|||
@Schema(description = "维护养护-维护标准细节")
|
||||
public class MentenceStDetail {
|
||||
@TableId
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField("mentence_st_id")
|
||||
@Schema(description = "维护对象名id")
|
||||
@NotNull(message = "维护对象名称Id不能为空",groups = {Insert.class, Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mentenceStId;
|
||||
|
||||
@TableField("name")
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public class MentencePlanService extends ServiceImpl<MentencePlanMapper, Menten
|
|||
save(dto);
|
||||
//保存细节
|
||||
List<MentencePlanDetail> details = dto.getDetails();
|
||||
if(details == null || details.isEmpty()){
|
||||
throw new IllegalArgumentException("至少需要一条维护内容");
|
||||
}
|
||||
details.stream().forEach(detail->{
|
||||
detail.setId(IdWorker.getId());
|
||||
detail.setMentencePlanId(dto.getId());
|
||||
|
|
@ -82,6 +85,9 @@ public class MentencePlanService extends ServiceImpl<MentencePlanMapper, Menten
|
|||
}
|
||||
updateById(dto);
|
||||
List<MentencePlanDetail> details = dto.getDetails();
|
||||
if(details == null || details.isEmpty()){
|
||||
throw new IllegalArgumentException("至少需要一条维护内容");
|
||||
}
|
||||
//先删除细节
|
||||
LambdaQueryWrapper<MentencePlanDetail> queryWrapperDetail = new LambdaQueryWrapper<>();
|
||||
queryWrapperDetail.eq(MentencePlanDetail::getMentencePlanId,mentencePlan.getId());
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class MentenceStService extends ServiceImpl<MentenceStMapper, MentenceSt>
|
|||
if(count > 0) {
|
||||
throw new IllegalArgumentException("存在养护项目,无法删除");
|
||||
}
|
||||
mentenceStDetailMapper.deleteById(id);
|
||||
removeById(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public class MentenceStService extends ServiceImpl<MentenceStMapper, MentenceSt>
|
|||
}
|
||||
dto.setId(IdWorker.getId());
|
||||
dto.setCreateTime(new Date());
|
||||
save(mentenceSt);
|
||||
save(dto);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue