删除非必要权限相关代码类,更改数据库命名相关代码修改

master
anthonywj 2 years ago
parent 6028359832
commit 08fb8afc63

@ -5,7 +5,6 @@ import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.dao.auth.AuthLicenseDao; import com.glxp.api.dao.auth.AuthLicenseDao;
import com.glxp.api.entity.auth.AuthLicense; import com.glxp.api.entity.auth.AuthLicense;
import com.glxp.api.exception.JsonException; import com.glxp.api.exception.JsonException;
import com.glxp.api.service.auth.AuthLoginService;
import com.glxp.api.util.JwtUtils; import com.glxp.api.util.JwtUtils;
import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.enums.ResultEnum;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
@ -22,7 +21,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List;
/** /**
* AOP * AOP
@ -32,8 +30,6 @@ import java.util.List;
@Slf4j @Slf4j
public class AuthorizeAspect { public class AuthorizeAspect {
@Resource
private AuthLoginService authLoginService;
@Resource @Resource
private AuthLicenseDao authLicenseDao; private AuthLicenseDao authLicenseDao;
@ -100,25 +96,5 @@ public class AuthorizeAspect {
// authRuleVerify(action.value(), adminId); // authRuleVerify(action.value(), adminId);
} }
/**
*
*
* @param authRule
*/
private void authRuleVerify(String authRule, Long adminId) {
if (authRule != null && authRule.length() > 0) {
List<String> authRules = authLoginService.listRuleByAdminId(adminId);
// admin 为最高权限
for (String item : authRules) {
if (item.equals("admin") || item.equals(authRule)) {
return;
}
}
throw new JsonException(ResultEnum.AUTH_FAILED);
}
}
} }

@ -34,88 +34,12 @@ public class AuthAdminController {
@Resource @Resource
private AuthAdminService authAdminService; private AuthAdminService authAdminService;
@Resource
private AuthRoleService authRoleService;
@Resource
private AuthRoleAdminService authRoleAdminService;
@Resource @Resource
private InvWarehouseService invWarehouseService; private InvWarehouseService invWarehouseService;
@Resource @Resource
private WarehouseUserService warehouseUserService; 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<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId());
List<Long> 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<AuthAdmin> authAdmins = authAdminService.listAdminPage(authAdminQueryRequest);
// 查询所有的权限
List<Long> adminIds = authAdmins.stream().map(AuthAdmin::getId).collect(Collectors.toList());
List<AuthRoleAdmin> authRoleAdminList = authRoleAdminService.listByAdminIdIn(adminIds);
// 视图列表
List<AuthAdminResponse> authAdminResponseList = authAdmins.stream().map(item -> {
AuthAdminResponse authAdminResponse = new AuthAdminResponse();
BeanUtils.copyProperties(item, authAdminResponse);
List<Long> 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<AuthAdmin> authAdminPageInfo = new PageInfo<>(authAdmins);
PageSimpleResponse<AuthAdminResponse> 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<AuthRole> authRoleList = authRoleService.listAuthAdminRolePage(page, limit, null);
PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList);
PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
List<AuthAdminRoleResponse> 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") @AuthRuleAnnotation("admin/auth/admin/updateInv")
@PostMapping("/admin/auth/admin/updateInv") @PostMapping("/admin/auth/admin/updateInv")
public BaseResponse updateInv(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, public BaseResponse updateInv(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest,
@ -162,7 +86,8 @@ public class AuthAdminController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK); return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
} }
// 先删除之前的角色 // 先删除之前的角色
authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId()); //todo 记得删除用户关联角色表
// authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId());
warehouseUserService.deleteByCodeAndId(authAdminSaveRequest.getId(), byId.getLocSubInvCode()); warehouseUserService.deleteByCodeAndId(authAdminSaveRequest.getId(), byId.getLocSubInvCode());
return ResultVOUtils.success(); return ResultVOUtils.success();
} }

@ -198,7 +198,7 @@ public class DeptController {
} }
deptEntity.setAdvanceType(pEntity.getAdvanceType()); deptEntity.setAdvanceType(pEntity.getAdvanceType());
deptEntity.setLevel(pEntity.getLevel() + 1); deptEntity.setLevel(pEntity.getLevel() + 1);
deptEntity.setPcode(pEntity.getPcode()); deptEntity.setPcode(pEntity.getCode());
} }
deptEntity.setUpdateTime(new Date()); deptEntity.setUpdateTime(new Date());
boolean b = deptService.insertInvWarehouse(deptEntity); boolean b = deptService.insertInvWarehouse(deptEntity);

@ -2,6 +2,7 @@ package com.glxp.api.controller.auth;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.entity.auth.DeptUserEntity;
import com.glxp.api.req.auth.DeptUserReqeust; import com.glxp.api.req.auth.DeptUserReqeust;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.auth.DeptUserResponse; 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.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.web.bind.annotation.GetMapping; 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 org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -32,4 +35,14 @@ public class DeptUserController {
return ResultVOUtils.success(deptEntityPageSimpleResponse); 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, "移除失败!");
}
} }

@ -7,7 +7,7 @@ import com.glxp.api.controller.BaseController;
import com.glxp.api.dao.auth.AuthLicenseDao; import com.glxp.api.dao.auth.AuthLicenseDao;
import com.glxp.api.entity.auth.*; import com.glxp.api.entity.auth.*;
import com.glxp.api.entity.system.CompanyEntity; 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.exception.JsonException;
import com.glxp.api.req.auth.LoginRequest; import com.glxp.api.req.auth.LoginRequest;
import com.glxp.api.req.auth.PCLoginRequest; import com.glxp.api.req.auth.PCLoginRequest;
@ -42,10 +42,8 @@ import java.util.*;
@Slf4j @Slf4j
public class LoginController extends BaseController { public class LoginController extends BaseController {
@Autowired
private AuthLoginService authLoginService;
@Autowired @Resource
private AuthAdminService authAdminService; private AuthAdminService authAdminService;
@Resource @Resource
private LogininforService logininforService; private LogininforService logininforService;
@ -53,7 +51,7 @@ public class LoginController extends BaseController {
@Resource @Resource
private AuthCheckService authCheckService; private AuthCheckService authCheckService;
@Resource @Resource
DeviceKeyService deviceKeyService; SysPdaKeyService sysPdaKeyService;
@Resource @Resource
SysPermissionService sysPermissionService; SysPermissionService sysPermissionService;
@ -90,12 +88,12 @@ public class LoginController extends BaseController {
throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!"); throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!");
} }
if (StrUtil.isNotEmpty(loginRequest.getImei())) { if (StrUtil.isNotEmpty(loginRequest.getImei())) {
DeviceKeyEntity deviceKeyEntity = deviceKeyService.findDeviceByImei(loginRequest.getImei()); SysPdaKeyEntity sysPdaKeyEntity = sysPdaKeyService.findDeviceByImei(loginRequest.getImei());
if (deviceKeyEntity == null) { if (sysPdaKeyEntity == null) {
return ResultVOUtils.error(410, "该设备未注册"); return ResultVOUtils.error(410, "该设备未注册");
} else if (deviceKeyEntity.getIsCheck() == 0) { } else if (sysPdaKeyEntity.getIsCheck() == 0) {
return ResultVOUtils.error(411, "该设备登记审核中,请等待,或联系管理员"); return ResultVOUtils.error(411, "该设备登记审核中,请等待,或联系管理员");
} else if (deviceKeyEntity.getIsCheck() == 2) { } else if (sysPdaKeyEntity.getIsCheck() == 2) {
return ResultVOUtils.error(412, "该设备被拒绝登录,请联系管理员!"); return ResultVOUtils.error(412, "该设备被拒绝登录,请联系管理员!");
} }
} }
@ -108,7 +106,7 @@ public class LoginController extends BaseController {
authAdminService.updateAuthAdmin(authAdminUp); authAdminService.updateAuthAdmin(authAdminUp);
// 登录成功后获取权限,这里面会设置到缓存 // 登录成功后获取权限,这里面会设置到缓存
authLoginService.listRuleByAdminId(authAdmin.getId()); // authLoginService.listRuleByAdminId(authAdmin.getId());
Map<String, Object> claims = new HashMap<>(); Map<String, Object> claims = new HashMap<>();
claims.put("admin_id", authAdmin.getId()); claims.put("admin_id", authAdmin.getId());
@ -180,7 +178,7 @@ public class LoginController extends BaseController {
authAdminService.updateAuthAdmin(authAdminUp); authAdminService.updateAuthAdmin(authAdminUp);
// 登录成功后获取权限,这里面会设置到缓存 // 登录成功后获取权限,这里面会设置到缓存
authLoginService.listRuleByAdminId(authAdmin.getId()); // authLoginService.listRuleByAdminId(authAdmin.getId());
Map<String, Object> claims = new HashMap<>(); Map<String, Object> claims = new HashMap<>();
claims.put("admin_id", authAdmin.getId()); claims.put("admin_id", authAdmin.getId());
@ -214,29 +212,6 @@ public class LoginController extends BaseController {
return ResultVOUtils.success(loginUserInfoResponse); 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<String> 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 @Resource
ISysRoleService sysRoleService; ISysRoleService sysRoleService;
@ -246,10 +221,8 @@ public class LoginController extends BaseController {
String adminId = request.getHeader("ADMIN_ID"); String adminId = request.getHeader("ADMIN_ID");
Long id = Long.valueOf(adminId); Long id = Long.valueOf(adminId);
AuthAdmin authAdmin = authAdminService.findById(id); AuthAdmin authAdmin = authAdminService.findById(id);
List<String> authRules = authLoginService.listRuleByAdminId(authAdmin.getId());
LoginUserInfoResponse loginUserInfoResponse = new LoginUserInfoResponse(); LoginUserInfoResponse loginUserInfoResponse = new LoginUserInfoResponse();
BeanUtils.copyProperties(authAdmin, loginUserInfoResponse); BeanUtils.copyProperties(authAdmin, loginUserInfoResponse);
loginUserInfoResponse.setAuthRules(authRules);
CompanyEntity companyEntity = companyService.findCompany(); CompanyEntity companyEntity = companyService.findCompany();
loginUserInfoResponse.setCompanyName(companyEntity.getName()); loginUserInfoResponse.setCompanyName(companyEntity.getName());
loginUserInfoResponse.setLocInvName(deptService.getInvName(loginUserInfoResponse.getLocInvCode())); loginUserInfoResponse.setLocInvName(deptService.getInvName(loginUserInfoResponse.getLocInvCode()));

@ -9,7 +9,6 @@ import com.glxp.api.annotation.Log;
import com.glxp.api.constant.BusinessType; import com.glxp.api.constant.BusinessType;
import com.glxp.api.controller.BaseController; import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin; 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.DeptUserEntity;
import com.glxp.api.entity.auth.SysRole; import com.glxp.api.entity.auth.SysRole;
import com.glxp.api.req.auth.AuthAdminQueryRequest; 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.AuthAdminResponse;
import com.glxp.api.res.auth.DeptUserResponse; import com.glxp.api.res.auth.DeptUserResponse;
import com.glxp.api.service.auth.AuthAdminService; 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.DeptUserService;
import com.glxp.api.service.auth.ISysRoleService; import com.glxp.api.service.auth.ISysRoleService;
import com.glxp.api.util.PasswordUtils; import com.glxp.api.util.PasswordUtils;
@ -51,8 +49,6 @@ public class SysUserController extends BaseController {
private final AuthAdminService userService; private final AuthAdminService userService;
private final ISysRoleService roleService; private final ISysRoleService roleService;
@Resource @Resource
private AuthRoleAdminService authRoleAdminService;
@Resource
ISysRoleService sysRoleService; ISysRoleService sysRoleService;
@GetMapping("/list") @GetMapping("/list")
@ -61,17 +57,7 @@ public class SysUserController extends BaseController {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
if (authAdminQueryRequest.getRoleId() != null) {
List<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId());
List<Long> ids = new ArrayList<>();
if (authRoleAdmins != null && !authRoleAdmins.isEmpty()) {
ids = authRoleAdmins.stream().map(AuthRoleAdmin::getAdmin_id).collect(Collectors.toList());
}
authAdminQueryRequest.setIds(ids);
}
List<AuthAdmin> authAdminList = userService.listAdminPage(authAdminQueryRequest); List<AuthAdmin> authAdminList = userService.listAdminPage(authAdminQueryRequest);
//查询对应角色和部门 //查询对应角色和部门
List<AuthAdminResponse> authAdminResponseList = authAdminList.stream().map(item -> { List<AuthAdminResponse> authAdminResponseList = authAdminList.stream().map(item -> {
AuthAdminResponse authAdminResponse = new AuthAdminResponse(); AuthAdminResponse authAdminResponse = new AuthAdminResponse();

@ -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.auth.AuthConnectEntity;
import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.entity.system.CompanyEntity;
@ -20,10 +20,7 @@ public class ConnectTestController {
@GetMapping("/udiwms/auth/device/connect") @GetMapping("/udiwms/auth/device/connect")
public BaseResponse index(ConnectRequest connequest) { public BaseResponse index(ConnectRequest connequest) {
CompanyEntity companyEntity = companyService.findCompany(); CompanyEntity companyEntity = companyService.findCompany();
AuthConnectEntity authConnectEntity = new AuthConnectEntity(); AuthConnectEntity authConnectEntity = new AuthConnectEntity();
authConnectEntity.setCompanyName(companyEntity.getName()); authConnectEntity.setCompanyName(companyEntity.getName());
authConnectEntity.setSysName("UDI管理系统"); authConnectEntity.setSysName("UDI管理系统");

@ -1,11 +1,11 @@
package com.glxp.api.controller.system; package com.glxp.api.controller.system;
import com.github.pagehelper.PageInfo; 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.DeleteRequest;
import com.glxp.api.req.system.FilterDeviceKeyRequest; import com.glxp.api.req.system.FilterDeviceKeyRequest;
import com.glxp.api.res.PageSimpleResponse; 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.util.DateUtil;
import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
@ -30,16 +30,16 @@ public class DeviceKeyController {
// @Value("${toMail}") // @Value("${toMail}")
// private String toMail; // private String toMail;
@Resource @Resource
DeviceKeyService deviceKeyService; SysPdaKeyService sysPdaKeyService;
// @Resource // @Resource
// private JavaMailSender javaMailSender; // private JavaMailSender javaMailSender;
@GetMapping("sale/device/registerList") @GetMapping("sale/device/registerList")
public BaseResponse registerList(FilterDeviceKeyRequest filterDeviceKeyRequest) { public BaseResponse registerList(FilterDeviceKeyRequest filterDeviceKeyRequest) {
List<DeviceKeyEntity> deviceKeyEntities = deviceKeyService.findDeviceKey(filterDeviceKeyRequest); List<SysPdaKeyEntity> deviceKeyEntities = sysPdaKeyService.findDeviceKey(filterDeviceKeyRequest);
PageInfo<DeviceKeyEntity> pageInfo; PageInfo<SysPdaKeyEntity> pageInfo;
pageInfo = new PageInfo<>(deviceKeyEntities); pageInfo = new PageInfo<>(deviceKeyEntities);
PageSimpleResponse<DeviceKeyEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<SysPdaKeyEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(deviceKeyEntities); pageSimpleResponse.setList(deviceKeyEntities);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
@ -47,27 +47,27 @@ public class DeviceKeyController {
@PostMapping("sale/device/check") @PostMapping("sale/device/check")
public BaseResponse checkRegister(@RequestBody @Valid DeviceKeyEntity deviceKeyEntity, public BaseResponse checkRegister(@RequestBody @Valid SysPdaKeyEntity sysPdaKeyEntity,
BindingResult bindingResult) { BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
deviceKeyEntity.setDate(DateUtil.getDate()); sysPdaKeyEntity.setDate(DateUtil.getDate());
deviceKeyService.updateDeviceKey(deviceKeyEntity); sysPdaKeyService.updateDeviceKey(sysPdaKeyEntity);
return ResultVOUtils.success("审核成功"); return ResultVOUtils.success("审核成功");
} }
@PostMapping("/sale/info/registerKey") @PostMapping("/sale/info/registerKey")
public BaseResponse registerKey(@RequestBody DeviceKeyEntity deviceKeyEntity) { public BaseResponse registerKey(@RequestBody SysPdaKeyEntity sysPdaKeyEntity) {
String key = md5("glxp2020" + deviceKeyEntity.getImei()); String key = md5("glxp2020" + sysPdaKeyEntity.getImei());
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest(); FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
filterDeviceKeyRequest.setImei(deviceKeyEntity.getImei()); filterDeviceKeyRequest.setImei(sysPdaKeyEntity.getImei());
DeviceKeyEntity deviceKeyEntity1 = deviceKeyService.findDeviceByImei(filterDeviceKeyRequest); SysPdaKeyEntity sysPdaKeyEntity1 = sysPdaKeyService.findDeviceByImei(filterDeviceKeyRequest);
if (deviceKeyEntity1 == null) { if (sysPdaKeyEntity1 == null) {
return ResultVOUtils.success("1"); return ResultVOUtils.success("1");
} else if (deviceKeyEntity1.getIsCheck() == 0) { } else if (sysPdaKeyEntity1.getIsCheck() == 0) {
return ResultVOUtils.success("0"); return ResultVOUtils.success("0");
} else { } else {
return ResultVOUtils.success(key); return ResultVOUtils.success(key);
@ -78,22 +78,22 @@ public class DeviceKeyController {
@PostMapping("/sale/info/deleterKey") @PostMapping("/sale/info/deleterKey")
public BaseResponse deleterKey(@RequestBody DeleteRequest deleteRequest) { public BaseResponse deleterKey(@RequestBody DeleteRequest deleteRequest) {
deviceKeyService.deleteDeviceKey(deleteRequest); sysPdaKeyService.deleteDeviceKey(deleteRequest);
return ResultVOUtils.success("删除成功"); return ResultVOUtils.success("删除成功");
} }
@PostMapping("sale/device/register") @PostMapping("sale/device/register")
public BaseResponse saveRegister(@RequestBody DeviceKeyEntity deviceKeyEntity, public BaseResponse saveRegister(@RequestBody SysPdaKeyEntity sysPdaKeyEntity,
BindingResult bindingResult) { BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
deviceKeyEntity.setDate(DateUtil.getDateTime()); sysPdaKeyEntity.setDate(DateUtil.getDateTime());
deviceKeyEntity.setIsCheck(0); sysPdaKeyEntity.setIsCheck(0);
deviceKeyService.insertDeviceKey(deviceKeyEntity); sysPdaKeyService.insertDeviceKey(sysPdaKeyEntity);
return ResultVOUtils.success("1"); return ResultVOUtils.success("1");
} }

@ -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<AuthPermission> listByRoleIdIn(List<Long> roleIds);
/**
* roleId
* @param roleId id
* @return
*/
List<AuthPermission> listByRoleId(Long roleId);
/**
*
* @param authPermissionList
* @return
*/
int insertAuthPermissionAll(List<AuthPermission> authPermissionList);
/**
* id
* @param roleId
* @return
*/
boolean deleteByRoleId(Long roleId);
}

@ -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<AuthPermissionRule> listByIdIn(List<Long> ids);
/**
*
* @param map
* @return
*/
List<AuthPermissionRule> listAll();
/**
* pid
* @param pid
* @return
*/
List<AuthPermissionRule> 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);
}

@ -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<AuthRoleAdmin> listByAdminId(Long adminId);
/**
* adminId
* @param adminIds adminIds
* @return
*/
List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
/**
* role_id admin_id
* @param roleId roleId
* @return
*/
List<AuthRoleAdmin> listByRoleId(Long roleId);
/**
*
* @param authRoleAdminList
* @return
*/
int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
/**
* adminId
* @param adminId
* @return
*/
boolean deleteByAdminId(Long adminId);
}

@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest);
/**
* id,name
* @return
*/
List<AuthRole> 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);
}

@ -16,6 +16,8 @@ public interface DeptUserDao {
List<DeptUserResponse> selectJoinDeptUser(DeptUserReqeust deptUserReqeust); List<DeptUserResponse> selectJoinDeptUser(DeptUserReqeust deptUserReqeust);
boolean delete(@Param("deptId") Long deptId, @Param("userId") Long userId);
int deleteById(Integer id); int deleteById(Integer id);
boolean deleteByUser(@Param("userId") Long userId); boolean deleteByUser(@Param("userId") Long userId);

@ -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<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
void insertDeviceKey(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKey(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity);
void deleteDeviceKey(DeleteRequest deleteRequest);
}

@ -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<SysPdaKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
void insertDeviceKey(SysPdaKeyEntity sysPdaKeyEntity);
void updateDeviceKey(SysPdaKeyEntity sysPdaKeyEntity);
void updateDeviceKeyByImei(SysPdaKeyEntity sysPdaKeyEntity);
void deleteDeviceKey(DeleteRequest deleteRequest);
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -3,7 +3,7 @@ package com.glxp.api.entity.system;
import lombok.Data; import lombok.Data;
@Data @Data
public class DeviceKeyEntity { public class SysPdaKeyEntity {
private String id; private String id;
private String imei; private String imei;
private int isCheck; private int isCheck;

@ -1,9 +0,0 @@
package com.glxp.api.service.auth;
import java.util.List;
public interface AuthLoginService {
List<String> listRuleByAdminId(Long adminId);
}

@ -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<AuthPermissionRule> listByIdIn(List<Long> ids);
List<AuthPermissionRule> listByPid(Long pid);
List<AuthPermissionRule> listAll();
boolean insertAuthPermissionRule(AuthPermissionRule authPermissionRule);
boolean updateAuthPermissionRule(AuthPermissionRule authPermissionRule);
boolean deleteById(Long id);
}

@ -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<AuthPermission> listByRoleIdIn(List<Long> roleIds);
List<AuthPermission> listByRoleId(Long roleId);
int insertAuthPermissionAll(List<AuthPermission> authPermissionList);
boolean deleteByRoleId(Long roleId);
}

@ -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<AuthRoleAdmin> listByAdminId(Long adminId);
List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
List<AuthRoleAdmin> listByRoleId(Long roleId);
int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
int insertRolesAdminIdAll(List<Long> roles, Long adminId);
boolean deleteByAdminId(Long adminId);
}

@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest);
List<AuthRole> listAuthAdminRolePage(Integer page, Integer limit, Integer status);
AuthRole findByName(String name);
boolean insertAuthRole(AuthRole authRole);
boolean updateAuthRole(AuthRole authRole);
boolean deleteById(Long id);
}

@ -16,6 +16,8 @@ public interface DeptUserService {
List<DeptUserResponse> selectJoinDeptUser(DeptUserReqeust deptUserReqeust); List<DeptUserResponse> selectJoinDeptUser(DeptUserReqeust deptUserReqeust);
boolean delete(Long deptId, Long userId);
boolean deleteByUser(Long userId); boolean deleteByUser(Long userId);
int deleteById(Integer id); int deleteById(Integer id);

@ -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<DeviceKeyEntity> 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);
}

@ -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<SysPdaKeyEntity> 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);
}

@ -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<String> listRuleByAdminId(Long adminId) {
List<String> 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<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByAdminId(adminId);
List<Long> roleIds = authRoleAdmins.stream().map(AuthRoleAdmin::getRole_id).collect(Collectors.toList());
// 角色授权列表
List<AuthPermission> authPermissions = authPermissionService.listByRoleIdIn(roleIds);
List<Long> permissionRuleIds = authPermissions.stream().map(AuthPermission::getPermissionRuleId).collect(Collectors.toList());
// 获取授权的规则
List<AuthPermissionRule> 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;
}
}

@ -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<AuthPermissionRule> listByIdIn(List<Long> ids) {
if (ids.isEmpty()) {
return Collections.emptyList();
}
return authPermissionRuleDao.listByIdIn(ids);
}
/**
* pid
*
* @param pid
* @return
*/
@Override
public List<AuthPermissionRule> listByPid(Long pid) {
return authPermissionRuleDao.listByPid(pid);
}
/**
*
* @return
*/
@Override
public List<AuthPermissionRule> 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);
}
}

@ -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<AuthPermission> listByRoleIdIn(List<Long> roleIds) {
if (roleIds.isEmpty()) {
return Collections.emptyList();
}
return authPermissionDao.listByRoleIdIn(roleIds);
}
/**
* id
* @param roleId
* @return
*/
@Override
public List<AuthPermission> listByRoleId(Long roleId) {
return authPermissionDao.listByRoleId(roleId);
}
/**
*
* @param authPermissionList
* @return
*/
@Override
public int insertAuthPermissionAll(List<AuthPermission> authPermissionList) {
return authPermissionDao.insertAuthPermissionAll(authPermissionList);
}
/**
* id
* @param roleId
* @return
*/
@Override
public boolean deleteByRoleId(Long roleId) {
return authPermissionDao.deleteByRoleId(roleId);
}
}

@ -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<AuthRoleAdmin> listByAdminId(Long adminId) {
return authRoleAdminDao.listByAdminId(adminId);
}
/**
* adminId
* @param adminIds
* @return
*/
@Override
public List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds) {
if (adminIds.isEmpty()) {
return Collections.emptyList();
}
return authRoleAdminDao.listByAdminIdIn(adminIds);
}
/**
* roleId id
* @param roleId
* @return
*/
@Override
public List<AuthRoleAdmin> listByRoleId(Long roleId) {
return authRoleAdminDao.listByRoleId(roleId);
}
/**
*
* @param authRoleAdminList
* @return
*/
@Override
public int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList) {
if (authRoleAdminList == null || authRoleAdminList.isEmpty()) {
return 0;
}
return authRoleAdminDao.insertAuthRoleAdminAll(authRoleAdminList);
}
/**
* ids adminId
* @param roles
* @param adminId
* @return
*/
@Override
public int insertRolesAdminIdAll(List<Long> roles, Long adminId) {
List<AuthRoleAdmin> 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);
}
}

@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest) {
int offset = (authRoleQueryRequest.getPage() - 1) * authRoleQueryRequest.getLimit();
PageHelper.offsetPage(offset, authRoleQueryRequest.getLimit());
List<AuthRole> list = authRoleDao.listAdminPage(authRoleQueryRequest);
return list;
}
/**
*
* @param page
* @param limit
* @param status
* @return
*/
@Override
public List<AuthRole> 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<AuthRole> 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);
}
}

@ -44,6 +44,11 @@ public class DeptUserServiceImpl implements DeptUserService {
return deptUserDao.selectJoinDeptUser(deptUserReqeust); return deptUserDao.selectJoinDeptUser(deptUserReqeust);
} }
@Override
public boolean delete(Long deptId, Long userId) {
return deptUserDao.delete(deptId, userId);
}
@Override @Override
public boolean deleteByUser(Long userId) { public boolean deleteByUser(Long userId) {
return deptUserDao.deleteByUser(userId); return deptUserDao.deleteByUser(userId);

@ -1,11 +1,11 @@
package com.glxp.api.service.auth.impl; package com.glxp.api.service.auth.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.DeviceKeyDao; import com.glxp.api.dao.auth.SysPdaKeyDao;
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.DeleteRequest;
import com.glxp.api.req.system.FilterDeviceKeyRequest; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -13,51 +13,51 @@ import java.util.Collections;
import java.util.List; import java.util.List;
@Service @Service
public class DeviceKeyServiceImpl implements DeviceKeyService { public class SysPdaKeyServiceImpl implements SysPdaKeyService {
@Resource @Resource
DeviceKeyDao deviceKeyDao; SysPdaKeyDao sysPdaKeyDao;
@Override @Override
public List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) { public List<SysPdaKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) {
if (filterDeviceKeyRequest == null) { if (filterDeviceKeyRequest == null) {
return Collections.emptyList(); return Collections.emptyList();
} }
int offset = (filterDeviceKeyRequest.getPage() - 1) * filterDeviceKeyRequest.getLimit(); int offset = (filterDeviceKeyRequest.getPage() - 1) * filterDeviceKeyRequest.getLimit();
PageHelper.offsetPage(offset, filterDeviceKeyRequest.getLimit()); PageHelper.offsetPage(offset, filterDeviceKeyRequest.getLimit());
return deviceKeyDao.findDeviceKey(filterDeviceKeyRequest); return sysPdaKeyDao.findDeviceKey(filterDeviceKeyRequest);
} }
@Override @Override
public DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) { public SysPdaKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) {
return deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest); return sysPdaKeyDao.findDeviceByImei(filterDeviceKeyRequest);
} }
@Override @Override
public DeviceKeyEntity findDeviceByImei(String imei) { public SysPdaKeyEntity findDeviceByImei(String imei) {
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest(); FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
filterDeviceKeyRequest.setImei(imei); filterDeviceKeyRequest.setImei(imei);
DeviceKeyEntity deviceKeyEntity = deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest); SysPdaKeyEntity sysPdaKeyEntity = sysPdaKeyDao.findDeviceByImei(filterDeviceKeyRequest);
return deviceKeyEntity; return sysPdaKeyEntity;
} }
@Override @Override
public void insertDeviceKey(DeviceKeyEntity deviceKeyEntity) { public void insertDeviceKey(SysPdaKeyEntity sysPdaKeyEntity) {
deviceKeyDao.insertDeviceKey(deviceKeyEntity); sysPdaKeyDao.insertDeviceKey(sysPdaKeyEntity);
} }
@Override @Override
public void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity) { public void updateDeviceKeyByImei(SysPdaKeyEntity sysPdaKeyEntity) {
deviceKeyDao.updateDeviceKeyByImei(deviceKeyEntity); sysPdaKeyDao.updateDeviceKeyByImei(sysPdaKeyEntity);
} }
@Override @Override
public void updateDeviceKey(DeviceKeyEntity deviceKeyEntity) { public void updateDeviceKey(SysPdaKeyEntity sysPdaKeyEntity) {
deviceKeyDao.updateDeviceKey(deviceKeyEntity); sysPdaKeyDao.updateDeviceKey(sysPdaKeyEntity);
} }
@Override @Override
public void deleteDeviceKey(DeleteRequest deleteRequest) { public void deleteDeviceKey(DeleteRequest deleteRequest) {
deviceKeyDao.deleteDeviceKey(deleteRequest); sysPdaKeyDao.deleteDeviceKey(deleteRequest);
} }
} }

@ -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<AuthPermissionRuleMergeResponse> merge(List<AuthPermissionRule> authPermissionRuleList,
Long pid) {
List<AuthPermissionRuleMergeResponse> 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;
}
}

@ -5,7 +5,7 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource 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 username: root
password: 123456 password: 123456
hikari: hikari:

@ -177,8 +177,8 @@
resultType="com.glxp.api.entity.auth.AuthAdmin"> resultType="com.glxp.api.entity.auth.AuthAdmin">
select u.* select u.*
from auth_user u from auth_user u
left join sys_user_role sur on u.id = sur.user_id left join auth_user_role sur on u.id = sur.user_id
left join sys_role r on r.role_id = sur.role_id left join auth_role r on r.role_id = sur.role_id
<where> <where>
<if test="roleId != null and '' != roleId"> <if test="roleId != null and '' != roleId">
AND r.role_id =#{roleId} AND r.role_id =#{roleId}
@ -192,8 +192,8 @@
resultType="com.glxp.api.entity.auth.AuthAdmin"> resultType="com.glxp.api.entity.auth.AuthAdmin">
select u.* select u.*
from auth_user u from auth_user u
left join sys_user_role sur on u.id = sur.user_id left join auth_user_role sur on u.id = sur.user_id
left join sys_role r on r.role_id = sur.role_id left join auth_role r on r.role_id = sur.role_id
<where> <where>
<if test="ids!=null and ids.size()!=0"> <if test="ids!=null and ids.size()!=0">
u.id not in u.id not in

