package com.testor.module.safeCheck.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongtech.tfw.backend.common.models.supers.SuperController;

import com.testor.module.safeCheck.service.TSafeHazardCheckResultService;

/**
 * 巡检结果Controller
 *
 * @author testor-framework
 * @date 2022-08-04 11:07:54
 */
@RestController
@RequestMapping("/safeCheck/checkResult")
@Api(value = "TSafeHazardCheckResult", tags = "巡检结果")
@Slf4j
public class TSafeHazardCheckResultController extends SuperController
{
    @Autowired
    private TSafeHazardCheckResultService tSafeHazardCheckResultService;

//    /* Generated Method*/
//	@ApiOperation(value = "新增 巡检结果", notes = "Add TSafeHazardCheckResult")
//	@PostMapping(value = "/add")
//	public BaseResponse<TSafeHazardCheckResult>addEntity(@RequestBody TSafeHazardCheckResult addRequest) {
//		BaseResponse<TSafeHazardCheckResult> baseResponse=new BaseResponse<>();
//		if(ObjectHelper.isNotEmpty(addRequest)){
//			// TODO 按需求添加数据去重，特殊值设定，业务异常
//			String id = IdHelper.getId32bit();
//            TSafeHazardCheckResult data=BeanHelper.beanToBean(addRequest,  TSafeHazardCheckResult.class);
//			data.setId(id);
//			boolean result= tSafeHazardCheckResultService.save(data);
//			if(result){
//                TSafeHazardCheckResult newEntity = new TSafeHazardCheckResult();
//				newEntity.setId(id);
//				baseResponse.setData(newEntity);
//			}
//		}
//		return baseResponse;
//	}

//	@ApiOperation(value = "获取 巡检结果 ", notes = "Get TSafeHazardCheckResult By Id")
//	@GetMapping(value = "/get")
//	public BaseResponse<TSafeHazardCheckResult> getById(String id){
//		BaseResponse<TSafeHazardCheckResult> baseResponse=new BaseResponse<>();
//		if(StringHelper.isNotEmpty(id)){
//			// TODO 按需求添加业务异常判断
//            TSafeHazardCheckResult data= tSafeHazardCheckResultService.getById(id);
//			baseResponse.setData(data);
//		}
//		return baseResponse;
//	}

//	@ApiOperation(value = "修改 巡检结果 ", notes = "Update TSafeHazardCheckResult By Id")
//	@PutMapping(value = "/update")
//	public BaseResponse<BizGeneralResponse> updateEntity(@RequestBody TSafeHazardCheckResult updateRequest){
//		BaseResponse<BizGeneralResponse> baseResponse=new BaseResponse<>();
//		if(ObjectHelper.isNotEmpty(updateRequest)&&StringHelper.isNotEmpty(updateRequest.getId())){
//			// TODO 按需求添加数据去重，特殊值设定，业务异常
//            TSafeHazardCheckResult data=BeanHelper.beanToBean(updateRequest, TSafeHazardCheckResult.class);
//			boolean result= tSafeHazardCheckResultService.updateById(data);
//			baseResponse.setData(
//					BizGeneralResponse.builder().result(TypeHelper.castToString(result)).build());
//		}
//		return baseResponse;
//	}

//	@ApiOperation(value = "删除 巡检结果 ", notes = "delete TSafeHazardCheckResult By Id")
//	@PutMapping(value = "/delete")
//	public BaseResponse<BizGeneralResponse> deleteEntity(@RequestBody TSafeHazardCheckResultDelParam deleteRequest){
//		BaseResponse<BizGeneralResponse> baseResponse=new BaseResponse<>();
//		if(ObjectHelper.isNotEmpty(deleteRequest)&&StringHelper.isNotEmpty(deleteRequest.getId())){
//			// TODO 按需求添加数据去重，特殊值设定，业务异常
//            TSafeHazardCheckResult data= new TSafeHazardCheckResult();
//			data.setId(deleteRequest.getId());
//			data.setStatus(BizConstants.STATUS_DELETE);
//			boolean result= tSafeHazardCheckResultService.updateById(data);
//			baseResponse.setData(
//					BizGeneralResponse.builder().result(TypeHelper.castToString(result)).build());
//		}
//		return baseResponse;
//	}

//	@ApiOperation(value = "批量删除巡检结果", notes = "delete TSafeHazardCheckResult by batch Id")
//	@PutMapping(value = "/batch_delete")
//	public BaseResponse<BizGeneralResponse> deleteEntityBatch(
//			@RequestBody TSafeHazardCheckResultDelParam deleteRequest) {
//		BaseResponse<BizGeneralResponse> baseResponse = new BaseResponse<>();
//		if (ObjectHelper.isNotEmpty(deleteRequest) && (!deleteRequest.getIds().isEmpty())) {
//            /* 批量删除 */
//			List<TSafeHazardCheckResult> tSafeHazardCheckResultList = new ArrayList<>();
//            for(String id: deleteRequest.getIds()){
//                TSafeHazardCheckResult data= new TSafeHazardCheckResult();
//				data.setId(id);
//				data.setStatus(BizConstants.STATUS_DELETE);
//                tSafeHazardCheckResultList.add(data);
//			}
//			boolean result = tSafeHazardCheckResultService.updateBatchById(tSafeHazardCheckResultList);
//			baseResponse.setData(
//					BizGeneralResponse.builder().result(TypeHelper.castToString(result)).build());
//		}
//		return baseResponse;
//	}
//
//	@ApiOperation(value = "获取 巡检结果 分页列表", notes = "List TSafeHazardCheckResult with page")
//	@GetMapping(value = "/list")
//	public  BaseResponse<BaseResponseList<TSafeHazardCheckResult>>listEntity(TSafeHazardCheckResultParam param){
//		BaseResponse<BaseResponseList<TSafeHazardCheckResult>>baseResponse=new BaseResponse<>();
//		Long page=
//				StringHelper.isEmpty(param.getPage())?BizConstants.PAGE:Long.valueOf(param.getPage());
//		Long limit=
//				StringHelper.isEmpty(param.getLimit())?BizConstants.LIMIT:Long.valueOf(param.getLimit());
//		Page<TSafeHazardCheckResult> resultPage=new Page<>(page,limit);
//		// TODO 根据需求修改查询条件及查询参数
//		QueryWrapper<TSafeHazardCheckResult> queryWrapper=this.createQuery(param);
//		Page<TSafeHazardCheckResult> resultList= tSafeHazardCheckResultService.page(resultPage,queryWrapper);
//		BaseResponseList<TSafeHazardCheckResult> baseResponseList=new BaseResponseList<>();
//		baseResponseList.setData(resultList.getRecords());
//		baseResponseList.setTotal(resultList.getTotal());
//		baseResponse.setData(baseResponseList);
//		return baseResponse;
//	}
//
//	@ApiOperation(value = "获取 巡检结果 列表", notes = "List TSafeHazardCheckResult all")
//	@GetMapping(value = "/datas")
//	public  BaseResponse<BaseResponseList<TSafeHazardCheckResult>>listAllEntity(TSafeHazardCheckResultParam param){
//		BaseResponse<BaseResponseList<TSafeHazardCheckResult>>baseResponse=new BaseResponse<>();
//		// TODO 根据需求修改查询条件及查询参数
//		QueryWrapper<TSafeHazardCheckResult> queryWrapper=this.createQuery(param);
//		List<TSafeHazardCheckResult> resultList=tSafeHazardCheckResultService.list(queryWrapper);
//		BaseResponseList<TSafeHazardCheckResult> baseResponseList=new BaseResponseList<>();
//		baseResponseList.setData(resultList);
//		baseResponseList.setTotal(resultList.size());
//		baseResponse.setData(baseResponseList);
//		return baseResponse;
//	}

}
