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

import static jj.tech.paolu.repository.mybatis.dao.support.SysUrlsDynamicSqlSupport.*;
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.SysUrls;
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 SysUrlsMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<SysUrls>, CommonUpdateMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6831838+08:00", comments="Source Table: yx..sys_urls")
    BasicColumn[] selectList = BasicColumn.columnList(id, pid, types, level, url, name, method);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6821828+08:00", comments="Source Table: yx..sys_urls")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="SysUrlsResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="pid", property="pid", jdbcType=JdbcType.INTEGER),
        @Result(column="types", property="types", jdbcType=JdbcType.INTEGER),
        @Result(column="level", property="level", jdbcType=JdbcType.INTEGER),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="method", property="method", jdbcType=JdbcType.VARCHAR)
    })
    List<SysUrls> selectMany(SelectStatementProvider selectStatement);

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6821828+08:00", comments="Source Table: yx..sys_urls")
    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.6821828+08:00", comments="Source Table: yx..sys_urls")
    default int insert(SysUrls row) {
        return MyBatis3Utils.insert(this::insert, row, sysUrls, c ->
            c.map(id).toProperty("id")
            .map(pid).toProperty("pid")
            .map(types).toProperty("types")
            .map(level).toProperty("level")
            .map(url).toProperty("url")
            .map(name).toProperty("name")
            .map(method).toProperty("method")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6821828+08:00", comments="Source Table: yx..sys_urls")
    default int insertMultiple(Collection<SysUrls> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, sysUrls, c ->
            c.map(id).toProperty("id")
            .map(pid).toProperty("pid")
            .map(types).toProperty("types")
            .map(level).toProperty("level")
            .map(url).toProperty("url")
            .map(name).toProperty("name")
            .map(method).toProperty("method")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6831838+08:00", comments="Source Table: yx..sys_urls")
    default int insertSelective(SysUrls row) {
        return MyBatis3Utils.insert(this::insert, row, sysUrls, c ->
            c.map(id).toPropertyWhenPresent("id", row::getId)
            .map(pid).toPropertyWhenPresent("pid", row::getPid)
            .map(types).toPropertyWhenPresent("types", row::getTypes)
            .map(level).toPropertyWhenPresent("level", row::getLevel)
            .map(url).toPropertyWhenPresent("url", row::getUrl)
            .map(name).toPropertyWhenPresent("name", row::getName)
            .map(method).toPropertyWhenPresent("method", row::getMethod)
        );
    }

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

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

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6831838+08:00", comments="Source Table: yx..sys_urls")
    static UpdateDSL<UpdateModel> updateAllColumns(SysUrls row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalTo(row::getId)
                .set(pid).equalTo(row::getPid)
                .set(types).equalTo(row::getTypes)
                .set(level).equalTo(row::getLevel)
                .set(url).equalTo(row::getUrl)
                .set(name).equalTo(row::getName)
                .set(method).equalTo(row::getMethod);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6831838+08:00", comments="Source Table: yx..sys_urls")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(SysUrls row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalToWhenPresent(row::getId)
                .set(pid).equalToWhenPresent(row::getPid)
                .set(types).equalToWhenPresent(row::getTypes)
                .set(level).equalToWhenPresent(row::getLevel)
                .set(url).equalToWhenPresent(row::getUrl)
                .set(name).equalToWhenPresent(row::getName)
                .set(method).equalToWhenPresent(row::getMethod);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6831838+08:00", comments="Source Table: yx..sys_urls")
    default int updateByPrimaryKey(SysUrls row) {
        return update(c ->
            c.set(pid).equalTo(row::getPid)
            .set(types).equalTo(row::getTypes)
            .set(level).equalTo(row::getLevel)
            .set(url).equalTo(row::getUrl)
            .set(name).equalTo(row::getName)
            .set(method).equalTo(row::getMethod)
            .where(id, isEqualTo(row::getId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.684182+08:00", comments="Source Table: yx..sys_urls")
    default int updateByPrimaryKeySelective(SysUrls row) {
        return update(c ->
            c.set(pid).equalToWhenPresent(row::getPid)
            .set(types).equalToWhenPresent(row::getTypes)
            .set(level).equalToWhenPresent(row::getLevel)
            .set(url).equalToWhenPresent(row::getUrl)
            .set(name).equalToWhenPresent(row::getName)
            .set(method).equalToWhenPresent(row::getMethod)
            .where(id, isEqualTo(row::getId))
        );
    }
}