| | |
| | | //String enable2 = env.getProperty("spring.datasource.druid.web-stat-filter.enabled"); |
| | | //String filters = env.getProperty("spring.datasource.druid.filters"); |
| | | //String pattern = env.getProperty("spring.datasource.druid.stat-view-servlet.url-pattern"); |
| | | |
| | | |
| | | GdalHelper.init(env.getProperty("sys.gdal_path")); |
| | | UploadAttachService.init(env.getProperty("sys.attachTabs")); |
| | | |
| | |
| | | import com.terra.system.entity.all.ResponseMsg; |
| | | import com.terra.system.entity.sys.ResEntity; |
| | | import com.terra.system.entity.sys.UserEntity; |
| | | import com.terra.system.helper.StringHelper; |
| | | import com.terra.system.service.all.PermsService; |
| | | import com.terra.system.service.all.UploadAttachService; |
| | | import com.terra.system.service.data.DownloadService; |
| | | import com.terra.system.service.sys.ResService; |
| | | import com.terra.system.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | PermsService permsService; |
| | | |
| | | @Resource |
| | | DownloadService downloadService; |
| | | |
| | | @Resource |
| | | UploadAttachService uploadAttachService; |
| | | |
| | | private final static String TAB_NAME = "lf.sys_res"; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", required = false, example = "sys_res") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String name) { |
| | | try { |
| | | int count = resService.selectCount(name); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = "sys_res"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<ResEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = "sys_res"), |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "status", value = "ç¶æ", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "category", value = "æå¡ç±»å«", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "type", value = "æå¡ç±»å", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "data", value = "æ°æ®ç±»å", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<ResEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<ResEntity>> selectByPageAndCount(String name, Integer status, Integer category, Integer type, Integer data, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = resService.selectCount(name); |
| | | int count = resService.selectCount(name, status, category, type, data); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | List<ResEntity> rs = resService.selectByPage(name, status, category, type, data, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<ResEntity>> selectAll() { |
| | | try { |
| | | List<ResEntity> list = resService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectById") |
| | | public ResponseMsg<ResEntity> selectById(int id) { |
| | | try { |
| | | ResEntity entity = resService.selectById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "com.terra.system.entity.sys.ResEntity", paramType = "body", example = "") |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "ResEntity", paramType = "body") |
| | | }) |
| | | @PostMapping(value = "/insertRes", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertRes(@RequestBody ResEntity entity, HttpServletRequest req) { |
| | | @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insert(@RequestBody ResEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setCreateUser(ue.getId()); |
| | | entity.setDepid(ue.getDepcode()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = resService.insertRes(entity); |
| | | int count = resService.insert(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "List<ResEntity>", paramType = "body", example = "") |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "ResEntity", paramType = "body") |
| | | }) |
| | | @PostMapping(value = "/insertRess", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertRess(@RequestBody List<ResEntity> list, HttpServletRequest req) { |
| | | @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> inserts(@RequestBody List<ResEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (ResEntity entity : list) { |
| | | entity.setCreateUser(ue.getId()); |
| | | entity.setDepid(ue.getDepcode()); |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = resService.insertRess(list); |
| | | int count = resService.inserts(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteRes") |
| | | public ResponseMsg<Integer> deleteRes(int id) { |
| | | @GetMapping(value = "/delete") |
| | | public ResponseMsg<Integer> delete(int id) { |
| | | try { |
| | | permsService.clearPermsCache(); |
| | | int count = resService.deleteRes(id); |
| | | int count = resService.delete(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "IDæ°ç»", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | @ApiImplicitParam(name = "ids", value = "IDæ°ç»", dataType = "Integer", paramType = "query", example = "1,2") |
| | | }) |
| | | @GetMapping(value = "/deleteRess") |
| | | public ResponseMsg<Integer> deleteRess(@RequestParam List<Integer> ids) { |
| | | @GetMapping(value = "/deletes") |
| | | public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = resService.deleteRess(ids); |
| | | String strs = StringHelper.join(ids, ","); |
| | | int count = resService.deletes(strs); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "ResEntity", paramType = "body", example = "") |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "ResEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateRes", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateRes(@RequestBody ResEntity entity, HttpServletRequest req) { |
| | | @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> update(@RequestBody ResEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | entity.setDepid(ue.getDepcode()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = resService.updateRes(entity); |
| | | int count = resService.update(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢") |
| | | @ApiOperation(value = "æ´æ°å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "ResEntity", paramType = "body") |
| | | }) |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<ResEntity> selectRes(int id) { |
| | | @ResponseBody |
| | | @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updates(@RequestBody List<ResEntity> list, HttpServletRequest req) { |
| | | try { |
| | | ResEntity resEntity = resService.selectRes(id); |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (ResEntity entity : list) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | entity.setDepid(ue.getDepcode()); |
| | | } |
| | | } |
| | | |
| | | return success(resEntity); |
| | | permsService.clearPermsCache(); |
| | | int count = resService.updates(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectResAll") |
| | | public ResponseMsg<List<ResEntity>> selectResAll() { |
| | | try { |
| | | List<ResEntity> list = resService.selectResAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ResEntity implements Serializable { |
| | | private static final long serialVersionUID = 9047079519693255710L; |
| | | |
| | | private int id; |
| | | |
| | | private String name; |
| | | private String cnName; |
| | | |
| | | private String server; |
| | | private String enName; |
| | | |
| | | private String source; |
| | | private int status; |
| | | |
| | | private int depid; |
| | | private int type; |
| | | |
| | | private String depName; |
| | | private int data; |
| | | |
| | | private int dirid; |
| | | private int category; |
| | | |
| | | private String dirName; |
| | | private String url; |
| | | |
| | | private String code; |
| | | private String test; |
| | | |
| | | private String proxy; |
| | | |
| | | private String descr; |
| | | |
| | | private String depid; |
| | | |
| | | private String dirid; |
| | | |
| | | private String img; |
| | | |
| | | private int createUser; |
| | | |
| | | private String createName; |
| | | |
| | | private Timestamp createTime; |
| | | |
| | | private int updateUser; |
| | | |
| | | private String updateName; |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | private String bak; |
| | | |
| | | private String tab; |
| | | |
| | | private String args; |
| | | |
| | | private String fileGuid; |
| | | private String createName; |
| | | |
| | | private String updateName; |
| | | |
| | | private Integer pubid; |
| | | |
| | | public ResEntity() { |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getCnName() { |
| | | return cnName; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setCnName(String cnName) { |
| | | this.cnName = cnName; |
| | | } |
| | | |
| | | public String getServer() { |
| | | return server; |
| | | public String getEnName() { |
| | | return enName; |
| | | } |
| | | |
| | | public void setServer(String server) { |
| | | this.server = server; |
| | | public void setEnName(String enName) { |
| | | this.enName = enName; |
| | | } |
| | | |
| | | public String getSource() { |
| | | return source; |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setSource(String source) { |
| | | this.source = source; |
| | | public void setStatus(int status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public int getDepid() { |
| | | return depid; |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setDepid(int depid) { |
| | | this.depid = depid; |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDepName() { |
| | | return depName; |
| | | public int getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setDepName(String depName) { |
| | | this.depName = depName; |
| | | public void setData(int data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public int getDirid() { |
| | | return dirid; |
| | | public int getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setDirid(int dirid) { |
| | | this.dirid = dirid; |
| | | public void setCategory(int category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public String getDirName() { |
| | | return dirName; |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setDirName(String dirName) { |
| | | this.dirName = dirName; |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | public String getTest() { |
| | | return test; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | public void setTest(String test) { |
| | | this.test = test; |
| | | } |
| | | |
| | | public String getProxy() { |
| | | return proxy; |
| | | } |
| | | |
| | | public void setProxy(String proxy) { |
| | | this.proxy = proxy; |
| | | } |
| | | |
| | | public String getDescr() { |
| | |
| | | |
| | | public void setDescr(String descr) { |
| | | this.descr = descr; |
| | | } |
| | | |
| | | public String getDepid() { |
| | | return depid; |
| | | } |
| | | |
| | | public void setDepid(String depid) { |
| | | this.depid = depid; |
| | | } |
| | | |
| | | public String getDirid() { |
| | | return dirid; |
| | | } |
| | | |
| | | public void setDirid(String dirid) { |
| | | this.dirid = dirid; |
| | | } |
| | | |
| | | public String getImg() { |
| | |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public String getCreateName() { |
| | | return createName; |
| | | } |
| | | |
| | | public void setCreateName(String createName) { |
| | | this.createName = createName; |
| | | } |
| | | |
| | | public Timestamp getCreateTime() { |
| | | return createTime; |
| | | } |
| | |
| | | |
| | | public void setUpdateUser(int updateUser) { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public String getUpdateName() { |
| | | return updateName; |
| | | } |
| | | |
| | | public void setUpdateName(String updateName) { |
| | | this.updateName = updateName; |
| | | } |
| | | |
| | | public Timestamp getUpdateTime() { |
| | |
| | | this.bak = bak; |
| | | } |
| | | |
| | | public String getFileGuid() { |
| | | return fileGuid; |
| | | public String getTab() { |
| | | return tab; |
| | | } |
| | | |
| | | public void setFileGuid(String fileGuid) { |
| | | this.fileGuid = fileGuid; |
| | | public void setTab(String tab) { |
| | | this.tab = tab; |
| | | } |
| | | |
| | | public String getArgs() { |
| | | return args; |
| | | } |
| | | |
| | | public void setArgs(String args) { |
| | | this.args = args; |
| | | } |
| | | |
| | | public String getCreateName() { |
| | | return createName; |
| | | } |
| | | |
| | | public void setCreateName(String createName) { |
| | | this.createName = createName; |
| | | } |
| | | |
| | | public String getUpdateName() { |
| | | return updateName; |
| | | } |
| | | |
| | | public void setUpdateName(String updateName) { |
| | | this.updateName = updateName; |
| | | } |
| | | |
| | | public Integer getPubid() { |
| | | return pubid; |
| | | } |
| | | |
| | | public void setPubid(Integer pubid) { |
| | | this.pubid = pubid; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Mapper |
| | | @ResponseBody |
| | | @SuppressWarnings("ALL") |
| | | public interface ResMapper { |
| | | /** |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param name 表å |
| | | * @return è®°å½æ° |
| | | */ |
| | | public Integer selectCount(String name); |
| | | public Integer selectCount(String name, Integer status, Integer category, Integer type, Integer data); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param name 表å |
| | | * @param limit è®°å½æ° |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<ResEntity> selectByPage(String name, Integer limit, Integer offset); |
| | | public List<ResEntity> selectByPage(String name, Integer status, Integer category, Integer type, Integer data, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param roleid |
| | | * @return |
| | | */ |
| | | public List<ResEntity> selectAll(); |
| | | |
| | | public ResEntity selectById(int id); |
| | | |
| | | public ResEntity selectByPubid(Integer pubid); |
| | | |
| | | public Integer selectCountForRole(Integer roleid); |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²å页æ¥è¯¢ |
| | | * |
| | | * @param roleid |
| | | * @param limit |
| | | * @param offset |
| | | * @return |
| | | */ |
| | | public List<ResEntity> selectByPageForRole(Integer roleid, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | | * |
| | | * @param resEntity |
| | | * @return |
| | | */ |
| | | public Integer insertRes(ResEntity resEntity); |
| | | public Integer insert(ResEntity entity); |
| | | |
| | | /** |
| | | * æå
¥å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer insertRess(List<ResEntity> list); |
| | | public Integer inserts(List<ResEntity> list); |
| | | |
| | | /** |
| | | * å é¤ä¸æ¡ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer deleteRes(int id); |
| | | public Integer delete(int id); |
| | | |
| | | /** |
| | | * å é¤å¤æ¡ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deleteRess(List<Integer> ids); |
| | | public Integer deletes(String ids); |
| | | |
| | | /** |
| | | * æ´æ°ä¸æ¡ |
| | | * |
| | | * @param resEntity |
| | | * @return |
| | | */ |
| | | public Integer updateRes(ResEntity resEntity); |
| | | public Integer update(ResEntity entity); |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ¡æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public ResEntity selectRes(int id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ |
| | | * |
| | | * @return |
| | | */ |
| | | public List<ResEntity> selectResAll(); |
| | | |
| | | |
| | | |
| | | public Integer updates(List<ResEntity> list); |
| | | } |
| | |
| | | * æ¥è¯¢æå¡èµæºç¶æ |
| | | */ |
| | | public List<ResEntity> selectResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | | List<ResEntity> resList = resService.selectAll(); |
| | | |
| | | return testResStatus(resList); |
| | | } |
| | |
| | | for (ResEntity re : resList) { |
| | | Socket socket = new Socket(); |
| | | try { |
| | | if (StringHelper.isEmpty(re.getServer())) { |
| | | if (StringHelper.isEmpty(re.getUrl())) { |
| | | list.add(re); |
| | | continue; |
| | | } |
| | | |
| | | URI uri = new URI(re.getServer()); |
| | | URI uri = new URI(re.getUrl()); |
| | | SocketAddress add = new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()); |
| | | |
| | | // Pingéå°å |
| | | socket.connect(add, 2000); |
| | | socket.connect(add, 1500); |
| | | } catch (Exception e) { |
| | | // log.error(e.getMessage()) |
| | | list.add(re); |
| | |
| | | * ç»è®¡æå¡èµæºç¶æ |
| | | */ |
| | | public JSONObject countResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | | List<ResEntity> resList = resService.selectAll(); |
| | | List<ResEntity> unableList = testResStatus(resList); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | ResMapper resMapper; |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | public Integer selectCount(String name, Integer status, Integer category, Integer type, Integer data) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return resMapper.selectCount(name); |
| | | return resMapper.selectCount(name, status, category, type, data); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | public List<ResEntity> selectByPage(String name, Integer status, Integer category, Integer type, Integer data, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return resMapper.selectByPage(name, limit, offset); |
| | | return resMapper.selectByPage(name, status, category, type, data, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResEntity> selectAll() { |
| | | return resMapper.selectAll(); |
| | | } |
| | | |
| | | @Override |
| | | public ResEntity selectById(int id) { |
| | | return resMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ResEntity selectByPubid(Integer pubid) { |
| | | return resMapper.selectByPubid(pubid); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertRes(ResEntity resEntity) { |
| | | return resMapper.insertRes(resEntity); |
| | | public Integer insert(ResEntity entity) { |
| | | return resMapper.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertRess(List<ResEntity> resEntity) { |
| | | return resMapper.insertRess(resEntity); |
| | | public Integer inserts(List<ResEntity> list) { |
| | | return resMapper.inserts(list); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteRes(int id) { |
| | | return resMapper.deleteRes(id); |
| | | public Integer delete(int id) { |
| | | return resMapper.delete(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteRess(List<Integer> ids) { |
| | | return resMapper.deleteRess(ids); |
| | | public Integer deletes(String ids) { |
| | | return resMapper.deletes(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateRes(ResEntity resEntity) { |
| | | return resMapper.updateRes(resEntity); |
| | | public Integer update(ResEntity entity) { |
| | | return resMapper.update(entity); |
| | | } |
| | | |
| | | @Override |
| | | public ResEntity selectRes(int id) { |
| | | return resMapper.selectRes(id); |
| | | public Integer updates(List<ResEntity> list) { |
| | | return resMapper.updates(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResEntity> selectResAll() { |
| | | return resMapper.selectResAll(); |
| | | } |
| | | |
| | | } |
| | |
| | | locale: zh_CN |
| | | thymeleaf: |
| | | cache: false |
| | | # datasource |
| | | # datasourceï¼https://blog.csdn.net/weixin_43724911/article/details/147566522 |
| | | datasource: |
| | | name: prod |
| | | # JDBC åºæ¬é
ç½® ¤tSchema=public |
| | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_res |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(name) like #{name} |
| | | and (upper(cn_name) like #{name} or upper(en_name) like #{name}) |
| | | </if> |
| | | <if test="status != null"> |
| | | and status = #{status} |
| | | </if> |
| | | <if test="category != null"> |
| | | and category = #{category} |
| | | </if> |
| | | <if test="type != null"> |
| | | and type = #{type} |
| | | </if> |
| | | <if test="data != null"> |
| | | and data = #{data} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select a.*,fn_rec_query(a.depid, 'dep') depName,fn_rec_query(a.dirid, 'dir') dirName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_res a |
| | | select a.*, fn_uname(a.create_user) createName, fn_uname(a.update_user) updateName from lf.sys_res a |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(a.name) like #{name} |
| | | and (upper(cn_name) like #{name} or upper(en_name) like #{name}) |
| | | </if> |
| | | <if test="status != null"> |
| | | and status = #{status} |
| | | </if> |
| | | <if test="category != null"> |
| | | and category = #{category} |
| | | </if> |
| | | <if test="type != null"> |
| | | and type = #{type} |
| | | </if> |
| | | <if test="data != null"> |
| | | and data = #{data} |
| | | </if> |
| | | </where> |
| | | order by a.id desc |
| | | limit #{limit} offset #{offset} |
| | | limit #{limit} offset #{offset}; |
| | | </select> |
| | | |
| | | <select id="selectAll" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select a.*, fn_uname(a.create_user) createName, fn_uname(a.update_user) updateName |
| | | from lf.sys_res a |
| | | order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select a.*, fn_uname(a.create_user) createName, fn_uname(a.update_user) updateName |
| | | from lf.sys_res a |
| | | where id = #{id}; |
| | | </select> |
| | | |
| | | <select id="selectByPubid" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select * from lf.sys_res where pubid = #{pubid} limit 1; |
| | | </select> |
| | | |
| | | <select id="selectCountForRole" resultType="java.lang.Integer"> |
| | |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectResAll" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select * from lf.sys_res order by id desc |
| | | </select> |
| | | <insert id="insert" parameterType="com.terra.system.entity.sys.ResEntity"> |
| | | <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> |
| | | select currval('lf.sys_res_id_seq'::regclass) as id |
| | | </selectKey> |
| | | |
| | | <select id="selectRes" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select * from lf.sys_res where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertRes" parameterType="com.terra.system.entity.data.DictEntity"> |
| | | insert into lf.sys_res |
| | | (name,server,source,depid,dirid,code,descr,img,create_user,create_time,bak) |
| | | values |
| | | (#{name},#{server},#{source},#{depid},#{dirid},#{code},#{descr},#{img},#{createUser},now(),#{bak}); |
| | | insert into lf.sys_res |
| | | (cn_name,en_name,status,type,data,category,url,test,descr,depid,dirid,img,create_user,create_time,bak,tab,args,pubid) |
| | | values |
| | | (#{cnName},#{enName},#{status},#{type},#{data},#{category},#{url},#{test},#{descr},#{depid},#{dirid},#{img},#{createUser},now(),#{bak},#{tab},#{args},#{pubid}) |
| | | </insert> |
| | | |
| | | <insert id="insertRess"> |
| | | insert into lf.sys_res |
| | | (name,server,source,depid,dirid,code,descr,img,create_user,create_time,bak) |
| | | values |
| | | <insert id="inserts"> |
| | | insert into lf.sys_res |
| | | (cn_name,en_name,status,type,data,category,url,test,descr,depid,dirid,img,create_user,create_time,bak,tab,args,pubid) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | #{item.name},#{item.server},#{item.source},#{item.depid},#{item.dirid},#{item.code},#{item.descr},#{item.img},#{item.createUser},now(),#{item.bak}) |
| | | (#{item.cnName},#{item.enName},#{item.status},#{item.type},#{item.data},#{item.category},#{item.url},#{item.test},#{item.descr},#{item.depid},#{item.dirid},#{item.img},#{item.createUser},now(),#{item.bak},#{item.tab},#{item.args},#{item.pubid}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="deleteRes"> |
| | | delete from lf.sys_role_res where resid = #{id}; |
| | | <delete id="delete"> |
| | | delete from lf.sys_layer where resid = #{id}; |
| | | delete from lf.sys_res where id = #{id}; |
| | | </delete> |
| | | |
| | | <delete id="deleteRess"> |
| | | delete from lf.sys_role_res where resid in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach>; |
| | | delete from lf.sys_res where id in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach>; |
| | | <delete id="deletes"> |
| | | delete from lf.sys_layer where resid in (${ids}); |
| | | delete from lf.sys_res where id in (${ids}); |
| | | </delete> |
| | | |
| | | <update id="updateRes"> |
| | | update lf.sys_res set name=#{name},server=#{server},source=#{source},depid=#{depid},dirid=#{dirid},code=#{code},descr=#{descr},img=#{img}, |
| | | update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} |
| | | <update id="update"> |
| | | update lf.sys_res |
| | | set cn_name=#{cnName},en_name=#{enName},status=#{status},type=#{type},data=#{data},category=#{category},url=#{url},test=#{test},descr=#{descr},depid=#{depid},dirid=#{dirid},img=#{img},update_user=#{updateUser},update_time=now(),bak=#{bak},tab=#{tab},args=#{args},pubid=#{pubid} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_res |
| | | set cn_name=#{item.cnName},en_name=#{item.enName},status=#{item.status},type=#{item.type},data=#{item.data},category=#{item.category},url=#{item.url},test=#{item.test},descr=#{item.descr},depid=#{item.depid},dirid=#{item.dirid},img=#{item.img},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},tab=#{item.tab},args=#{item.args},pubid=#{item.pubid} |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | ------------------------------------------------------------------- |
| | | admin:Admin@1234_lf |
| | | nacosï¼nAcos_!9#_admIn |
| | | |
| | | http://localhost:8848/nacos |
| | | http://localhost:8002/ |
| | | http://localhost:8001/system/ |
| | | |
| | | http://localhost:8001/system/sign/getPublicKey |
| | | http://localhost:8002/sign/getPublicKey |
| | | |
| | | http://localhost:8001/system/dir/selectDir?id=1 |
| | | http://localhost:8002/dir/selectDir?id=1 |
| | | ------------------------------------------------------------------- |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | ------------------------------------------------------------------- |