package cn.autoform.web.service.formresource; import java.util.ArrayList; import java.util.List; import java.util.UUID; import cn.autoform.util.UUIDUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.autoform.db.entity.FormresourceEntity; import cn.autoform.web.mapper.formresource.FormResourceMapper; @Service public class FormResourceService { @Autowired private FormResourceMapper formResourceMapper = null; /** * * @param tenantID * @param formID * @return */ public List getFormresourceList(String tenantID,String formID) { List listFormresourceEntity = formResourceMapper.getFormresourceList(tenantID, formID); List result = new ArrayList<>(); for(FormresourceEntity obj : listFormresourceEntity) { FormresourceEntity resource = new FormresourceEntity(); resource.setResourceFileID(obj.getResourceFileID()); String temp = obj.getResourceFilepath(); temp = temp.substring(temp.lastIndexOf('/') + 1); resource.setResourceFilepath(temp); resource.setDeleteFlg(obj.getDeleteFlg()); result.add(resource); } return result; } /** * * @param tenantID * @param formID * @return */ public List getFormresourcePath(String tenantID,String formID) { return formResourceMapper.getFormresourceList(tenantID, formID); } /** * * @param formID * @param tenantID * @param resourceFilepath * @param createUser * @return */ public int createFormresource(FormresourceEntity formresourceEntity) { formresourceEntity.setResourceFileID(UUIDUtil.uuid()); return formResourceMapper.createFormresource(formresourceEntity); } /** * * @param formID * @param tenantID * @param resourceFilepath * @return */ public int deleteFormresource(String formID, String tenantID, String resourceFileID) { return formResourceMapper.deleteFormresource(tenantID, formID, resourceFileID); } }