已重命名1个文件
已添加9个文件
已删除5个文件
已修改15个文件
| | |
| | | import com.terra.system.entity.all.*; |
| | | import com.terra.system.entity.data.LayerEntity; |
| | | import com.terra.system.entity.sys.MenuEntity; |
| | | import com.terra.system.entity.sys.ResEntity; |
| | | import com.terra.system.entity.sys.UserEntity; |
| | | import com.terra.system.service.all.PermsService; |
| | | import com.terra.system.service.data.LayerService; |
| | |
| | | LayerService layerService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢å½åç¨æ·çèµæºææ") |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) { |
| | | @ApiOperation(value = "æ¥è¯¢å½åç¨æ·çå¾å±ææ") |
| | | @GetMapping(value = "/selectLayers") |
| | | public ResponseMsg<Object> selectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResAuthEntity> rs = permsService.selectRes(uid); |
| | | List<LayerEntity> rs = layerService.selectLayers(uid); |
| | | |
| | | return success(rs); |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢å½åç¨æ·çæå½±å¾å±ææ") |
| | | @GetMapping(value = "/selectProjectLayers") |
| | | public ResponseMsg<Object> selectProjectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<LayerEntity> rs = layerService.selectProjectLayers(uid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢å½åç¨æ·çèµæºææ") |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<Object> selectRes(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResEntity> rs = permsService.selectRes(uid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¸
ç©ºææææç¼å") |
| | | @ApiOperation(value = "æ¸
空ææç¼å") |
| | | @GetMapping(value = "/deletePermsCache") |
| | | public ResponseMsg<Boolean> deletePermsCache() { |
| | | try { |
| | | permsService.clearPermsCache(); |
| | | |
| | | return success(true); |
| | | } catch (Exception ex) { |
| | | return fail(ex, false); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¸
空ææç¼å") |
| | | @GetMapping(value = "/deleteAllCache") |
| | | public ResponseMsg<Boolean> deleteAllCache() { |
| | | try { |
| | |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<MenuEntity> list = permsService.selectMenuRecursive(id, uid); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææå¾å±") |
| | | @GetMapping(value = "/selectLayers") |
| | | public ResponseMsg<Object> selectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | List<LayerEntity> list = layerService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
ÎļþÃû´Ó se-system/src/main/java/com/terra/system/controller/data/LayerController.java ÐÞ¸Ä |
| | |
| | | package com.terra.system.controller.data; |
| | | package com.terra.system.controller.sys; |
| | | |
| | | import com.terra.system.annotation.SysLog; |
| | | import com.terra.system.controller.all.BaseController; |
| | | import com.terra.system.entity.all.ResponseMsg; |
| | | import com.terra.system.entity.data.LayerEntity; |
| | | import com.terra.system.entity.sys.LayerEntity; |
| | | import com.terra.system.entity.sys.UserEntity; |
| | | import com.terra.system.service.data.LayerService; |
| | | import com.terra.system.service.all.PermsService; |
| | | import com.terra.system.service.sys.LayerService; |
| | | import com.terra.system.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¾å±ç®¡ç |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "æ°æ®ç®¡ç\\å¾å±ç®¡ç") |
| | | @Api(tags = "è¿ç»´ç®¡ç\\å¾å±ç®¡ç") |
| | | @RestController |
| | | @SuppressWarnings("ALL") |
| | | @RequestMapping("/layer") |
| | | public class LayerController extends BaseController { |
| | | @Resource |
| | | @Autowired |
| | | LayerService layerService; |
| | | |
| | | @Resource |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "cnName", value = "䏿åç§°", dataType = "String", paramType = "query", required = false, example = "") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String cnName) { |
| | | try { |
| | | int count = layerService.selectCount(cnName); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "cnName", value = "䏿åç§°", dataType = "String", 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 = "/selectByPage") |
| | | public ResponseMsg<List<LayerEntity>> selectByPage(String cnName, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | @Autowired |
| | | PermsService permsService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "cnName", value = "䏿åç§°", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", 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<LayerEntity>> selectByPageAndCount(String cnName, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<LayerEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = layerService.selectCount(cnName); |
| | | int count = layerService.selectCount(name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); |
| | | List<LayerEntity> rs = layerService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<LayerEntity>> selectAll() { |
| | | public ResponseMsg<List<LayerEntity>> selectAll(Integer flag) { |
| | | try { |
| | | List<LayerEntity> list = layerService.selectAll(); |
| | | List<LayerEntity> list = layerService.selectAll(flag); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.insert(entity); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.inserts(list); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @GetMapping(value = "/delete") |
| | | public ResponseMsg<Integer> delete(int id) { |
| | | try { |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.delete(id); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.deletes(ids); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.update(entity); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = layerService.updates(list); |
| | | if (count > 0) { |
| | | layerService.clearCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleService.insertRole(entity); |
| | | if (count > 0) { |
| | | permsService.clearPermsCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleService.insertRoles(list); |
| | | if (count > 0) { |
| | | permsService.clearPermsCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @GetMapping(value = "/deleteRole") |
| | | public ResponseMsg<Integer> deleteRole(int id) { |
| | | try { |
| | | permsService.clearPermsCache(); |
| | | int count = roleService.deleteRole(id); |
| | | if (count > 0) { |
| | | permsService.clearPermsCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleService.deleteRoles(ids); |
| | | if (count > 0) { |
| | | permsService.clearPermsCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleService.updateRole(entity); |
| | | if (count > 0) { |
| | | permsService.clearPermsCache(); |
| | | } |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.controller.sys; |
| | | |
| | | import com.terra.system.annotation.SysLog; |
| | | import com.terra.system.controller.all.BaseController; |
| | | import com.terra.system.entity.all.ResponseMsg; |
| | | import com.terra.system.entity.sys.RoleLayerEntity; |
| | | import com.terra.system.entity.sys.RoleResEntity; |
| | | import com.terra.system.entity.sys.UserEntity; |
| | | import com.terra.system.service.all.PermsService; |
| | | import com.terra.system.service.sys.RoleLayerService; |
| | | import com.terra.system.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | @SuppressWarnings("ALL") |
| | | @Api(tags = "è¿ç»´ç®¡ç\\è§è²å¾å±") |
| | | @RestController |
| | | @RequestMapping("/roleLayer") |
| | | public class RoleLayerController extends BaseController { |
| | | @Autowired |
| | | RoleLayerService roleLayerService; |
| | | |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | @Autowired |
| | | PermsService permsService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®è§è²IDæ¥è¯¢å¾å±") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectResByRole") |
| | | public ResponseMsg<Object> selectLayersByRole(Integer roleid) { |
| | | try { |
| | | List<RoleLayerEntity> rs = roleLayerService.selectLayersByRole(roleid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", 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<RoleLayerEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = roleLayerService.selectCount(roleid); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<RoleLayerEntity> rs = roleLayerService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } 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<RoleLayerEntity> selectById(int id) { |
| | | try { |
| | | RoleLayerEntity entity = roleLayerService.selectById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "RoleLayerEntity", paramType = "body") |
| | | }) |
| | | @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insert(@RequestBody RoleLayerEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleLayerService.insert(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "RoleLayerEntity", paramType = "body") |
| | | }) |
| | | @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> inserts(@RequestBody List<RoleLayerEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (RoleLayerEntity entity : list) { |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleLayerService.inserts(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/delete") |
| | | public ResponseMsg<Integer> delete(int id) { |
| | | try { |
| | | permsService.clearPermsCache(); |
| | | int count = roleLayerService.delete(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "IDæ°ç»", dataType = "Integer", paramType = "query", example = "1,2") |
| | | }) |
| | | @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 = roleLayerService.deletes(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "RoleLayerEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> update(@RequestBody RoleLayerEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleLayerService.update(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ´æ°å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "RoleLayerEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updates(@RequestBody List<RoleLayerEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (RoleLayerEntity entity : list) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | int count = roleLayerService.updates(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | } |
| | |
| | | PermsService permsService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiOperation(value = "æ ¹æ®è§è²IDæ¥è¯¢èµæº") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", dataType = "Integer", paramType = "query", required = false, example = "") |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(Integer roleid) { |
| | | @GetMapping(value = "/selectResByRole") |
| | | public ResponseMsg<List<RoleResEntity>> selectResByRole(Integer roleid) { |
| | | try { |
| | | int count = roleResService.selectCount(roleid); |
| | | List<RoleResEntity> rs = roleResService.selectResByRole(roleid); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", 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 = "/selectByPage") |
| | | public ResponseMsg<List<RoleResEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "roleid", value = "è§è²ID", dataType = "Integer", 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") |
| | | }) |
| | |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = roleResService.selectCount(roleid); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | |
| | | List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<RoleResEntity>> selectAll() { |
| | | try { |
| | | List<RoleResEntity> list = roleResService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | return "perms:layer:" + key; |
| | | } |
| | | |
| | | public static String permsProjectLayerKey(String key) { |
| | | return "perms:projectLayer:" + key; |
| | | } |
| | | |
| | | /** |
| | | * èåææé® |
| | | */ |
| | |
| | | |
| | | private String url; |
| | | |
| | | private String testUrl; |
| | | private int isLayer; |
| | | |
| | | private int type; |
| | | private int isShow; |
| | | |
| | | private String icon; |
| | | |
| | |
| | | |
| | | private int orderNum; |
| | | |
| | | private int isShow; |
| | | private int status; |
| | | |
| | | private int data; |
| | | |
| | | private String tab; |
| | | |
| | | private int createUser; |
| | | |
| | |
| | | |
| | | private String bak; |
| | | |
| | | private String serveType; |
| | | |
| | | private String dataType; |
| | | |
| | | private double elev; |
| | | |
| | | private String ns; |
| | | private int resid; |
| | | |
| | | private int type; |
| | | |
| | | private String proxy; |
| | | |
| | | private int category; |
| | | |
| | | private int flag; |
| | | |
| | | private Integer pubid; |
| | | |
| | | private Integer isProject; |
| | | |
| | | private String json; |
| | | private String unit; |
| | | |
| | | public LayerEntity() { |
| | | } |
| | |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getTestUrl() { |
| | | return testUrl; |
| | | public int getIsLayer() { |
| | | return isLayer; |
| | | } |
| | | |
| | | public void setTestUrl(String testUrl) { |
| | | this.testUrl = testUrl; |
| | | public void setIsLayer(int isLayer) { |
| | | this.isLayer = isLayer; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | public int getIsShow() { |
| | | return isShow; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | public void setIsShow(int isShow) { |
| | | this.isShow = isShow; |
| | | } |
| | | |
| | | public String getIcon() { |
| | |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public int getIsShow() { |
| | | return isShow; |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setIsShow(int isShow) { |
| | | this.isShow = isShow; |
| | | public void setStatus(int status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public int getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(int data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public String getTab() { |
| | | return tab; |
| | | } |
| | | |
| | | public void setTab(String tab) { |
| | | this.tab = tab; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | |
| | | this.bak = bak; |
| | | } |
| | | |
| | | public String getServeType() { |
| | | return serveType; |
| | | } |
| | | |
| | | public void setServeType(String serveType) { |
| | | this.serveType = serveType; |
| | | } |
| | | |
| | | public String getDataType() { |
| | | return dataType; |
| | | } |
| | | |
| | | public void setDataType(String dataType) { |
| | | this.dataType = dataType; |
| | | } |
| | | |
| | | public double getElev() { |
| | | return elev; |
| | | } |
| | |
| | | this.elev = elev; |
| | | } |
| | | |
| | | public String getNs() { |
| | | return ns; |
| | | public int getResid() { |
| | | return resid; |
| | | } |
| | | |
| | | public void setNs(String ns) { |
| | | this.ns = ns; |
| | | public void setResid(int resid) { |
| | | this.resid = resid; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getProxy() { |
| | | return proxy; |
| | | } |
| | | |
| | | public void setProxy(String proxy) { |
| | | this.proxy = proxy; |
| | | } |
| | | |
| | | public int getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(int category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public int getFlag() { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(int flag) { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | public Integer getPubid() { |
| | |
| | | this.pubid = pubid; |
| | | } |
| | | |
| | | public Integer getIsProject() { |
| | | return isProject; |
| | | public String getUnit() { |
| | | return unit; |
| | | } |
| | | |
| | | public void setIsProject(Integer isProject) { |
| | | this.isProject = isProject; |
| | | } |
| | | |
| | | public String getJson() { |
| | | return json; |
| | | } |
| | | |
| | | public void setJson(String json) { |
| | | this.json = json; |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.entity.sys; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | |
| | | @SuppressWarnings("ALL") |
| | | public class LayerEntity implements Serializable { |
| | | private static final long serialVersionUID = -371902381708800000L; |
| | | |
| | | private int id; |
| | | |
| | | private int pid; |
| | | |
| | | private String cnName; |
| | | |
| | | private String enName; |
| | | |
| | | private String url; |
| | | |
| | | private int isLayer; |
| | | |
| | | private int isShow; |
| | | |
| | | private String icon; |
| | | |
| | | private int level; |
| | | |
| | | private int orderNum; |
| | | |
| | | private int status; |
| | | |
| | | private int data; |
| | | |
| | | private String tab; |
| | | |
| | | private int createUser; |
| | | |
| | | private Timestamp createTime; |
| | | |
| | | private int updateUser; |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | private String bak; |
| | | |
| | | private double elev; |
| | | |
| | | private int resid; |
| | | |
| | | private int type; |
| | | |
| | | private String proxy; |
| | | |
| | | private int category; |
| | | |
| | | private int flag; |
| | | |
| | | private Integer pubid; |
| | | |
| | | private String unit; |
| | | |
| | | public LayerEntity() { |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(int pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getCnName() { |
| | | return cnName; |
| | | } |
| | | |
| | | public void setCnName(String cnName) { |
| | | this.cnName = cnName; |
| | | } |
| | | |
| | | public String getEnName() { |
| | | return enName; |
| | | } |
| | | |
| | | public void setEnName(String enName) { |
| | | this.enName = enName; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public int getIsLayer() { |
| | | return isLayer; |
| | | } |
| | | |
| | | public void setIsLayer(int isLayer) { |
| | | this.isLayer = isLayer; |
| | | } |
| | | |
| | | public int getIsShow() { |
| | | return isShow; |
| | | } |
| | | |
| | | public void setIsShow(int isShow) { |
| | | this.isShow = isShow; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public int getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(int level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public int getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(int orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(int status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public int getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(int data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public String getTab() { |
| | | return tab; |
| | | } |
| | | |
| | | public void setTab(String tab) { |
| | | this.tab = tab; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(int createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Timestamp getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Timestamp createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public int getUpdateUser() { |
| | | return updateUser; |
| | | } |
| | | |
| | | public void setUpdateUser(int updateUser) { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public Timestamp getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Timestamp updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getBak() { |
| | | return bak; |
| | | } |
| | | |
| | | public void setBak(String bak) { |
| | | this.bak = bak; |
| | | } |
| | | |
| | | public double getElev() { |
| | | return elev; |
| | | } |
| | | |
| | | public void setElev(double elev) { |
| | | this.elev = elev; |
| | | } |
| | | |
| | | public int getResid() { |
| | | return resid; |
| | | } |
| | | |
| | | public void setResid(int resid) { |
| | | this.resid = resid; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getProxy() { |
| | | return proxy; |
| | | } |
| | | |
| | | public void setProxy(String proxy) { |
| | | this.proxy = proxy; |
| | | } |
| | | |
| | | public int getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(int category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public int getFlag() { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(int flag) { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | public Integer getPubid() { |
| | | return pubid; |
| | | } |
| | | |
| | | public void setPubid(Integer pubid) { |
| | | this.pubid = pubid; |
| | | } |
| | | |
| | | public String getUnit() { |
| | | return unit; |
| | | } |
| | | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.entity.sys; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | |
| | | @SuppressWarnings("ALL") |
| | | public class RoleLayerEntity implements Serializable { |
| | | private static final long serialVersionUID = -773018130926889472L; |
| | | |
| | | private Integer id; |
| | | |
| | | private int roleid; |
| | | |
| | | private int layerid; |
| | | |
| | | private int createUser; |
| | | |
| | | private Timestamp createTime; |
| | | |
| | | private int updateUser; |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | private String cnName; |
| | | |
| | | private String enName; |
| | | |
| | | private Integer isLayer; |
| | | |
| | | private Integer pid; |
| | | |
| | | private Integer level; |
| | | |
| | | private Integer orderNum; |
| | | |
| | | public RoleLayerEntity() { |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getRoleid() { |
| | | return roleid; |
| | | } |
| | | |
| | | public void setRoleid(int roleid) { |
| | | this.roleid = roleid; |
| | | } |
| | | |
| | | public int getLayerid() { |
| | | return layerid; |
| | | } |
| | | |
| | | public void setLayerid(int layerid) { |
| | | this.layerid = layerid; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(int createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Timestamp getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Timestamp createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public int getUpdateUser() { |
| | | return updateUser; |
| | | } |
| | | |
| | | public void setUpdateUser(int updateUser) { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public Timestamp getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Timestamp updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getCnName() { |
| | | return cnName; |
| | | } |
| | | |
| | | public void setCnName(String cnName) { |
| | | this.cnName = cnName; |
| | | } |
| | | |
| | | public String getEnName() { |
| | | return enName; |
| | | } |
| | | |
| | | public void setEnName(String enName) { |
| | | this.enName = enName; |
| | | } |
| | | |
| | | public Integer getIsLayer() { |
| | | return isLayer; |
| | | } |
| | | |
| | | public void setIsLayer(Integer isLayer) { |
| | | this.isLayer = isLayer; |
| | | } |
| | | |
| | | public Integer getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Integer pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public Integer getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(Integer level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public Integer getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.terra.system.entity.all.MenusAuthEntity; |
| | | import com.terra.system.entity.all.PermsAuthEntity; |
| | | import com.terra.system.entity.all.ResAuthEntity; |
| | | import com.terra.system.entity.sys.MenuEntity; |
| | | import com.terra.system.entity.sys.ResEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | @Mapper |
| | | @Repository |
| | | public interface PermsMapper { |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæºææ |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<ResAuthEntity> selectRes(String uid); |
| | | public List<ResEntity> selectRes(String uid); |
| | | |
| | | public List<ResEntity> selectAllRes(); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èåææ |
| | |
| | | @Mapper |
| | | @Repository |
| | | public interface LayerMapper { |
| | | /** |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param cnName 䏿åç§° |
| | | * @return è®°å½æ° |
| | | */ |
| | | public Integer selectCount(String cnName); |
| | | public List<LayerEntity> selectLayers(String uid); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param cnName 䏿åç§° |
| | | * @param limit è®°å½æ° |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset); |
| | | public List<LayerEntity> selectProjectLayers(String uid); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LayerEntity> selectAll(); |
| | | public Integer selectCount(String name); |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset); |
| | | |
| | | public List<LayerEntity> selectAll(Integer flag); |
| | | |
| | | public LayerEntity selectById(int id); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | | * |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | public Integer selectIdByName(String name); |
| | | |
| | | public Integer selectMaxOrderNumByPid(Integer pid); |
| | | |
| | | public LayerEntity selectByResId(Integer resid); |
| | | |
| | | public Integer insert(LayerEntity entity); |
| | | |
| | | /** |
| | | * æå
¥å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer inserts(List<LayerEntity> list); |
| | | |
| | | /** |
| | | * å é¤ä¸æ¡ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer delete(int id); |
| | | |
| | | /** |
| | | * å é¤å¤æ¡ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deletes(List<Integer> ids); |
| | | |
| | | /** |
| | | * æ´æ°ä¸æ¡ |
| | | * |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | public Integer update(LayerEntity entity); |
| | | |
| | | /** |
| | | * æ´æ°å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer updates(List<LayerEntity> list); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.mapper.sys; |
| | | |
| | | import com.terra.system.entity.sys.LayerEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | @SuppressWarnings("ALL") |
| | | public interface LayerMapper { |
| | | public List<LayerEntity> selectLayers(String uid); |
| | | |
| | | public List<LayerEntity> selectProjectLayers(String uid); |
| | | |
| | | public Integer selectCount(String name); |
| | | |
| | | public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset); |
| | | |
| | | public List<LayerEntity> selectAll(Integer flag); |
| | | |
| | | public LayerEntity selectById(int id); |
| | | |
| | | public Integer selectIdByName(String name); |
| | | |
| | | public Integer selectMaxOrderNumByPid(Integer pid); |
| | | |
| | | public LayerEntity selectByResId(Integer resid); |
| | | |
| | | public Integer insert(LayerEntity entity); |
| | | |
| | | public Integer inserts(List<LayerEntity> list); |
| | | |
| | | public Integer delete(int id); |
| | | |
| | | public Integer deletes(List<Integer> ids); |
| | | |
| | | public Integer update(LayerEntity entity); |
| | | |
| | | public Integer updates(List<LayerEntity> list); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.mapper.sys; |
| | | |
| | | import com.terra.system.entity.sys.RoleLayerEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | @SuppressWarnings("ALL") |
| | | public interface RoleLayerMapper { |
| | | public List<RoleLayerEntity> selectLayersByRole(Integer roleid); |
| | | |
| | | public Integer selectCount(Integer roleid); |
| | | |
| | | public List<RoleLayerEntity> selectByPage(Integer roleid, Integer limit, Integer offset); |
| | | |
| | | public List<RoleLayerEntity> selectAll(); |
| | | |
| | | public RoleLayerEntity selectById(int id); |
| | | |
| | | public Integer insert(RoleLayerEntity entity); |
| | | |
| | | public Integer inserts(List<RoleLayerEntity> list); |
| | | |
| | | public Integer delete(int id); |
| | | |
| | | public Integer deletes(List<Integer> ids); |
| | | |
| | | public Integer update(RoleLayerEntity entity); |
| | | |
| | | public Integer updates(List<RoleLayerEntity> list); |
| | | } |
| | |
| | | @Mapper |
| | | @Repository |
| | | public interface RoleResMapper { |
| | | /** |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param roleid è§è²ID |
| | | * @return è®°å½æ° |
| | | */ |
| | | public List<RoleResEntity> selectResByRole(Integer roleid); |
| | | |
| | | public Integer selectCount(Integer roleid); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param roleid è§è²ID |
| | | * @param limit è®°å½æ° |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<RoleResEntity> selectByPage(Integer roleid, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ |
| | | * |
| | | * @return |
| | | */ |
| | | public List<RoleResEntity> selectAll(); |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public RoleResEntity selectById(int id); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | | * |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | public Integer insert(RoleResEntity entity); |
| | | |
| | | /** |
| | | * æå
¥å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer inserts(List<RoleResEntity> list); |
| | | |
| | | /** |
| | | * å é¤ä¸æ¡ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer delete(int id); |
| | | |
| | | /** |
| | | * å é¤å¤æ¡ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deletes(List<Integer> ids); |
| | | |
| | | /** |
| | | * æ´æ°ä¸æ¡ |
| | | * |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | public Integer update(RoleResEntity entity); |
| | | |
| | | /** |
| | | * æ´æ°å¤æ¡ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public Integer updates(List<RoleResEntity> list); |
| | | } |
| | |
| | | |
| | | import com.terra.system.entity.all.*; |
| | | import com.terra.system.entity.sys.MenuEntity; |
| | | import com.terra.system.entity.sys.ResEntity; |
| | | import com.terra.system.mapper.all.PermsMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | RedisService redisService; |
| | | |
| | | @Override |
| | | public List<ResAuthEntity> selectRes(String uid) { |
| | | public List<ResEntity> selectRes(String uid) { |
| | | return selectResByUid(uid, false); |
| | | } |
| | | |
| | | @Override |
| | | public List<ResEntity> selectAllRes() { |
| | | return selectResByUid(StaticData.ADMIN, true); |
| | | } |
| | | |
| | | private List<ResEntity> selectResByUid(String uid, boolean isAll) { |
| | | String key = RedisCacheKey.permsResKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<ResAuthEntity>) obj; |
| | | return (List<ResEntity>) obj; |
| | | } |
| | | |
| | | List<ResAuthEntity> list = permsMapper.selectRes(uid); |
| | | List<ResEntity> list = isAll ? permsMapper.selectAllRes() : permsMapper.selectRes(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | |
| | | } |
| | | |
| | | List<MenusAuthEntity> list = permsMapper.selectMenus(uid); |
| | | if (list != null && list.size() > 0) { |
| | | if (list != null && !list.isEmpty()) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<String> list = permsMapper.selectPerms(uid); |
| | | if (list != null && list.size() > 0) { |
| | | if (list != null && !list.isEmpty()) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<PermsAuthEntity> list = permsMapper.selectPermsEntity(uid); |
| | | if (list != null && list.size() > 0) { |
| | | if (list != null && !list.isEmpty()) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | |
| | | import com.terra.system.entity.ctrl.CountEntity; |
| | | import com.terra.system.entity.data.MetaEntity; |
| | | import com.terra.system.entity.data.MetaFileEntity; |
| | | import com.terra.system.entity.sys.ResEntity; |
| | | import com.terra.system.helper.*; |
| | | import com.terra.system.service.data.MetaService; |
| | | import com.terra.system.service.data.UploadService; |
| | |
| | | } |
| | | |
| | | public void testPerms() { |
| | | List<ResAuthEntity> raeList = permsService.selectRes("admin"); |
| | | List<ResAuthEntity> raeList2 = permsService.selectRes("admin"); |
| | | List<ResEntity> raeList = permsService.selectRes("admin"); |
| | | List<ResEntity> raeList2 = permsService.selectRes("admin"); |
| | | |
| | | List<MenusAuthEntity> maeList = permsService.selectMenus("admin"); |
| | | List<MenusAuthEntity> maeList2 = permsService.selectMenus("admin"); |
| | |
| | | package com.terra.system.service.data; |
| | | |
| | | import com.terra.system.entity.all.RedisCacheKey; |
| | | import com.terra.system.entity.all.SettingData; |
| | | import com.terra.system.entity.data.LayerEntity; |
| | | import com.terra.system.helper.StringHelper; |
| | | import com.terra.system.mapper.data.LayerMapper; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * å¾å± |
| | |
| | | RedisService redisService; |
| | | |
| | | @Override |
| | | public Integer selectCount(String cnName) { |
| | | cnName = StringHelper.getLikeUpperStr(cnName); |
| | | public List<LayerEntity> selectLayers(String uid) { |
| | | String key = RedisCacheKey.permsLayerKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<LayerEntity>) obj; |
| | | } |
| | | |
| | | return layerMapper.selectCount(cnName); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset) { |
| | | cnName = StringHelper.getLikeUpperStr(cnName); |
| | | |
| | | return layerMapper.selectByPage(cnName, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectAll() { |
| | | String key = RedisCacheKey.permsLayerKey("selectAll"); |
| | | List<LayerEntity> list = redisService.getListByKey(key); |
| | | if (null == list) { |
| | | list = layerMapper.selectAll(); |
| | | redisService.saveListByKey(key, list); |
| | | List<LayerEntity> list = layerMapper.selectLayers(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * æ¸
é¤ç¼å |
| | | */ |
| | | public void clearCache() { |
| | | redisService.clearKeys(RedisCacheKey.permsLayerKey("")); |
| | | @Override |
| | | public List<LayerEntity> selectProjectLayers(String uid) { |
| | | String key = RedisCacheKey.permsProjectLayerKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<LayerEntity>) obj; |
| | | } |
| | | |
| | | List<LayerEntity> list = layerMapper.selectProjectLayers(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return layerMapper.selectCount(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return layerMapper.selectByPage(name, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectAll(Integer flag) { |
| | | return layerMapper.selectAll(flag); |
| | | } |
| | | |
| | | @Override |
| | | public LayerEntity selectById(int id) { |
| | | return layerMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectIdByName(String name) { |
| | | Integer id = layerMapper.selectIdByName(name); |
| | | return null == id ? 0 : id; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectMaxOrderNumByPid(Integer pid) { |
| | | return layerMapper.selectMaxOrderNumByPid(pid); |
| | | } |
| | | |
| | | @Override |
| | | public LayerEntity selectByResId(Integer resid) { |
| | | return layerMapper.selectByResId(resid); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public Integer updates(List<LayerEntity> list) { |
| | | return layerMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
é¤ç¼å |
| | | */ |
| | | public void clearCache() { |
| | | redisService.clearKeys(RedisCacheKey.permsLayerKey("")); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.service.sys; |
| | | |
| | | import com.terra.system.entity.all.RedisCacheKey; |
| | | import com.terra.system.entity.all.SettingData; |
| | | import com.terra.system.entity.sys.LayerEntity; |
| | | import com.terra.system.helper.StringHelper; |
| | | import com.terra.system.mapper.sys.LayerMapper; |
| | | import com.terra.system.service.all.RedisService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class LayerService implements LayerMapper { |
| | | @Resource |
| | | LayerMapper layerMapper; |
| | | |
| | | @Resource |
| | | RedisService redisService; |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectLayers(String uid) { |
| | | String key = RedisCacheKey.permsLayerKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<LayerEntity>) obj; |
| | | } |
| | | |
| | | List<LayerEntity> list = layerMapper.selectLayers(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectProjectLayers(String uid) { |
| | | String key = RedisCacheKey.permsProjectLayerKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<LayerEntity>) obj; |
| | | } |
| | | |
| | | List<LayerEntity> list = layerMapper.selectProjectLayers(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return layerMapper.selectCount(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return layerMapper.selectByPage(name, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<LayerEntity> selectAll(Integer flag) { |
| | | return layerMapper.selectAll(flag); |
| | | } |
| | | |
| | | @Override |
| | | public LayerEntity selectById(int id) { |
| | | return layerMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectIdByName(String name) { |
| | | Integer id = layerMapper.selectIdByName(name); |
| | | return null == id ? 0 : id; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectMaxOrderNumByPid(Integer pid) { |
| | | return layerMapper.selectMaxOrderNumByPid(pid); |
| | | } |
| | | |
| | | @Override |
| | | public LayerEntity selectByResId(Integer resid) { |
| | | return layerMapper.selectByResId(resid); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insert(LayerEntity entity) { |
| | | return layerMapper.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer inserts(List<LayerEntity> list) { |
| | | return layerMapper.inserts(list); |
| | | } |
| | | |
| | | @Override |
| | | public Integer delete(int id) { |
| | | return layerMapper.delete(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deletes(List<Integer> ids) { |
| | | return layerMapper.deletes(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer update(LayerEntity entity) { |
| | | return layerMapper.update(entity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updates(List<LayerEntity> list) { |
| | | return layerMapper.updates(list); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.terra.system.service.sys; |
| | | |
| | | import com.terra.system.entity.sys.RoleLayerEntity; |
| | | import com.terra.system.helper.StringHelper; |
| | | import com.terra.system.mapper.sys.RoleLayerMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class RoleLayerService implements RoleLayerMapper { |
| | | @Autowired |
| | | RoleLayerMapper roleLayerMapper; |
| | | |
| | | @Override |
| | | public List<RoleLayerEntity> selectLayersByRole(Integer roleid) { |
| | | return roleLayerMapper.selectLayersByRole(roleid); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCount(Integer roleid) { |
| | | return roleLayerMapper.selectCount(roleid); |
| | | } |
| | | |
| | | @Override |
| | | public List<RoleLayerEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { |
| | | return roleLayerMapper.selectByPage(roleid, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<RoleLayerEntity> selectAll() { |
| | | return roleLayerMapper.selectAll(); |
| | | } |
| | | |
| | | @Override |
| | | public RoleLayerEntity selectById(int id) { |
| | | return roleLayerMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insert(RoleLayerEntity entity) { |
| | | return roleLayerMapper.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer inserts(List<RoleLayerEntity> list) { |
| | | return roleLayerMapper.inserts(list); |
| | | } |
| | | |
| | | @Override |
| | | public Integer delete(int id) { |
| | | return roleLayerMapper.delete(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deletes(List<Integer> ids) { |
| | | return roleLayerMapper.deletes(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer update(RoleLayerEntity entity) { |
| | | return roleLayerMapper.update(entity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updates(List<RoleLayerEntity> list) { |
| | | return roleLayerMapper.updates(list); |
| | | } |
| | | } |
| | |
| | | RoleResMapper roleResMapper; |
| | | |
| | | @Override |
| | | public List<RoleResEntity> selectResByRole(Integer roleid) { |
| | | return roleResMapper.selectResByRole(roleid); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCount(Integer roleid) { |
| | | return roleResMapper.selectCount(roleid); |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.terra.system.mapper.all.PermsMapper"> |
| | | <select id="selectRes" resultType="com.terra.system.entity.all.ResAuthEntity"> |
| | | select distinct d.id,d.name,d.server |
| | | <select id="selectRes" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select distinct e.* |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_res c on b.roleid = c.roleid |
| | | inner join lf.sys_res d on c.resid = d.id |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_layer c on b.roleid = c.roleid |
| | | inner join lf.sys_layer d on c.layerid = d.id |
| | | inner join lf.sys_res e on d.resid = e.id |
| | | <where> |
| | | d.status between 1 and 2 and e.status between 1 and 2 |
| | | <if test="uid != null"> |
| | | a.uid = #{uid} |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id |
| | | order by e.id; |
| | | </select> |
| | | |
| | | <select id="selectAllRes" resultType="com.terra.system.entity.sys.ResEntity"> |
| | | select e.* |
| | | from lf.sys_res e |
| | | where e.status between 1 and 2 |
| | | order by e.id; |
| | | </select> |
| | | |
| | | <select id="selectMenus" resultType="com.terra.system.entity.all.MenusAuthEntity"> |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.terra.system.mapper.data.LayerMapper"> |
| | | <select id="selectLayers" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select distinct d.*, e.proxy, e.pubid |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_layer c on b.roleid = c.roleid |
| | | inner join lf.sys_layer d on c.layerid = d.id |
| | | left join lf.sys_res e on d.resid = e.id and e.status = 2 |
| | | <where> |
| | | d.status = 1 and d.flag = 0 |
| | | <if test="uid != null"> |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id; |
| | | </select> |
| | | |
| | | <select id="selectProjectLayers" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select distinct d.*, e.proxy |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_layer c on b.roleid = c.roleid |
| | | inner join lf.sys_layer d on c.layerid = d.id |
| | | left join lf.sys_res e on d.resid = e.id and e.status = 2 |
| | | <where> |
| | | d.status = 1 and d.flag = 1 |
| | | <if test="uid != null"> |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id; |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_layer |
| | | <where> |
| | | <if test="cnName != null"> |
| | | upper(cn_name) like #{cnName} |
| | | <if test="name != null"> |
| | | upper(cn_name) like #{name} or upper(en_name) like #{name} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.terra.system.entity.data.LayerEntity"> |
| | | <select id="selectByPage" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer |
| | | <where> |
| | | <if test="cnName != null"> |
| | | upper(cn_name) like #{cnName} |
| | | <if test="name != null"> |
| | | upper(cn_name) like #{name} or upper(en_name) like #{name} |
| | | </if> |
| | | </where> |
| | | order by id |
| | | order by id desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectAll" resultType="com.terra.system.entity.data.LayerEntity"> |
| | | select a.*, |
| | | (select ns from lf.sys_dict b where b.field = 'gid' and b.tab = a.en_name) "ns", |
| | | (select json from lf.sys_publish c where c.id = a.pubid) |
| | | from lf.sys_layer a |
| | | order by id; |
| | | <select id="selectAll" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * |
| | | from lf.sys_layer |
| | | <where> |
| | | <if test="flag != null"> |
| | | flag = #{flag} |
| | | </if> |
| | | </where> |
| | | order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.terra.system.entity.data.LayerEntity"> |
| | | <select id="selectById" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.terra.system.entity.data.LayerEntity"> |
| | | <select id="selectIdByName" resultType="java.lang.Integer"> |
| | | select id from lf.sys_dir where name = #{name}; |
| | | </select> |
| | | |
| | | <select id="selectMaxOrderNumByPid" resultType="java.lang.Integer"> |
| | | select coalesce(max(order_num), 0) + 1 from lf.sys_layer where pid = #{pid}; |
| | | </select> |
| | | |
| | | <select id="selectByResId" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer where resid = #{resid} limit 1; |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.terra.system.entity.sys.LayerEntity"> |
| | | insert into lf.sys_layer |
| | | (pid,cn_name,en_name,url,test_url,type,icon,level,order_num,is_show,create_user,create_time,bak,serve_type,data_type,elev,is_project) |
| | | (pid,cn_name,en_name,url,is_layer,is_show,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type,data,tab,category,flag,unit) |
| | | values |
| | | (#{pid},#{cnName},#{enName},#{url},#{testUrl},#{type},#{icon},#{level},#{orderNum},#{isShow},#{createUser},now(),#{bak},#{serveType},#{dataType},#{elev},#{isProject}) |
| | | (#{pid},#{cnName},#{enName},#{url},#{isLayer},#{isShow},#{icon},#{level},#{orderNum},#{status},#{createUser},now(),#{bak},#{elev},#{resid},#{type},#{data},#{tab},#{category},#{flag},#{unit}) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | | insert into lf.sys_layer |
| | | (pid,cn_name,en_name,url,test_url,type,icon,level,order_num,is_show,create_user,create_time,bak,serve_type,data_type,elev,is_project) |
| | | (pid,cn_name,en_name,url,is_layer,is_show,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type,data,tab,category,flag,unit) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.pid},#{item.cnName},#{item.enName},#{item.url},#{item.testUrl},#{item.type},#{item.icon},#{item.level},#{item.orderNum},#{item.isShow},#{item.createUser},now(),#{item.bak},#{item.serveType},#{item.dataType},#{item.elev},#{item.isProject}) |
| | | (#{item.pid},#{item.cnName},#{item.enName},#{item.url},#{item.isLayer},#{item.isShow},#{item.icon},#{item.level},#{item.orderNum},#{item.status},#{item.createUser},now(),#{item.bak},#{item.elev},#{item.resid},#{item.type},#{item.data},#{item.tab},#{item.category},#{item.flag},#{item.unit}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | |
| | | <update id="update"> |
| | | update lf.sys_layer |
| | | set pid=#{pid},cn_name=#{cnName},en_name=#{enName},url=#{url},test_url=#{testUrl},type=#{type},icon=#{icon},level=#{level},order_num=#{orderNum},is_show=#{isShow},update_user=#{updateUser},update_time=now(),bak=#{bak},serve_type=#{serveType},data_type=#{dataType},elev=#{elev},is_project=#{isProject} |
| | | set pid=#{pid},cn_name=#{cnName},en_name=#{enName},url=#{url},is_layer=#{isLayer},is_show=#{isShow},icon=#{icon},level=#{level},order_num=#{orderNum},status=#{status},update_user=#{updateUser},update_time=now(),bak=#{bak},elev=#{elev},resid=#{resid},type=#{type},data=#{data},tab=#{tab},category=#{category},flag=#{flag},unit=#{unit} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_layer |
| | | <set> |
| | | pid=#{item.pid},cn_name=#{item.cnName},en_name=#{item.enName},url=#{item.url},test_url=#{item.testUrl},type=#{item.type},icon=#{item.icon},level=#{item.level},order_num=#{item.orderNum},is_show=#{item.isShow},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},serve_type=#{item.serveType},data_type=#{item.dataType},elev=#{item.elev},is_project=#{item.isProject} |
| | | </set> |
| | | set pid=#{item.pid},cn_name=#{item.cnName},en_name=#{item.enName},url=#{item.url},is_layer=#{item.isLayer},is_show=#{item.isShow},icon=#{item.icon},level=#{item.level},order_num=#{item.orderNum},status=#{item.status},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},elev=#{item.elev},resid=#{item.resid},type=#{item.type},data=#{item.data},tab=#{item.tab},category=#{item.category},flag=#{item.flag},unit=#{item.unit} |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.terra.system.mapper.sys.LayerMapper"> |
| | | <select id="selectLayers" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select distinct d.*, e.proxy, e.pubid |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_layer c on b.roleid = c.roleid |
| | | inner join lf.sys_layer d on c.layerid = d.id |
| | | left join lf.sys_res e on d.resid = e.id and e.status = 2 |
| | | <where> |
| | | d.status = 1 and d.flag = 0 |
| | | <if test="uid != null"> |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id; |
| | | </select> |
| | | |
| | | <select id="selectProjectLayers" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select distinct d.*, e.proxy |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_layer c on b.roleid = c.roleid |
| | | inner join lf.sys_layer d on c.layerid = d.id |
| | | left join lf.sys_res e on d.resid = e.id and e.status = 2 |
| | | <where> |
| | | d.status = 1 and d.flag = 1 |
| | | <if test="uid != null"> |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id; |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_layer |
| | | <where> |
| | | <if test="name != null"> |
| | | upper(cn_name) like #{name} or upper(en_name) like #{name} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer |
| | | <where> |
| | | <if test="name != null"> |
| | | upper(cn_name) like #{name} or upper(en_name) like #{name} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectAll" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * |
| | | from lf.sys_layer |
| | | <where> |
| | | <if test="flag != null"> |
| | | flag = #{flag} |
| | | </if> |
| | | </where> |
| | | order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectIdByName" resultType="java.lang.Integer"> |
| | | select id from lf.sys_dir where name = #{name}; |
| | | </select> |
| | | |
| | | <select id="selectMaxOrderNumByPid" resultType="java.lang.Integer"> |
| | | select coalesce(max(order_num), 0) + 1 from lf.sys_layer where pid = #{pid}; |
| | | </select> |
| | | |
| | | <select id="selectByResId" resultType="com.terra.system.entity.sys.LayerEntity"> |
| | | select * from lf.sys_layer where resid = #{resid} limit 1; |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.terra.system.entity.sys.LayerEntity"> |
| | | insert into lf.sys_layer |
| | | (pid,cn_name,en_name,url,is_layer,is_show,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type,data,tab,category,flag,unit) |
| | | values |
| | | (#{pid},#{cnName},#{enName},#{url},#{isLayer},#{isShow},#{icon},#{level},#{orderNum},#{status},#{createUser},now(),#{bak},#{elev},#{resid},#{type},#{data},#{tab},#{category},#{flag},#{unit}) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | | insert into lf.sys_layer |
| | | (pid,cn_name,en_name,url,is_layer,is_show,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type,data,tab,category,flag,unit) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.pid},#{item.cnName},#{item.enName},#{item.url},#{item.isLayer},#{item.isShow},#{item.icon},#{item.level},#{item.orderNum},#{item.status},#{item.createUser},now(),#{item.bak},#{item.elev},#{item.resid},#{item.type},#{item.data},#{item.tab},#{item.category},#{item.flag},#{item.unit}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="delete"> |
| | | delete from lf.sys_layer where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deletes"> |
| | | delete from lf.sys_layer where id in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="update"> |
| | | update lf.sys_layer |
| | | set pid=#{pid},cn_name=#{cnName},en_name=#{enName},url=#{url},is_layer=#{isLayer},is_show=#{isShow},icon=#{icon},level=#{level},order_num=#{orderNum},status=#{status},update_user=#{updateUser},update_time=now(),bak=#{bak},elev=#{elev},resid=#{resid},type=#{type},data=#{data},tab=#{tab},category=#{category},flag=#{flag},unit=#{unit} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_layer |
| | | set pid=#{item.pid},cn_name=#{item.cnName},en_name=#{item.enName},url=#{item.url},is_layer=#{item.isLayer},is_show=#{item.isShow},icon=#{item.icon},level=#{item.level},order_num=#{item.orderNum},status=#{item.status},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},elev=#{item.elev},resid=#{item.resid},type=#{item.type},data=#{item.data},tab=#{item.tab},category=#{item.category},flag=#{item.flag},unit=#{item.unit} |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.terra.system.mapper.sys.RoleLayerMapper"> |
| | | <select id="selectLayersByRole" resultType="com.terra.system.entity.sys.RoleLayerEntity"> |
| | | with rs as (select id, layerid from lf.sys_role_layer where roleid = #{roleid}) |
| | | select (select id from rs b where b.layerid = a.id) "id", a.id "layerid", a.cn_name, a.en_name, a.is_layer, a.pid, a.level, a.order_num |
| | | from lf.sys_layer a |
| | | order by a.id; |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_role_layer |
| | | <where> |
| | | <if test="roleid != null"> |
| | | roleid = #{roleid} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.terra.system.entity.sys.RoleLayerEntity"> |
| | | select * from lf.sys_role_layer |
| | | <where> |
| | | <if test="roleid != null"> |
| | | roleid = #{roleid} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectAll" resultType="com.terra.system.entity.sys.RoleLayerEntity"> |
| | | select * from lf.sys_role_layer order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.terra.system.entity.sys.RoleLayerEntity"> |
| | | select * from lf.sys_role_layer where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.terra.system.entity.sys.RoleLayerEntity"> |
| | | insert into lf.sys_role_layer |
| | | (roleid,layerid,create_user,create_time) |
| | | values |
| | | (#{roleid},#{layerid},#{createUser},now()) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | | insert into lf.sys_role_layer |
| | | (roleid,layerid,create_user,create_time) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.roleid},#{item.layerid},#{item.createUser},now()) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="delete"> |
| | | delete from lf.sys_role_layer where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deletes"> |
| | | delete from lf.sys_role_layer where id in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="update"> |
| | | update lf.sys_role_layer |
| | | set roleid=#{roleid},layerid=#{layerid},update_user=#{updateUser},update_time=now() |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_role_layer |
| | | set roleid=#{item.roleid},layerid=#{item.layerid},update_user=#{item.updateUser},update_time=now() |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.terra.system.mapper.sys.RoleResMapper"> |
| | | <select id="selectResByRole" resultType="com.terra.system.entity.sys.RoleResEntity"> |
| | | with rs as (select id, resid from lf.sys_role_res where roleid = #{roleid}) |
| | | select (select id from rs b where b.resid = a.id) "id", a.id "resid", a.cn_name, a.en_name, a.type, a.data, a.tab |
| | | from lf.sys_res a; |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_role_res |
| | | <where> |
| | |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.terra.system.entity.sys.RoleResEntity"> |
| | | select a.*,b.name as resName from lf.sys_role_res a inner join lf.sys_res b |
| | | on a.resid = b.id |
| | | select a.* |
| | | from lf.sys_role_res a |
| | | <where> |
| | | <if test="roleid != null"> |
| | | a.roleid = #{roleid} |
| | | </if> |
| | | </where> |
| | | order by id |
| | | order by a.id |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.terra.system.entity.sys.RoleResEntity"> |
| | | select * from lf.sys_role_res where id = #{id} |
| | | select * from lf.sys_role_res where id = #{id}; |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.terra.system.entity.sys.RoleResEntity"> |
| | | insert into lf.sys_role_res |
| | | (roleid,resid,create_user,create_time) |
| | | values |
| | | (#{roleid},#{resid},#{createUser},now()) |
| | | insert into lf.sys_role_res |
| | | (roleid,resid,create_user,create_time) |
| | | values |
| | | (#{roleid},#{resid},#{createUser},now()) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | |
| | | </delete> |
| | | |
| | | <update id="update"> |
| | | update lf.sys_role_res |
| | | set roleid=#{roleid},resid=#{resid},update_user=#{updateUser},update_time=now() |
| | | where id=#{id} |
| | | update lf.sys_role_res |
| | | set roleid=#{roleid},resid=#{resid},update_user=#{updateUser},update_time=now() |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |