diff --git a/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java b/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java index e4348c4f..c4f1b6e1 100644 --- a/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java +++ b/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java @@ -5,7 +5,6 @@ import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.dao.auth.AuthLicenseDao; import com.glxp.api.entity.auth.AuthLicense; import com.glxp.api.exception.JsonException; -import com.glxp.api.service.auth.AuthLoginService; import com.glxp.api.util.JwtUtils; import com.glxp.api.common.enums.ResultEnum; import io.jsonwebtoken.Claims; @@ -22,7 +21,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; -import java.util.List; /** * 登录验证 AOP @@ -32,8 +30,6 @@ import java.util.List; @Slf4j public class AuthorizeAspect { - @Resource - private AuthLoginService authLoginService; @Resource private AuthLicenseDao authLicenseDao; @@ -100,25 +96,5 @@ public class AuthorizeAspect { // authRuleVerify(action.value(), adminId); } - /** - * 权限验证 - * - * @param authRule - */ - private void authRuleVerify(String authRule, Long adminId) { - - if (authRule != null && authRule.length() > 0) { - - List authRules = authLoginService.listRuleByAdminId(adminId); - // admin 为最高权限 - for (String item : authRules) { - if (item.equals("admin") || item.equals(authRule)) { - return; - } - } - throw new JsonException(ResultEnum.AUTH_FAILED); - } - - } } diff --git a/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java b/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java index 6e832e2c..94f13e6a 100644 --- a/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java +++ b/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java @@ -34,88 +34,12 @@ public class AuthAdminController { @Resource private AuthAdminService authAdminService; - - @Resource - private AuthRoleService authRoleService; - - @Resource - private AuthRoleAdminService authRoleAdminService; @Resource private InvWarehouseService invWarehouseService; @Resource private WarehouseUserService warehouseUserService; - /** - * 获取管理员列表 - */ - @AuthRuleAnnotation("admin/auth/admin/index") - @GetMapping("/admin/auth/admin/index") - public BaseResponse index(@Valid AuthAdminQueryRequest authAdminQueryRequest, - BindingResult bindingResult) { - - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); - } - - if (authAdminQueryRequest.getRoleId() != null) { - List authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId()); - List ids = new ArrayList<>(); - if (authRoleAdmins != null && !authRoleAdmins.isEmpty()) { - ids = authRoleAdmins.stream().map(AuthRoleAdmin::getAdmin_id).collect(Collectors.toList()); - } - authAdminQueryRequest.setIds(ids); - } - authAdminQueryRequest.setNeUserName("admin"); - List authAdmins = authAdminService.listAdminPage(authAdminQueryRequest); - // 查询所有的权限 - List adminIds = authAdmins.stream().map(AuthAdmin::getId).collect(Collectors.toList()); - List authRoleAdminList = authRoleAdminService.listByAdminIdIn(adminIds); - - // 视图列表 - List authAdminResponseList = authAdmins.stream().map(item -> { - AuthAdminResponse authAdminResponse = new AuthAdminResponse(); - BeanUtils.copyProperties(item, authAdminResponse); - List roles = authRoleAdminList.stream() - .filter(authRoleAdmin -> authAdminResponse.getId().equals(authRoleAdmin.getAdmin_id())) - .map(AuthRoleAdmin::getRole_id) - .collect(Collectors.toList()); - authAdminResponse.setRoles(roles); - return authAdminResponse; - }).collect(Collectors.toList()); - - PageInfo authAdminPageInfo = new PageInfo<>(authAdmins); - PageSimpleResponse authAdminPageSimpleResponse = new PageSimpleResponse<>(); - authAdminPageSimpleResponse.setTotal(authAdminPageInfo.getTotal()); - authAdminPageSimpleResponse.setList(authAdminResponseList); - return ResultVOUtils.success(authAdminPageSimpleResponse); - } - - - /** - * 获取角色列表 - */ - @AuthRuleAnnotation("admin/auth/admin/roleList") - @GetMapping("/admin/auth/admin/roleList") - public BaseResponse roleList(@RequestParam(value = "page", defaultValue = "1") Integer page, - @RequestParam(value = "limit", defaultValue = "100") Integer limit) { - - List authRoleList = authRoleService.listAuthAdminRolePage(page, limit, null); - PageInfo pageInfo = new PageInfo<>(authRoleList); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageInfo.getTotal()); - List authAdminRoleResponses = authRoleList.stream().map(e -> { - AuthAdminRoleResponse authAdminRoleResponse = new AuthAdminRoleResponse(); - BeanUtils.copyProperties(e, authAdminRoleResponse); - return authAdminRoleResponse; - }).collect(Collectors.toList()); - pageSimpleResponse.setList(authAdminRoleResponses); - - return ResultVOUtils.success(pageSimpleResponse); - - } - - @AuthRuleAnnotation("admin/auth/admin/updateInv") @PostMapping("/admin/auth/admin/updateInv") public BaseResponse updateInv(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, @@ -162,7 +86,8 @@ public class AuthAdminController { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } // 先删除之前的角色 - authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId()); + //todo 记得删除用户关联角色表 +// authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId()); warehouseUserService.deleteByCodeAndId(authAdminSaveRequest.getId(), byId.getLocSubInvCode()); return ResultVOUtils.success(); } diff --git a/src/main/java/com/glxp/api/controller/auth/DeptController.java b/src/main/java/com/glxp/api/controller/auth/DeptController.java index 21b8e1b0..e92cdda7 100644 --- a/src/main/java/com/glxp/api/controller/auth/DeptController.java +++ b/src/main/java/com/glxp/api/controller/auth/DeptController.java @@ -198,7 +198,7 @@ public class DeptController { } deptEntity.setAdvanceType(pEntity.getAdvanceType()); deptEntity.setLevel(pEntity.getLevel() + 1); - deptEntity.setPcode(pEntity.getPcode()); + deptEntity.setPcode(pEntity.getCode()); } deptEntity.setUpdateTime(new Date()); boolean b = deptService.insertInvWarehouse(deptEntity); diff --git a/src/main/java/com/glxp/api/controller/auth/DeptUserController.java b/src/main/java/com/glxp/api/controller/auth/DeptUserController.java index 952da1bb..94bad028 100644 --- a/src/main/java/com/glxp/api/controller/auth/DeptUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/DeptUserController.java @@ -2,6 +2,7 @@ package com.glxp.api.controller.auth; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.entity.auth.DeptUserEntity; import com.glxp.api.req.auth.DeptUserReqeust; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.auth.DeptUserResponse; @@ -9,6 +10,8 @@ import com.glxp.api.service.auth.DeptUserService; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -32,4 +35,14 @@ public class DeptUserController { return ResultVOUtils.success(deptEntityPageSimpleResponse); } + + @AuthRuleAnnotation("") + @PostMapping("udi/auth/dept/user/delete") + public BaseResponse delete(@RequestBody DeptUserEntity deptUserEntity) { + boolean b = deptUserService.delete(deptUserEntity.getDeptId(), deptUserEntity.getUserId()); + if (b) + return ResultVOUtils.success("移除成功!"); + return ResultVOUtils.error(500, "移除失败!"); + } + } diff --git a/src/main/java/com/glxp/api/controller/auth/LoginController.java b/src/main/java/com/glxp/api/controller/auth/LoginController.java index d6a4efea..407c7e7b 100644 --- a/src/main/java/com/glxp/api/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/api/controller/auth/LoginController.java @@ -7,7 +7,7 @@ import com.glxp.api.controller.BaseController; import com.glxp.api.dao.auth.AuthLicenseDao; import com.glxp.api.entity.auth.*; import com.glxp.api.entity.system.CompanyEntity; -import com.glxp.api.entity.system.DeviceKeyEntity; +import com.glxp.api.entity.system.SysPdaKeyEntity; import com.glxp.api.exception.JsonException; import com.glxp.api.req.auth.LoginRequest; import com.glxp.api.req.auth.PCLoginRequest; @@ -42,10 +42,8 @@ import java.util.*; @Slf4j public class LoginController extends BaseController { - @Autowired - private AuthLoginService authLoginService; - @Autowired + @Resource private AuthAdminService authAdminService; @Resource private LogininforService logininforService; @@ -53,7 +51,7 @@ public class LoginController extends BaseController { @Resource private AuthCheckService authCheckService; @Resource - DeviceKeyService deviceKeyService; + SysPdaKeyService sysPdaKeyService; @Resource SysPermissionService sysPermissionService; @@ -90,12 +88,12 @@ public class LoginController extends BaseController { throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!"); } if (StrUtil.isNotEmpty(loginRequest.getImei())) { - DeviceKeyEntity deviceKeyEntity = deviceKeyService.findDeviceByImei(loginRequest.getImei()); - if (deviceKeyEntity == null) { + SysPdaKeyEntity sysPdaKeyEntity = sysPdaKeyService.findDeviceByImei(loginRequest.getImei()); + if (sysPdaKeyEntity == null) { return ResultVOUtils.error(410, "该设备未注册"); - } else if (deviceKeyEntity.getIsCheck() == 0) { + } else if (sysPdaKeyEntity.getIsCheck() == 0) { return ResultVOUtils.error(411, "该设备登记审核中,请等待,或联系管理员"); - } else if (deviceKeyEntity.getIsCheck() == 2) { + } else if (sysPdaKeyEntity.getIsCheck() == 2) { return ResultVOUtils.error(412, "该设备被拒绝登录,请联系管理员!"); } } @@ -108,7 +106,7 @@ public class LoginController extends BaseController { authAdminService.updateAuthAdmin(authAdminUp); // 登录成功后获取权限,这里面会设置到缓存 - authLoginService.listRuleByAdminId(authAdmin.getId()); +// authLoginService.listRuleByAdminId(authAdmin.getId()); Map claims = new HashMap<>(); claims.put("admin_id", authAdmin.getId()); @@ -180,7 +178,7 @@ public class LoginController extends BaseController { authAdminService.updateAuthAdmin(authAdminUp); // 登录成功后获取权限,这里面会设置到缓存 - authLoginService.listRuleByAdminId(authAdmin.getId()); +// authLoginService.listRuleByAdminId(authAdmin.getId()); Map claims = new HashMap<>(); claims.put("admin_id", authAdmin.getId()); @@ -214,29 +212,6 @@ public class LoginController extends BaseController { return ResultVOUtils.success(loginUserInfoResponse); } - /** - * 获取登录用户信息 - * - * @return - */ - @AuthRuleAnnotation("") - @GetMapping("/admin/auth/login/userInfo") - public BaseResponse userInfo(HttpServletRequest request) { - String adminId = request.getHeader("ADMIN_ID"); - Long id = Long.valueOf(adminId); - - AuthAdmin authAdmin = authAdminService.findById(id); - - List authRules = authLoginService.listRuleByAdminId(authAdmin.getId()); - - LoginUserInfoResponse loginUserInfoResponse = new LoginUserInfoResponse(); - BeanUtils.copyProperties(authAdmin, loginUserInfoResponse); - loginUserInfoResponse.setAuthRules(authRules); - loginUserInfoResponse.setLocInvName(deptService.getInvName(loginUserInfoResponse.getLocInvCode())); - loginUserInfoResponse.setLocSubInvName(invWarehouseService.getSubInvName(loginUserInfoResponse.getLocSubInvCode())); - return ResultVOUtils.success(loginUserInfoResponse); - } - @Resource ISysRoleService sysRoleService; @@ -246,10 +221,8 @@ public class LoginController extends BaseController { String adminId = request.getHeader("ADMIN_ID"); Long id = Long.valueOf(adminId); AuthAdmin authAdmin = authAdminService.findById(id); - List authRules = authLoginService.listRuleByAdminId(authAdmin.getId()); LoginUserInfoResponse loginUserInfoResponse = new LoginUserInfoResponse(); BeanUtils.copyProperties(authAdmin, loginUserInfoResponse); - loginUserInfoResponse.setAuthRules(authRules); CompanyEntity companyEntity = companyService.findCompany(); loginUserInfoResponse.setCompanyName(companyEntity.getName()); loginUserInfoResponse.setLocInvName(deptService.getInvName(loginUserInfoResponse.getLocInvCode())); diff --git a/src/main/java/com/glxp/api/controller/auth/SysUserController.java b/src/main/java/com/glxp/api/controller/auth/SysUserController.java index 81070a91..51edad53 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysUserController.java @@ -9,7 +9,6 @@ import com.glxp.api.annotation.Log; import com.glxp.api.constant.BusinessType; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; -import com.glxp.api.entity.auth.AuthRoleAdmin; import com.glxp.api.entity.auth.DeptUserEntity; import com.glxp.api.entity.auth.SysRole; import com.glxp.api.req.auth.AuthAdminQueryRequest; @@ -18,7 +17,6 @@ import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.auth.AuthAdminResponse; import com.glxp.api.res.auth.DeptUserResponse; import com.glxp.api.service.auth.AuthAdminService; -import com.glxp.api.service.auth.AuthRoleAdminService; import com.glxp.api.service.auth.DeptUserService; import com.glxp.api.service.auth.ISysRoleService; import com.glxp.api.util.PasswordUtils; @@ -51,8 +49,6 @@ public class SysUserController extends BaseController { private final AuthAdminService userService; private final ISysRoleService roleService; @Resource - private AuthRoleAdminService authRoleAdminService; - @Resource ISysRoleService sysRoleService; @GetMapping("/list") @@ -61,17 +57,7 @@ public class SysUserController extends BaseController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - - if (authAdminQueryRequest.getRoleId() != null) { - List authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId()); - List ids = new ArrayList<>(); - if (authRoleAdmins != null && !authRoleAdmins.isEmpty()) { - ids = authRoleAdmins.stream().map(AuthRoleAdmin::getAdmin_id).collect(Collectors.toList()); - } - authAdminQueryRequest.setIds(ids); - } List authAdminList = userService.listAdminPage(authAdminQueryRequest); - //查询对应角色和部门 List authAdminResponseList = authAdminList.stream().map(item -> { AuthAdminResponse authAdminResponse = new AuthAdminResponse(); diff --git a/src/main/java/com/glxp/api/controller/auth/ConnectTestController.java b/src/main/java/com/glxp/api/controller/system/ConnectTestController.java similarity index 96% rename from src/main/java/com/glxp/api/controller/auth/ConnectTestController.java rename to src/main/java/com/glxp/api/controller/system/ConnectTestController.java index 2676a4cb..fc424820 100644 --- a/src/main/java/com/glxp/api/controller/auth/ConnectTestController.java +++ b/src/main/java/com/glxp/api/controller/system/ConnectTestController.java @@ -1,4 +1,4 @@ -package com.glxp.api.controller.auth; +package com.glxp.api.controller.system; import com.glxp.api.entity.auth.AuthConnectEntity; import com.glxp.api.entity.system.CompanyEntity; @@ -20,10 +20,7 @@ public class ConnectTestController { @GetMapping("/udiwms/auth/device/connect") public BaseResponse index(ConnectRequest connequest) { - - CompanyEntity companyEntity = companyService.findCompany(); - AuthConnectEntity authConnectEntity = new AuthConnectEntity(); authConnectEntity.setCompanyName(companyEntity.getName()); authConnectEntity.setSysName("UDI管理系统"); diff --git a/src/main/java/com/glxp/api/controller/system/DeviceKeyController.java b/src/main/java/com/glxp/api/controller/system/DeviceKeyController.java index ad5bc9fc..29c20778 100644 --- a/src/main/java/com/glxp/api/controller/system/DeviceKeyController.java +++ b/src/main/java/com/glxp/api/controller/system/DeviceKeyController.java @@ -1,11 +1,11 @@ package com.glxp.api.controller.system; import com.github.pagehelper.PageInfo; -import com.glxp.api.entity.system.DeviceKeyEntity; +import com.glxp.api.entity.system.SysPdaKeyEntity; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.system.FilterDeviceKeyRequest; import com.glxp.api.res.PageSimpleResponse; -import com.glxp.api.service.auth.DeviceKeyService; +import com.glxp.api.service.auth.SysPdaKeyService; import com.glxp.api.util.DateUtil; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; @@ -30,16 +30,16 @@ public class DeviceKeyController { // @Value("${toMail}") // private String toMail; @Resource - DeviceKeyService deviceKeyService; + SysPdaKeyService sysPdaKeyService; // @Resource // private JavaMailSender javaMailSender; @GetMapping("sale/device/registerList") public BaseResponse registerList(FilterDeviceKeyRequest filterDeviceKeyRequest) { - List deviceKeyEntities = deviceKeyService.findDeviceKey(filterDeviceKeyRequest); - PageInfo pageInfo; + List deviceKeyEntities = sysPdaKeyService.findDeviceKey(filterDeviceKeyRequest); + PageInfo pageInfo; pageInfo = new PageInfo<>(deviceKeyEntities); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(deviceKeyEntities); return ResultVOUtils.success(pageSimpleResponse); @@ -47,27 +47,27 @@ public class DeviceKeyController { @PostMapping("sale/device/check") - public BaseResponse checkRegister(@RequestBody @Valid DeviceKeyEntity deviceKeyEntity, + public BaseResponse checkRegister(@RequestBody @Valid SysPdaKeyEntity sysPdaKeyEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - deviceKeyEntity.setDate(DateUtil.getDate()); - deviceKeyService.updateDeviceKey(deviceKeyEntity); + sysPdaKeyEntity.setDate(DateUtil.getDate()); + sysPdaKeyService.updateDeviceKey(sysPdaKeyEntity); return ResultVOUtils.success("审核成功"); } @PostMapping("/sale/info/registerKey") - public BaseResponse registerKey(@RequestBody DeviceKeyEntity deviceKeyEntity) { - String key = md5("glxp2020" + deviceKeyEntity.getImei()); + public BaseResponse registerKey(@RequestBody SysPdaKeyEntity sysPdaKeyEntity) { + String key = md5("glxp2020" + sysPdaKeyEntity.getImei()); FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest(); - filterDeviceKeyRequest.setImei(deviceKeyEntity.getImei()); - DeviceKeyEntity deviceKeyEntity1 = deviceKeyService.findDeviceByImei(filterDeviceKeyRequest); - if (deviceKeyEntity1 == null) { + filterDeviceKeyRequest.setImei(sysPdaKeyEntity.getImei()); + SysPdaKeyEntity sysPdaKeyEntity1 = sysPdaKeyService.findDeviceByImei(filterDeviceKeyRequest); + if (sysPdaKeyEntity1 == null) { return ResultVOUtils.success("1"); - } else if (deviceKeyEntity1.getIsCheck() == 0) { + } else if (sysPdaKeyEntity1.getIsCheck() == 0) { return ResultVOUtils.success("0"); } else { return ResultVOUtils.success(key); @@ -78,22 +78,22 @@ public class DeviceKeyController { @PostMapping("/sale/info/deleterKey") public BaseResponse deleterKey(@RequestBody DeleteRequest deleteRequest) { - deviceKeyService.deleteDeviceKey(deleteRequest); + sysPdaKeyService.deleteDeviceKey(deleteRequest); return ResultVOUtils.success("删除成功"); } @PostMapping("sale/device/register") - public BaseResponse saveRegister(@RequestBody DeviceKeyEntity deviceKeyEntity, + public BaseResponse saveRegister(@RequestBody SysPdaKeyEntity sysPdaKeyEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - deviceKeyEntity.setDate(DateUtil.getDateTime()); - deviceKeyEntity.setIsCheck(0); - deviceKeyService.insertDeviceKey(deviceKeyEntity); + sysPdaKeyEntity.setDate(DateUtil.getDateTime()); + sysPdaKeyEntity.setIsCheck(0); + sysPdaKeyService.insertDeviceKey(sysPdaKeyEntity); return ResultVOUtils.success("1"); } diff --git a/src/main/java/com/glxp/api/dao/auth/AuthPermissionDao.java b/src/main/java/com/glxp/api/dao/auth/AuthPermissionDao.java deleted file mode 100644 index 32c3349a..00000000 --- a/src/main/java/com/glxp/api/dao/auth/AuthPermissionDao.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.glxp.api.dao.auth; - -import com.glxp.api.entity.auth.AuthPermission; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface AuthPermissionDao { - - /** - * 根据roleIds查询 - * @param roleIds 传入的id - * @return - */ - List listByRoleIdIn(List roleIds); - - /** - * 根据 roleId 查询 - * @param roleId 传入的id - * @return - */ - List listByRoleId(Long roleId); - - - /** - * 批量插入 - * @param authPermissionList - * @return - */ - int insertAuthPermissionAll(List authPermissionList); - - /** - * 根据角色id删除 - * @param roleId - * @return - */ - boolean deleteByRoleId(Long roleId); - -} diff --git a/src/main/java/com/glxp/api/dao/auth/AuthPermissionRuleDao.java b/src/main/java/com/glxp/api/dao/auth/AuthPermissionRuleDao.java deleted file mode 100644 index 202e6f6c..00000000 --- a/src/main/java/com/glxp/api/dao/auth/AuthPermissionRuleDao.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.glxp.api.dao.auth; - -import com.glxp.api.entity.auth.AuthPermissionRule; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - - -@Mapper -public interface AuthPermissionRuleDao { - - /** - * 根据ids查询 规则名称 - * @param ids 传入的ids - * @return - */ - List listByIdIn(List ids); - - /** - * 查询所有 - * @param map - * @return - */ - List listAll(); - - /** - * 根据 父级 pid 查询 - * @param pid - * @return - */ - List listByPid(Long pid); - - /** - * 根据 规则名称查询 - * @param name - * @return - */ - AuthPermissionRule findByName(String name); - - /** - * 插入 - * @param authPermissionRule - * @return - */ - boolean insertAuthPermissionRule(AuthPermissionRule authPermissionRule); - - /** - * 更新 - * @param authPermissionRule - * @return - */ - boolean updateAuthPermissionRule(AuthPermissionRule authPermissionRule); - - /** - * 删除 - * @param id - * @return - */ - boolean deleteById(Long id); - -} diff --git a/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java b/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java deleted file mode 100644 index 37b9706e..00000000 --- a/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.glxp.api.dao.auth; - -import com.glxp.api.entity.auth.AuthRoleAdmin; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - - -@Mapper -public interface AuthRoleAdminDao { - - /** - * 根据 adminId 查询 - * @param adminId 传入的 adminId - * @return - */ - List listByAdminId(Long adminId); - - /** - * 根据 多个 adminId 查询 - * @param adminIds 传入的 adminIds - * @return - */ - List listByAdminIdIn(List adminIds); - - /** - * 根据 role_id 查询 admin_id - * @param roleId 传入的 roleId - * @return - */ - List listByRoleId(Long roleId); - - /** - * 批量插入 - * @param authRoleAdminList - * @return - */ - int insertAuthRoleAdminAll(List authRoleAdminList); - - - /** - * 根据 adminId 删除 - * @param adminId - * @return - */ - boolean deleteByAdminId(Long adminId); -} diff --git a/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java b/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java deleted file mode 100644 index 3431488a..00000000 --- a/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.glxp.api.dao.auth; - -import com.glxp.api.entity.auth.AuthRole; -import com.glxp.api.req.auth.AuthRoleQueryRequest; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface AuthRoleDao { - - /** - * 后台管理业务查询列表 - * @return 列表 - */ - List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest); - - /** - * 返回id,name 字段的列表 - * @return 列表 - */ - List listAuthAdminRolePage(Integer status); - - AuthRole findByName(String name); - - /** - * 插入 - * @param authAdmin - * @return - */ - boolean insertAuthRole(AuthRole authAdmin); - - /** - * 更新 - * @param authAdmin - * @return - */ - boolean updateAuthRole(AuthRole authAdmin); - - /** - * 删除 - * @param id - * @return - */ - boolean deleteById(Long id); - -} diff --git a/src/main/java/com/glxp/api/dao/auth/DeptUserDao.java b/src/main/java/com/glxp/api/dao/auth/DeptUserDao.java index 5962c114..3857f991 100644 --- a/src/main/java/com/glxp/api/dao/auth/DeptUserDao.java +++ b/src/main/java/com/glxp/api/dao/auth/DeptUserDao.java @@ -16,6 +16,8 @@ public interface DeptUserDao { List selectJoinDeptUser(DeptUserReqeust deptUserReqeust); + boolean delete(@Param("deptId") Long deptId, @Param("userId") Long userId); + int deleteById(Integer id); boolean deleteByUser(@Param("userId") Long userId); diff --git a/src/main/java/com/glxp/api/dao/auth/DeviceKeyDao.java b/src/main/java/com/glxp/api/dao/auth/DeviceKeyDao.java deleted file mode 100644 index e4992fd4..00000000 --- a/src/main/java/com/glxp/api/dao/auth/DeviceKeyDao.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.glxp.api.dao.auth; - -import com.glxp.api.entity.system.DeviceKeyEntity; -import com.glxp.api.req.system.DeleteRequest; -import com.glxp.api.req.system.FilterDeviceKeyRequest; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface DeviceKeyDao { - DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest); - - List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest); - - void insertDeviceKey(DeviceKeyEntity deviceKeyEntity); - - void updateDeviceKey(DeviceKeyEntity deviceKeyEntity); - - void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity); - - void deleteDeviceKey(DeleteRequest deleteRequest); - -} diff --git a/src/main/java/com/glxp/api/dao/auth/SysPdaKeyDao.java b/src/main/java/com/glxp/api/dao/auth/SysPdaKeyDao.java new file mode 100644 index 00000000..397f9015 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/SysPdaKeyDao.java @@ -0,0 +1,24 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.entity.system.SysPdaKeyEntity; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.req.system.FilterDeviceKeyRequest; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface SysPdaKeyDao { + SysPdaKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest); + + List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest); + + void insertDeviceKey(SysPdaKeyEntity sysPdaKeyEntity); + + void updateDeviceKey(SysPdaKeyEntity sysPdaKeyEntity); + + void updateDeviceKeyByImei(SysPdaKeyEntity sysPdaKeyEntity); + + void deleteDeviceKey(DeleteRequest deleteRequest); + +} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthPermission.java b/src/main/java/com/glxp/api/entity/auth/AuthPermission.java deleted file mode 100644 index a3b65104..00000000 --- a/src/main/java/com/glxp/api/entity/auth/AuthPermission.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.glxp.api.entity.auth; - -import lombok.Data; - -/** - * 权限授权表 - */ -@Data -public class AuthPermission { - - private Long id; - - private Long roleId; - - private Long permissionRuleId; - - private String type; - -} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthPermissionRule.java b/src/main/java/com/glxp/api/entity/auth/AuthPermissionRule.java deleted file mode 100644 index cf54fbd2..00000000 --- a/src/main/java/com/glxp/api/entity/auth/AuthPermissionRule.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.glxp.api.entity.auth; - -import lombok.Data; - -import java.util.Date; - -/** - * 规则表 - */ -@Data -public class AuthPermissionRule { - - private Long id; - private Long pid; - private String name; - private String title; - private Integer status; - private String condition; - private Integer listorder; - private Date createTime; - private Date updateTime; -} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthRole.java b/src/main/java/com/glxp/api/entity/auth/AuthRole.java deleted file mode 100644 index 2fdffbe9..00000000 --- a/src/main/java/com/glxp/api/entity/auth/AuthRole.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.glxp.api.entity.auth; - -import lombok.Data; - -import java.util.Date; - -/** - * 角色表 - */ -@Data -public class AuthRole { - - private Long id; - private String name; - private Long pid; - private Long status; - private String remark; - private Long listorder; - private Date createTime; - private Date updateTime; -} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java b/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java deleted file mode 100644 index a13fe0da..00000000 --- a/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.glxp.api.entity.auth; - -import lombok.Data; - -/** - * 用户角色对应表 - */ -@Data -public class AuthRoleAdmin { - private Long id; - private Long role_id; - private Long admin_id; - -} diff --git a/src/main/java/com/glxp/api/entity/system/DeviceKeyEntity.java b/src/main/java/com/glxp/api/entity/system/SysPdaKeyEntity.java similarity index 92% rename from src/main/java/com/glxp/api/entity/system/DeviceKeyEntity.java rename to src/main/java/com/glxp/api/entity/system/SysPdaKeyEntity.java index da4ea8d8..25c83c89 100644 --- a/src/main/java/com/glxp/api/entity/system/DeviceKeyEntity.java +++ b/src/main/java/com/glxp/api/entity/system/SysPdaKeyEntity.java @@ -3,7 +3,7 @@ package com.glxp.api.entity.system; import lombok.Data; @Data -public class DeviceKeyEntity { +public class SysPdaKeyEntity { private String id; private String imei; private int isCheck; diff --git a/src/main/java/com/glxp/api/service/auth/AuthLoginService.java b/src/main/java/com/glxp/api/service/auth/AuthLoginService.java deleted file mode 100644 index 429d8054..00000000 --- a/src/main/java/com/glxp/api/service/auth/AuthLoginService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.glxp.api.service.auth; - -import java.util.List; - -public interface AuthLoginService { - - List listRuleByAdminId(Long adminId); - -} diff --git a/src/main/java/com/glxp/api/service/auth/AuthPermissionRuleService.java b/src/main/java/com/glxp/api/service/auth/AuthPermissionRuleService.java deleted file mode 100644 index bbc46ae8..00000000 --- a/src/main/java/com/glxp/api/service/auth/AuthPermissionRuleService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.glxp.api.service.auth; - - -import com.glxp.api.entity.auth.AuthPermissionRule; - -import java.util.List; - -public interface AuthPermissionRuleService { - - - List listByIdIn(List ids); - - - List listByPid(Long pid); - - List listAll(); - - boolean insertAuthPermissionRule(AuthPermissionRule authPermissionRule); - - boolean updateAuthPermissionRule(AuthPermissionRule authPermissionRule); - - boolean deleteById(Long id); - - -} diff --git a/src/main/java/com/glxp/api/service/auth/AuthPermissionService.java b/src/main/java/com/glxp/api/service/auth/AuthPermissionService.java deleted file mode 100644 index c32ae2a1..00000000 --- a/src/main/java/com/glxp/api/service/auth/AuthPermissionService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.glxp.api.service.auth; - - -import com.glxp.api.entity.auth.AuthPermission; - -import java.util.List; - -public interface AuthPermissionService { - - - List listByRoleIdIn(List roleIds); - - List listByRoleId(Long roleId); - - int insertAuthPermissionAll(List authPermissionList); - - boolean deleteByRoleId(Long roleId); - -} diff --git a/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java b/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java deleted file mode 100644 index 56226271..00000000 --- a/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.glxp.api.service.auth; - - -import com.glxp.api.entity.auth.AuthRoleAdmin; - -import java.util.List; - -public interface AuthRoleAdminService { - - List listByAdminId(Long adminId); - - List listByAdminIdIn(List adminIds); - - List listByRoleId(Long roleId); - - int insertAuthRoleAdminAll(List authRoleAdminList); - - int insertRolesAdminIdAll(List roles, Long adminId); - - boolean deleteByAdminId(Long adminId); - -} diff --git a/src/main/java/com/glxp/api/service/auth/AuthRoleService.java b/src/main/java/com/glxp/api/service/auth/AuthRoleService.java deleted file mode 100644 index a14d0585..00000000 --- a/src/main/java/com/glxp/api/service/auth/AuthRoleService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.glxp.api.service.auth; - - -import com.glxp.api.entity.auth.AuthRole; -import com.glxp.api.req.auth.AuthRoleQueryRequest; - -import java.util.List; - -public interface AuthRoleService { - - List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest); - - List listAuthAdminRolePage(Integer page, Integer limit, Integer status); - - AuthRole findByName(String name); - - boolean insertAuthRole(AuthRole authRole); - - boolean updateAuthRole(AuthRole authRole); - - boolean deleteById(Long id); - -} diff --git a/src/main/java/com/glxp/api/service/auth/DeptUserService.java b/src/main/java/com/glxp/api/service/auth/DeptUserService.java index baed6def..911bf6c7 100644 --- a/src/main/java/com/glxp/api/service/auth/DeptUserService.java +++ b/src/main/java/com/glxp/api/service/auth/DeptUserService.java @@ -16,6 +16,8 @@ public interface DeptUserService { List selectJoinDeptUser(DeptUserReqeust deptUserReqeust); + boolean delete(Long deptId, Long userId); + boolean deleteByUser(Long userId); int deleteById(Integer id); diff --git a/src/main/java/com/glxp/api/service/auth/DeviceKeyService.java b/src/main/java/com/glxp/api/service/auth/DeviceKeyService.java deleted file mode 100644 index b1d7a9b5..00000000 --- a/src/main/java/com/glxp/api/service/auth/DeviceKeyService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.glxp.api.service.auth; - - -import com.glxp.api.entity.system.DeviceKeyEntity; -import com.glxp.api.req.system.DeleteRequest; -import com.glxp.api.req.system.FilterDeviceKeyRequest; - -import java.util.List; - -public interface DeviceKeyService { - List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest); - - DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest); - - DeviceKeyEntity findDeviceByImei(String imei); - - void insertDeviceKey(DeviceKeyEntity deviceKeyEntity); - - void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity); - - void updateDeviceKey(DeviceKeyEntity deviceKeyEntity); - - void deleteDeviceKey(DeleteRequest deleteRequest); - -} diff --git a/src/main/java/com/glxp/api/service/auth/SysPdaKeyService.java b/src/main/java/com/glxp/api/service/auth/SysPdaKeyService.java new file mode 100644 index 00000000..d9b85710 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/SysPdaKeyService.java @@ -0,0 +1,25 @@ +package com.glxp.api.service.auth; + + +import com.glxp.api.entity.system.SysPdaKeyEntity; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.req.system.FilterDeviceKeyRequest; + +import java.util.List; + +public interface SysPdaKeyService { + List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest); + + SysPdaKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest); + + SysPdaKeyEntity findDeviceByImei(String imei); + + void insertDeviceKey(SysPdaKeyEntity sysPdaKeyEntity); + + void updateDeviceKeyByImei(SysPdaKeyEntity sysPdaKeyEntity); + + void updateDeviceKey(SysPdaKeyEntity sysPdaKeyEntity); + + void deleteDeviceKey(DeleteRequest deleteRequest); + +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthLoginServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthLoginServiceImpl.java deleted file mode 100644 index 13830f2a..00000000 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthLoginServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.glxp.api.service.auth.impl; - -import com.glxp.api.entity.auth.AuthPermission; -import com.glxp.api.entity.auth.AuthPermissionRule; -import com.glxp.api.entity.auth.AuthRoleAdmin; -import com.glxp.api.service.auth.AuthLoginService; -import com.glxp.api.service.auth.AuthPermissionRuleService; -import com.glxp.api.service.auth.AuthPermissionService; -import com.glxp.api.service.auth.AuthRoleAdminService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -@Service -@Slf4j -public class AuthLoginServiceImpl implements AuthLoginService { - - @Resource - private AuthRoleAdminService authRoleAdminService; - - @Resource - private AuthPermissionService authPermissionService; - - @Resource - private AuthPermissionRuleService authPermissionRuleService; - - - /** - * 根据 管理员id 获取权限 - * - * @param adminId - * @return - */ - @Override - public List listRuleByAdminId(Long adminId) { - - List authRules = new ArrayList<>(); - // 超级管理员 - if (adminId.equals(1L)) { - authRules.add("admin"); - return authRules; - } - - // 如果存在,先从缓存中获取权限 -// String aarKey = String.format(CacheConstant.ADMIN_AUTH_RULES, adminId); -// if (CacheUtils.hasKey(aarKey)) { -// return new ArrayList<>(CacheUtils.sGetMembers(aarKey)); -// } -// log.info("开始获取数据库中的用户的权限规则列表"); - - // 获取角色ids - List authRoleAdmins = authRoleAdminService.listByAdminId(adminId); - - List roleIds = authRoleAdmins.stream().map(AuthRoleAdmin::getRole_id).collect(Collectors.toList()); - - // 角色授权列表 - List authPermissions = authPermissionService.listByRoleIdIn(roleIds); - List permissionRuleIds = authPermissions.stream().map(AuthPermission::getPermissionRuleId).collect(Collectors.toList()); - - // 获取授权的规则 - List authPermissionRules = authPermissionRuleService.listByIdIn(permissionRuleIds); - - // 获取权限列表 - authRules = authPermissionRules.stream().map(AuthPermissionRule::getName).collect(Collectors.toList()); - - // 如果为空,则添加一个空值 - if (authRules.isEmpty()) { - authRules.add(""); - } - -// String[] strings = authRules.toArray(new String[0]); -// CacheUtils.sAdd(aarKey, strings); -// CacheUtils.expire(aarKey, 7200L); // 两小时后过期 - - return authRules; - } - -} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionRuleServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionRuleServiceImpl.java deleted file mode 100644 index 225fc06d..00000000 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionRuleServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.glxp.api.service.auth.impl; - -import com.glxp.api.common.enums.ResultEnum; -import com.glxp.api.dao.auth.AuthPermissionRuleDao; -import com.glxp.api.entity.auth.AuthPermissionRule; -import com.glxp.api.exception.JsonException; -import com.glxp.api.service.auth.AuthPermissionRuleService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * - */ -@Service -public class AuthPermissionRuleServiceImpl implements AuthPermissionRuleService { - - @Resource - private AuthPermissionRuleDao authPermissionRuleDao; - - /** - * 根据多个id查询 - * - * @param ids - * @return - */ - @Override - public List listByIdIn(List ids) { - if (ids.isEmpty()) { - return Collections.emptyList(); - } - return authPermissionRuleDao.listByIdIn(ids); - } - - /** - * 根据父级 pid 查询 - * - * @param pid - * @return - */ - @Override - public List listByPid(Long pid) { - return authPermissionRuleDao.listByPid(pid); - } - - /** - * 查询所有 - * @return - */ - @Override - public List listAll() { - return authPermissionRuleDao.listAll(); - } - - /** - * 插入 - * @param authPermissionRule - * @return - */ - @Override - public boolean insertAuthPermissionRule(AuthPermissionRule authPermissionRule) { - - // 查询是否存在 - AuthPermissionRule byName = authPermissionRuleDao.findByName(authPermissionRule.getName()); - if (byName != null) { - throw new JsonException(ResultEnum.DATA_REPEAT, "当前权限规则已存在"); - } - - authPermissionRule.setCreateTime(new Date()); - authPermissionRule.setUpdateTime(new Date()); - if (authPermissionRule.getListorder() == null) { - authPermissionRule.setListorder(999); - } - return authPermissionRuleDao.insertAuthPermissionRule(authPermissionRule); - } - - /** - * 更新 - * @param authPermissionRule - * @return - */ - @Override - public boolean updateAuthPermissionRule(AuthPermissionRule authPermissionRule) { - - if (authPermissionRule.getName() != null) { - // 查询是否存在 - AuthPermissionRule byName = authPermissionRuleDao.findByName(authPermissionRule.getName()); - if (byName != null && !authPermissionRule.getId().equals(byName.getId())) { - throw new JsonException(ResultEnum.DATA_REPEAT, "当前权限规则已存在"); - } - } - - authPermissionRule.setUpdateTime(new Date()); - return authPermissionRuleDao.updateAuthPermissionRule(authPermissionRule); - } - - /** - * 删除 - * - * @param id - * @return - */ - @Override - public boolean deleteById(Long id) { - return authPermissionRuleDao.deleteById(id); - } -} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionServiceImpl.java deleted file mode 100644 index 126ef039..00000000 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthPermissionServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.glxp.api.service.auth.impl; - -import com.glxp.api.dao.auth.AuthPermissionDao; -import com.glxp.api.entity.auth.AuthPermission; -import com.glxp.api.service.auth.AuthPermissionService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; - -@Service -public class AuthPermissionServiceImpl implements AuthPermissionService { - - @Resource - private AuthPermissionDao authPermissionDao; - - /** - * 根据 多个角色id 查询 - * @param roleIds - * @return - */ - @Override - public List listByRoleIdIn(List roleIds) { - if (roleIds.isEmpty()) { - return Collections.emptyList(); - } - return authPermissionDao.listByRoleIdIn(roleIds); - } - - /** - * 根据某个角色id 查询 - * @param roleId - * @return - */ - @Override - public List listByRoleId(Long roleId) { - return authPermissionDao.listByRoleId(roleId); - } - - /** - * 批量插入 - * @param authPermissionList - * @return - */ - @Override - public int insertAuthPermissionAll(List authPermissionList) { - return authPermissionDao.insertAuthPermissionAll(authPermissionList); - } - - /** - * 根据角色id删除 - * @param roleId - * @return - */ - @Override - public boolean deleteByRoleId(Long roleId) { - return authPermissionDao.deleteByRoleId(roleId); - } -} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java deleted file mode 100644 index 8da7df91..00000000 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.glxp.api.service.auth.impl; - -import com.glxp.api.dao.auth.AuthRoleAdminDao; -import com.glxp.api.entity.auth.AuthRoleAdmin; -import com.glxp.api.service.auth.AuthRoleAdminService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -@Service -public class AuthRoleAdminServiceImpl implements AuthRoleAdminService { - - @Resource - private AuthRoleAdminDao authRoleAdminDao; - - /** - * 根据 adminid 获取角色id - * @param adminId - * @return - */ - @Override - public List listByAdminId(Long adminId) { - return authRoleAdminDao.listByAdminId(adminId); - } - - /** - * 根据多个 adminId 查询角色列表 - * @param adminIds - * @return - */ - @Override - public List listByAdminIdIn(List adminIds) { - if (adminIds.isEmpty()) { - return Collections.emptyList(); - } - return authRoleAdminDao.listByAdminIdIn(adminIds); - } - - /** - * 根据 roleId 获取 管理员id - * @param roleId - * @return - */ - @Override - public List listByRoleId(Long roleId) { - return authRoleAdminDao.listByRoleId(roleId); - } - - /** - * 批量插入 - * @param authRoleAdminList - * @return - */ - @Override - public int insertAuthRoleAdminAll(List authRoleAdminList) { - - if (authRoleAdminList == null || authRoleAdminList.isEmpty()) { - return 0; - } - - return authRoleAdminDao.insertAuthRoleAdminAll(authRoleAdminList); - } - - /** - * 根据 角色ids 和 管理员 adminId 批量插入 - * @param roles - * @param adminId - * @return - */ - @Override - public int insertRolesAdminIdAll(List roles, Long adminId) { - - List authRoleAdminList = roles.stream().map(aLong -> { - AuthRoleAdmin authRoleAdmin = new AuthRoleAdmin(); - authRoleAdmin.setRole_id(aLong); - authRoleAdmin.setAdmin_id(adminId); - return authRoleAdmin; - }).collect(Collectors.toList()); - if (!authRoleAdminList.isEmpty()) { - return insertAuthRoleAdminAll(authRoleAdminList); - } - - return 0; - } - - /** - * 根据 adminId 删除对应的权限 - * @param adminId - * @return - */ - @Override - public boolean deleteByAdminId(Long adminId) { - -// // 删除之前缓存权限规则 -// String aarKey = String.format(CacheConstant.ADMIN_AUTH_RULES, adminId); -// CacheUtils.delete(aarKey); - - return authRoleAdminDao.deleteByAdminId(adminId); - } -} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java deleted file mode 100644 index 76f5c019..00000000 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.glxp.api.service.auth.impl; - -import com.github.pagehelper.PageHelper; -import com.glxp.api.dao.auth.AuthRoleDao; -import com.glxp.api.entity.auth.AuthRole; -import com.glxp.api.req.auth.AuthRoleQueryRequest; -import com.glxp.api.service.auth.AuthRoleService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.List; - -@Service -public class AuthRoleServiceImpl implements AuthRoleService { - - @Resource - private AuthRoleDao authRoleDao; - - /** - * 查询列表 - * @return - */ - @Override - public List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest) { - int offset = (authRoleQueryRequest.getPage() - 1) * authRoleQueryRequest.getLimit(); - PageHelper.offsetPage(offset, authRoleQueryRequest.getLimit()); - List list = authRoleDao.listAdminPage(authRoleQueryRequest); - return list; - } - - /** - * 查询管理员页面的列表 - * @param page - * @param limit - * @param status - * @return - */ - @Override - public List listAuthAdminRolePage(Integer page, Integer limit, Integer status) { - page = page != null && page > 0 ? page : 1; - limit = limit != null && limit > 0 && limit < 100 ? limit : 100; - int offset = (page - 1) * limit; - PageHelper.offsetPage(offset, limit); - List list = authRoleDao.listAuthAdminRolePage(status); - return list; - } - - /** - * 根据名称查询 - * @param name - * @return - */ - @Override - public AuthRole findByName(String name) { - return authRoleDao.findByName(name); - } - - /** - * 插入 - * @param authRole - * @return - */ - @Override - public boolean insertAuthRole(AuthRole authRole) { - - authRole.setCreateTime(new Date()); - authRole.setUpdateTime(new Date()); - - return authRoleDao.insertAuthRole(authRole); - } - - /** - * 修改 - * @param authRole - * @return - */ - @Override - public boolean updateAuthRole(AuthRole authRole) { - authRole.setUpdateTime(new Date()); - return authRoleDao.updateAuthRole(authRole); - } - - /** - * 删除 - * @param id - * @return - */ - @Override - public boolean deleteById(Long id) { - return authRoleDao.deleteById(id); - } -} diff --git a/src/main/java/com/glxp/api/service/auth/impl/DeptUserServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/DeptUserServiceImpl.java index b354377e..84e77a99 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/DeptUserServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/DeptUserServiceImpl.java @@ -44,6 +44,11 @@ public class DeptUserServiceImpl implements DeptUserService { return deptUserDao.selectJoinDeptUser(deptUserReqeust); } + @Override + public boolean delete(Long deptId, Long userId) { + return deptUserDao.delete(deptId, userId); + } + @Override public boolean deleteByUser(Long userId) { return deptUserDao.deleteByUser(userId); diff --git a/src/main/java/com/glxp/api/service/auth/impl/DeviceKeyServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/SysPdaKeyServiceImpl.java similarity index 50% rename from src/main/java/com/glxp/api/service/auth/impl/DeviceKeyServiceImpl.java rename to src/main/java/com/glxp/api/service/auth/impl/SysPdaKeyServiceImpl.java index 2bc1a93f..f585b835 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/DeviceKeyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/SysPdaKeyServiceImpl.java @@ -1,11 +1,11 @@ package com.glxp.api.service.auth.impl; import com.github.pagehelper.PageHelper; -import com.glxp.api.dao.auth.DeviceKeyDao; -import com.glxp.api.entity.system.DeviceKeyEntity; +import com.glxp.api.dao.auth.SysPdaKeyDao; +import com.glxp.api.entity.system.SysPdaKeyEntity; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.system.FilterDeviceKeyRequest; -import com.glxp.api.service.auth.DeviceKeyService; +import com.glxp.api.service.auth.SysPdaKeyService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -13,51 +13,51 @@ import java.util.Collections; import java.util.List; @Service -public class DeviceKeyServiceImpl implements DeviceKeyService { +public class SysPdaKeyServiceImpl implements SysPdaKeyService { @Resource - DeviceKeyDao deviceKeyDao; + SysPdaKeyDao sysPdaKeyDao; @Override - public List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) { + public List findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) { if (filterDeviceKeyRequest == null) { return Collections.emptyList(); } int offset = (filterDeviceKeyRequest.getPage() - 1) * filterDeviceKeyRequest.getLimit(); PageHelper.offsetPage(offset, filterDeviceKeyRequest.getLimit()); - return deviceKeyDao.findDeviceKey(filterDeviceKeyRequest); + return sysPdaKeyDao.findDeviceKey(filterDeviceKeyRequest); } @Override - public DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) { - return deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest); + public SysPdaKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) { + return sysPdaKeyDao.findDeviceByImei(filterDeviceKeyRequest); } @Override - public DeviceKeyEntity findDeviceByImei(String imei) { + public SysPdaKeyEntity findDeviceByImei(String imei) { FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest(); filterDeviceKeyRequest.setImei(imei); - DeviceKeyEntity deviceKeyEntity = deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest); - return deviceKeyEntity; + SysPdaKeyEntity sysPdaKeyEntity = sysPdaKeyDao.findDeviceByImei(filterDeviceKeyRequest); + return sysPdaKeyEntity; } @Override - public void insertDeviceKey(DeviceKeyEntity deviceKeyEntity) { - deviceKeyDao.insertDeviceKey(deviceKeyEntity); + public void insertDeviceKey(SysPdaKeyEntity sysPdaKeyEntity) { + sysPdaKeyDao.insertDeviceKey(sysPdaKeyEntity); } @Override - public void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity) { - deviceKeyDao.updateDeviceKeyByImei(deviceKeyEntity); + public void updateDeviceKeyByImei(SysPdaKeyEntity sysPdaKeyEntity) { + sysPdaKeyDao.updateDeviceKeyByImei(sysPdaKeyEntity); } @Override - public void updateDeviceKey(DeviceKeyEntity deviceKeyEntity) { - deviceKeyDao.updateDeviceKey(deviceKeyEntity); + public void updateDeviceKey(SysPdaKeyEntity sysPdaKeyEntity) { + sysPdaKeyDao.updateDeviceKey(sysPdaKeyEntity); } @Override public void deleteDeviceKey(DeleteRequest deleteRequest) { - deviceKeyDao.deleteDeviceKey(deleteRequest); + sysPdaKeyDao.deleteDeviceKey(deleteRequest); } } diff --git a/src/main/java/com/glxp/api/util/PermissionRuleTreeUtils.java b/src/main/java/com/glxp/api/util/PermissionRuleTreeUtils.java deleted file mode 100644 index 3b11e519..00000000 --- a/src/main/java/com/glxp/api/util/PermissionRuleTreeUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.glxp.api.util; - -import com.glxp.api.entity.auth.AuthPermissionRule; -import com.glxp.api.res.auth.AuthPermissionRuleMergeResponse; -import org.springframework.beans.BeanUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * 权限规则生成树形节点工具类 - */ -public class PermissionRuleTreeUtils { - - /** - * 多维数组 - */ - public static List merge(List authPermissionRuleList, - Long pid) { - - List authPermissionRuleMergeResponseList = new ArrayList<>(); - for (AuthPermissionRule v : authPermissionRuleList) { - AuthPermissionRuleMergeResponse authPermissionRuleMergeResponse = new AuthPermissionRuleMergeResponse(); - BeanUtils.copyProperties(v, authPermissionRuleMergeResponse); - authPermissionRuleMergeResponse.setStatus(Long.valueOf(v.getStatus())); - if (pid.equals(v.getPid())) { - authPermissionRuleMergeResponse.setChildren(merge(authPermissionRuleList, v.getId())); - authPermissionRuleMergeResponseList.add(authPermissionRuleMergeResponse); - authPermissionRuleMergeResponse.setStatus(v.getStatus().longValue()); - } - } - - return authPermissionRuleMergeResponseList; - } - - -} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 80b21535..9865bb2f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -5,7 +5,7 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://127.0.0.1:3306/udiwms_ph1?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: 123456 hikari: diff --git a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml index 8b43ebbc..3fbc4343 100644 --- a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml +++ b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml @@ -177,8 +177,8 @@ resultType="com.glxp.api.entity.auth.AuthAdmin"> select u.* from auth_user u - left join sys_user_role sur on u.id = sur.user_id - left join sys_role r on r.role_id = sur.role_id + left join auth_user_role sur on u.id = sur.user_id + left join auth_role r on r.role_id = sur.role_id AND r.role_id =#{roleId} @@ -192,8 +192,8 @@ resultType="com.glxp.api.entity.auth.AuthAdmin"> select u.* from auth_user u - left join sys_user_role sur on u.id = sur.user_id - left join sys_role r on r.role_id = sur.role_id + left join auth_user_role sur on u.id = sur.user_id + left join auth_role r on r.role_id = sur.role_id u.id not in diff --git a/src/main/resources/mybatis/mapper/auth/AuthCheckDao.xml b/src/main/resources/mybatis/mapper/auth/AuthCheckDao.xml index 7e78af1e..1e24bc6a 100644 --- a/src/main/resources/mybatis/mapper/auth/AuthCheckDao.xml +++ b/src/main/resources/mybatis/mapper/auth/AuthCheckDao.xml @@ -6,7 +6,7 @@ SELECT * - FROM auth_device_check + FROM sys_device_check machineInfo = #{machineInfo} @@ -33,7 +33,7 @@ - INSERT INTO auth_device_check + INSERT INTO sys_device_check (machineInfo, remark, registerCode, createDate) values (#{machineInfo}, #{remark}, @@ -41,7 +41,7 @@ - UPDATE auth_device_check + UPDATE sys_device_check remark=#{remark}, registerCode=#{registerCode}, diff --git a/src/main/resources/mybatis/mapper/auth/AuthPermissionDao.xml b/src/main/resources/mybatis/mapper/auth/AuthPermissionDao.xml deleted file mode 100644 index 1f9d4e1b..00000000 --- a/src/main/resources/mybatis/mapper/auth/AuthPermissionDao.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - INSERT INTO auth_permission - (roleId, permissionRuleId,`type`) - VALUES - - - (#{item.roleId}, #{item.permissionRuleId}, #{item.type}) - - - - - - - delete from auth_permission where roleId = #{roleId} - - - \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/AuthPermissionRuleDao.xml b/src/main/resources/mybatis/mapper/auth/AuthPermissionRuleDao.xml deleted file mode 100644 index 09175a20..00000000 --- a/src/main/resources/mybatis/mapper/auth/AuthPermissionRuleDao.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - INSERT INTO auth_permission_rule(pid,`name`,`title`,`status`,`condition`,`listorder`,create_time,update_time) - values - (#{pid}, - #{name}, - #{title}, - #{status}, - - - #{condition}, - - - '', - - - #{listorder}, - #{createTime}, - #{updateTime}) - - - - UPDATE auth_permission_rule - - pid=#{pid}, - `name`=#{name}, - title=#{title}, - `status`=#{status}, - `condition`=#{condition}, - `listorder`=#{listorder}, - update_time=#{updateTime}, - - WHERE id=#{id} - - - - delete from auth_permission_rule where id = #{id} - - - \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml deleted file mode 100644 index 897ccdcf..00000000 --- a/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - INSERT INTO auth_role_admin - (role_id, admin_id) - VALUES - - - (#{item.role_id}, #{item.admin_id}) - - - - - - delete from auth_role_admin where admin_id = #{adminId} - - - \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml b/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml deleted file mode 100644 index 2ff8886a..00000000 --- a/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - INSERT INTO auth_role(`name`,pid,`status`,`remark`,`listorder`,create_time,update_time) - values - ( - #{name}, - - - #{pid}, - - - 0, - - - #{status}, - - - #{remark}, - - - '', - - - - - #{listorder}, - - - 999, - - - #{createTime}, - #{updateTime} - ) - - - - UPDATE auth_role - - `name`=#{name}, - pid=#{pid}, - `status`=#{status}, - remark=#{remark}, - `listorder`=#{listorder}, - update_time=#{updateTime}, - - WHERE id=#{id} - - - - delete from auth_role where id = #{id} - - - \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/DeptDao.xml b/src/main/resources/mybatis/mapper/auth/DeptDao.xml index 41db1a5b..b921b5c4 100644 --- a/src/main/resources/mybatis/mapper/auth/DeptDao.xml +++ b/src/main/resources/mybatis/mapper/auth/DeptDao.xml @@ -5,8 +5,8 @@ - select inv_warehouse.* from inv_warehouse INNER JOIN inv_warehouse_sub - on inv_warehouse.`code` =inv_warehouse_sub.parentId - INNER JOIN inv_warehouse_user on inv_warehouse_user.`code` = inv_warehouse_sub.code + select auth_dept.* from auth_dept INNER JOIN auth_warehouse + on auth_dept.`code` =auth_warehouse.parentId + INNER JOIN auth_warehouse_user on auth_warehouse_user.`code` = auth_warehouse.code AND id = #{id} @@ -56,7 +56,7 @@ AND pid = #{pid} - AND inv_warehouse.code = #{code} + AND auth_dept.code = #{code} AND name = #{name} @@ -71,7 +71,7 @@ AND pcode = #{pcode} - AND inv_warehouse_user.userId = #{userId} + AND auth_warehouse_user.userId = #{userId} @@ -81,7 +81,7 @@ AND spUse = #{spUse} - group by inv_warehouse.code + group by auth_dept.code @@ -89,14 +89,14 @@ - SELECT * FROM inv_warehouse + SELECT * FROM auth_dept AND id = #{id} @@ -169,13 +169,13 @@ replace - INTO inv_warehouse + INTO auth_dept (pid, code, `name`, advanceType, isDefault, status, updateTime, remark,`level`,pcode,spUse, thirdId, thirdId1, thirdId2, thirdId3, thirdId4) values ( @@ -201,12 +201,12 @@ DELETE - FROM inv_warehouse + FROM auth_dept WHERE id = #{id} - UPDATE inv_warehouse + UPDATE auth_dept pid=#{pid}, name=#{name}, @@ -231,7 +231,7 @@ - replace into inv_warehouse (id, pid, code, `name`, advanceType, isDefault, status, + replace into auth_dept (id, pid, code, `name`, advanceType, isDefault, status, updateTime, remark, `level`, pcode, thirdId, thirdId1, thirdId2, thirdId3, thirdId4,spUse) values @@ -251,13 +251,13 @@ - update inv_warehouse + update auth_dept set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR} where id = #{id} - update inv_warehouse + update auth_dept SET updateTime = #{updateTime} where code = #{code} @@ -265,13 +265,13 @@ \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/DeptUserDao.xml b/src/main/resources/mybatis/mapper/auth/DeptUserDao.xml index aba32061..9b461beb 100644 --- a/src/main/resources/mybatis/mapper/auth/DeptUserDao.xml +++ b/src/main/resources/mybatis/mapper/auth/DeptUserDao.xml @@ -22,10 +22,10 @@ select - from inv_space + from auth_space where id = #{id,jdbcType=INTEGER} delete - from inv_space + from auth_space where id = #{id,jdbcType=INTEGER} - insert into inv_space (code, `name`, type, invStorageCode, + insert into auth_space (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, `createUser`, updateUser, remark) @@ -59,7 +59,7 @@ - insert into inv_space + insert into auth_space code, @@ -133,7 +133,7 @@ - update inv_space + update auth_space code = #{code,jdbcType=VARCHAR}, @@ -173,7 +173,7 @@ - update inv_space + update auth_space set code = #{code,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR}, @@ -189,7 +189,7 @@ - update inv_space + update auth_space @@ -254,7 +254,7 @@ - insert into inv_space + insert into auth_space (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, `createUser`, updateUser, remark) values @@ -273,9 +273,9 @@ select s.*, w.name invStorageName, iws.name invSubStorageName - from inv_space s - left join inv_warehouse w on s.invStorageCode = w.code - left join inv_warehouse_sub iws on s.invWarehouseCode = iws.code + from auth_space s + left join auth_dept w on s.invStorageCode = w.code + left join auth_warehouse iws on s.invWarehouseCode = iws.code AND s.invStorageCode = #{invStorageCode} @@ -295,7 +295,7 @@ select * - from inv_space + from auth_space where invWarehouseCode = #{warehouseCode} select - from inv_space + from auth_space AND invStorageCode = #{invStorageCode} diff --git a/src/main/resources/mybatis/mapper/auth/InvSubWarehouseDao.xml b/src/main/resources/mybatis/mapper/auth/InvSubWarehouseDao.xml index 714456c6..512598c2 100644 --- a/src/main/resources/mybatis/mapper/auth/InvSubWarehouseDao.xml +++ b/src/main/resources/mybatis/mapper/auth/InvSubWarehouseDao.xml @@ -6,7 +6,7 @@ - select inv_warehouse_sub.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name + select auth_warehouse.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name thirdName4 - from inv_warehouse_sub - LEFT JOIN thr_inv_warehouse_sub a on a.code = inv_warehouse_sub.thirdId - LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = inv_warehouse_sub.thirdId1 - LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = inv_warehouse_sub.thirdId2 - LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = inv_warehouse_sub.thirdId3 - LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = inv_warehouse_sub.thirdId4 + from auth_warehouse + LEFT JOIN thr_inv_warehouse_sub a on a.code = auth_warehouse.thirdId + LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = auth_warehouse.thirdId1 + LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = auth_warehouse.thirdId2 + LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = auth_warehouse.thirdId3 + LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = auth_warehouse.thirdId4 - AND inv_warehouse_sub.code = #{code} + AND auth_warehouse.code = #{code} - AND inv_warehouse_sub.`name` = #{name} + AND auth_warehouse.`name` = #{name} - AND inv_warehouse_sub.parentId = #{parentId} + AND auth_warehouse.parentId = #{parentId} limit 1 @@ -54,51 +54,51 @@ select count(*) - from inv_warehouse_sub + from auth_warehouse where parentId = #{parentId} and name = #{name} - update inv_warehouse_sub + update auth_warehouse set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR} where id = #{id} @@ -197,9 +197,9 @@ resultType="com.glxp.api.res.auth.InvSubWarehouseResponse"> select a.id, a.code, a.name, a.parentId, a.remark, a.defaultInv, a.thirdId, a.thirdId1, a.thirdId2, a.thirdId3, a.thirdId4, b.name as parentName,a.parentCode,c.name parentInvName - FROM inv_warehouse_sub a - left join inv_warehouse b on a.parentId = b.code - left join inv_warehouse_sub c on a.parentCode = c.code + FROM auth_warehouse a + left join auth_dept b on a.parentId = b.code + left join auth_warehouse c on a.parentCode = c.code AND a.id = #{id} @@ -221,16 +221,16 @@ @@ -247,9 +247,9 @@ a.thirdId3, a.thirdId4, b.name parentName,a.parentCode - from inv_warehouse_sub a - left join inv_warehouse b on a.parentId = b.code - left join inv_warehouse_user c on a.code = c.code + from auth_warehouse a + left join auth_dept b on a.parentId = b.code + left join auth_warehouse_user c on a.code = c.code AND c.userId = #{userId} diff --git a/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml b/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml index 82ebe534..a7823d95 100644 --- a/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml +++ b/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml @@ -31,15 +31,15 @@ - INSERT INTO sys_menu(`menu_id`, `menu_name`, parent_id, `order_num`, `path`, component + INSERT INTO auth_menu(`menu_id`, `menu_name`, parent_id, `order_num`, `path`, component , query_param, is_frame, is_cache, menu_type, visible, status, perms, icon, - remark, create_by, create_time, update_time, update_by) + remark, create_by, create_time, update_time, update_by) values (#{menuId}, #{menuName}, #{parentId}, #{orderNum}, #{path}, #{component}, #{queryParam}, #{isFrame}, #{isCache} @@ -48,7 +48,7 @@ - UPDATE sys_menu + UPDATE auth_menu `menu_name`=#{menuName}, `parent_id`=#{parentId}, @@ -75,7 +75,7 @@ delete - from sys_menu + from auth_menu where menu_id = #{id} @@ -83,7 +83,7 @@ resultMap="SysMenuResult"> select * - FROM sys_menu + FROM auth_menu order by order_num @@ -91,7 +91,7 @@ select m.menu_id - from sys_menu m - left join sys_role_menu rm on m.menu_id = rm.menu_id + from auth_menu m + left join auth_role_menu rm on m.menu_id = rm.menu_id where rm.role_id = #{roleId} - and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = + and m.menu_id not in (select m.parent_id from auth_menu m inner join auth_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) order by m.parent_id, m.order_num @@ -181,17 +181,17 @@ select distinct m.perms - from sys_menu m - left join sys_role_menu rm on m.menu_id = rm.menu_id + from auth_menu m + left join auth_role_menu rm on m.menu_id = rm.menu_id where m.status = '0' and rm.role_id = #{roleId} diff --git a/src/main/resources/mybatis/mapper/auth/SysRoleMapper.xml b/src/main/resources/mybatis/mapper/auth/SysRoleMapper.xml index 7f6eac42..a39b56bc 100644 --- a/src/main/resources/mybatis/mapper/auth/SysRoleMapper.xml +++ b/src/main/resources/mybatis/mapper/auth/SysRoleMapper.xml @@ -23,7 +23,7 @@ - INSERT INTO sys_role(`role_name`, `role_key`, role_sort, data_scope + INSERT INTO auth_role(`role_name`, `role_key`, role_sort, data_scope , menu_check_strictly, dept_check_strictly, status, del_flag, remark, create_by, create_time, update_by) values (#{roleName}, @@ -33,7 +33,7 @@ - UPDATE sys_role + UPDATE auth_role `role_name`=#{roleName}, `role_key`=#{roleKey}, @@ -55,7 +55,7 @@ delete - from sys_role + from auth_role where role_id in #{item} @@ -66,7 +66,7 @@ delete - from sys_role + from auth_role where role_id = #{id} @@ -74,7 +74,7 @@ @@ -90,8 +90,8 @@ r.del_flag, r.create_time, r.remark - from sys_role r - left join sys_user_role sur on sur.role_id = r.role_id + from auth_role r + left join auth_user_role sur on sur.role_id = r.role_id left join auth_user u on u.id = sur.user_id @@ -99,7 +99,7 @@ @@ -166,8 +166,8 @@ r.del_flag, r.create_time, r.remark - from sys_role r - left join sys_user_role sur on sur.role_id = r.role_id + from auth_role r + left join auth_user_role sur on sur.role_id = r.role_id left join auth_user u on u.id = sur.user_id WHERE u.userName = #{userName} diff --git a/src/main/resources/mybatis/mapper/auth/SysRoleMenuMapper.xml b/src/main/resources/mybatis/mapper/auth/SysRoleMenuMapper.xml index dc0dd778..1804e382 100644 --- a/src/main/resources/mybatis/mapper/auth/SysRoleMenuMapper.xml +++ b/src/main/resources/mybatis/mapper/auth/SysRoleMenuMapper.xml @@ -13,7 +13,7 @@ select u.id from auth_user u - inner join sys_user_role sur + inner join auth_user_role sur on u.id = sur.user_id and sur.role_id = #{roleId} DELETE - FROM sys_user_role + FROM auth_user_role AND user_id = #{userId} @@ -31,7 +31,7 @@ - insert INTO sys_user_role + insert INTO auth_user_role ( user_id,role_id ) diff --git a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml index 2464f603..8ef82bbe 100644 --- a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml +++ b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml @@ -3,7 +3,7 @@ - + @@ -19,23 +19,23 @@ select - from inv_warehouse_user + from auth_warehouse_user where id = #{id,jdbcType=INTEGER} - delete from inv_warehouse_user + delete from auth_warehouse_user where id = #{id,jdbcType=INTEGER} - delete from inv_warehouse_user + delete from auth_warehouse_user where userid = #{id} and code=#{code} - insert into inv_warehouse_user (code, userId, userName, isDirector + insert into auth_warehouse_user (code, userId, userName, isDirector ) values (#{code,jdbcType=VARCHAR}, #{userid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{isDirector} ) @@ -43,7 +43,7 @@ - insert into inv_warehouse_user + insert into auth_warehouse_user code, @@ -71,7 +71,7 @@ - update inv_warehouse_user + update auth_warehouse_user code = #{code,jdbcType=VARCHAR}, @@ -88,7 +88,7 @@ - update inv_warehouse_user + update auth_warehouse_user set code = #{code,jdbcType=VARCHAR}, userId = #{userid,jdbcType=BIGINT}, userName = #{username,jdbcType=VARCHAR} @@ -97,7 +97,7 @@ - update inv_warehouse_user + update auth_warehouse_user @@ -122,7 +122,7 @@ - update inv_warehouse_user + update auth_warehouse_user @@ -153,7 +153,7 @@ - insert into inv_warehouse_user + insert into auth_warehouse_user (code, userId, userName, isDirector) values @@ -165,7 +165,7 @@ - insert into inv_warehouse_user + insert into auth_warehouse_user id, @@ -198,7 +198,7 @@ - insert into inv_warehouse_user + insert into auth_warehouse_user id, @@ -246,16 +246,16 @@ - select inv_warehouse_user.* - from inv_warehouse_user + select auth_warehouse_user.* + from auth_warehouse_user where userId = #{userId} delete - from inv_warehouse_user + from auth_warehouse_user where code = #{code} - update inv_warehouse_user + update auth_warehouse_user set isDirector = #{isDirector} where code = #{code} - update inv_warehouse_user + update auth_warehouse_user set isDirector = #{isDirector} where id = #{id} diff --git a/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml b/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml index c71ebe1d..f257b2b8 100644 --- a/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml +++ b/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml @@ -20,7 +20,7 @@ resultMap="SysLogininforResult"> select * - FROM sys_logininfor + FROM monitor_login_log and info_id = #{infoId} @@ -45,14 +45,14 @@ - INSERT INTO sys_logininfor( `user_name`, `status`, ipaddr, `login_location`, browser, `os`, msg - , login_time) + INSERT INTO monitor_login_log( `user_name`, `status`, ipaddr, `login_location`, browser, `os`, msg + , login_time) values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, #{loginTime}) @@ -60,7 +60,7 @@ delete - from sys_logininfor + from monitor_login_log where info_id = #{id} @@ -68,7 +68,7 @@ delete - from sys_logininfor + from monitor_login_log where info_id in #{item} diff --git a/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml b/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml index b58b6771..c0e9088c 100644 --- a/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml +++ b/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml @@ -28,10 +28,10 @@ select * - FROM sys_oper_log + FROM monitor_oper_log WHERE oper_id = #{id} - INSERT INTO sys_oper_log(`oper_id`, `title`, business_type, `method`, `request_method`, operator_type + INSERT INTO monitor_oper_log(`oper_id`, `title`, business_type, `method`, `request_method`, operator_type , oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time) values ( #{operId}, @@ -91,7 +91,7 @@ delete - from sys_oper_log + from monitor_oper_log where oper_id = #{id} @@ -99,7 +99,7 @@ delete - from sys_oper_log + from monitor_oper_log where oper_id in #{item} diff --git a/src/main/resources/mybatis/mapper/system/DeviceKeyDao.xml b/src/main/resources/mybatis/mapper/system/SysPdaKeyDao.xml similarity index 81% rename from src/main/resources/mybatis/mapper/system/DeviceKeyDao.xml rename to src/main/resources/mybatis/mapper/system/SysPdaKeyDao.xml index 7eed18a7..639af83b 100644 --- a/src/main/resources/mybatis/mapper/system/DeviceKeyDao.xml +++ b/src/main/resources/mybatis/mapper/system/SysPdaKeyDao.xml @@ -1,12 +1,12 @@ - + - + - UPDATE device_check + UPDATE sys_pda_check isCheck=#{isCheck}, companyName=#{companyName}, @@ -47,9 +47,9 @@ - + - UPDATE device_check + UPDATE sys_pda_check isCheck=#{isCheck}, companyName=#{companyName}, @@ -65,8 +65,9 @@ WHERE imei=#{imei} - - replace INTO device_check( + + replace + INTO sys_pda_check( imei, isCheck, companyName, @@ -81,12 +82,17 @@ #{phone}, #{contact}, #{date}, - #{imeiKey},#{creditNum},#{rgType},#{remark} + #{imeiKey}, + #{creditNum}, + #{rgType}, + #{remark} - ) + ) - DELETE FROM device_check WHERE id = #{id} + DELETE + FROM sys_pda_check + WHERE id = #{id} \ No newline at end of file diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index cfa24580..9989d115 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -1,82 +1,4 @@ --- 字段新增 (表名,字段名,字段类型,修改方式(1:新增,2:修改,3:删除) -CALL Pro_Temp_ColumnWork ('basic_export_status','receiveStatus','varchar(255) ', 1); -CALL Pro_Temp_ColumnWork ('io_order','wzUploadStatus','varchar(255) ', 1); -CALL Pro_Temp_ColumnWork ('io_order','wzUploadResult','varchar(255) ', 1); -CALL Pro_Temp_ColumnWork ('stock_order','noInvOut','tinyint ', 1); -CALL Pro_Temp_ColumnWork ('sup_cert','filePath','varchar(255) ', 2); -CALL Pro_Temp_ColumnWork ('inv_warehouse_sub','parentCode','varchar(255)', 1); - - - --- 创建表时必须 create table if not exists 表名 -CREATE TABLE if not exists `device_collect_order` ( - `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', - `orderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '领用记录号', - `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用部门', - `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人', - `auditUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '审核人', - `createTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用时间', - `updateTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新时间', - `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态 0:草稿 1:未审核 2:已审核', - `collectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用人', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备领用记录表' ROW_FORMAT = Dynamic; - -CREATE TABLE if not exists `device_collect_order_detail` ( - `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', - `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备领用记录号', - `originCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '原始码', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '码', - `productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID', - `nameCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品DI', - `batchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号', - `produceDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期', - `expireDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期', - `serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号', - `createTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用时间', - `updateTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新时间', - `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用分库', - `invStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用仓库', - `invSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用货位', - `receiveWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收分库', - `receiveStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收仓库', - `receiveSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收货位', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备领用记录详情' ROW_FORMAT = Dynamic; - -CREATE TABLE if not exists `device_ma_order` ( - `id` int NOT NULL AUTO_INCREMENT, - `orderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备养护记录号', - `collOrderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备领用单据号', - `createTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护时间', - `updateTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新时间', - `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护人', - `auditUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '审核人', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护说明', - `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备养护记录表' ROW_FORMAT = Dynamic; - -CREATE TABLE if not exists `device_ma_order_detail` ( - `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', - `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备养护记录号', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '条码', - `nameCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品DI', - `productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID', - `batchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号', - `produceDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期', - `expireDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期', - `serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号', - `createTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建时间', - `updateTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新时间', - `deviceStatus` tinyint(1) NULL DEFAULT NULL COMMENT '设备状态 0:异常 1:正常', - `maintenanceStatus` tinyint(1) NULL DEFAULT NULL COMMENT '养护状态 0:未养护 1:已养护', - `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护人', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护说明', - `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备养护记录详情表' ROW_FORMAT = Dynamic; -- 删除自助平台表 drop table if exists auth_platform;