给角色和平台模块优化接口

This commit is contained in:
jishenghua
2025-02-23 18:14:49 +08:00
parent 8e3a971a04
commit e589d5f9cd
18 changed files with 226 additions and 350 deletions

View File

@@ -2,8 +2,6 @@ package com.jsh.erp.service.orgaUserRel;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.organization.OrganizationResource;
import com.jsh.erp.service.organization.OrganizationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

View File

@@ -1,68 +0,0 @@
package com.jsh.erp.service.organization;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* Description
*
* @Author: cjl
* @Date: 2019/3/6 15:09
*/
@Service(value = "organization_component")
@OrganizationResource
public class OrganizationComponent implements ICommonQuery {
@Resource
private OrganizationService organizationService;
@Override
public Object selectOne(Long id) throws Exception {
return organizationService.getOrganization(id);
}
@Override
public List<?> select(Map<String, String> parameterMap)throws Exception {
return getOrganizationList(parameterMap);
}
private List<?> getOrganizationList(Map<String, String> map)throws Exception {
return null;
}
@Override
public Long counts(Map<String, String> parameterMap)throws Exception {
return null;
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return organizationService.insertOrganization(obj,request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return organizationService.updateOrganization(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return organizationService.deleteOrganization(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return organizationService.batchDeleteOrganization(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return organizationService.checkIsNameExist(id, name);
}
}

View File

@@ -1,18 +0,0 @@
package com.jsh.erp.service.organization;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* Description
* 机构
* @Author: cjl
* @Date: 2019/3/6 15:10
*/
@ResourceInfo(value = "organization")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface OrganizationResource {
}

View File

@@ -3,7 +3,6 @@ package com.jsh.erp.service.organization;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.MaterialProperty;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.entities.OrganizationExample;
import com.jsh.erp.datasource.entities.User;
@@ -29,10 +28,7 @@ import java.util.Date;
import java.util.List;
/**
* Description
*
* @Author: cjl
* @Date: 2019/3/6 15:10
* @Author: jsh
*/
@Service
public class OrganizationService {

View File

@@ -1,70 +0,0 @@
package com.jsh.erp.service.platformConfig;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "platformConfig_component")
@PlatformConfigResource
public class PlatformConfigComponent implements ICommonQuery {
@Resource
private PlatformConfigService platformConfigService;
@Override
public Object selectOne(Long id) throws Exception {
return platformConfigService.getPlatformConfig(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getPlatformConfigList(map);
}
private List<?> getPlatformConfigList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String platformKey = StringUtil.getInfo(search, "platformKey");
return platformConfigService.select(platformKey, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String platformKey = StringUtil.getInfo(search, "platformKey");
return platformConfigService.countPlatformConfig(platformKey);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return platformConfigService.insertPlatformConfig(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return platformConfigService.updatePlatformConfig(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return platformConfigService.deletePlatformConfig(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return platformConfigService.batchDeletePlatformConfig(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return 0;
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.platformConfig;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2020-10-16 22:26:27
*/
@ResourceInfo(value = "platformConfig")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface PlatformConfigResource {
}

View File

@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.mappers.PlatformConfigMapper;
import com.jsh.erp.datasource.mappers.PlatformConfigMapperEx;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,11 +58,12 @@ public class PlatformConfigService {
return list;
}
public List<PlatformConfig> select(String platformKey, int offset, int rows)throws Exception {
public List<PlatformConfig> select(String platformKey)throws Exception {
List<PlatformConfig> list=null;
try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
list = platformConfigMapperEx.selectByConditionPlatformConfig(platformKey, offset, rows);
PageUtils.startPage();
list = platformConfigMapperEx.selectByConditionPlatformConfig(platformKey);
}
}catch(Exception e){
JshException.readFail(logger, e);
@@ -69,18 +71,6 @@ public class PlatformConfigService {
return list;
}
public Long countPlatformConfig(String platformKey)throws Exception {
Long result=null;
try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
result = platformConfigMapperEx.countsByPlatformConfig(platformKey);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertPlatformConfig(JSONObject obj, HttpServletRequest request) throws Exception{
PlatformConfig platformConfig = JSONObject.parseObject(obj.toJSONString(), PlatformConfig.class);

View File

@@ -1,72 +0,0 @@
package com.jsh.erp.service.role;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "role_component")
@RoleResource
public class RoleComponent implements ICommonQuery {
@Resource
private RoleService roleService;
@Override
public Object selectOne(Long id) throws Exception {
return roleService.getRole(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getRoleList(map);
}
private List<?> getRoleList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String description = StringUtil.getInfo(search, "description");
return roleService.select(name, description, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String description = StringUtil.getInfo(search, "description");
return roleService.countRole(name, description);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return roleService.insertRole(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return roleService.updateRole(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return roleService.deleteRole(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return roleService.batchDeleteRole(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return roleService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.role;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "role")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface RoleResource {
}

View File

@@ -11,6 +11,7 @@ import com.jsh.erp.datasource.mappers.RoleMapperEx;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -94,10 +95,11 @@ public class RoleService {
return list;
}
public List<RoleEx> select(String name, String description, int offset, int rows)throws Exception {
public List<RoleEx> select(String name, String description)throws Exception {
List<RoleEx> list=null;
try{
list=roleMapperEx.selectByConditionRole(name, description, offset, rows);
PageUtils.startPage();
list=roleMapperEx.selectByConditionRole(name, description);
for(RoleEx roleEx: list) {
String priceLimit = roleEx.getPriceLimit();
if(StringUtil.isNotEmpty(priceLimit)) {
@@ -117,16 +119,6 @@ public class RoleService {
return list;
}
public Long countRole(String name, String description)throws Exception {
Long result=null;
try{
result=roleMapperEx.countsByRole(name, description);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertRole(JSONObject obj, HttpServletRequest request)throws Exception {
Role role = JSONObject.parseObject(obj.toJSONString(), Role.class);