2つの判定条件に基づいて、データベースリストgetList(state,receiveUserId)をロードする.

2194 ワード

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