package com.unis.module.coding.dal.mysql.kqxx;

import java.util.*;

import com.unis.framework.common.pojo.PageResult;
import com.unis.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.unis.framework.mybatis.core.mapper.BaseMapperX;
import com.unis.module.coding.dal.dataobject.kqxx.KqxxDO;
import com.unis.module.system.dal.dataobject.dict.DictDataDO;
import org.apache.ibatis.annotations.Mapper;
import com.unis.module.coding.controller.admin.kqxx.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 库区信息; Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface KqxxMapper extends BaseMapperX<KqxxDO> {

    default PageResult<KqxxDO> selectPage(KqxxPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KqxxDO>()
                .eqIfPresent(KqxxDO::getDwid, reqVO.getDwid())
                .eqIfPresent(KqxxDO::getKqmc, reqVO.getKqmc())
                .eqIfPresent(KqxxDO::getKqdm, reqVO.getKqdm())
                .eqIfPresent(KqxxDO::getJc, reqVO.getJc())
                .eqIfPresent(KqxxDO::getJd, reqVO.getJd())
                .eqIfPresent(KqxxDO::getWd, reqVO.getWd())
                .eqIfPresent(KqxxDO::getYzbm, reqVO.getYzbm())
                .eqIfPresent(KqxxDO::getSheng, reqVO.getSheng())
                .eqIfPresent(KqxxDO::getKqfzr, reqVO.getKqfzr())
                .eqIfPresent(KqxxDO::getLxdh, reqVO.getLxdh())
                .eqIfPresent(KqxxDO::getZdmj, reqVO.getZdmj())
                .eqIfPresent(KqxxDO::getResid, reqVO.getResid())
                .betweenIfPresent(KqxxDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(KqxxDO::getShi, reqVO.getShi())
                .eqIfPresent(KqxxDO::getXian, reqVO.getXian())
                .eqIfPresent(KqxxDO::getJtdz, reqVO.getJtdz())
                .eqIfPresent(KqxxDO::getSsfrqy, reqVO.getSsfrqy())
                .eqIfPresent(KqxxDO::getShxydm, reqVO.getShxydm())
                .orderByDesc(KqxxDO::getId));
    }

    String getBySHXYDM(@Param("tyxydm") String tyxydm);
    int deleteByKqId(@Param("id")Long id);

    default List<KqxxDO> selectListByDwId(Long dwId) {
        return selectList(KqxxDO::getDwid, dwId);
    }
}