优化功能模块的接口
This commit is contained in:
@@ -10,6 +10,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.functions.FunctionService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -26,6 +27,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
/**
|
||||
* @author ji-sheng-hua jshERP
|
||||
*/
|
||||
@@ -41,6 +44,21 @@ public class FunctionController {
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@GetMapping(value = "/checkIsNumberExist")
|
||||
@ApiOperation(value = "检查编号是否存在")
|
||||
public String checkIsNumberExist(@RequestParam Long id,
|
||||
@RequestParam(value ="number", required = false) String number,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
int exist = functionService.checkIsNumberExist(id, number);
|
||||
if(exist > 0) {
|
||||
objectMap.put("status", true);
|
||||
} else {
|
||||
objectMap.put("status", false);
|
||||
}
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父编号查询菜单
|
||||
* @param jsonObject
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
public class FunctionEx extends Function {
|
||||
|
||||
private String parentName;
|
||||
|
||||
public String getParentName() {
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.Function;
|
||||
import com.jsh.erp.datasource.entities.FunctionEx;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
public interface FunctionMapperEx {
|
||||
|
||||
List<Function> selectByConditionFunction(
|
||||
List<FunctionEx> selectByConditionFunction(
|
||||
@Param("name") String name,
|
||||
@Param("type") String type,
|
||||
@Param("offset") Integer offset,
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.jsh.erp.service.functions;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.Function;
|
||||
import com.jsh.erp.datasource.entities.FunctionEx;
|
||||
import com.jsh.erp.datasource.entities.FunctionExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.FunctionMapper;
|
||||
@@ -73,8 +74,8 @@ public class FunctionService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Function> select(String name, String type, int offset, int rows)throws Exception {
|
||||
List<Function> list=null;
|
||||
public List<FunctionEx> select(String name, String type, int offset, int rows)throws Exception {
|
||||
List<FunctionEx> list=null;
|
||||
try{
|
||||
list= functionMapperEx.selectByConditionFunction(name, type, offset, rows);
|
||||
}catch(Exception e){
|
||||
@@ -164,6 +165,18 @@ public class FunctionService {
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
public int checkIsNumberExist(Long id, String number)throws Exception {
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andNumberEqualTo(number).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list = functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
public List<Function> getRoleFunction(String pNumber)throws Exception {
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andParentNumberEqualTo(pNumber)
|
||||
|
||||
Reference in New Issue
Block a user