package com.ruoyi.common.utils;

import java.util.Collection;

/**
 * SQL 工具类
 * @author wjh
 * 2024/11/2
 */
public class SqlUtils {

    /**
     * TODO 批量更新SQL 拼接 暂时还没想好怎么做
     * @param collection
     * @param primaryKey
     * @param columnName
     * @return
     */
    public static String updateColumn(Collection<?> collection, String primaryKey, String columnName) {
        StringBuilder sb = new StringBuilder();
        sb.append(columnName).append(" = case ").append(primaryKey);

        for (Object item : collection) {

            sb.append(" when ");

        }

        return sb.toString();
    }

}
