Commit 95514982 authored by tangwei's avatar tangwei

新增删除接口

parent 2a5dfa4b
......@@ -10,6 +10,8 @@ import java.util.Set;
import java.util.stream.Collectors;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.dao.mapper.RoutePointItemMapper;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -54,6 +56,8 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/api/route")
@Api(tags="巡检路线api")
......@@ -72,6 +76,10 @@ public class RouteController extends AbstractBaseController {
@Autowired
private JcsFeignClient jcsFeignClient;
@Resource
private RoutePointItemMapper routePointItemMapper;
@Autowired
private IRoutePointDao iRoutePointDao;
/**
*
* 新增接口
......@@ -746,6 +754,22 @@ public class RouteController extends AbstractBaseController {
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "删除线路点", notes = "删除线路点")
@PutMapping(value = "/delPoint", produces = "application/json;charset=UTF-8")
public CommonResponse delPoint(@ApiParam(value = "巡检点id", required = true) @RequestParam List<Long> pointIds) {
try {
for (Long pointId : pointIds) {
// 删除点的检查项项
routePointItemMapper.delRoutePointItemByPointId(pointId);
// 删除点
iRoutePointDao.delRoutePointByPointId(pointId);
}
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("删除线路点失败");
}
}
}
......@@ -8,4 +8,5 @@ public interface RoutePointItemMapper extends BaseMapper{
public void updateRoutePointItem( RoutePointItem pointItem);
int delRoutePointItemByRouteId(Long routeId);
int delRoutePointItemByPointId(Long pointId);
}
......@@ -26,6 +26,12 @@ public interface IRoutePointDao extends BaseDao<RoutePoint, Long> {
@Query(value = "delete from p_route_point WHERE route_id = ?1", nativeQuery = true)
void delRoutePointByRouteId(Long routeId);
@Modifying
@Transactional
@Query(value = "delete from p_route_point WHERE point_id = ?1", nativeQuery = true)
void delRoutePointByPointId(Long pointId);
@Query(value = "SELECT DISTINCT point_id FROM `p_route_point` where route_id = ?1", nativeQuery = true)
List<Long> queryRoutePointIds(Long routeId);
......
......@@ -274,10 +274,10 @@ public class RouteServiceImpl implements IRouteService {
String orgCode = route.getOrgCode();
String CreatorId = route.getCreatorId();
// 以下删除顺序不可更改
// 删除旧的项
routePointItemMapper.delRoutePointItemByRouteId(routeId);
// 删除旧的点
iRoutePointDao.delRoutePointByRouteId(routeId);
// // 删除旧的项
// routePointItemMapper.delRoutePointItemByRouteId(routeId);
// // 删除旧的点
// iRoutePointDao.delRoutePointByRouteId(routeId);
// 保存新的点
if (routePoints != null && !routePoints.isEmpty()) {
List<RoutePoint> points = new ArrayList<>();
......
......@@ -43,4 +43,19 @@
route_id = #{routeId}
)
</delete>
<delete id="delRoutePointItemByPointId">
DELETE
FROM
p_route_point_item
WHERE
route_point_id IN (
SELECT
id
FROM
p_route_point prp
WHERE
point_id = #{pointId}
)
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment