package ${code.packageName}.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.inkasso.adapter.service.KafubaoServiceImpl; import com.inkasso.adapter.util.BeanUtilsProxy; import ${code.packageName}.dao.${code.className}DAO; import ${code.packageName}.entity.${code.className}DO; import ${code.packageName}.model.dto.${code.className}DTO; import ${code.packageName}.model.request.Add${code.className}Request; import ${code.packageName}.model.request.Edit${code.className}Request; import ${code.packageName}.service.${code.className}Service; import com.inkasso.adapter.exception.ServiceException; import com.inkasso.adapter.exception.enums.ExceptionEnum; import org.springframework.stereotype.Service; /** * @author ${code.author} * @date ${.now?string('yyyy-MM-dd')} */ @Service <#if code.parentName = "RelationBaseBean"> public class ${code.className}ServiceImpl extends ServiceImpl<${code.className}DAO, ${code.className}DO> implements ${code.className}Service { @Override public void add${code.className}(Add${code.className}Request add${code.className}Request) { ${code.className}DO ${code.className?uncap_first} = BeanUtilsProxy.copyPropertiesIgnoreNull(add${code.className}Request, ${code.className}DO.class); this.baseMapper.insert(${code.className?uncap_first}); } @Override public void edit${code.className}(Edit${code.className}Request edit${code.className}Request) { ${code.className}DO ${code.className?uncap_first} = super.getById(edit${code.className}Request.getId()); if (${code.className?uncap_first} == null) { throw new ServiceException(400, ExceptionEnum.SYSTEM_DATE_ERROR); } BeanUtilsProxy.copyPropertiesNotIgnoreNull(edit${code.className}Request,${code.className?uncap_first}); this.updateById(${code.className?uncap_first}); } @Override public ${code.className}DTO get${code.className}DtoById(Long id) { ${code.className}DO ${code.className?uncap_first} = super.getById(id); ${code.className}DTO ${code.className?uncap_first}Dto = BeanUtilsProxy.copyProperties(${code.className?uncap_first},${code.className}DTO.class); return ${code.className?uncap_first}Dto; } @Override public void delete${code.className}(Long id) { this.removeById(id); } } <#if code.parentName = "BaseBean"> public class ${code.className}ServiceImpl extends KafubaoServiceImpl<${code.className}DAO, ${code.className}DO,${code.className}DTO > implements ${code.className}Service { @Override public void add${code.className}(Add${code.className}Request add${code.className}Request) { ${code.className}DO ${code.className?uncap_first} = BeanUtilsProxy.copyPropertiesIgnoreNull(add${code.className}Request, ${code.className}DO.class); this.baseMapper.insert(${code.className?uncap_first}); } @Override public void edit${code.className}(Edit${code.className}Request edit${code.className}Request) { ${code.className}DO ${code.className?uncap_first} = super.getById(edit${code.className}Request.getId()); if (${code.className?uncap_first} == null) { throw new ServiceException(400, ExceptionEnum.SYSTEM_DATE_ERROR); } BeanUtilsProxy.copyPropertiesNotIgnoreNull(edit${code.className}Request,${code.className?uncap_first}); this.updateById(${code.className?uncap_first}); } @Override public ${code.className}DTO get${code.className}DtoById(Long id) { ${code.className}DO ${code.className?uncap_first} = super.getById(id); ${code.className}DTO ${code.className?uncap_first}Dto = BeanUtilsProxy.copyProperties(${code.className?uncap_first},${code.className}DTO.class); return ${code.className?uncap_first}Dto; } @Override public void delete${code.className}(Long id) { this.removeById(id); } }