Commit 387953fe authored by đinh thị đầm's avatar đinh thị đầm

damdt -delete

parent 4b34df8c
......@@ -25,4 +25,5 @@ public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCo
@Query("delete from CampaignCompleteCode c where c.campaignCompleteCodeId in (:ids)")
int deleteds(@Param("ids") List<Long> ids);
}
......@@ -20,4 +20,6 @@ public interface CampaignCompleteCodeService {
ResultDTO deleteList(List<Long> completeCodeDtos);
ResultDTO deleteById(Long id);
}
......@@ -142,4 +142,21 @@ public class CampaignCompleteCodeServiceImpl implements CampaignCompleteCodeServ
return resultDTO;
}
@Override
public ResultDTO deleteById(Long id) {
ResultDTO result = new ResultDTO();
try {
completeCodeRepository.deleteById(id);
result.setErrorCode(Constants.Status.ACTIVE_STR);
result.setDescription(Constants.Status.ACTIVE_STR);
} catch (Exception e) {
result.setErrorCode("-1");
return result;
}
result.setErrorCode("0");
return result;
}
}
......@@ -60,13 +60,8 @@ public class CampaignCompleteCodeController {
@ResponseBody
public ResultDTO updateCompleteCode(@RequestBody @Valid CampaignCompleteCodeDTO completeCodeDTO) {
ResultDTO result = new ResultDTO();
//LogUtil logUtil = new LogUtil();
//logUtil.initKpiLog("createCust");
try {
//LOGGER.info("Returning createCustomer: start");
result = completeCodeService.updateCompleteCode(completeCodeDTO);
//LOGGER.info("Returning createCustomer:" + result.getErrorCode());
//logUtil.endKpiLog(customerDTO, 0, result.getErrorCode(), result.getDetail(), CustomerController.class, customerDTO.getAgentProcess(), this.serverPort);
} catch (Exception e) {
result.setErrorCode("-1");
LOGGER.error(e);
......@@ -89,4 +84,13 @@ public class CampaignCompleteCodeController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/deleteById/{id}")
@ResponseBody
public ResultDTO deleteById(@RequestParam("id") Long id){
ResultDTO resultDTO = new ResultDTO();
resultDTO = completeCodeService.deleteById(id);
return resultDTO;
}
}
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