根据两个判断条件,加载数据库列表getList(state, receiveUserId);

Action

    /**
     * 根据登陆用户id获取新任务
     */

    public String getProjectByUserId() {

        List list = projectService.getList(state, receiveUserId);

        String jsonResult = JSONArray.fromObject(list).toString();
        try {
            response.getWriter().write(jsonResult);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

service

/**
     * 根据登陆用户的id获得任务列表
     */
    public List getList(int flag,int userId);

impl

    @Override
    public List getList(int flag, int userId) {

        List list = projectDaoUtil.getList("from Project p where p.state=? and p.receiveUser.id =?",
                new Object[] { flag, userId }, new Type[] { new IntegerType(), new IntegerType() });

        return list;
    }

 

转载于:https://www.cnblogs.com/1ming/p/6116310.html

你可能感兴趣的:(数据库)