@ -6,7 +6,7 @@
<select id="filterDevices" parameterType="com.glxp.api.req.auth.AuthCheckRequest" <select id="filterDevices" parameterType="com.glxp.api.req.auth.AuthCheckRequest"
resultType="com.glxp.api.entity.auth.AuthCheckEntity"> resultType="com.glxp.api.entity.auth.AuthCheckEntity">
SELECT * SELECT *
FROM auth_device_check FROM sys_device_check
<where> <where>
<if test="machineInfo != null"> <if test="machineInfo != null">
AND machineInfo = #{machineInfo} AND machineInfo = #{machineInfo}
@ -24,7 +24,7 @@
<select id="findByMachine" parameterType="hashmap" resultType="com.glxp.api.entity.auth.AuthCheckEntity"> <select id="findByMachine" parameterType="hashmap" resultType="com.glxp.api.entity.auth.AuthCheckEntity">
SELECT * SELECT *
FROM auth_device_check FROM sys_device_check
<where> <where>
machineInfo = #{machineInfo} machineInfo = #{machineInfo}
</where> </where>
@ -33,7 +33,7 @@
<insert id="insertDevices" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthCheckEntity"> <insert id="insertDevices" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthCheckEntity">
INSERT INTO auth_device_check INSERT INTO sys_device_check
(machineInfo, remark, registerCode, createDate) (machineInfo, remark, registerCode, createDate)
values (#{machineInfo}, values (#{machineInfo},
#{remark}, #{remark},
@ -41,7 +41,7 @@
</insert> </insert>
<update id="updateDevices" parameterType="com.glxp.api.entity.auth.AuthCheckEntity"> <update id="updateDevices" parameterType="com.glxp.api.entity.auth.AuthCheckEntity">
UPDATE auth_device_check UPDATE sys_device_check
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="remark != null">remark=#{remark},</if> <if test="remark != null">remark=#{remark},</if>
<if test="registerCode != null">registerCode=#{registerCode},</if> <if test="registerCode != null">registerCode=#{registerCode},</if>

@ -1,38 +0,0 @@
<?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.glxp.api.dao.auth.AuthPermissionDao" >
<select id="listByRoleIdIn" resultType="com.glxp.api.entity.auth.AuthPermission">
SELECT permissionRuleId
FROM auth_permission
where roleId IN
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="listByRoleId" resultType="com.glxp.api.entity.auth.AuthPermission">
SELECT permissionRuleId
FROM auth_permission
where roleId = #{roleId}
</select>
<insert id="insertAuthPermissionAll">
INSERT INTO auth_permission
(roleId, permissionRuleId,`type`)
VALUES
<foreach collection="list" item="item" separator=",">
<if test="item.roleId != null and item.permissionRuleId != null and item.type != null">
(#{item.roleId}, #{item.permissionRuleId}, #{item.type})
</if>
</foreach>
</insert>
<delete id="deleteByRoleId" parameterType="java.lang.Long">
delete from auth_permission where roleId = #{roleId}
</delete>
</mapper>

@ -1,71 +0,0 @@
<?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.glxp.api.dao.auth.AuthPermissionRuleDao" >
<select id="listByIdIn" resultType="com.glxp.api.entity.auth.AuthPermissionRule">
SELECT `name`
FROM auth_permission_rule
where id IN
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="listByPid" resultType="com.glxp.api.entity.auth.AuthPermissionRule">
SELECT `id`,`pid`,`name`,`title`,`status`,`condition`,`listorder`
FROM auth_permission_rule
where pid = #{pid}
</select>
<select id="listAll" resultType="com.glxp.api.entity.auth.AuthPermissionRule">
SELECT `id`,`pid`,`name`,`title`,`status`,`condition`,`listorder`
FROM auth_permission_rule
</select>
<select id="findByName" resultType="com.glxp.api.entity.auth.AuthPermissionRule">
SELECT `id`
FROM auth_permission_rule
where `name` = #{name}
limit 1
</select>
<insert id="insertAuthPermissionRule" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthPermissionRule">
INSERT INTO auth_permission_rule(pid,`name`,`title`,`status`,`condition`,`listorder`,create_time,update_time)
values
(#{pid},
#{name},
#{title},
#{status},
<choose>
<when test="condition != null">
#{condition},
</when>
<otherwise>
'',
</otherwise>
</choose>
#{listorder},
#{createTime},
#{updateTime})
</insert>
<update id="updateAuthPermissionRule" parameterType="com.glxp.api.entity.auth.AuthPermissionRule">
UPDATE auth_permission_rule
<set>
<if test="pid != null">pid=#{pid},</if>
<if test="name != null">`name`=#{name},</if>
<if test="title != null">title=#{title},</if>
<if test="status != null">`status`=#{status},</if>
<if test="condition != null">`condition`=#{condition},</if>
<if test="listorder != null">`listorder`=#{listorder},</if>
<if test="updateTime != null">update_time=#{updateTime},</if>
</set>
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
delete from auth_permission_rule where id = #{id}
</delete>
</mapper>

@ -1,42 +0,0 @@
<?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.glxp.api.dao.auth.AuthRoleAdminDao">
<select id="listByAdminId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
SELECT role_id
FROM auth_role_admin
where admin_id = #{adminId}
</select>
<select id="listByAdminIdIn" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
SELECT *
FROM auth_role_admin
where admin_id in
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="listByRoleId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
SELECT admin_id
FROM auth_role_admin
where role_id = #{roleId}
</select>
<insert id="insertAuthRoleAdminAll">
INSERT INTO auth_role_admin
(role_id, admin_id)
VALUES
<foreach collection="list" item="item" separator=",">
<if test="item.role_id != null and item.admin_id != null">
(#{item.role_id}, #{item.admin_id})
</if>
</foreach>
</insert>
<delete id="deleteByAdminId" parameterType="java.lang.Long">
delete from auth_role_admin where admin_id = #{adminId}
</delete>
</mapper>

@ -1,89 +0,0 @@
<?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.glxp.api.dao.auth.AuthRoleDao">
<select id="listAdminPage" parameterType="com.glxp.api.req.auth.AuthRoleQueryRequest"
resultType="com.glxp.api.entity.auth.AuthRole">
SELECT id,name,status,remark,create_time,listorder
FROM auth_role
<where>
<if test="status != null">
AND status = #{status}
</if>
<if test="name != null and '' != name">
AND `name` LIKE CONCAT(#{name},'%')
</if>
</where>
</select>
<select id="listAuthAdminRolePage" resultType="com.glxp.api.entity.auth.AuthRole">
SELECT id,name
FROM auth_role
<where>
<if test="status != null">
AND status = #{status}
</if>
</where>
</select>
<select id="findByName" resultType="com.glxp.api.entity.auth.AuthRole">
SELECT id
FROM auth_role
where `name` = #{name}
</select>
<insert id="insertAuthRole" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthRole">
INSERT INTO auth_role(`name`,pid,`status`,`remark`,`listorder`,create_time,update_time)
values
(
#{name},
<choose>
<when test="pid != null">
#{pid},
</when>
<otherwise>
0,
</otherwise>
</choose>
#{status},
<choose>
<when test="remark != null">
#{remark},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="listorder != null">
#{listorder},
</when>
<otherwise>
999,
</otherwise>
</choose>
#{createTime},
#{updateTime}
)
</insert>
<update id="updateAuthRole" parameterType="com.glxp.api.entity.auth.AuthRole">
UPDATE auth_role
<set>
<if test="name != null">`name`=#{name},</if>
<if test="pid != null">pid=#{pid},</if>
<if test="status != null">`status`=#{status},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="listorder != null">`listorder`=#{listorder},</if>
<if test="updateTime != null">update_time=#{updateTime},</if>
</set>
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
delete from auth_role where id = #{id}
</delete>
</mapper>

@ -5,8 +5,8 @@
<select id="filterInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.DeptEntity"> resultType="com.glxp.api.entity.auth.DeptEntity">
select * ,(select name from inv_warehouse WHERE a.pcode = code) pName select * ,(select name from auth_dept WHERE a.pcode = code) pName
FROM inv_warehouse a FROM auth_dept a
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND a.id = #{id} AND a.id = #{id}
@ -45,9 +45,9 @@
<select id="filterAllByUser" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterAllByUser" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.DeptEntity"> resultType="com.glxp.api.entity.auth.DeptEntity">
select inv_warehouse.* from inv_warehouse INNER JOIN inv_warehouse_sub select auth_dept.* from auth_dept INNER JOIN auth_warehouse
on inv_warehouse.`code` =inv_warehouse_sub.parentId on auth_dept.`code` =auth_warehouse.parentId
INNER JOIN inv_warehouse_user on inv_warehouse_user.`code` = inv_warehouse_sub.code INNER JOIN auth_warehouse_user on auth_warehouse_user.`code` = auth_warehouse.code
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND id = #{id} AND id = #{id}
@ -56,7 +56,7 @@
AND pid = #{pid} AND pid = #{pid}
</if> </if>
<if test="code != '' and code != null"> <if test="code != '' and code != null">
AND inv_warehouse.code = #{code} AND auth_dept.code = #{code}
</if> </if>
<if test="name != '' and name != null"> <if test="name != '' and name != null">
AND name = #{name} AND name = #{name}
@ -71,7 +71,7 @@
AND pcode = #{pcode} AND pcode = #{pcode}
</if> </if>
<if test="userId != null"> <if test="userId != null">
AND inv_warehouse_user.userId = #{userId} AND auth_warehouse_user.userId = #{userId}
</if> </if>
<if test="level != null"> <if test="level != null">
@ -81,7 +81,7 @@
AND spUse = #{spUse} AND spUse = #{spUse}
</if> </if>
</where> </where>
group by inv_warehouse.code group by auth_dept.code
</select> </select>
@ -89,14 +89,14 @@
<select id="selectById" parameterType="Map" <select id="selectById" parameterType="Map"
resultType="com.glxp.api.entity.auth.DeptEntity"> resultType="com.glxp.api.entity.auth.DeptEntity">
SELECT * SELECT *
FROM inv_warehouse FROM auth_dept
WHERE id = #{id} WHERE id = #{id}
</select> </select>
<select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.DeptEntity"> resultType="com.glxp.api.entity.auth.DeptEntity">
select max(code) as code from inv_warehouse select max(code) as code from auth_dept
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND id = #{id} AND id = #{id}
@ -129,7 +129,7 @@
<select id="filterGroupInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterGroupInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.DeptEntity"> resultType="com.glxp.api.entity.auth.DeptEntity">
SELECT * FROM inv_warehouse SELECT * FROM auth_dept
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND id = #{id} AND id = #{id}
@ -169,13 +169,13 @@
</select> </select>
<select id="getNameByCode" resultType="java.lang.String"> <select id="getNameByCode" resultType="java.lang.String">
select name select name
from inv_warehouse from auth_dept
where code = #{fromCorpId} where code = #{fromCorpId}
</select> </select>
<insert id="insertInvWarehouse" keyProperty="id" <insert id="insertInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.auth.DeptEntity"> parameterType="com.glxp.api.entity.auth.DeptEntity">
replace replace
INTO inv_warehouse INTO auth_dept
(pid, code, `name`, advanceType, isDefault, (pid, code, `name`, advanceType, isDefault,
status, updateTime, remark,`level`,pcode,spUse, thirdId, thirdId1, thirdId2, thirdId3, thirdId4) status, updateTime, remark,`level`,pcode,spUse, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
values ( values (
@ -201,12 +201,12 @@
<delete id="deleteById" parameterType="Map"> <delete id="deleteById" parameterType="Map">
DELETE DELETE
FROM inv_warehouse FROM auth_dept
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>
<update id="updateInvWarehouse" parameterType="com.glxp.api.entity.auth.DeptEntity"> <update id="updateInvWarehouse" parameterType="com.glxp.api.entity.auth.DeptEntity">
UPDATE inv_warehouse UPDATE auth_dept
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="pid != null">pid=#{pid},</if> <if test="pid != null">pid=#{pid},</if>
<if test="name != null">name=#{name},</if> <if test="name != null">name=#{name},</if>
@ -231,7 +231,7 @@
</update> </update>
<insert id="importInvWarehouse" parameterType="java.util.List"> <insert id="importInvWarehouse" parameterType="java.util.List">
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, updateTime, remark, `level`, pcode, thirdId, thirdId1, thirdId2, thirdId3,
thirdId4,spUse) values thirdId4,spUse) values
<foreach collection="invWarehouseEntities" item="item" index="index" separator=","> <foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
@ -251,13 +251,13 @@
</insert> </insert>
<update id="updateThridId" parameterType="Map"> <update id="updateThridId" parameterType="Map">
update inv_warehouse update auth_dept
set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR} set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR}
where id = #{id} where id = #{id}
</update> </update>
<update id="updateTime" parameterType="Map"> <update id="updateTime" parameterType="Map">
update inv_warehouse update auth_dept
SET updateTime = #{updateTime} SET updateTime = #{updateTime}
where code = #{code} where code = #{code}
</update> </update>
@ -265,13 +265,13 @@
<select id="selectByThirdSys" resultType="com.glxp.api.entity.auth.DeptEntity"> <select id="selectByThirdSys" resultType="com.glxp.api.entity.auth.DeptEntity">
select * select *
from inv_warehouse from auth_dept
where ${thirdIdSys} = #{thirdId} where ${thirdIdSys} = #{thirdId}
</select> </select>
<select id="selectByCodeAll" resultType="com.glxp.api.entity.auth.DeptEntity"> <select id="selectByCodeAll" resultType="com.glxp.api.entity.auth.DeptEntity">
select * select *
from inv_warehouse from auth_dept
where code = #{code} where code = #{code}
</select> </select>
</mapper> </mapper>

@ -22,10 +22,10 @@
<select id="selectJoinDeptUser" parameterType="com.glxp.api.req.auth.DeptUserReqeust" <select id="selectJoinDeptUser" parameterType="com.glxp.api.req.auth.DeptUserReqeust"
resultType="com.glxp.api.res.auth.DeptUserResponse"> resultType="com.glxp.api.res.auth.DeptUserResponse">
SELECT auth_dept_user.*,auth_user.userName,auth_user.employeeName,inv_warehouse.`name` deptName SELECT auth_dept_user.*,auth_user.userName,auth_user.employeeName,auth_dept.`name` deptName
FROM auth_dept_user INNER JOIN auth_user FROM auth_dept_user INNER JOIN auth_user
on auth_dept_user.userId = auth_user.id on auth_dept_user.userId = auth_user.id
INNER JOIN inv_warehouse on auth_dept_user.deptId = inv_warehouse.id INNER JOIN auth_dept on auth_dept_user.deptId = auth_dept.id
<where> <where>
<if test="deptId != null "> <if test="deptId != null ">
and deptId = #{deptId} and deptId = #{deptId}
@ -48,6 +48,12 @@
from auth_dept_user from auth_dept_user
where userId = #{userId} where userId = #{userId}
</delete> </delete>
<delete id="delete" parameterType="java.lang.Long">
delete
from auth_dept_user
where userId = #{userId}
and deptId = #{deptId}
</delete>
<delete id="deleteByList" parameterType="java.util.List" <delete id="deleteByList" parameterType="java.util.List"
> >

@ -34,19 +34,19 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from inv_space from auth_space
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete delete
from inv_space from auth_space
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace" <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace"
useGeneratedKeys="true"> useGeneratedKeys="true">
insert into inv_space (code, `name`, type, invStorageCode, insert into auth_space (code, `name`, type, invStorageCode,
invWarehouseCode, `status`, createTime, invWarehouseCode, `status`, createTime,
updateTime, `createUser`, updateUser, updateTime, `createUser`, updateUser,
remark) remark)
@ -59,7 +59,7 @@
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.InvSpace" useGeneratedKeys="true"> parameterType="com.glxp.api.entity.auth.InvSpace" useGeneratedKeys="true">
insert into inv_space insert into auth_space
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null"> <if test="code != null">
code, code,
@ -133,7 +133,7 @@
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.InvSpace"> <update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.InvSpace">
update inv_space update auth_space
<set> <set>
<if test="code != null"> <if test="code != null">
code = #{code,jdbcType=VARCHAR}, code = #{code,jdbcType=VARCHAR},
@ -173,7 +173,7 @@
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.InvSpace"> <update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.InvSpace">
update inv_space update auth_space
set code = #{code,jdbcType=VARCHAR}, set code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR},
@ -189,7 +189,7 @@
</update> </update>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
update inv_space update auth_space
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="code = case" suffix="end,"> <trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
@ -254,7 +254,7 @@
</update> </update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true"> <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into inv_space insert into auth_space
(code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime,
`createUser`, updateUser, remark) `createUser`, updateUser, remark)
values values
@ -273,9 +273,9 @@
select s.*, select s.*,
w.name invStorageName, w.name invStorageName,
iws.name invSubStorageName iws.name invSubStorageName
from inv_space s from auth_space s
left join inv_warehouse w on s.invStorageCode = w.code left join auth_dept w on s.invStorageCode = w.code
left join inv_warehouse_sub iws on s.invWarehouseCode = iws.code left join auth_warehouse iws on s.invWarehouseCode = iws.code
<where> <where>
<if test="invStorageCode != null and invStorageCode != ''"> <if test="invStorageCode != null and invStorageCode != ''">
AND s.invStorageCode = #{invStorageCode} AND s.invStorageCode = #{invStorageCode}
@ -295,7 +295,7 @@
<select id="selectList" resultMap="BaseResultMap"> <select id="selectList" resultMap="BaseResultMap">
select * select *
from inv_space from auth_space
<where> <where>
<if test="invStorageCode != null and invStorageCode != ''"> <if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode} AND invStorageCode = #{invStorageCode}
@ -316,26 +316,26 @@
</select> </select>
<select id="selectSpaceCodeList" resultType="com.glxp.api.res.auth.InvSpaceResponse"> <select id="selectSpaceCodeList" resultType="com.glxp.api.res.auth.InvSpaceResponse">
select inv_space.code, inv_space.name, iws.name invSubStorageName, iw.name invStorageName select auth_space.code, auth_space.name, iws.name invSubStorageName, iw.name invStorageName
from inv_space from auth_space
left join inv_warehouse_sub iws on iws.code = inv_space.invWarehouseCode left join auth_warehouse iws on iws.code = auth_space.invWarehouseCode
left join inv_warehouse iw on iw.code = inv_space.invStorageCode left join auth_dept iw on iw.code = auth_space.invStorageCode
<where> <where>
<if test="invStorageCode != null and invStorageCode != ''"> <if test="invStorageCode != null and invStorageCode != ''">
AND inv_space.invStorageCode = #{invStorageCode} AND auth_space.invStorageCode = #{invStorageCode}
</if> </if>
<if test="invWarehouseCode != null and invWarehouseCode != ''"> <if test="invWarehouseCode != null and invWarehouseCode != ''">
AND inv_space.invWarehouseCode = #{invWarehouseCode} AND auth_space.invWarehouseCode = #{invWarehouseCode}
</if> </if>
<if test="status != null"> <if test="status != null">
AND inv_space.status = #{status} AND auth_space.status = #{status}
</if> </if>
</where> </where>
</select> </select>
<select id="selectNameByCode" resultType="java.lang.String"> <select id="selectNameByCode" resultType="java.lang.String">
select name select name
from inv_space from auth_space
where invStorageCode = #{invStorageCode} where invStorageCode = #{invStorageCode}
and invWarehouseCode = #{invWarehouseCode} and invWarehouseCode = #{invWarehouseCode}
and code = #{code} and code = #{code}
@ -343,13 +343,13 @@
<select id="selectByWarehouseCode" resultMap="BaseResultMap"> <select id="selectByWarehouseCode" resultMap="BaseResultMap">
select * select *
from inv_space from auth_space
where invWarehouseCode = #{warehouseCode} where invWarehouseCode = #{warehouseCode}
</select> </select>
<select id="selectExist" resultMap="BaseResultMap"> <select id="selectExist" resultMap="BaseResultMap">
select * select *
from inv_space from auth_space
<where> <where>
<if test="invStorageCode != null and invStorageCode != ''"> <if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode} AND invStorageCode = #{invStorageCode}
@ -369,7 +369,7 @@
<select id="selectByInvCode" resultMap="BaseResultMap"> <select id="selectByInvCode" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from inv_space from auth_space
<where> <where>
<if test="invStorageCode != null and invStorageCode != ''"> <if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode} AND invStorageCode = #{invStorageCode}

@ -6,7 +6,7 @@
<select id="filterInvSubWarehouse" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest" <select id="filterInvSubWarehouse" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select * select *
FROM inv_warehouse_sub a FROM auth_warehouse a
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND a.id = #{id} AND a.id = #{id}
@ -30,23 +30,23 @@
<select id="selectJoinThirdSys" parameterType="Map" <select id="selectJoinThirdSys" parameterType="Map"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
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 thirdName4
from inv_warehouse_sub from auth_warehouse
LEFT JOIN thr_inv_warehouse_sub a on a.code = inv_warehouse_sub.thirdId LEFT JOIN thr_inv_warehouse_sub a on a.code = auth_warehouse.thirdId
LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = inv_warehouse_sub.thirdId1 LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = auth_warehouse.thirdId1
LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = inv_warehouse_sub.thirdId2 LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = auth_warehouse.thirdId2
LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = inv_warehouse_sub.thirdId3 LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = auth_warehouse.thirdId3
LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = inv_warehouse_sub.thirdId4 LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = auth_warehouse.thirdId4
<where> <where>
<if test="code != '' and code != null"> <if test="code != '' and code != null">
AND inv_warehouse_sub.code = #{code} AND auth_warehouse.code = #{code}
</if> </if>
<if test="name != '' and name != null"> <if test="name != '' and name != null">
AND inv_warehouse_sub.`name` = #{name} AND auth_warehouse.`name` = #{name}
</if> </if>
<if test="parentId != '' and parentId != null"> <if test="parentId != '' and parentId != null">
AND inv_warehouse_sub.parentId = #{parentId} AND auth_warehouse.parentId = #{parentId}
</if> </if>
</where> </where>
limit 1 limit 1
@ -54,51 +54,51 @@
<select id="filterGroupInvSub" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterGroupInvSub" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select inv_warehouse_sub.*, inv_warehouse.`name` AS warehouseName from inv_warehouse_sub INNER JOIN select auth_warehouse.*, auth_dept.`name` AS warehouseName from auth_warehouse INNER JOIN
inv_warehouse auth_dept
on inv_warehouse_sub.parentId = inv_warehouse.code on auth_warehouse.parentId = auth_dept.code
<if test="userId != '' and userId != null"> <if test="userId != '' and userId != null">
INNER JOIN inv_warehouse_user on inv_warehouse_sub.code = inv_warehouse_user.code INNER JOIN auth_warehouse_user on auth_warehouse.code = auth_warehouse_user.code
</if> </if>
<where> <where>
<if test="userId != '' and userId != null"> <if test="userId != '' and userId != null">
AND inv_warehouse_user.userId = #{userId} AND auth_warehouse_user.userId = #{userId}
</if> </if>
<if test="pcode != '' and pcode != null"> <if test="pcode != '' and pcode != null">
AND inv_warehouse.code = #{pcode} AND auth_dept.code = #{pcode}
</if> </if>
<if test="warehouseCode != '' and warehouseCode != null"> <if test="warehouseCode != '' and warehouseCode != null">
AND inv_warehouse.code &lt;&gt; #{warehouseCode} AND auth_dept.code &lt;&gt; #{warehouseCode}
</if> </if>
<if test="spUse != '' and spUse != null"> <if test="spUse != '' and spUse != null">
AND inv_warehouse.spUse = #{spUse} AND auth_dept.spUse = #{spUse}
</if> </if>
<if test="superiorCode != '' and superiorCode != null"> <if test="superiorCode != '' and superiorCode != null">
AND (inv_warehouse.code = #{superiorPcode} AND (auth_dept.code = #{superiorPcode}
OR inv_warehouse.pcode = #{superiorCode}) OR auth_dept.pcode = #{superiorCode})
</if> </if>
<if test="subordinateCode != '' and subordinateCode != null"> <if test="subordinateCode != '' and subordinateCode != null">
AND inv_warehouse.pcode = #{subordinateCode} AND auth_dept.pcode = #{subordinateCode}
</if> </if>
</where> </where>
group by inv_warehouse_sub.id group by auth_warehouse.id
</select> </select>
<select id="filterGroupInvSubAndcode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterGroupInvSubAndcode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select inv_warehouse_sub.* from inv_warehouse_sub select auth_warehouse.* from auth_warehouse
<where> <where>
<if test="code != '' and code != null"> <if test="code != '' and code != null">
AND inv_warehouse_sub.code = #{code} AND auth_warehouse.code = #{code}
</if> </if>
</where> </where>
group by inv_warehouse_sub.id group by auth_warehouse.id
</select> </select>
<select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest" <select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select max(code) as code from inv_warehouse_sub select max(code) as code from auth_warehouse
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND id = #{id} AND id = #{id}
@ -120,7 +120,7 @@
<insert id="insertInvSubWarehouse" keyProperty="id" <insert id="insertInvSubWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.auth.InvWarehouseEntity"> parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
replace replace
INTO inv_warehouse_sub INTO auth_warehouse
(id, code, `name`, parentId, remark,defaultInv,parentCode) (id, code, `name`, parentId, remark,defaultInv,parentCode)
values ( values (
#{id}, #{id},
@ -136,19 +136,19 @@
<delete id="deleteById" parameterType="Map"> <delete id="deleteById" parameterType="Map">
DELETE DELETE
FROM inv_warehouse_sub FROM auth_warehouse
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>
<delete id="deleteByParentCode" parameterType="Map"> <delete id="deleteByParentCode" parameterType="Map">
DELETE DELETE
FROM inv_warehouse_sub FROM auth_warehouse
WHERE parentId = #{code} WHERE parentId = #{code}
</delete> </delete>
<update id="updateInvSubWarehouse" parameterType="com.glxp.api.entity.auth.InvWarehouseEntity"> <update id="updateInvSubWarehouse" parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
UPDATE inv_warehouse_sub UPDATE auth_warehouse
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="name != null">name=#{name},</if> <if test="name != null">name=#{name},</if>
<if test="code != null">code=#{code},</if> <if test="code != null">code=#{code},</if>
@ -161,7 +161,7 @@
</update> </update>
<insert id="importInvSubWarehouse" parameterType="java.util.List"> <insert id="importInvSubWarehouse" parameterType="java.util.List">
replace into inv_warehouse_sub replace into auth_warehouse
(id, code, `name`, parentId, remark,defaultInv,parentCode) (id, code, `name`, parentId, remark,defaultInv,parentCode)
values values
<foreach collection="invWarehouseEntities" item="item" index="index" separator=","> <foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
@ -176,19 +176,19 @@
<select id="countByParentIdAndName" resultType="int"> <select id="countByParentIdAndName" resultType="int">
select count(*) select count(*)
from inv_warehouse_sub from auth_warehouse
where parentId = #{parentId} where parentId = #{parentId}
and name = #{name} and name = #{name}
</select> </select>
<select id="selectNameByCode" resultType="java.lang.String"> <select id="selectNameByCode" resultType="java.lang.String">
select name select name
from inv_warehouse_sub from auth_warehouse
where code = #{code} where code = #{code}
</select> </select>
<update id="updateThridId" parameterType="Map"> <update id="updateThridId" parameterType="Map">
update inv_warehouse_sub update auth_warehouse
set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR} set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR}
where id = #{id} where id = #{id}
</update> </update>
@ -197,9 +197,9 @@
resultType="com.glxp.api.res.auth.InvSubWarehouseResponse"> 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, 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 a.thirdId3, a.thirdId4, b.name as parentName,a.parentCode,c.name parentInvName
FROM inv_warehouse_sub a FROM auth_warehouse a
left join inv_warehouse b on a.parentId = b.code left join auth_dept b on a.parentId = b.code
left join inv_warehouse_sub c on a.parentCode = c.code left join auth_warehouse c on a.parentCode = c.code
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND a.id = #{id} AND a.id = #{id}
@ -221,16 +221,16 @@
<select id="filterGroupInvSubDown" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest" <select id="filterGroupInvSubDown" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity"> resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select inv_warehouse_sub.*, inv_warehouse.`name` AS warehouseName from inv_warehouse_sub INNER JOIN select auth_warehouse.*, auth_dept.`name` AS warehouseName from auth_warehouse INNER JOIN
inv_warehouse auth_dept
on inv_warehouse_sub.parentId = inv_warehouse.code on auth_warehouse.parentId = auth_dept.code
<where> <where>
<if test="subordinateCode != '' and subordinateCode != null"> <if test="subordinateCode != '' and subordinateCode != null">
AND inv_warehouse.pcode = #{subordinateCode} AND auth_dept.pcode = #{subordinateCode}
</if> </if>
</where> </where>
group by inv_warehouse_sub.id group by auth_warehouse.id
</select> </select>
@ -247,9 +247,9 @@
a.thirdId3, a.thirdId3,
a.thirdId4, a.thirdId4,
b.name parentName,a.parentCode b.name parentName,a.parentCode
from inv_warehouse_sub a from auth_warehouse a
left join inv_warehouse b on a.parentId = b.code left join auth_dept b on a.parentId = b.code
left join inv_warehouse_user c on a.code = c.code left join auth_warehouse_user c on a.code = c.code
<where> <where>
<if test="userId != null"> <if test="userId != null">
AND c.userId = #{userId} AND c.userId = #{userId}

@ -31,15 +31,15 @@
<select id="selectById" parameterType="java.lang.Long" <select id="selectById" parameterType="java.lang.Long"
resultMap="SysMenuResult"> resultMap="SysMenuResult">
select * select *
FROM sys_menu FROM auth_menu
WHERE menu_id = #{id} WHERE menu_id = #{id}
</select> </select>
<insert id="insert" keyProperty="id" parameterType="com.glxp.api.entity.auth.SysMenu"> <insert id="insert" keyProperty="id" parameterType="com.glxp.api.entity.auth.SysMenu">
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, , 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}, values (#{menuId},
#{menuName}, #{parentId}, #{menuName}, #{parentId},
#{orderNum}, #{path}, #{component}, #{queryParam}, #{isFrame}, #{isCache} #{orderNum}, #{path}, #{component}, #{queryParam}, #{isFrame}, #{isCache}
@ -48,7 +48,7 @@
</insert> </insert>
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysMenu"> <update id="updateById" parameterType="com.glxp.api.entity.auth.SysMenu">
UPDATE sys_menu UPDATE auth_menu
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="menuName != null">`menu_name`=#{menuName},</if> <if test="menuName != null">`menu_name`=#{menuName},</if>
<if test="parentId != null">`parent_id`=#{parentId},</if> <if test="parentId != null">`parent_id`=#{parentId},</if>
@ -75,7 +75,7 @@
<delete id="deleteById" parameterType="java.lang.Long"> <delete id="deleteById" parameterType="java.lang.Long">
delete delete
from sys_menu from auth_menu
where menu_id = #{id} where menu_id = #{id}
</delete> </delete>
@ -83,7 +83,7 @@
resultMap="SysMenuResult"> resultMap="SysMenuResult">
select * select *
FROM sys_menu FROM auth_menu
order by order_num order by order_num
</select> </select>
@ -91,7 +91,7 @@
<select id="selectMenuList" parameterType="com.glxp.api.req.auth.SysMenuRequest" <select id="selectMenuList" parameterType="com.glxp.api.req.auth.SysMenuRequest"
resultMap="SysMenuResult"> resultMap="SysMenuResult">
select * select *
FROM sys_menu FROM auth_menu
<where> <where>
<if test="menuId != null "> <if test="menuId != null ">
and menu_id = #{menuId} and menu_id = #{menuId}
@ -133,10 +133,10 @@
m.icon, m.icon,
m.order_num, m.order_num,
m.create_time m.create_time
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role sur on rm.role_id = sur.role_id left join auth_user_role sur on rm.role_id = sur.role_id
left join sys_role ro on sur.role_id = ro.role_id left join auth_role ro on sur.role_id = ro.role_id
</select> </select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult"> <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
@ -155,10 +155,10 @@
m.icon, m.icon,
m.order_num, m.order_num,
m.create_time m.create_time
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role sur on rm.role_id = sur.role_id left join auth_user_role sur on rm.role_id = sur.role_id
left join sys_role ro on sur.role_id = ro.role_id left join auth_role ro on sur.role_id = ro.role_id
left join auth_user u on sur.user_id = u.id left join auth_user u on sur.user_id = u.id
where u.id = #{userId} where u.id = #{userId}
and m.menu_type in ('M', 'C') and m.menu_type in ('M', 'C')
@ -169,11 +169,11 @@
<select id="selectMenuListByRoleId" resultType="Long"> <select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id select m.menu_id
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId} where rm.role_id = #{roleId}
<if test="menuCheckStrictly"> <if test="menuCheckStrictly">
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}) rm.menu_id and rm.role_id = #{roleId})
</if> </if>
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
@ -181,17 +181,17 @@
<select id="selectMenuPerms" resultType="String"> <select id="selectMenuPerms" resultType="String">
select distinct m.perms select distinct m.perms
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role sur on rm.role_id = sur.role_id left join auth_user_role sur on rm.role_id = sur.role_id
</select> </select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String"> <select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms select distinct m.perms
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role sur on rm.role_id = sur.role_id left join auth_user_role sur on rm.role_id = sur.role_id
left join sys_role r on r.role_id = sur.role_id left join auth_role r on r.role_id = sur.role_id
where m.status = '0' where m.status = '0'
and r.status = '0' and r.status = '0'
and sur.user_id = #{userId} and sur.user_id = #{userId}
@ -199,8 +199,8 @@
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String"> <select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms select distinct m.perms
from sys_menu m from auth_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join auth_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' where m.status = '0'
and rm.role_id = #{roleId} and rm.role_id = #{roleId}
</select> </select>

@ -23,7 +23,7 @@
<insert id="insert" keyProperty="roleId" useGeneratedKeys="true" <insert id="insert" keyProperty="roleId" useGeneratedKeys="true"
parameterType="com.glxp.api.entity.auth.SysRole"> parameterType="com.glxp.api.entity.auth.SysRole">
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, , menu_check_strictly, dept_check_strictly, status, del_flag, remark,
create_by, create_time, update_by) create_by, create_time, update_by)
values (#{roleName}, values (#{roleName},
@ -33,7 +33,7 @@
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole"> <update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole">
UPDATE sys_role UPDATE auth_role
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="roleName != null">`role_name`=#{roleName},</if> <if test="roleName != null">`role_name`=#{roleName},</if>
<if test="roleKey != null">`role_key`=#{roleKey},</if> <if test="roleKey != null">`role_key`=#{roleKey},</if>
@ -55,7 +55,7 @@
<delete id="deleteBatchIds" parameterType="java.util.List" <delete id="deleteBatchIds" parameterType="java.util.List"
> >
delete delete
from sys_role from auth_role
where role_id in where role_id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item} #{item}
@ -66,7 +66,7 @@
<delete id="deleteById" parameterType="java.lang.Long"> <delete id="deleteById" parameterType="java.lang.Long">
delete delete
from sys_role from auth_role
where role_id = #{id} where role_id = #{id}
</delete> </delete>
@ -74,7 +74,7 @@
<select id="selectById" parameterType="java.lang.Long" <select id="selectById" parameterType="java.lang.Long"
resultMap="SysRoleResult"> resultMap="SysRoleResult">
select * select *
FROM sys_role FROM auth_role
WHERE role_id = #{id} WHERE role_id = #{id}
</select> </select>
@ -90,8 +90,8 @@
r.del_flag, r.del_flag,
r.create_time, r.create_time,
r.remark r.remark
from sys_role r from auth_role r
left join sys_user_role sur on sur.role_id = r.role_id left join auth_user_role sur on sur.role_id = r.role_id
left join auth_user u on u.id = sur.user_id left join auth_user u on u.id = sur.user_id
</sql> </sql>
@ -99,7 +99,7 @@
<select id="selectRoleList" parameterType="com.glxp.api.req.auth.SysRoleRequest" <select id="selectRoleList" parameterType="com.glxp.api.req.auth.SysRoleRequest"
resultMap="SysRoleResult"> resultMap="SysRoleResult">
SELECT * SELECT *
FROM sys_role FROM auth_role
<where> <where>
<if test="roleId != null "> <if test="roleId != null ">
and role_id = #{roleId} and role_id = #{roleId}
@ -139,16 +139,16 @@
r.del_flag, r.del_flag,
r.create_time, r.create_time,
r.remark r.remark
from sys_role r from auth_role r
left join sys_user_role sur on sur.role_id = r.role_id left join auth_user_role sur on sur.role_id = r.role_id
left join auth_user u on u.id = sur.user_id left join auth_user u on u.id = sur.user_id
WHERE sur.user_id = #{userId} WHERE sur.user_id = #{userId}
</select> </select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long"> <select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id select r.role_id
from sys_role r from auth_role r
left join sys_user_role sur on sur.role_id = r.role_id left join auth_user_role sur on sur.role_id = r.role_id
left join auth_user u on u.id = sur.user_id left join auth_user u on u.id = sur.user_id
where u.id = #{userId} where u.id = #{userId}
</select> </select>
@ -166,8 +166,8 @@
r.del_flag, r.del_flag,
r.create_time, r.create_time,
r.remark r.remark
from sys_role r from auth_role r
left join sys_user_role sur on sur.role_id = r.role_id left join auth_user_role sur on sur.role_id = r.role_id
left join auth_user u on u.id = sur.user_id left join auth_user u on u.id = sur.user_id
WHERE u.userName = #{userName} WHERE u.userName = #{userName}

