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