cxf+mybaties+spring
来源:互联网 发布:过山车是谁发明的 知乎 编辑:程序博客网 时间:2024/06/05 13:31
刚到公司接触的一个新的项目,用的是spring进行管理,mybaties进行数据持久化,cxf发布接口整体dao-service-action;和web项目区别是这只写接口由前边c#传入数据,
具体记录一下
1.webservice暴露出来的方法
@WebService(endpointInterface="com.lgt.webservice.action.UniqueAction",targetNamespace="http://www.lgt.com")
private UniqueService uniqueService ;
public UniqueService getUniqueService() {
return uniqueService;
}
public void setUniqueService(UniqueService uniqueService) {
this.uniqueService = uniqueService;
}
public String method(String code,String data){
try {
logger.info("【执行"+code+"模块】-请求来自IP:"+ClientUtil.getRemoteAddr());
String str = this.uniqueService.execute(code, data);
//这里说一下前台传进来的总是字符串形式的两个参数,code为要执行的方法,data为封装类,写一个json工具类将对象,page全部转换为String
return str;} catch (Exception e) {
// TODO: handle exception
return JsonUtil.formatResult(code, MessageCode.CODE_500000,"访问接口出现错误!接口编码:"+code);
}finally{
logger.info("【执行"+code+"模块】-处理来自IP:"+ClientUtil.getLocalAddr());
}
2.service
所有Action私有并写set,get方法
public String execute(String code, String data){
// TODO Auto-generated method stub
//判断是否为空
if(StringUtils.isNotEmpty(this.getModuleType(code))){
////////////系统管理///////////////////
if(ModuleCode.CODE_LL.equalsIgnoreCase(this.getModuleType(code))){//登录模块
logger.debug("进入登录模块......");
return this.loginAction.execute(code, data).toString();
}else if(ModuleCode.CODE_QQ.equalsIgnoreCase(this.getModuleType(code))){//权限模块
logger.debug("进入权限模块......");
return this.authorityAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AI.equalsIgnoreCase(this.getModuleType(code))){//日志模块
logger.debug("进入日志模块......");
return this.loggerAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AK.equalsIgnoreCase(this.getModuleType(code))){//数据字典模块
logger.debug("进入数据字典管理 模块......");
return this.dictionaryAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AM.equalsIgnoreCase(this.getModuleType(code))){//菜单模块管理
logger.debug("进入菜单模块管理模块....");
// TODO Auto-generated method stub
//判断是否为空
if(StringUtils.isNotEmpty(this.getModuleType(code))){
////////////系统管理///////////////////
if(ModuleCode.CODE_LL.equalsIgnoreCase(this.getModuleType(code))){//登录模块
logger.debug("进入登录模块......");
return this.loginAction.execute(code, data).toString();
}else if(ModuleCode.CODE_QQ.equalsIgnoreCase(this.getModuleType(code))){//权限模块
logger.debug("进入权限模块......");
return this.authorityAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AI.equalsIgnoreCase(this.getModuleType(code))){//日志模块
logger.debug("进入日志模块......");
return this.loggerAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AK.equalsIgnoreCase(this.getModuleType(code))){//数据字典模块
logger.debug("进入数据字典管理 模块......");
return this.dictionaryAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AM.equalsIgnoreCase(this.getModuleType(code))){//菜单模块管理
logger.debug("进入菜单模块管理模块....");
。。。
这里只是一部分,
ModuleCode.CODE这些都是已经写好的常量
this.getModuleType(code)截取字符串前两位的方法,进入到模块以后再根据具体code进入相应的方法,
具体转换方法我会写一个专门的文章
阅读全文
1 0
- cxf+mybaties+spring
- Spring整合Mybaties
- spring整合mybaties
- spring+springMVC+mybaties 搭建
- spring mvc+mybaties+maven+redis
- Spring+springmvc+mybaties框架整合
- Spring + mybaties + mysql + maven开发
- mybaties
- mybaties
- MyBaties
- springMVC+spring+mybaties ||struts+spring+hibernate
- cxf+spring
- Spring+Cxf
- cxf spring
- spring+cxf
- cxf spring
- spring cxf
- Mybaties入门 Mybatis与SpringMVC,spring整合
- Java内部类详解
- BOM知识整理
- Qt可拖动窗口的实现
- python 本周,上周,本月,上月,本季,上季,今年, 去年
- Go游戏服务器开发的一些思考(十四):IO游戏同步(二)
- cxf+mybaties+spring
- Mybatis或iBatis的XML文件特殊字符
- 云服务已经成为一种趋势
- Git多人合作操作处理
- Java9新特性之——接口中的私有方法
- Palindrome Number
- Java实现基于SMTP发送邮件的工具类
- 羽化
- C#中Invoke的用法()