@ -13,7 +13,7 @@
<select id="selectRoleMenuList" parameterType="com.glxp.api.req.auth.SysRoleMenuRequest" <select id="selectRoleMenuList" parameterType="com.glxp.api.req.auth.SysRoleMenuRequest"
resultMap="SysRoleMenuResult"> resultMap="SysRoleMenuResult">
SELECT * SELECT *
FROM sys_role_menu FROM auth_role_menu
<where> <where>
<if test="roleId != null "> <if test="roleId != null ">
and role_id = #{roleId} and role_id = #{roleId}
@ -26,14 +26,14 @@
<delete id="deleteById" parameterType="java.lang.Long"> <delete id="deleteById" parameterType="java.lang.Long">
delete delete
from sys_role_menu from auth_role_menu
where role_id = #{id} where role_id = #{id}
</delete> </delete>
<delete id="deleteByList" parameterType="java.util.List" <delete id="deleteByList" parameterType="java.util.List"
> >
delete delete
from sys_role_menu from auth_role_menu
where role_id in where role_id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item} #{item}
@ -43,7 +43,7 @@
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List"> <insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
insert INTO sys_role_menu insert INTO auth_role_menu
( (
role_id,menu_id role_id,menu_id
) )

@ -11,14 +11,14 @@
<select id="selectUserIdsByRoleId" resultType="Long"> <select id="selectUserIdsByRoleId" resultType="Long">
select u.id select u.id
from auth_user u 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} on u.id = sur.user_id and sur.role_id = #{roleId}
</select> </select>
<delete id="delete" parameterType="com.glxp.api.req.auth.SysUserRoleRequest"> <delete id="delete" parameterType="com.glxp.api.req.auth.SysUserRoleRequest">
DELETE DELETE
FROM sys_user_role FROM auth_user_role
<where> <where>
<if test="userId != '' and userId != null"> <if test="userId != '' and userId != null">
AND user_id = #{userId} AND user_id = #{userId}
@ -31,7 +31,7 @@
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List"> <insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
insert INTO sys_user_role insert INTO auth_user_role
( (
user_id,role_id user_id,role_id
) )

