| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.data.DirService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载目录结构") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "目录ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/downloadDir") |
| | | public void downloadDir(int id, HttpServletResponse res) { |
| | | try { |
| | | DirEntity entity = dirService.selectDir(id); |
| | | if (null == entity || entity.getPid() > 0) { |
| | | return; |
| | | } |
| | | |
| | | String zipFile = dirService.createDirs(id); |
| | | if (null == zipFile) { |
| | | return; |
| | | } |
| | | |
| | | WebHelper.download(zipFile, entity.getName() + ".zip", res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |