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

Action

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

    public String getProjectByUserId() {

        List<Project> 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<Project> getList(int flag,int userId);

impl

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

        List<Project> 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;
    }

 

posted @ 2016-11-30 09:23  百事没事  阅读(308)  评论(0编辑  收藏  举报