数据加工处理拼sql

Posted ZZZZW

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据加工处理拼sql相关的知识,希望对你有一定的参考价值。

  

@Override
	public void offonShareBill(Boolean fg, Map<String,String[]> map) throws BusinessException {
		System.out.println();
		BaseDAO dao = new BaseDAO();
		Set<String> set = map.keySet();
		for (String key : set) {
			String[] ids = map.get(key);
			String sql = "update hrwa_washare a set a.isdeal = ‘N‘ , a.csourcebillid = ‘‘ " +
					"where a.csourcebillid = ‘"+key+"‘";
			if(fg){
				StringBuffer aq = new StringBuffer();
				aq = aq.append("(");
				for(String abs : ids){
					abs = "‘"+abs+"‘"+",";
					aq.append(abs);					
				}
				String aq_string = aq.substring(0, aq.length()-1);
				aq_string = aq_string+")";
				sql = "update hrwa_washare a set a.isdeal = ‘Y‘ , a.csourcebillid = ‘"+key+"‘ " +
						"where a.pk_washare in "+aq_string+"";
			}
			try {
				dao.executeUpdate(sql);
			} catch (DAOException e) {
				throw new BusinessException("更新薪资分摊(人力)单据失败!");
			}
		}	
	}

 

以上是关于数据加工处理拼sql的主要内容,如果未能解决你的问题,请参考以下文章

SQL SERVER2000将多行查询结果拼接到一行数据

mybatis如何传入java中拼接的sql语句

java代码中组装where条件然后拼接到mybatis xml中的sql后面

matlab把workpace的多个数据拼成一个

简化动态MERGE的SQL计算

Stream