简体   繁体   中英

How to find entity from frontend in spring boot?

I'm learning spring boot from a project https://github.com/rstyro/admin
In page/role/list.html,there is code:

     <button th:if="${QX.add == '1' && QX.query == '1'}" class="btn btn-success 
         btn-sm" id="addRole"><i class="fa fa-plus"></i> &nbsp;&nbsp;add role</button>

I want to check what is this QX entity, So I go to RoleController.java

 @RequestMapping(value="/list",method=RequestMethod.GET)
     public Object list(Model model){
        model.addAttribute("roles", roleService.list());
        return "page/role/list";
    } 

then RoleService.java

@Service
public class RoleService implements IRoleService{

    @Autowired
    private RoleDao roleDao;
    
    @Autowired
    private MenuService menuService;
    
    private Logger log = Logger.getLogger(this.getClass());
    
    @Override
    public List<ParameterMap> list() {
        return roleDao.list();
    }

then RoleDao.java

public interface RoleDao {
    public List<ParameterMap> list();
    public List<ParameterMap> getRoleByuId(ParameterMap pm);
    public ParameterMap getRoleById(ParameterMap pm);
    public void updateRoleQX(ParameterMap pm);
    public void addRole(ParameterMap pm);
    public void delRole(String roleId);
    public void delUserRole(String roleId);
}

and RoleMapper.xml

<mapper namespace="com.lrs.admin.dao.RoleDao" >
    <select id="list"  resultType="pm">
        SELECT 
            role_id,
            role_name,
            role_desc,
            rights,
            add_qx,
            del_qx,
            edit_qx,
            query_qx
        from 
            sys_role
    </select>

and Role.java

public class Role {
    private long roleId;
    private String roleName;
    private String roleDesc;
    private String rights;
    private String addQX;
    private String delQX;
    private String editQX;
    private String queryQX;
    public long getRoleId() {
        return roleId;
    }

But nothing is there. Am I missing something? Thx.

He is calling

   return roleDao.list();

But there is no implementation of that statement, RoleDao interface is not implemented anywhere. Which means there is no bean called roleDao , which means, you cannot run this code. It will give you error.

The author probably did not share RoleDao implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM