日期:2014-05-16  浏览次数:20388 次

总结思考

最近在改一个存储过程其实应该不难,但是就是遇到麻烦,

select b.store_qty,b.wh_code,b.part_code
into #po_wh_part
from #tmp_none_store a,po_wh_part b
? where? a.wh_code = b.wh_code and
???????? a.part_code = b.part_code

首先是? 使用了?? cross join?考虑一下,这个和inner join的效率哪个比较高呢?? 还有就是left join,

另外选择出来的结果, 我看到是重复的,? 例如?? 从b选择出来同个型号的产品part_code一样,出来两次, 但实际在b中,只有一条

?

/*???????????????????
? 首先更新小型机的库存和未发送????????????
*/??
?update? #tmp_none_store set none_nums = nosend_nums - b.store_qty,
local_nums = case when? nosend_nums - b.store_qty <0 then nosend_nums else b.store_qty end ,
store_nums = case when nosend_nums - b.store_qty <0 then? b.store_qty -nosend_nums else 0 end
?? from? #tmp_none_store a,
???#po_wh_part b
? where? a.wh_code = b.wh_code and
???????? a.part_code = b.part_code and
??a.mkind_type='1'

?

这里出现的问题是,update语句中? none_nums 在第二行语句中的值是否已经改变,结果是还是为初始值。看来在语句没完全执行前,他的值还是原来的。

?

?

--------------------------------------------------------------------------------------------------------------------

关于dao抽象工厂模式,在项目中我们使用了hibernate这个框架,而在项目中我们经常要使用到各自不同的dao,那么我们将这种创建任务集中其他来处理,使用抽象工厂模式,DaoFactory 和 HibernateDaoFactory? 那么,能不能使用接口来实现呢?? 这个时候选择接口和抽象类的区别在哪里呢?? 如果使用spring 的话,是用注入吧,这些问题都需要去考虑。。。。?