src/main/java/com/moon/server/entity/all/StaticData.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/mapper/sys/ResMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/service/data/ShuJianService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/service/sys/ResService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/sys/ResMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/moon/server/entity/all/StaticData.java
@@ -162,6 +162,8 @@ public final static String NO = "NO"; public final static String DOM = "DOM"; public final static String SUCCESS = "$SUCCESS"; public final static String LINESTRING = "LINESTRING"; src/main/java/com/moon/server/mapper/sys/ResMapper.java
@@ -55,6 +55,14 @@ public ResEntity selectById(int id); /** * 根据发布ID查询 * * @param pubid 发布ID * @return */ public ResEntity selectByPubid(Integer pubid); /** * 根据角色查询记录数 * * @param roleid src/main/java/com/moon/server/service/data/ShuJianService.java
@@ -7,6 +7,7 @@ import com.moon.server.entity.data.MetaPubEntity; import com.moon.server.entity.data.PublishEntity; import com.moon.server.entity.shujian.*; import com.moon.server.entity.sys.ResEntity; import com.moon.server.helper.HttpHelper; import com.moon.server.helper.PathHelper; import com.moon.server.helper.RestHelper; @@ -95,6 +96,10 @@ if (null == id) { return id; } publishEntity.setId(id); ResEntity resEntity = createResEntity(publishEntity); resService.insert(resEntity); return insertMetaPub(pub, id); } @@ -242,6 +247,31 @@ } /** * 创建资源实体类 */ private ResEntity createResEntity(PublishEntity pub) { ResEntity entity = new ResEntity(); entity.setCnName(pub.getName()); // 状态:0-禁用,1-启用原始地址,2-启用代理地址 entity.setStatus(2); // 服务类别:0-其他,1-GisServer,2-GeoServer,3-数简 entity.setCategory(3); // 服务类型:0-URL,1-TMS,2-WMTS,3-WMS,4-WFS,5-Tileset entity.setType(StaticData.DOM.equals(pub.getType()) ? 2 : 0); // 数据类型:0-URL,1-DOM,2-DEM entity.setData(StaticData.DOM.equals(pub.getType()) ? 1 : 2); entity.setUrl(pub.getUrl()); entity.setArgs(ak); entity.setDescr("系统自动创建"); entity.setDepid(pub.getDepid()); entity.setDirid(pub.getDirid()); entity.setCreateUser(pub.getCreateUser()); entity.setPubid(pub.getId()); return entity; } /** * 获取颜色表的JSON字符串 */ public String getColorTableJson(PubEntity pub) { @@ -308,7 +338,20 @@ entity.setGeom(StaticData.NULL); } return publishService.update(entity); int rows = publishService.update(entity); if (0 == rows) { return 0; } ResEntity resEntity = resService.selectByPubid(entity.getId()); if (null == resEntity) { resEntity = createResEntity(entity); return resService.insert(resEntity); } else { resEntity.setCnName(entity.getName()); resEntity.setUrl(entity.getUrl()); return resService.update(resEntity); } } /** src/main/java/com/moon/server/service/sys/ResService.java
@@ -42,6 +42,11 @@ } @Override public ResEntity selectByPubid(Integer pubid) { return resMapper.selectByPubid(pubid); } @Override public Integer selectCountForRole(Integer roleid) { return resMapper.selectCountForRole(roleid); } src/main/resources/mapper/sys/ResMapper.xml
@@ -59,6 +59,10 @@ where id = #{id}; </select> <select id="selectByPubid" resultType="com.moon.server.entity.sys.ResEntity"> select * from lf.sys_res where pubid = #{pubid} limit 1; </select> <select id="selectCountForRole" resultType="java.lang.Integer"> select count(a.*) from lf.sys_res a where not exists (select b.id from lf.sys_role_res b <where>