Class DictDAO

java.lang.Object
io.github.xezzon.zeroweb.common.jpa.BaseDAO<Dict, String, DictRepository>
io.github.xezzon.zeroweb.dict.internal.DictDAO
All Implemented Interfaces:
io.github.xezzon.zeroweb.core.trait.NewType<DictRepository>

@Repository @NullMarked public class DictDAO extends io.github.xezzon.zeroweb.common.jpa.BaseDAO<Dict, String, DictRepository>

字典数据访问对象

继承自 BaseDAO,提供字典数据的增删改查功能。 实现了分页查询、状态更新等业务方法。

Author:
xezzon
  • Nested Class Summary

    Nested classes/interfaces inherited from class io.github.xezzon.zeroweb.common.jpa.BaseDAO

    io.github.xezzon.zeroweb.common.jpa.BaseDAO.ICopier<T>, io.github.xezzon.zeroweb.common.jpa.BaseDAO.UpdateCriteriaBuilder<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Page<Dict>
    findAll(io.github.xezzon.zeroweb.core.odata.ODataQueryOption odata)
    分页查询
    io.github.xezzon.zeroweb.common.jpa.BaseDAO.ICopier<Dict>
    数据复制器实例
    long
    更新字典项的状态
    void
    upsert(Dict dict)
    插入或更新字典数据

    Methods inherited from class io.github.xezzon.zeroweb.common.jpa.BaseDAO

    get, partialUpdate

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCopier

      public io.github.xezzon.zeroweb.common.jpa.BaseDAO.ICopier<Dict> getCopier()
      数据复制器实例
      Specified by:
      getCopier in class io.github.xezzon.zeroweb.common.jpa.BaseDAO<Dict, String, DictRepository>
      Returns:
      字典数据复制器
    • findAll

      public org.springframework.data.domain.Page<Dict> findAll(io.github.xezzon.zeroweb.core.odata.ODataQueryOption odata)
      分页查询
      Overrides:
      findAll in class io.github.xezzon.zeroweb.common.jpa.BaseDAO<Dict, String, DictRepository>
      Parameters:
      odata - 前端查询参数
      Returns:
      字典列表
    • upsert

      public void upsert(Dict dict)

      插入或更新字典数据

      根据 tag、code 判断,如果字典存在,则跳过;否则保存。

      Parameters:
      dict - 字典信息
    • updateStatus

      public long updateStatus(Collection<String> ids, Boolean enabled)
      更新字典项的状态
      Parameters:
      ids - 需要更新的字典项ID集合
      enabled - 更新后的启用状态,true为启用,false为禁用
      Returns:
      更新影响的行数