提交 10565fcb 作者: zhenjie

添加服务详情接口

上级 f4097232
package com.mmc.pms.controller.inspection; package com.mmc.pms.controller.inspection;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
import com.mmc.pms.service.inspection.InspectionService; import com.mmc.pms.service.inspection.InspectionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -41,4 +42,11 @@ public class InspectionController { ...@@ -41,4 +42,11 @@ public class InspectionController {
public ResultBody remove(@RequestParam Integer id){ public ResultBody remove(@RequestParam Integer id){
return inspectionService.remove(id); return inspectionService.remove(id);
} }
@ApiOperation(value = "服务详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = InspectionDTO.class)})
@GetMapping("detail")
public ResultBody<InspectionDTO> detail(@RequestParam Integer id){
return inspectionService.detail(id);
}
} }
...@@ -16,4 +16,6 @@ public interface InspectionDao { ...@@ -16,4 +16,6 @@ public interface InspectionDao {
void update(InspectionDO inspectionDO); void update(InspectionDO inspectionDO);
void remove(Integer id); void remove(Integer id);
InspectionDO getInspectionById(Integer id);
} }
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface InspectionTagDao { public interface InspectionTagDao {
int countSameName(String tagName); int countSameName(Integer id, String tagName, Integer inspectionId);
void insert(InspectionTagDO inspectionTagDO); void insert(InspectionTagDO inspectionTagDO);
......
package com.mmc.pms.service.inspection; package com.mmc.pms.service.inspection;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
/** /**
...@@ -13,4 +14,6 @@ public interface InspectionService { ...@@ -13,4 +14,6 @@ public interface InspectionService {
ResultBody update(InspectionVO inspectionVO); ResultBody update(InspectionVO inspectionVO);
ResultBody remove(Integer id); ResultBody remove(Integer id);
ResultBody<InspectionDTO> detail(Integer id);
} }
...@@ -4,6 +4,7 @@ import com.mmc.pms.common.ResultBody; ...@@ -4,6 +4,7 @@ import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.inspection.InspectionDao; import com.mmc.pms.dao.inspection.InspectionDao;
import com.mmc.pms.entity.inspection.InspectionDO; import com.mmc.pms.entity.inspection.InspectionDO;
import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
import com.mmc.pms.service.inspection.InspectionService; import com.mmc.pms.service.inspection.InspectionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,4 +46,13 @@ public class InspectionServiceImpl implements InspectionService { ...@@ -45,4 +46,13 @@ public class InspectionServiceImpl implements InspectionService {
inspectionDao.remove(id); inspectionDao.remove(id);
return ResultBody.success(); return ResultBody.success();
} }
@Override
public ResultBody<InspectionDTO> detail(Integer id) {
InspectionDO inspectionDO = inspectionDao.getInspectionById(id);
if (inspectionDO == null) {
return ResultBody.success();
}
return ResultBody.success(inspectionDO.buildInspectionDTO());
}
} }
...@@ -25,7 +25,7 @@ public class InspectionTagServiceImpl implements InspectionTagService { ...@@ -25,7 +25,7 @@ public class InspectionTagServiceImpl implements InspectionTagService {
@Override @Override
public ResultBody insert(InspectionTagVO inspectionTagVO) { public ResultBody insert(InspectionTagVO inspectionTagVO) {
int count = inspectionTagDao.countSameName(inspectionTagVO.getTagName()); int count = inspectionTagDao.countSameName(inspectionTagVO.getId(), inspectionTagVO.getTagName(), inspectionTagVO.getInspectionId());
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.NAME_DUPLICATION_ERROR); return ResultBody.error(ResultEnum.NAME_DUPLICATION_ERROR);
} }
...@@ -36,7 +36,7 @@ public class InspectionTagServiceImpl implements InspectionTagService { ...@@ -36,7 +36,7 @@ public class InspectionTagServiceImpl implements InspectionTagService {
@Override @Override
public ResultBody update(InspectionTagVO inspectionTagVO) { public ResultBody update(InspectionTagVO inspectionTagVO) {
int count = inspectionTagDao.countSameName(inspectionTagVO.getTagName()); int count = inspectionTagDao.countSameName(inspectionTagVO.getId(), inspectionTagVO.getTagName(), inspectionTagVO.getInspectionId());
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.NAME_DUPLICATION_ERROR); return ResultBody.error(ResultEnum.NAME_DUPLICATION_ERROR);
} }
......
...@@ -52,4 +52,11 @@ ...@@ -52,4 +52,11 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getInspectionById" resultType="com.mmc.pms.entity.inspection.InspectionDO">
select ins.id , ins.inspection_no, ins.inspection_name, ins.industry_type_id, ins.inspection_img,
ins.inspection_description, ins.sale_state as ins_sale_state, ins.case_img, ins.case_video, ins.create_time
from inspection ins
where ins.is_deleted = 0 and ins.id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
<if test="id != null"> <if test="id != null">
and id != #{id} and id != #{id}
</if> </if>
<if test="inspectionId != null">
and inspection_id = #{inspectionId}
</if>
</select> </select>
<select id="listByInspectionId" resultType="com.mmc.pms.entity.inspection.InspectionTagDO"> <select id="listByInspectionId" resultType="com.mmc.pms.entity.inspection.InspectionTagDO">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论