随笔 - 23  文章 - 3  trackbacks - 0
<2006年4月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(1)

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

public class EmployUnitBaseInfo
{   
 
    private long ID; //用人单位系统编号---逻辑主键
    private String unitCode; //用人单位代号--业务主键
}
1、    使用逻辑主键,分页比较方便
2、    有可能unitcode会改变,用id可以保证当unitcode改变时,这个实体还存在

{C5A4CCF8-A282-4700-A5F3-FA6A5246D9F2}0.jpg

在页面上必须返回workpost + demandid,,
pojo 中的demand类如下:只有以下属性的setter和getter
    private String usedNeedNum;
    private int unitId;
    private String demandInfo;
 private long ID;
    private String needNum;
    private String position;
必须再添加一个属性demandInfo,
而在另一个毕业生申报中又要如图上操作,,如何在service层向页面层传递这些信息(测试程序员(剩2需求数))
 public class DemandServiceImpl
    extends BaseServiceImpl implements DemandService{
    public List getDemandList(int unitId)
    {
          long demandId;
          int needNum;
          int usedNeedNum;
          int lastNum;
         
          String demandInfo;
          TRealDemandDAOImpl dao = (TRealDemandDAOImpl) this.getBaseDAO();
          List list = dao.getSpareDemandByUnitId(unitId);
          Iterator it = list.iterator();
          while(it.hasNext())
          {
              TRealDemand demand = (TRealDemand) it.next();
              demandId = demand.getID();
              needNum =  Integer.parseInt(demand.getNeedNum()); 
              usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
              if(needNum>usedNeedNum)
              {
                  lastNum = usedNeedNum-needNum;
                  demandInfo = demand.getPosition()+" 剩 " + lastNum +" 需求数 ";
              }
             
          }
          return list;
    }
}

在action层再通过以下代码向页面传递数据:

DemandService demandService = (DemandService) this.getBean("DemandService");
 request.setAttribute("demandList",demandService.findDemandListByUnitId(unitInfo.getID()));



4、注意DemandServiceImpl 是实现类,DemandService 是interface
DemandService demandService = (DemandService) this.getBean("DemandService");
和DemandServiceImpl demandService = (DemandServiceImpl) this.getBean("DemandService");

虽然两个的操作一样,但是demandService是接口但可以执行相应的操作,起到黑箱子的作用。

5、记得在action中添加一个实体时,要通过idcard取得sex和birthday的属性加到内存中(表相对应的pojo)

posted on 2006-04-21 10:36 aimy 阅读(95) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: