Commit e7d3ce6b by guojuxing

角色下拉框列表数据接口

parent 8039737a
......@@ -75,4 +75,6 @@ public interface TabSysRoleMapper {
* @return int


 */
int deleteByRoleId(@Param("roleId") Integer roleId);
List<TabSysRole> listRoleNoPage(@Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
......@@ -5,6 +5,9 @@ import com.gic.auth.dto.RoleListDTO;
import com.gic.auth.entity.TabSysRole;
import com.gic.auth.qo.RoleListQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
* 角色权限接口
* @ClassName: RoleService

......@@ -55,4 +58,14 @@ public interface RoleService {
Page<RoleListDTO> pageRole(RoleListQO params);
TabSysRole getById(Integer id);
/**
* 列表查询
* @Title: listRole

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return java.util.List<com.gic.auth.entity.TabSysRole>


 */
List<TabSysRole> listRole(Integer enterpriseId);
}
......@@ -53,4 +53,9 @@ public class RoleServiceImpl implements RoleService{
public TabSysRole getById(Integer id) {
return tabSysRoleMapper.selectByPrimaryKey(id);
}
@Override
public List<TabSysRole> listRole(Integer enterpriseId) {
return tabSysRoleMapper.listRoleNoPage(enterpriseId);
}
}
......@@ -9,6 +9,7 @@ import com.gic.auth.entity.TabSysRole;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -103,6 +104,15 @@ public class RoleApiServiceImpl implements RoleApiService{
return ServiceResponse.success(resultPage);
}
@Override
public ServiceResponse<List<RoleDTO>> listRole(Integer enterpriseId) {
List<TabSysRole> list = roleService.listRole(enterpriseId);
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(EntityUtil.changeEntityListNew(RoleDTO.class, list));
}
return ServiceResponse.success(new ArrayList<>());
}
private ServiceResponse<Integer> saveMenuRole(Integer roleId, Integer enterpriseId, String menuIds) {
String[] menuIdArr;
ServiceResponse<String[]> menuIdResponse = ValidSplitUtils.validStr(menuIds);
......
......@@ -122,4 +122,12 @@
where role_id = #{roleId}
and status = 1
</update>
<select id="listRoleNoPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_role
where status = 1
and enterprise_id = #{enterpriseId}
</select>
</mapper>
\ No newline at end of file
package com.gic.auth.web.controller;
import com.gic.enterprise.utils.UserDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -9,8 +8,10 @@ import com.gic.auth.dto.RoleDTO;
import com.gic.auth.qo.RoleListQO;
import com.gic.auth.service.RoleApiService;
import com.gic.auth.web.vo.RoleDetailVO;
import com.gic.auth.web.vo.RoleSelectVO;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
@RestController
@RequestMapping("/role")
......@@ -41,4 +42,10 @@ public class RoleController {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return ResultControllerUtils.commonResult(roleApiService.pageRole(params));
}
@RequestMapping("/list-role-no-page")
public RestResponse listRoleNoPage() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
return ResultControllerUtils.commonResult(roleApiService.listRole(enterpriseId), RoleSelectVO.class);
}
}
package com.gic.auth.web.vo;
import java.io.Serializable;
/**
* 下拉框列表
* @ClassName: RoleSelectVO

* @Description: 

* @author guojuxing

* @date 2019/9/3 4:32 PM

*/
public class RoleSelectVO implements Serializable{
private static final long serialVersionUID = 2667055023531890522L;
/**
* id
*/
private Integer roleId;
/**
* 管理员角色名称
*/
private String roleName;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment