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

import static jj.tech.paolu.repository.mybatis.dao.support.SysRoleUrlDynamicSqlSupport.*;
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.SysRoleUrl;
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 SysRoleUrlMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<SysRoleUrl>, CommonUpdateMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    BasicColumn[] selectList = BasicColumn.columnList(id, roleid, url, urltypes);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6931951+08:00", comments="Source Table: yx..sys_role_url")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="SysRoleUrlResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="roleid", property="roleid", jdbcType=JdbcType.VARCHAR),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="urltypes", property="urltypes", jdbcType=JdbcType.INTEGER)
    })
    List<SysRoleUrl> selectMany(SelectStatementProvider selectStatement);

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    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.6941864+08:00", comments="Source Table: yx..sys_role_url")
    default int insert(SysRoleUrl row) {
        return MyBatis3Utils.insert(this::insert, row, sysRoleUrl, c ->
            c.map(id).toProperty("id")
            .map(roleid).toProperty("roleid")
            .map(url).toProperty("url")
            .map(urltypes).toProperty("urltypes")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    default int insertMultiple(Collection<SysRoleUrl> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, sysRoleUrl, c ->
            c.map(id).toProperty("id")
            .map(roleid).toProperty("roleid")
            .map(url).toProperty("url")
            .map(urltypes).toProperty("urltypes")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    default int insertSelective(SysRoleUrl row) {
        return MyBatis3Utils.insert(this::insert, row, sysRoleUrl, c ->
            c.map(id).toPropertyWhenPresent("id", row::getId)
            .map(roleid).toPropertyWhenPresent("roleid", row::getRoleid)
            .map(url).toPropertyWhenPresent("url", row::getUrl)
            .map(urltypes).toPropertyWhenPresent("urltypes", row::getUrltypes)
        );
    }

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

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

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    static UpdateDSL<UpdateModel> updateAllColumns(SysRoleUrl row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalTo(row::getId)
                .set(roleid).equalTo(row::getRoleid)
                .set(url).equalTo(row::getUrl)
                .set(urltypes).equalTo(row::getUrltypes);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6941864+08:00", comments="Source Table: yx..sys_role_url")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(SysRoleUrl row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalToWhenPresent(row::getId)
                .set(roleid).equalToWhenPresent(row::getRoleid)
                .set(url).equalToWhenPresent(row::getUrl)
                .set(urltypes).equalToWhenPresent(row::getUrltypes);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6951891+08:00", comments="Source Table: yx..sys_role_url")
    default int updateByPrimaryKey(SysRoleUrl row) {
        return update(c ->
            c.set(roleid).equalTo(row::getRoleid)
            .set(url).equalTo(row::getUrl)
            .set(urltypes).equalTo(row::getUrltypes)
            .where(id, isEqualTo(row::getId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6951891+08:00", comments="Source Table: yx..sys_role_url")
    default int updateByPrimaryKeySelective(SysRoleUrl row) {
        return update(c ->
            c.set(roleid).equalToWhenPresent(row::getRoleid)
            .set(url).equalToWhenPresent(row::getUrl)
            .set(urltypes).equalToWhenPresent(row::getUrltypes)
            .where(id, isEqualTo(row::getId))
        );
    }
}