问个编码规范问题
比如说我有个业务是向emp 表和dept表中各插入一条数据,这里就拿Spring MVC+Mybatis来说
和emp表和dept表的相关文件EmpMapper.xml和DeptMapper.xml、DeptMapper和EmpMapper都已经写好了,EmpController、DeptController、DeptService、EmpService这些都写好了,
假如我浏览器访问的是EmpController,
下面哪种方式比较好呢。。。。。
方式一:EmpController中调用EmpService,EmpService调用EmpMapper向emp表插入数据,然后跳转到DeptController中,DeptController再调用DeptService,DeptService调用DeptMapper向dept表中插入数据。
方式二:EmpController中调用EmpService,EmpService直接调用DeptMapper和EmpMapper向各自的表插入数据