| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.tcm.training.admin.common.enums.EnabledStatus; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | return toDetail(require(id)); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProvincialAgentDetailVO create(ProvincialAgentSaveRequest request) { |
| | | boolean firstAgent = agentMapper.selectCount(new LambdaQueryWrapper<ProvincialAgent>() |
| | | .eq(ProvincialAgent::getDeleted, 0)) == 0; |
| | |
| | | return detail(agent.getId()); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProvincialAgentDetailVO update(Long id, ProvincialAgentSaveRequest request) { |
| | | ProvincialAgent agent = require(id); |
| | | fill(agent, request); |
| | |
| | | return detail(id); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(Long id) { |
| | | require(id); |
| | | agentMapper.deleteById(id); |
| | |
| | | agent.setAccountHolder(trim(request.getAccountHolder())); |
| | | agent.setBranchName(trim(request.getBranchName())); |
| | | agent.setContactInfo(trim(request.getContactInfo())); |
| | | agent.setStatus(request.getStatus() == null ? 1 : request.getStatus()); |
| | | agent.setStatus(request.getStatus() == null ? EnabledStatus.ENABLED.getValue() : request.getStatus()); |
| | | agent.setAddress(trim(request.getAddress())); |
| | | } |
| | | |