// Path: cango-model/src/main/java/com/bella/cango/entity/CangoTable.java
// public class CangoTable {
// 
//     private Long id;
// 
//     private String instancesName;
// 
//     private String tableName;
// 
//     private Date createTime;
// 
//     private Date updateTime;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getInstancesName() {
//         return instancesName;
//     }
// 
//     public CangoTable setInstancesName(String instancesName) {
//         this.instancesName = instancesName;
//         return this;
//     }
// 
//     public String getTableName() {
//         return tableName;
//     }
// 
//     public CangoTable setTableName(String tableName) {
//         this.tableName = tableName;
//         return this;
//     }
// 
//     public Date getCreateTime() {
//         return createTime;
//     }
// 
//     public CangoTable setCreateTime(Date createTime) {
//         this.createTime = createTime;
//         return this;
//     }
// 
//     public Date getUpdateTime() {
//         return updateTime;
//     }
// 
//     public CangoTable setUpdateTime(Date updateTime) {
//         this.updateTime = updateTime;
//         return this;
//     }
// }
// 
// Path: cango-service/src/main/java/com/bella/cango/service/CangoTableService.java
// public interface CangoTableService {
//     void save(CangoTable cangoTable);
// 
//     CangoTable query(CangoTable cangoTable);
// 
//     void deleteByInstancesName(CangoTable cangoTable);
// 
//     List<CangoTable> findByInstancesName(CangoTable cangoTable);
// 
//     void deleteAll();
// 
//     void batchSave(List<CangoTable> cangoTables);
// }
// 
// Path: cango-common/src/main/java/com/bella/cango/utils/ValidateUtil.java
// public class ValidateUtil {
//     private static Validator validator;
//     static {
//         final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
//         validator = validatorFactory.getValidator();
//     }
//     public static <T> void validate(T t) {
//         final Set<ConstraintViolation<T>> constraintViolations = validator.validate(t);
//         if (constraintViolations != null && constraintViolations.size() > 0) {
//             StringBuilder stringBuilder = new StringBuilder();
//             for (ConstraintViolation<T> constraintViolation : constraintViolations) {
//                 stringBuilder.append(constraintViolation.getPropertyPath())
//                         .append(" : ")
//                         .append(constraintViolation.getMessage())
//                         .append(", ");
//             }
//             String constraintMessage = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString();
//             throw new CangoException(constraintMessage);
//         }
//     }
// }


import com.bella.cango.entity.CangoTable;
import com.bella.cango.service.CangoTableService;
import com.bella.cango.utils.ValidateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
    public void deleteByInstancesName(final CangoTable cangoTable) {
        String deleteSql = "delete from cango_table where instances_name = ?";
        jdbcTemplate.update(deleteSql, new PreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement ps) throws SQLException {
                ps.setString(1, cangoTable.getInstancesName());
            }
        });
    }

    @Override
    public List<CangoTable> findByInstancesName(CangoTable cangoTable) {
        String queryListSql = "select * from cango_table where instances_name";
        return jdbcTemplate.query(queryListSql, new Object[]{cangoTable.getInstancesName()}, new BeanPropertyRowMapper<>(CangoTable.class));
    }

    @Override
    public void deleteAll() {
        String deleteAllSql = "delete from cango_table";
        jdbcTemplate.execute(deleteAllSql);
    }

    @Override
    public void batchSave(final List<CangoTable> cangoTables) {
        if (cangoTables != null && cangoTables.size() > 0) {
            String insertSql = "insert into cango_table instances_name, table_name, create_time values(?, ?, ?)";
            final Date current = getCurrentTime();
            jdbcTemplate.batchUpdate(insertSql, new BatchPreparedStatementSetter() {
                @Override
                public void setValues(PreparedStatement ps, int i) throws SQLException {
// Path: cango-model/src/main/java/com/bella/cango/entity/CangoTable.java
// public class CangoTable {
// 
//     private Long id;
// 
//     private String instancesName;
// 
//     private String tableName;
// 
//     private Date createTime;
// 
//     private Date updateTime;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getInstancesName() {
//         return instancesName;
//     }
// 
//     public CangoTable setInstancesName(String instancesName) {
//         this.instancesName = instancesName;
//         return this;
//     }
// 
//     public String getTableName() {
//         return tableName;
//     }
// 
//     public CangoTable setTableName(String tableName) {
//         this.tableName = tableName;
//         return this;
//     }
// 
//     public Date getCreateTime() {
//         return createTime;
//     }
// 
//     public CangoTable setCreateTime(Date createTime) {
//         this.createTime = createTime;
//         return this;
//     }
// 
//     public Date getUpdateTime() {
//         return updateTime;
//     }
// 
//     public CangoTable setUpdateTime(Date updateTime) {
//         this.updateTime = updateTime;
//         return this;
//     }
// }
// 
// Path: cango-service/src/main/java/com/bella/cango/service/CangoTableService.java
// public interface CangoTableService {
//     void save(CangoTable cangoTable);
// 
//     CangoTable query(CangoTable cangoTable);
// 
//     void deleteByInstancesName(CangoTable cangoTable);
// 
//     List<CangoTable> findByInstancesName(CangoTable cangoTable);
// 
//     void deleteAll();
// 
//     void batchSave(List<CangoTable> cangoTables);
// }
// 
// Path: cango-common/src/main/java/com/bella/cango/utils/ValidateUtil.java
// public class ValidateUtil {
//     private static Validator validator;
//     static {
//         final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
//         validator = validatorFactory.getValidator();
//     }
//     public static <T> void validate(T t) {
//         final Set<ConstraintViolation<T>> constraintViolations = validator.validate(t);
//         if (constraintViolations != null && constraintViolations.size() > 0) {
//             StringBuilder stringBuilder = new StringBuilder();
//             for (ConstraintViolation<T> constraintViolation : constraintViolations) {
//                 stringBuilder.append(constraintViolation.getPropertyPath())
//                         .append(" : ")
//                         .append(constraintViolation.getMessage())
//                         .append(", ");
//             }
//             String constraintMessage = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString();
//             throw new CangoException(constraintMessage);
//         }
//     }
// }


// Path: cango-service/src/main/java/com/bella/cango/service/impl/CangoTableServiceImpl.java
import com.bella.cango.entity.CangoTable;
import com.bella.cango.service.CangoTableService;
import com.bella.cango.utils.ValidateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

    public void deleteByInstancesName(final CangoTable cangoTable) {
        String deleteSql = "delete from cango_table where instances_name = ?";
        jdbcTemplate.update(deleteSql, new PreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement ps) throws SQLException {
                ps.setString(1, cangoTable.getInstancesName());
            }
        });
    }

    @Override
    public List<CangoTable> findByInstancesName(CangoTable cangoTable) {
        String queryListSql = "select * from cango_table where instances_name";
        return jdbcTemplate.query(queryListSql, new Object[]{cangoTable.getInstancesName()}, new BeanPropertyRowMapper<>(CangoTable.class));
    }

    @Override
    public void deleteAll() {
        String deleteAllSql = "delete from cango_table";
        jdbcTemplate.execute(deleteAllSql);
    }

    @Override
    public void batchSave(final List<CangoTable> cangoTables) {
        if (cangoTables != null && cangoTables.size() > 0) {
            String insertSql = "insert into cango_table instances_name, table_name, create_time values(?, ?, ?)";
            final Date current = getCurrentTime();
            jdbcTemplate.batchUpdate(insertSql, new BatchPreparedStatementSetter() {
                @Override
                public void setValues(PreparedStatement ps, int i) throws SQLException {
                    CangoTable cangoTable = cangoTables.get(i);