package jj.tech.paolu.repository.mybatis.dao;

import static jj.tech.paolu.repository.mybatis.dao.support.CurrentG24DynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import jakarta.annotation.Generated;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import jj.tech.paolu.repository.mybatis.entity.CurrentG24;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;

@Mapper
public interface CurrentG24Mapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<CurrentG24>, CommonUpdateMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    BasicColumn[] selectList = BasicColumn.columnList(id, newIssue, issue, ball, closeTime, openTime, addTime, gameID);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6991843+08:00", comments="Source Table: yx..current_g24")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="CurrentG24Result", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="newIssue", property="newIssue", jdbcType=JdbcType.VARCHAR),
        @Result(column="issue", property="issue", jdbcType=JdbcType.VARCHAR),
        @Result(column="ball", property="ball", jdbcType=JdbcType.VARCHAR),
        @Result(column="closeTime", property="closeTime", jdbcType=JdbcType.INTEGER),
        @Result(column="openTime", property="openTime", jdbcType=JdbcType.INTEGER),
        @Result(column="addTime", property="addTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gameID", property="gameID", jdbcType=JdbcType.VARCHAR)
    })
    List<CurrentG24> selectMany(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6991843+08:00", comments="Source Table: yx..current_g24")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("CurrentG24Result")
    Optional<CurrentG24> selectOne(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6991843+08:00", comments="Source Table: yx..current_g24")
    default long count(CountDSLCompleter completer) {
        return MyBatis3Utils.countFrom(this::count, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6991843+08:00", comments="Source Table: yx..current_g24")
    default int delete(DeleteDSLCompleter completer) {
        return MyBatis3Utils.deleteFrom(this::delete, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int deleteByPrimaryKey(String id_) {
        return delete(c -> 
            c.where(id, isEqualTo(id_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int insert(CurrentG24 row) {
        return MyBatis3Utils.insert(this::insert, row, currentG24, c ->
            c.map(id).toProperty("id")
            .map(newIssue).toProperty("newIssue")
            .map(issue).toProperty("issue")
            .map(ball).toProperty("ball")
            .map(closeTime).toProperty("closeTime")
            .map(openTime).toProperty("openTime")
            .map(addTime).toProperty("addTime")
            .map(gameID).toProperty("gameID")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int insertMultiple(Collection<CurrentG24> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, currentG24, c ->
            c.map(id).toProperty("id")
            .map(newIssue).toProperty("newIssue")
            .map(issue).toProperty("issue")
            .map(ball).toProperty("ball")
            .map(closeTime).toProperty("closeTime")
            .map(openTime).toProperty("openTime")
            .map(addTime).toProperty("addTime")
            .map(gameID).toProperty("gameID")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int insertSelective(CurrentG24 row) {
        return MyBatis3Utils.insert(this::insert, row, currentG24, c ->
            c.map(id).toPropertyWhenPresent("id", row::getId)
            .map(newIssue).toPropertyWhenPresent("newIssue", row::getNewIssue)
            .map(issue).toPropertyWhenPresent("issue", row::getIssue)
            .map(ball).toPropertyWhenPresent("ball", row::getBall)
            .map(closeTime).toPropertyWhenPresent("closeTime", row::getCloseTime)
            .map(openTime).toPropertyWhenPresent("openTime", row::getOpenTime)
            .map(addTime).toPropertyWhenPresent("addTime", row::getAddTime)
            .map(gameID).toPropertyWhenPresent("gameID", row::getGameID)
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default Optional<CurrentG24> selectOne(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectOne(this::selectOne, selectList, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default List<CurrentG24> select(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectList(this::selectMany, selectList, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default List<CurrentG24> selectDistinct(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectDistinct(this::selectMany, selectList, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default Optional<CurrentG24> selectByPrimaryKey(String id_) {
        return selectOne(c ->
            c.where(id, isEqualTo(id_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int update(UpdateDSLCompleter completer) {
        return MyBatis3Utils.update(this::update, currentG24, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    static UpdateDSL<UpdateModel> updateAllColumns(CurrentG24 row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalTo(row::getId)
                .set(newIssue).equalTo(row::getNewIssue)
                .set(issue).equalTo(row::getIssue)
                .set(ball).equalTo(row::getBall)
                .set(closeTime).equalTo(row::getCloseTime)
                .set(openTime).equalTo(row::getOpenTime)
                .set(addTime).equalTo(row::getAddTime)
                .set(gameID).equalTo(row::getGameID);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(CurrentG24 row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalToWhenPresent(row::getId)
                .set(newIssue).equalToWhenPresent(row::getNewIssue)
                .set(issue).equalToWhenPresent(row::getIssue)
                .set(ball).equalToWhenPresent(row::getBall)
                .set(closeTime).equalToWhenPresent(row::getCloseTime)
                .set(openTime).equalToWhenPresent(row::getOpenTime)
                .set(addTime).equalToWhenPresent(row::getAddTime)
                .set(gameID).equalToWhenPresent(row::getGameID);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7001825+08:00", comments="Source Table: yx..current_g24")
    default int updateByPrimaryKey(CurrentG24 row) {
        return update(c ->
            c.set(newIssue).equalTo(row::getNewIssue)
            .set(issue).equalTo(row::getIssue)
            .set(ball).equalTo(row::getBall)
            .set(closeTime).equalTo(row::getCloseTime)
            .set(openTime).equalTo(row::getOpenTime)
            .set(addTime).equalTo(row::getAddTime)
            .set(gameID).equalTo(row::getGameID)
            .where(id, isEqualTo(row::getId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.7011827+08:00", comments="Source Table: yx..current_g24")
    default int updateByPrimaryKeySelective(CurrentG24 row) {
        return update(c ->
            c.set(newIssue).equalToWhenPresent(row::getNewIssue)
            .set(issue).equalToWhenPresent(row::getIssue)
            .set(ball).equalToWhenPresent(row::getBall)
            .set(closeTime).equalToWhenPresent(row::getCloseTime)
            .set(openTime).equalToWhenPresent(row::getOpenTime)
            .set(addTime).equalToWhenPresent(row::getAddTime)
            .set(gameID).equalToWhenPresent(row::getGameID)
            .where(id, isEqualTo(row::getId))
        );
    }
}