@@ -1,6 +1,6 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.service.airport.AirPortService; | |||
import com.tuoheng.admin.service.airport.AirportService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -19,24 +19,25 @@ import org.springframework.web.bind.annotation.*; | |||
public class AirPortController { | |||
@Autowired | |||
private AirPortService airPortService; | |||
private AirportService airportService; | |||
/** | |||
* 获取巡检机场 | |||
*/ | |||
@GetMapping("/airport") | |||
public JsonResult getAirPortList() { | |||
return airPortService.getAirportList(); | |||
@GetMapping("/list") | |||
public JsonResult getList() { | |||
return airportService.getAirportList(); | |||
} | |||
/** | |||
* 获取巡检线路 | |||
* | |||
* @param droneId 机场列表里面的droneId | |||
* @return | |||
*/ | |||
@GetMapping("/airport/line/{droneId}") | |||
@GetMapping("/line/{droneId}") | |||
public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) { | |||
return airPortService.getAirLineList(droneId); | |||
return airportService.getAirLineList(droneId); | |||
} | |||
} |
@@ -57,7 +57,7 @@ public class DeptController { | |||
/** | |||
* 新增部门 | |||
*/ | |||
@PostMapping | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody AddDeptRequest addDeptRequest) { | |||
log.info("进入新增部门接口"); | |||
return deptService.insert(addDeptRequest); | |||
@@ -66,7 +66,7 @@ public class DeptController { | |||
/** | |||
* 修改部门 | |||
*/ | |||
@PutMapping | |||
@PutMapping("/edit") | |||
public JsonResult update(@RequestBody Map<String, Object> param) { | |||
log.info("进入修改部门接口"); | |||
EditDeptRequest oldEditDeptRequest = JSON.parseObject(JSON.toJSONString(param.get("oldEditDeptRequest")), EditDeptRequest.class); | |||
@@ -77,7 +77,7 @@ public class DeptController { | |||
/** | |||
* 删除部门 | |||
*/ | |||
@DeleteMapping("/{id}") | |||
@DeleteMapping("/delete/{id}") | |||
public JsonResult delete(@PathVariable("id") String id) { | |||
log.info("进入删除部门接口"); | |||
return deptService.deleteById(id); |
@@ -1,6 +1,8 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.IInspectionService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -37,6 +39,7 @@ public class InspectionController { | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public JsonResult getInfo(QueryInspectionPageListRequest request) { | |||
log.info("进入查询任务详情接口"); | |||
return iInspectionService.selectOneById(request); | |||
} | |||
@@ -44,23 +47,26 @@ public class InspectionController { | |||
* 新增巡检任务 | |||
*/ | |||
@PostMapping | |||
public JsonResult add(@RequestBody Inspection inspection) { | |||
return iInspectionService.insert(inspection); | |||
public JsonResult add(@RequestBody AddInspectionRequest addInspectionRequest) { | |||
log.info("进入添加任务接口"); | |||
return iInspectionService.insert(addInspectionRequest); | |||
} | |||
/** | |||
* 修改巡检任务 | |||
*/ | |||
@PutMapping | |||
public JsonResult edit(@RequestBody Inspection inspection) { | |||
return iInspectionService.update(inspection); | |||
public JsonResult edit(@RequestBody EditInspectionRequest editInspectionRequest) { | |||
log.info("进入修改任务接口"); | |||
return iInspectionService.update(editInspectionRequest); | |||
} | |||
/** | |||
* 删除巡检任务 | |||
*/ | |||
@DeleteMapping("/{ids}") | |||
public JsonResult delete(@PathVariable String[] ids) { | |||
return iInspectionService.deleteByIds(ids); | |||
@DeleteMapping("/{id}") | |||
public JsonResult delete(@PathVariable("id") String id) { | |||
log.info("进入删除任务接口"); | |||
return iInspectionService.deleteById(id); | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
@Mapper | |||
public interface InspectionConverMapper { | |||
InspectionConverMapper INSTANCE = Mappers.getMapper(InspectionConverMapper.class); | |||
Inspection fromAddInspectionRequestToInspection(AddInspectionRequest request); | |||
Inspection fromEditInspectionRequestToInspection(EditInspectionRequest request); | |||
} |
@@ -1,34 +0,0 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.vo.DeptTreeVo; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class Test { | |||
public static void main(String[] args) { | |||
List<Dept> deptList = new ArrayList<>(); | |||
Dept dept1 = new Dept(); | |||
dept1.setId("1001"); | |||
dept1.setTenantId("1"); | |||
dept1.setName("aaa"); | |||
Dept dept2 = new Dept(); | |||
dept2.setId("2002"); | |||
dept2.setTenantId("1"); | |||
dept2.setName("bbb"); | |||
deptList.add(dept1); | |||
deptList.add(dept2); | |||
List<DeptTreeVo> deptTreeVoList = DeptConverMapper.INSTANCE.deptListToDeptVoList(deptList); | |||
for (DeptTreeVo dv : deptTreeVoList) { | |||
System.out.println(dv); | |||
} | |||
} | |||
} |
@@ -2,9 +2,12 @@ package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigDecimal; | |||
@@ -18,14 +21,13 @@ import java.util.Date; | |||
* @date 2022-11-16 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_inspection") | |||
public class Inspection extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** ID */ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private String id; | |||
/** 租户ID */ | |||
private String tenantId; | |||
@@ -57,13 +59,13 @@ public class Inspection extends BaseEntity { | |||
private Integer inspectionType; | |||
/** 巡检机场id */ | |||
private Long airportId; | |||
private Integer airportId; | |||
/** 巡检机场名称 */ | |||
private String airportName; | |||
/** 巡检线路id */ | |||
private Long inspectionLine; | |||
private Integer inspectionLine; | |||
/** 巡检线路名称 */ | |||
private String inspectionLineName; | |||
@@ -176,13 +178,4 @@ public class Inspection extends BaseEntity { | |||
/** 巡逻地点 */ | |||
private String patrolLocation; | |||
/** 创建人 */ | |||
private String createUser; | |||
/** 更新人 */ | |||
private String updateUser; | |||
/** 有效标记 */ | |||
private Integer mark; | |||
} |
@@ -0,0 +1,57 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 添加任务信息返回码 | |||
* 模块代码:23(任务管理) | |||
* 接口代码:01 (添加任务) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
public enum AddInspectionCodeEnum { | |||
ADD_DEPT_IS_FAILED(1230100, "添加任务失败"), | |||
NAME_IS_NULL(1230101, "任务名为空"), | |||
TYPE_IS_NULL(1230102, "任务类型为空"), | |||
ROAD_IS_NULL(1230103, "任务地点为空"), | |||
SECTION_IS_NULL(1230104, "路段信息为空"), | |||
INSPECTION_TYPE_IS_NULL(1230105, "巡检方式为空"), | |||
AIRPORT_IS_NULL(1230106, "巡检机场为空"), | |||
INSPECTION_LINE_IS_NULL(1230107, "巡检路线为空"), | |||
INSPECTION_TIME_IS_NULL(1230108, "巡检时间为空"), | |||
ROAD_IS_NOT_EXIST(1230109, "公路不存在"), | |||
SECTION_IS_NOT_EXIST(1230110, "路段不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
AddInspectionCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 删除任务信息返回码 | |||
* 模块代码:23(任务管理) | |||
* 接口代码:02 (删除任务) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
public enum DeleteInspectionCodeEnum { | |||
DELETE_IS_FAILED(1230200, "删除任务失败"), | |||
ID_IS_NULL(1230201, "任务ID为空"), | |||
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
DeleteInspectionCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,58 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 修改任务信息返回码 | |||
* 模块代码:23(任务管理) | |||
* 接口代码:03 (修改任务) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
public enum EditInspectionCodeEnum { | |||
ADD_DEPT_IS_FAILED(1230300, "修改任务失败"), | |||
ID_IS_NULL(1230301, "任务ID为空"), | |||
NAME_IS_NULL(1230302, "任务名为空"), | |||
TYPE_IS_NULL(1230303, "任务类型为空"), | |||
ROAD_IS_NULL(1230304, "任务地点为空"), | |||
SECTION_IS_NULL(1230305, "路段信息为空"), | |||
INSPECTION_TYPE_IS_NULL(1230306, "巡检方式为空"), | |||
AIRPORT_IS_NULL(1230307, "巡检机场为空"), | |||
INSPECTION_LINE_IS_NULL(1230308, "巡检路线为空"), | |||
INSPECTION_TIME_IS_NULL(1230309, "巡检时间为空"), | |||
ROAD_IS_NOT_EXIST(1230310, "公路不存在"), | |||
SECTION_IS_NOT_EXIST(1230311, "路段不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
EditInspectionCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -2,8 +2,8 @@ package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 查询巡检任务分页列表返回码 | |||
* 模块代码:21(公路管理) | |||
* 接口代码:03 (根据部门id获取该部门下公路列表) | |||
* 模块代码:23(公路管理) | |||
* 接口代码:04 (根据部门id获取该部门下公路列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
@@ -11,9 +11,9 @@ package com.tuoheng.admin.enums.code.inspection; | |||
*/ | |||
public enum QueryInspectionPageListCodeEnum { | |||
QUERY_IS_FAILED(1210300, "获取数据失败"), | |||
DEPT_ID_IS_NULL(1210301, "部门id为空"), | |||
DEPT_IS_NOT_EXIST(1210302, "部门不存在"); | |||
QUERY_IS_FAILED(1230400, "获取数据失败"), | |||
DEPT_ID_IS_NULL(1230401, "部门id为空"), | |||
DEPT_IS_NOT_EXIST(1230402, "部门不存在"); | |||
/** | |||
* 错误码 |
@@ -33,9 +33,9 @@ public interface DeptMapper extends BaseMapper<Dept> { | |||
/** | |||
* 删除部门 | |||
* | |||
* @param dept 部门 | |||
* @param id 部门 | |||
* @return 结果 | |||
*/ | |||
int deleteById(Dept dept); | |||
int deleteById(String id); | |||
} |
@@ -1,13 +1,14 @@ | |||
package com.tuoheng.admin.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
/** | |||
* 巡检任务Mapper接口 | |||
* | |||
@@ -15,13 +16,13 @@ import org.apache.ibatis.annotations.Param; | |||
* @author wanjing | |||
* @date 2022-11-16 | |||
*/ | |||
public interface InspectionMapper { | |||
/** | |||
* 查询巡检任务 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务 | |||
*/ | |||
public interface InspectionMapper extends BaseMapper<Inspection> { | |||
/** | |||
* 查询巡检任务 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务 | |||
*/ | |||
Inspection selectOneById(QueryInspectionPageListRequest request); | |||
/** | |||
@@ -42,7 +43,7 @@ public interface InspectionMapper { | |||
/** | |||
* 修改巡检任务 | |||
* | |||
* | |||
* @param inspection 巡检任务 | |||
* @return 结果 | |||
*/ | |||
@@ -56,11 +57,4 @@ public interface InspectionMapper { | |||
*/ | |||
int deleteById(String id); | |||
/** | |||
* 批量删除巡检任务 | |||
* | |||
* @param ids 需要删除的数据主键集合 | |||
* @return 结果 | |||
*/ | |||
int deleteByIds(String[] ids); | |||
} |
@@ -1,7 +1,12 @@ | |||
package com.tuoheng.admin.request.inspection; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import javax.validation.constraints.NotNull; | |||
import java.util.Date; | |||
/** | |||
* 新增任务请求参数 | |||
@@ -11,17 +16,17 @@ import lombok.Data; | |||
* @date 2022-11-24 | |||
*/ | |||
@Data | |||
public class AddInspectionRequest extends BaseQuery { | |||
public class AddInspectionRequest { | |||
/** | |||
* 用户ID | |||
*/ | |||
private Integer userId; | |||
private String userId; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
private String tenantId; | |||
/** | |||
* 任务编号 | |||
@@ -41,7 +46,7 @@ public class AddInspectionRequest extends BaseQuery { | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private Integer airportName; | |||
private String airportName; | |||
/** | |||
* 巡检线路Id | |||
@@ -51,7 +56,7 @@ public class AddInspectionRequest extends BaseQuery { | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private Integer inspectionLineName; | |||
private String inspectionLineName; | |||
/** | |||
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) | |||
@@ -88,4 +93,17 @@ public class AddInspectionRequest extends BaseQuery { | |||
*/ | |||
private String sectionName; | |||
/** | |||
* 计划巡检日期 | |||
*/ | |||
@NotNull(message = "计划巡检日期不能为空!") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date inspectionTime; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
} |
@@ -0,0 +1,108 @@ | |||
package com.tuoheng.admin.request.inspection; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import javax.validation.constraints.NotNull; | |||
import java.util.Date; | |||
/** | |||
* 修改任务请求参数 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
@Data | |||
public class EditInspectionRequest { | |||
/** | |||
* ID | |||
*/ | |||
private String id; | |||
/** | |||
* 用户ID | |||
*/ | |||
private String userId; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 巡检机场id | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
/** | |||
* 巡检线路Id | |||
*/ | |||
private Integer inspectionLine; | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private String inspectionLineName; | |||
/** | |||
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) | |||
*/ | |||
private Integer type; | |||
/** | |||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | |||
*/ | |||
private Integer inspectionType; | |||
/** | |||
* 部门Id | |||
*/ | |||
private String deptId; | |||
/** | |||
* 公路Id | |||
*/ | |||
private String roadId; | |||
/** | |||
* 公路名称 | |||
*/ | |||
private String roadName; | |||
/** | |||
* 路段Id | |||
*/ | |||
private String sectionId; | |||
/** | |||
* 路段名称 | |||
*/ | |||
private String sectionName; | |||
/** | |||
* 计划巡检日期 | |||
*/ | |||
@NotNull(message = "计划巡检日期不能为空!") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date inspectionTime; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
} |
@@ -2,7 +2,7 @@ package com.tuoheng.admin.service.airport; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
public interface AirPortService { | |||
public interface AirportService { | |||
JsonResult getAirportList(); | |||
@@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; | |||
import java.util.Objects; | |||
@Service | |||
public class AirPortServiceImpl implements AirPortService { | |||
public class AirportServiceImpl implements AirportService { | |||
@Autowired | |||
private TenantMapper tenantMapper; |
@@ -1,6 +1,8 @@ | |||
package com.tuoheng.admin.service.inspection; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -40,26 +42,18 @@ public interface IInspectionService { | |||
/** | |||
* 新增巡检任务 | |||
* | |||
* @param Inspection 巡检任务 | |||
* @param addInspectionRequest 新增任务请求参数 | |||
* @return 结果 | |||
*/ | |||
JsonResult insert(Inspection Inspection); | |||
JsonResult insert(AddInspectionRequest addInspectionRequest); | |||
/** | |||
* 修改巡检任务 | |||
* | |||
* @param Inspection 巡检任务 | |||
* @param editInspectionRequest 修改任务请求参数 | |||
* @return 结果 | |||
*/ | |||
JsonResult update(Inspection Inspection); | |||
/** | |||
* 批量删除巡检任务 | |||
* | |||
* @param ids 需要删除的巡检任务主键集合 | |||
* @return 结果 | |||
*/ | |||
JsonResult deleteByIds(String[] ids); | |||
JsonResult update(EditInspectionRequest editInspectionRequest); | |||
/** | |||
* 删除巡检任务信息 |
@@ -2,8 +2,13 @@ package com.tuoheng.admin.service.inspection; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | |||
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | |||
import com.tuoheng.admin.service.inspection.query.QueryInspectionPageListService; | |||
import com.tuoheng.admin.service.inspection.update.UpdateInspectionService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -23,7 +28,16 @@ public class InspectionServiceImpl implements IInspectionService { | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
QueryInspectionPageListService queryInspectionPageListService; | |||
private QueryInspectionPageListService queryInspectionPageListService; | |||
@Autowired | |||
private AddInspectionService addinspectionService; | |||
@Autowired | |||
private UpdateInspectionService updateInspectionService; | |||
@Autowired | |||
private DeleteInspectionService deleteInspectionService; | |||
/** | |||
* 查询巡检任务分页分页列表 | |||
@@ -76,39 +90,23 @@ public class InspectionServiceImpl implements IInspectionService { | |||
/** | |||
* 新增巡检任务 | |||
* | |||
* @param inspection 巡检任务 | |||
* @param addInspectionRequest 新增任务请求参数 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult insert(Inspection inspection) { | |||
return JsonResult.success(); | |||
public JsonResult insert(AddInspectionRequest addInspectionRequest) { | |||
return addinspectionService.add(addInspectionRequest); | |||
} | |||
/** | |||
* 修改巡检任务 | |||
* | |||
* @param inspection 巡检任务 | |||
* @param editInspectionRequest 修改任务请求参数 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult update(Inspection inspection) { | |||
inspectionMapper.update(inspection); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 批量删除巡检任务 | |||
* | |||
* @param ids 需要删除的巡检任务主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult deleteByIds(String[] ids) { | |||
inspectionMapper.deleteByIds(ids); | |||
return JsonResult.success(); | |||
public JsonResult update(EditInspectionRequest editInspectionRequest) { | |||
return updateInspectionService.update(editInspectionRequest); | |||
} | |||
/** | |||
@@ -119,8 +117,6 @@ public class InspectionServiceImpl implements IInspectionService { | |||
*/ | |||
@Override | |||
public JsonResult deleteById(String id) { | |||
inspectionMapper.deleteById(id); | |||
return JsonResult.success(); | |||
return deleteInspectionService.deleteById(id); | |||
} | |||
} |
@@ -0,0 +1,146 @@ | |||
package com.tuoheng.admin.service.inspection.add; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 添加任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-23 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class AddInspectionService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private RoadInformationMapper roadInformationMapper; | |||
@Autowired | |||
private SectionMapper sectionMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
/** | |||
* 添加任务 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult add(AddInspectionRequest addInspectionRequest) { | |||
log.info("进入添加任务业务接口"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(tenantId, addInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("添加任务业务接口:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, user.getDeptId()) | |||
.eq(Dept::getMark, 1)); | |||
String code = DateUtils.generateCode("XJRW"); | |||
addInspectionRequest.setTenantId(tenantId); | |||
addInspectionRequest.setCode(code); | |||
addInspectionRequest.setDeptId(dept.getId()); | |||
Inspection inspection = InspectionConverMapper.INSTANCE.fromAddInspectionRequestToInspection(addInspectionRequest); | |||
Integer rowId = inspectionMapper.insert(inspection); | |||
log.info("添加任务, 返回结果: deptId={}", rowId); | |||
if (rowId <= 0) { | |||
log.info("添加任务业务接口:添加任务失败:{}", result.getMsg()); | |||
return JsonResult.error(AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getMsg()); | |||
} | |||
log.info("添加任务业务接口:添加任务成功:{}", inspection); | |||
return JsonResult.success(inspection); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param tenantId | |||
* @param addInspectionRequest | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, AddInspectionRequest addInspectionRequest) { | |||
if (StringUtils.isEmpty(addInspectionRequest.getName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.NAME_IS_NULL.getCode(), AddInspectionCodeEnum.NAME_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getType()) { | |||
return JsonResult.error(AddInspectionCodeEnum.TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.TYPE_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getInspectionType()) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getAirportId() || StringUtils.isEmpty(addInspectionRequest.getAirportName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getInspectionTime()) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg()); | |||
} | |||
Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery() | |||
.eq(RoadInformation::getTenantId, tenantId) | |||
.eq(RoadInformation::getId, addInspectionRequest.getRoadId()) | |||
.eq(RoadInformation::getMark, 1)); | |||
if (roadCount <= 0) { | |||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg()); | |||
} | |||
Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery() | |||
.eq(Section::getTenantId, tenantId) | |||
.eq(Section::getId, addInspectionRequest.getSectionId()) | |||
.eq(Section::getMark, 1)); | |||
if (sectionCount <= 0) { | |||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -1,87 +0,0 @@ | |||
package com.tuoheng.admin.service.inspection.add; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.RoadDeptMapper; | |||
import com.tuoheng.admin.mapper.SectionDeptMapper; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 添加任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-23 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class AddinspectionService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private RoadDeptMapper roadDeptMapper; | |||
@Autowired | |||
private SectionDeptMapper sectionDeptMapper; | |||
/** | |||
* 添加任务 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult add(AddInspectionRequest addInspectionRequest) { | |||
log.info("进入添加任务业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(tenantId, addInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("添加任务业务接口:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
String code = DateUtils.generateCode("XJRW"); | |||
addInspectionRequest.setCode(code); | |||
Integer rowId = 0; | |||
log.info("添加任务, 返回结果: deptId={}", rowId); | |||
if (rowId <= 0) { | |||
log.info("添加任务业务接口:添加任务失败:{}", result.getMsg()); | |||
return JsonResult.error(AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getMsg()); | |||
} | |||
log.info("添加任务业务接口:添加任务成功:{}"); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param tenantId | |||
* @param addInspectionRequest | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, AddInspectionRequest addInspectionRequest) { | |||
if (null == addInspectionRequest.getDeptId()) { | |||
return JsonResult.error(AddDeptCodeEnum.DEPT_PID_IS_NULL.getCode(), AddDeptCodeEnum.DEPT_PID_IS_NULL.getMsg()); | |||
} | |||
if (StringUtils.isEmpty(addInspectionRequest.getName())) { | |||
return JsonResult.error(AddDeptCodeEnum.DEPT_NAME_IS_NULL.getCode(), AddDeptCodeEnum.DEPT_NAME_IS_NULL.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,89 @@ | |||
package com.tuoheng.admin.service.inspection.delete; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.code.dept.DeleteDeptCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
/** | |||
* 删除任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class DeleteInspectionService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
public JsonResult deleteById(String id) { | |||
log.info("进入删除任务业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("删除部门任务接口:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数 | |||
Inspection inspection = (Inspection) result.getData(); | |||
// inspection.setUpdateUser(SecurityUtils.getUserId()); | |||
inspection.setUpdateTime(DateUtils.now()); | |||
Integer rowId = inspectionMapper.deleteById(id); | |||
log.info("删除任务, 返回结果: deptId={}", rowId); | |||
if (rowId <= 0) { | |||
log.info("删除任务业务接口:删除任务失败:{}", result.getMsg()); | |||
return JsonResult.error(DeleteInspectionCodeEnum.DELETE_IS_FAILED.getCode(), DeleteInspectionCodeEnum.DELETE_IS_FAILED.getMsg()); | |||
} | |||
log.info("删除任务业务接口:删除任务成功:id={}", inspection.getId()); | |||
return JsonResult.success("删除部门任务"); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param tenantId | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, String id) { | |||
// 判断id是否为空 | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(DeleteInspectionCodeEnum.ID_IS_NULL.getCode(), DeleteInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||
} | |||
// 判断任务是否存在 | |||
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() | |||
.eq(Inspection::getTenantId, tenantId) | |||
.eq(Inspection::getId, id) | |||
.eq(Inspection::getMark, 1)); | |||
if (null == inspection) { | |||
return JsonResult.error(DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(inspection); | |||
} | |||
} |
@@ -0,0 +1,134 @@ | |||
package com.tuoheng.admin.service.inspection.update; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.RoadInformation; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 修改任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class UpdateInspectionService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private RoadInformationMapper roadInformationMapper; | |||
@Autowired | |||
private SectionMapper sectionMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
/** | |||
* 添加任务 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult update(EditInspectionRequest editInspectionRequest) { | |||
log.info("进入修改任务业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(tenantId, editInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("修改任务业务接口:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
Inspection inspection = InspectionConverMapper.INSTANCE.fromEditInspectionRequestToInspection(editInspectionRequest); | |||
inspection.setUpdateUser(""); | |||
inspection.setUpdateTime(DateUtils.now()); | |||
Integer rowId = inspectionMapper.update(inspection); | |||
if (rowId <= 0) { | |||
log.info("修改任务业务接口:修改任务失败:{}", result.getMsg()); | |||
return JsonResult.error(AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getMsg()); | |||
} | |||
log.info("修改任务业务接口:修改任务成功:{}", inspection); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param tenantId | |||
* @param editInspectionRequest | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, EditInspectionRequest editInspectionRequest) { | |||
if (StringUtils.isEmpty(editInspectionRequest.getId())) { | |||
return JsonResult.error(EditInspectionCodeEnum.ID_IS_NULL.getCode(), EditInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||
} | |||
if (StringUtils.isEmpty(editInspectionRequest.getName())) { | |||
return JsonResult.error(EditInspectionCodeEnum.NAME_IS_NULL.getCode(), EditInspectionCodeEnum.NAME_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getType()) { | |||
return JsonResult.error(EditInspectionCodeEnum.TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.TYPE_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getRoadId() || StringUtils.isEmpty(editInspectionRequest.getRoadName())) { | |||
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NULL.getCode(), EditInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getSectionId() || StringUtils.isEmpty(editInspectionRequest.getSectionName()) ) { | |||
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NULL.getCode(), EditInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getInspectionType()) { | |||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getAirportId() || StringUtils.isEmpty(editInspectionRequest.getAirportName())) { | |||
return JsonResult.error(EditInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), EditInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getInspectionLine() || StringUtils.isEmpty(editInspectionRequest.getInspectionLineName())) { | |||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||
} | |||
if (null == editInspectionRequest.getInspectionTime()) { | |||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg()); | |||
} | |||
Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery() | |||
.eq(RoadInformation::getTenantId, tenantId) | |||
.eq(RoadInformation::getId, editInspectionRequest.getRoadId()) | |||
.eq(RoadInformation::getMark, 1)); | |||
if (roadCount <= 0) { | |||
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg()); | |||
} | |||
Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery() | |||
.eq(Section::getTenantId, tenantId) | |||
.eq(Section::getId, editInspectionRequest.getSectionId()) | |||
.eq(Section::getMark, 1)); | |||
if (sectionCount <= 0) { | |||
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -1,5 +1,11 @@ | |||
package com.tuoheng.admin.utils; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import org.springframework.http.HttpStatus; | |||
import java.util.Optional; | |||
/** | |||
* Shiro工具类 | |||
*/ | |||
@@ -11,6 +17,30 @@ public class ShiroUtils { | |||
private ShiroUtils() { | |||
} | |||
/** | |||
* 获取当前用户信息 | |||
* | |||
* @return | |||
*/ | |||
public static User getUserInfo() { | |||
// return (User) SecurityUtils.getSubject().getPrincipal(); | |||
return null; | |||
} | |||
/** | |||
* 获取用户编号 | |||
* | |||
* @return | |||
*/ | |||
public static String getUserId() { | |||
// User user = getUserInfo(); | |||
// return Optional.ofNullable(user.getId()).orElseThrow(() -> | |||
// new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!")); | |||
return "1"; | |||
} | |||
/** | |||
* 租户ID | |||
* |
@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
where id = #{id} | |||
</update> | |||
<delete id="deleteById" parameterType="com.tuoheng.admin.entity.Dept"> | |||
<delete id="deleteById" parameterType="String"> | |||
update th_dept | |||
set mark = 0 | |||
where id = #{id} |
@@ -62,7 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</resultMap> | |||
<sql id="selectInspectionVo"> | |||
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, create_user, create_time, update_user, update_time, mark from th_inspection | |||
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type, | |||
airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, | |||
equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, | |||
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, | |||
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, | |||
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, | |||
create_user, create_time, update_user, update_time, mark | |||
from th_inspection | |||
</sql> | |||
<select id="selectOneById" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | |||
@@ -93,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<select id="selectList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | |||
<include refid="selectInspectionVo"/> | |||
<where> | |||
<where> | |||
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if> | |||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> | |||
<if test="code != null and code != ''"> and code = #{code}</if> | |||
@@ -209,13 +216,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</update> | |||
<delete id="deleteById" parameterType="String"> | |||
delete from th_inspection where id = #{id} | |||
</delete> | |||
<delete id="deleteByIds" parameterType="String"> | |||
delete from th_inspection where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
update th_inspection | |||
set mark = 0 | |||
where id = #{id} | |||
</delete> | |||
</mapper> |