| | |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_25w_aanp"), |
| | | @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "210"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "b_hy20w_s23"), |
| | | @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有表") |
| | | @GetMapping(value = "/selectTabs") |
| | | public ResponseMsg<List<TabEntity>> selectTabs() { |
| | | @ApiOperation(value = "查询值域表集合") |
| | | @GetMapping(value = "/selectDomainTabs") |
| | | public ResponseMsg<List<TabEntity>> selectDomainTabs() { |
| | | try { |
| | | List<TabEntity> list = baseQueryService.selectTabs(); |
| | | List<TabEntity> list = domainService.selectDomainTabs(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) |
| | | public void downloadFile(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "密码不能为空", res); |
| | | } |
| | | if (StringHelper.isEmpty(reqEntity.getGuid())) { |
| | | WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "找不到文件ID", res); |
| | | WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "找不到文件ID", res); |
| | | return; |
| | | } |
| | | |
| | |
| | | de.setDownloadUser(ue.getId()); |
| | | int rows = downloadService.update(de); |
| | | |
| | | //String filePath = exportService.getDownloadFilePath(de); |
| | | //WebHelper.download(filePath, de.getName(), res); |
| | | String filePath = downloadService.getDownloadFilePath(de); |
| | | WebHelper.download(filePath, de.getName(), res); |
| | | } catch (Exception ex) { |
| | | WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); |
| | | } |
| | |
| | | public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (StringHelper.isEmpty(guid)) { |
| | | WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "找不到文件ID", res); |
| | | WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "找不到文件ID", res); |
| | | return; |
| | | } |
| | | |
| | |
| | | de.setDownloadUser(ue.getId()); |
| | | int rows = downloadService.update(de); |
| | | |
| | | String filePath = exportService.getDownloadFilePath(de); |
| | | String filePath = downloadService.getDownloadFilePath(de); |
| | | WebHelper.download(filePath, de.getName(), res); |
| | | } catch (Exception ex) { |
| | | WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); |
| | |
| | | package com.lf.server.mapper.data; |
| | | |
| | | import com.lf.server.entity.ctrl.TabEntity; |
| | | import com.lf.server.entity.data.DomainEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | public DomainEntity selectById(int id); |
| | | |
| | | /** |
| | | * 查询值域表集合 |
| | | * @return |
| | | */ |
| | | public List<TabEntity> selectDomainTabs(); |
| | | |
| | | /** |
| | | * 插入一条 |
| | | * |
| | | * @param entity |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.ctrl.TabEntity; |
| | | import com.lf.server.entity.data.DomainEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.DomainMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TabEntity> selectDomainTabs() { |
| | | return domainMapper.selectDomainTabs(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insert(DomainEntity entity) { |
| | | return domainMapper.insert(entity); |
| | | } |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class DownloadService implements DownloadMapper { |
| | | @Autowired |
| | | PathHelper pathHelper; |
| | | |
| | | @Autowired |
| | | DownloadMapper downloadMapper; |
| | | |
| | |
| | | public Integer updates(List<DownloadEntity> list) { |
| | | return downloadMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | * |
| | | * @param de 下载实体类 |
| | | * @return 下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | } |
| | |
| | | |
| | | return de; |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | * |
| | | * @param de 下载实体类 |
| | | * @return 下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.data.DomainMapper"> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(a.*) from lf.sys_domain a |
| | | where exists (select * from lf.sys_dict b where b.ns = #{ns} |
| | | select count(a.*) from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = #{ns} |
| | | <if test="tab != null"> |
| | | and b.tab = #{tab} |
| | | </if> |
| | | ) |
| | | <if test="code != null"> |
| | | and a.dom_code like #{code} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.lf.server.entity.data.DomainEntity"> |
| | | select a.* from lf.sys_domain a |
| | | where exists (select * from lf.sys_dict b where b.ns = #{ns} |
| | | select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = #{ns} |
| | | <if test="tab != null"> |
| | | and b.tab = #{tab} |
| | | </if> |
| | | ) |
| | | <if test="code != null"> |
| | | and a.dom_code like #{code} |
| | | </if> |
| | |
| | | select * from lf.sys_domain where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectDomainTabs" resultType="com.lf.server.entity.ctrl.TabEntity"> |
| | | select distinct ns,tab,tab_desc,tableType from lf.sys_dict where domain_na is not null order by ns,tab |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.lf.server.entity.data.DomainEntity"> |
| | | insert into lf.sys_domain |
| | | (dom_desc,dom_name,dom_code,code_desc,level,orderid,bsm,create_user,create_time,bak) |