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

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

@ -3,10 +3,12 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.MaterialProperty;
import com.jsh.erp.service.materialProperty.MaterialPropertyService;
import com.jsh.erp.utils.*;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -15,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -58,7 +59,7 @@ public class MaterialPropertyController extends BaseController {
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
List<?> list = materialPropertyService.select(name);
List<MaterialProperty> list = materialPropertyService.select(name);
return getDataTable(list);
}

View File

@ -4,13 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.organization.OrganizationService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -20,13 +19,15 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/**
* create by: cjl
* description:
*
* create time: 2019/3/6 10:54
* create by: jsh
*/
@RestController
@RequestMapping(value = "/organization")
@ -40,6 +41,66 @@ public class OrganizationController {
@Resource
private UserService userService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Organization organization = organizationService.getOrganization(id);
Map<String, Object> objectMap = new HashMap<>();
if(organization != null) {
objectMap.put("info", organization);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = organizationService.insertOrganization(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = organizationService.updateOrganization(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = organizationService.deleteOrganization(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = organizationService.batchDeleteOrganization(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = organizationService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 根据id来查询机构信息
* @param id

View File

@ -1,25 +1,28 @@
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.datasource.entities.PlatformConfig;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.service.platformConfig.PlatformConfigService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/**
* @author ji|sheng|hua 管伊佳erp QQ7827-18920
@ -27,12 +30,67 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@RestController
@RequestMapping(value = "/platformConfig")
@Api(tags = {"平台参数"})
public class PlatformConfigController {
public class PlatformConfigController extends BaseController {
private Logger logger = LoggerFactory.getLogger(PlatformConfigController.class);
@Resource
private PlatformConfigService platformConfigService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
PlatformConfig platformConfig = platformConfigService.getPlatformConfig(id);
Map<String, Object> objectMap = new HashMap<>();
if(platformConfig != null) {
objectMap.put("info", platformConfig);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String platformKey = StringUtil.getInfo(search, "platformKey");
List<PlatformConfig> list = platformConfigService.select(platformKey);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = platformConfigService.insertPlatformConfig(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = platformConfigService.updatePlatformConfig(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = platformConfigService.deletePlatformConfig(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = platformConfigService.batchDeletePlatformConfig(ids, request);
return returnStr(objectMap, delete);
}
/**
* 获取平台名称
* @param request

View File

@ -2,10 +2,17 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.RoleEx;
import com.jsh.erp.service.role.RoleService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.ParamUtils;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -14,11 +21,13 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua jshERP
@ -26,7 +35,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@RestController
@RequestMapping(value = "/role")
@Api(tags = {"角色管理"})
public class RoleController {
public class RoleController extends BaseController {
private Logger logger = LoggerFactory.getLogger(RoleController.class);
@Resource
@ -35,6 +44,76 @@ public class RoleController {
@Resource
private UserBusinessService userBusinessService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Role role = roleService.getRole(id);
Map<String, Object> objectMap = new HashMap<>();
if(role != null) {
objectMap.put("info", role);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String description = StringUtil.getInfo(search, "description");
List<RoleEx> list = roleService.select(name, description);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = roleService.insertRole(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = roleService.updateRole(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = roleService.deleteRole(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = roleService.batchDeleteRole(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = roleService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 角色对应应用显示
* @param request

View File

@ -9,11 +9,6 @@ import java.util.List;
public interface PlatformConfigMapperEx {
List<PlatformConfig> selectByConditionPlatformConfig(
@Param("platformKey") String platformKey,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByPlatformConfig(
@Param("platformKey") String platformKey);
}

View File

@ -11,12 +11,6 @@ import java.util.List;
public interface RoleMapperEx {
List<RoleEx> selectByConditionRole(
@Param("name") String name,
@Param("description") String description,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByRole(
@Param("name") String name,
@Param("description") String description);

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);

View File

@ -1,6 +1,7 @@
<?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.jsh.erp.datasource.mappers.PlatformConfigMapperEx">
<select id="selectByConditionPlatformConfig" parameterType="com.jsh.erp.datasource.entities.PlatformConfigExample" resultMap="com.jsh.erp.datasource.mappers.PlatformConfigMapper.BaseResultMap">
select *
FROM jsh_platform_config
@ -11,20 +12,6 @@
<bind name="bindKey" value="'%'+platformKey+'%'"/>
and platform_key like #{bindKey}
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByPlatformConfig" resultType="java.lang.Long">
SELECT
COUNT(id)
FROM jsh_platform_config
WHERE 1=1
and platform_key!='activation_code'
and platform_key!='app_activation_code'
<if test="platformKey != null and platformKey != ''">
<bind name="bindKey" value="'%'+platformKey+'%'"/>
and platform_key like #{bindKey}
</if>
</select>
</mapper>

View File

@ -17,25 +17,8 @@
and description like #{bindDescription}
</if>
order by sort asc, id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByRole" resultType="java.lang.Long">
SELECT
COUNT(id)
FROM jsh_role
WHERE 1=1
and ifnull(delete_flag,'0') !='1'
<if test="name != null">
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
<if test="description != null">
<bind name="bindDescription" value="'%'+description+'%'"/>
and description like #{bindDescription}
</if>
</select>
<update id="batchDeleteRoleByIds">
update jsh_role
set delete_flag='1'