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

import static jj.tech.paolu.repository.mybatis.dao.support.SysAdminMenuDynamicSqlSupport.*;
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.SysAdminMenu;
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 SysAdminMenuMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<SysAdminMenu>, CommonUpdateMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    BasicColumn[] selectList = BasicColumn.columnList(id, adminid, memuid);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="SysAdminMenuResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="adminid", property="adminid", jdbcType=JdbcType.VARCHAR),
        @Result(column="memuid", property="memuid", jdbcType=JdbcType.VARCHAR)
    })
    List<SysAdminMenu> selectMany(SelectStatementProvider selectStatement);

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    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.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    default int insert(SysAdminMenu row) {
        return MyBatis3Utils.insert(this::insert, row, sysAdminMenu, c ->
            c.map(id).toProperty("id")
            .map(adminid).toProperty("adminid")
            .map(memuid).toProperty("memuid")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    default int insertMultiple(Collection<SysAdminMenu> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, sysAdminMenu, c ->
            c.map(id).toProperty("id")
            .map(adminid).toProperty("adminid")
            .map(memuid).toProperty("memuid")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.696184+08:00", comments="Source Table: yx..sys_admin_menu")
    default int insertSelective(SysAdminMenu row) {
        return MyBatis3Utils.insert(this::insert, row, sysAdminMenu, c ->
            c.map(id).toPropertyWhenPresent("id", row::getId)
            .map(adminid).toPropertyWhenPresent("adminid", row::getAdminid)
            .map(memuid).toPropertyWhenPresent("memuid", row::getMemuid)
        );
    }

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

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

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

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

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

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6971916+08:00", comments="Source Table: yx..sys_admin_menu")
    static UpdateDSL<UpdateModel> updateAllColumns(SysAdminMenu row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalTo(row::getId)
                .set(adminid).equalTo(row::getAdminid)
                .set(memuid).equalTo(row::getMemuid);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6971916+08:00", comments="Source Table: yx..sys_admin_menu")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(SysAdminMenu row, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(id).equalToWhenPresent(row::getId)
                .set(adminid).equalToWhenPresent(row::getAdminid)
                .set(memuid).equalToWhenPresent(row::getMemuid);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6971916+08:00", comments="Source Table: yx..sys_admin_menu")
    default int updateByPrimaryKey(SysAdminMenu row) {
        return update(c ->
            c.set(adminid).equalTo(row::getAdminid)
            .set(memuid).equalTo(row::getMemuid)
            .where(id, isEqualTo(row::getId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2024-09-27T03:01:29.6971916+08:00", comments="Source Table: yx..sys_admin_menu")
    default int updateByPrimaryKeySelective(SysAdminMenu row) {
        return update(c ->
            c.set(adminid).equalToWhenPresent(row::getAdminid)
            .set(memuid).equalToWhenPresent(row::getMemuid)
            .where(id, isEqualTo(row::getId))
        );
    }
}