@ -3,7 +3,7 @@
<mapper namespace="com.glxp.api.dao.inout.WarehouseUserDao"> <mapper namespace="com.glxp.api.dao.inout.WarehouseUserDao">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.WarehouseUserEntity"> <resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.WarehouseUserEntity">
<!--@mbg.generated--> <!--@mbg.generated-->
<!--@Table inv_warehouse_user--> <!--@Table auth_warehouse_user-->
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/> <result column="code" jdbcType="VARCHAR" property="code"/>
<result column="userId" jdbcType="BIGINT" property="userid"/> <result column="userId" jdbcType="BIGINT" property="userid"/>
@ -19,23 +19,23 @@
<!--@mbg.generated--> <!--@mbg.generated-->
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from inv_warehouse_user from auth_warehouse_user
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from inv_warehouse_user delete from auth_warehouse_user
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<delete id="deleteByCodeAndId"> <delete id="deleteByCodeAndId">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from inv_warehouse_user delete from auth_warehouse_user
where userid = #{id} and code=#{code} where userid = #{id} and code=#{code}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" <insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true"> parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
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} values (#{code,jdbcType=VARCHAR}, #{userid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{isDirector}
) )
@ -43,7 +43,7 @@
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true"> parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into inv_warehouse_user insert into auth_warehouse_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null"> <if test="code != null">
code, code,
@ -71,7 +71,7 @@
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity"> <update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity">
<!--@mbg.generated--> <!--@mbg.generated-->
update inv_warehouse_user update auth_warehouse_user
<set> <set>
<if test="code != null"> <if test="code != null">
code = #{code,jdbcType=VARCHAR}, code = #{code,jdbcType=VARCHAR},
@ -88,7 +88,7 @@
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity"> <update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity">
<!--@mbg.generated--> <!--@mbg.generated-->
update inv_warehouse_user update auth_warehouse_user
set code = #{code,jdbcType=VARCHAR}, set code = #{code,jdbcType=VARCHAR},
userId = #{userid,jdbcType=BIGINT}, userId = #{userid,jdbcType=BIGINT},
userName = #{username,jdbcType=VARCHAR} userName = #{username,jdbcType=VARCHAR}
@ -97,7 +97,7 @@
</update> </update>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update inv_warehouse_user update auth_warehouse_user
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="code = case" suffix="end,"> <trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
@ -122,7 +122,7 @@
</update> </update>
<update id="updateBatchSelective" parameterType="java.util.List"> <update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update inv_warehouse_user update auth_warehouse_user
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="code = case" suffix="end,"> <trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
@ -153,7 +153,7 @@
</update> </update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true"> <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into inv_warehouse_user insert into auth_warehouse_user
(code, userId, userName, isDirector) (code, userId, userName, isDirector)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
@ -165,7 +165,7 @@
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true"> parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into inv_warehouse_user insert into auth_warehouse_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
@ -198,7 +198,7 @@
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true"> parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into inv_warehouse_user insert into auth_warehouse_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
@ -246,16 +246,16 @@
</insert> </insert>
<select id="selectListByCode" resultMap="BaseResultMap"> <select id="selectListByCode" resultMap="BaseResultMap">
select inv_warehouse_user.*, auth_user.employeeName select auth_warehouse_user.*, auth_user.employeeName
from inv_warehouse_user from auth_warehouse_user
inner join auth_user on auth_user.id = inv_warehouse_user.userId inner join auth_user on auth_user.id = auth_warehouse_user.userId
where code = #{code} where code = #{code}
</select> </select>
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvUserRequest" <select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvUserRequest"
resultType="com.glxp.api.entity.auth.WarehouseUserEntity"> resultType="com.glxp.api.entity.auth.WarehouseUserEntity">
SELECT * FROM inv_warehouse_user SELECT * FROM auth_warehouse_user
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND id = #{id} AND id = #{id}
@ -275,31 +275,31 @@
<select id="selectCodeByUser" resultMap="BaseResultMap"> <select id="selectCodeByUser" resultMap="BaseResultMap">
select inv_warehouse_user.* select auth_warehouse_user.*
from inv_warehouse_user from auth_warehouse_user
where userId = #{userId} where userId = #{userId}
</select> </select>
<select id="countByCode" resultType="java.lang.Integer"> <select id="countByCode" resultType="java.lang.Integer">
select count(*) select count(*)
from inv_warehouse_user from auth_warehouse_user
where code = #{code} where code = #{code}
</select> </select>
<delete id="deleteByCode"> <delete id="deleteByCode">
delete delete
from inv_warehouse_user from auth_warehouse_user
where code = #{code} where code = #{code}
</delete> </delete>
<update id="updateDirector"> <update id="updateDirector">
update inv_warehouse_user update auth_warehouse_user
set isDirector = #{isDirector} set isDirector = #{isDirector}
where code = #{code} where code = #{code}
</update> </update>
<update id="updateDirectorById"> <update id="updateDirectorById">
update inv_warehouse_user update auth_warehouse_user
set isDirector = #{isDirector} set isDirector = #{isDirector}
where id = #{id} where id = #{id}
</update> </update>

@ -20,7 +20,7 @@
resultMap="SysLogininforResult"> resultMap="SysLogininforResult">
select * select *
FROM sys_logininfor FROM monitor_login_log
<where> <where>
<if test="infoId != null "> <if test="infoId != null ">
and info_id = #{infoId} and info_id = #{infoId}
@ -45,14 +45,14 @@
<select id="selectById" parameterType="java.lang.Long" <select id="selectById" parameterType="java.lang.Long"
resultMap="SysLogininforResult"> resultMap="SysLogininforResult">
select * select *
FROM sys_logininfor FROM monitor_login_log
WHERE oper_id = #{id} WHERE oper_id = #{id}
</select> </select>
<insert id="insert" keyProperty="infoId" useGeneratedKeys="true" <insert id="insert" keyProperty="infoId" useGeneratedKeys="true"
parameterType="com.glxp.api.entity.monitor.SysLogininfor"> parameterType="com.glxp.api.entity.monitor.SysLogininfor">
INSERT INTO sys_logininfor( `user_name`, `status`, ipaddr, `login_location`, browser, `os`, msg INSERT INTO monitor_login_log( `user_name`, `status`, ipaddr, `login_location`, browser, `os`, msg
, login_time) , login_time)
values (#{userName}, values (#{userName},
#{status}, #{ipaddr}, #{status}, #{ipaddr},
#{loginLocation}, #{browser}, #{os}, #{msg}, #{loginTime}) #{loginLocation}, #{browser}, #{os}, #{msg}, #{loginTime})
@ -60,7 +60,7 @@
<delete id="delete" parameterType="java.lang.Long"> <delete id="delete" parameterType="java.lang.Long">
delete delete
from sys_logininfor from monitor_login_log
where info_id = #{id} where info_id = #{id}
</delete> </delete>
@ -68,7 +68,7 @@
<delete id="deleteBatchIds" parameterType="java.util.List" <delete id="deleteBatchIds" parameterType="java.util.List"
> >
delete delete
from sys_logininfor from monitor_login_log
where info_id in where info_id in
<foreach item="item" index="index" collection="infoIds" open="(" separator="," close=")"> <foreach item="item" index="index" collection="infoIds" open="(" separator="," close=")">
#{item} #{item}

@ -28,10 +28,10 @@
<select id="selectList" parameterType="com.glxp.api.req.monitor.SysOperLogRequest" <select id="selectList" parameterType="com.glxp.api.req.monitor.SysOperLogRequest"
resultMap="SysOperLogResult"> resultMap="SysOperLogResult">
select sys_oper_log.*,auth_user.employeeName operUserName select monitor_oper_log.*,auth_user.employeeName operUserName
FROM sys_oper_log FROM monitor_oper_log
left join auth_user left join auth_user
on sys_oper_log.oper_name = auth_user.id on monitor_oper_log.oper_name = auth_user.id
<where> <where>
<if test="operId != null "> <if test="operId != null ">
and oper_id = #{operId} and oper_id = #{operId}
@ -74,13 +74,13 @@
<select id="selectById" parameterType="java.lang.Long" <select id="selectById" parameterType="java.lang.Long"
resultMap="SysOperLogResult"> resultMap="SysOperLogResult">
select * select *
FROM sys_oper_log FROM monitor_oper_log
WHERE oper_id = #{id} WHERE oper_id = #{id}
</select> </select>
<insert id="insert" keyProperty="operIp" useGeneratedKeys="true" <insert id="insert" keyProperty="operIp" useGeneratedKeys="true"
parameterType="com.glxp.api.entity.monitor.SysOperLog"> parameterType="com.glxp.api.entity.monitor.SysOperLog">
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, , oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status,
error_msg, oper_time) error_msg, oper_time)
values ( #{operId}, values ( #{operId},
@ -91,7 +91,7 @@
<delete id="delete" parameterType="java.lang.Long"> <delete id="delete" parameterType="java.lang.Long">
delete delete
from sys_oper_log from monitor_oper_log
where oper_id = #{id} where oper_id = #{id}
</delete> </delete>
@ -99,7 +99,7 @@
<delete id="deleteBatchIds" parameterType="java.util.List" <delete id="deleteBatchIds" parameterType="java.util.List"
> >
delete delete
from sys_oper_log from monitor_oper_log
where oper_id in where oper_id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item} #{item}

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.auth.DeviceKeyDao"> <mapper namespace="com.glxp.api.dao.auth.SysPdaKeyDao">
<select id="findDeviceKey" parameterType="com.glxp.api.req.system.FilterDeviceKeyRequest" <select id="findDeviceKey" parameterType="com.glxp.api.req.system.FilterDeviceKeyRequest"
resultType="com.glxp.api.entity.system.DeviceKeyEntity"> resultType="com.glxp.api.entity.system.SysPdaKeyEntity">
SELECT * FROM device_check SELECT * FROM sys_pda_check
<where> <where>
<if test="imei != null and imei != ''"> <if test="imei != null and imei != ''">
and imei = #{imei} and imei = #{imei}
@ -18,8 +18,8 @@
</select> </select>
<select id="findDeviceByImei" parameterType="com.glxp.api.req.system.FilterDeviceKeyRequest" <select id="findDeviceByImei" parameterType="com.glxp.api.req.system.FilterDeviceKeyRequest"
resultType="com.glxp.api.entity.system.DeviceKeyEntity"> resultType="com.glxp.api.entity.system.SysPdaKeyEntity">
SELECT * FROM device_check SELECT * FROM sys_pda_check
<where> <where>
<if test="imei != null and imei != ''"> <if test="imei != null and imei != ''">
and imei = #{imei} and imei = #{imei}
@ -28,9 +28,9 @@
</select> </select>
<update id="updateDeviceKey" parameterType="com.glxp.api.entity.system.DeviceKeyEntity"> <update id="updateDeviceKey" parameterType="com.glxp.api.entity.system.SysPdaKeyEntity">
UPDATE device_check UPDATE sys_pda_check
<set> <set>
<if test="isCheck != null">isCheck=#{isCheck},</if> <if test="isCheck != null">isCheck=#{isCheck},</if>
<if test="companyName != null">companyName=#{companyName},</if> <if test="companyName != null">companyName=#{companyName},</if>
@ -47,9 +47,9 @@
</update> </update>
<update id="updateDeviceKeyByImei" parameterType="com.glxp.api.entity.system.DeviceKeyEntity"> <update id="updateDeviceKeyByImei" parameterType="com.glxp.api.entity.system.SysPdaKeyEntity">
UPDATE device_check UPDATE sys_pda_check
<set> <set>
<if test="isCheck != null">isCheck=#{isCheck},</if> <if test="isCheck != null">isCheck=#{isCheck},</if>
<if test="companyName != null">companyName=#{companyName},</if> <if test="companyName != null">companyName=#{companyName},</if>
@ -65,8 +65,9 @@
WHERE imei=#{imei} WHERE imei=#{imei}
</update> </update>
<insert id="insertDeviceKey" parameterType="com.glxp.api.entity.system.DeviceKeyEntity"> <insert id="insertDeviceKey" parameterType="com.glxp.api.entity.system.SysPdaKeyEntity">
replace INTO device_check( replace
INTO sys_pda_check(
imei, imei,
isCheck, isCheck,
companyName, companyName,
@ -81,12 +82,17 @@
#{phone}, #{phone},
#{contact}, #{contact},
#{date}, #{date},
#{imeiKey},#{creditNum},#{rgType},#{remark} #{imeiKey},
#{creditNum},
#{rgType},
#{remark}
) )
</insert> </insert>
<delete id="deleteDeviceKey" parameterType="Map"> <delete id="deleteDeviceKey" parameterType="Map">
DELETE FROM device_check WHERE id = #{id} DELETE
FROM sys_pda_check
WHERE id = #{id}
</delete> </delete>
</mapper> </mapper>

@ -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; drop table if exists auth_platform;

Loading…
Cancel
Save