bf2c725f5e83d803e921b42a985fe75908d83484.svn-base 1.5 KB
package yxy.timer.webservice.interfaces.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

import yxy.timer.tool.DBUtil;
import yxy.timer.webservice.interfaces.UserSignatureWebservice;

@WebService(targetNamespace="http://UserSignatureWebservice.interfaces.webservice.timer.yxy/",serviceName="signatureWebservice")
public class UserSignatureWebserviceImpl implements UserSignatureWebservice 
{
	@WebResult(name="result")
	@WebMethod
	public String updateUserSignature(@WebParam(name="id",targetNamespace="http://UserSignatureWebservice.interfaces.webservice.timer.yxy/")int id,
			@WebParam(name="title",targetNamespace="http://UserSignatureWebservice.interfaces.webservice.timer.yxy/")String title,
			@WebParam(name="body",targetNamespace="http://UserSignatureWebservice.interfaces.webservice.timer.yxy/")String body)
	{
		String result = "";
		
		if(id == 0 && title == null && body == null)
		{
			result = "error";
			
			return result;
		}
		
		try
		{
			Connection connection;
			
			PreparedStatement  pst;
			
			//获取数据库的连接
			connection = DBUtil.getConnection("dataSource");
			
			String sql = "update yxy_user_signature set title='"+title+"',body='"+body+"' where id="+id;
			
			pst = connection.prepareStatement(sql);
			
			pst.executeUpdate(sql);
			
			result = "success";
			
			return result;
		}
		
		catch(Exception e)
		{
			e.printStackTrace();
			
			result = "error";
			
			return result;
		}
	}
}