package com.zcxk.rmcp.core.dao;


import com.zcxk.core.common.pojo.UserCondition;
import com.zcxk.rmcp.api.dto.community.CommunityDto;
import com.zcxk.rmcp.api.vo.CommunityVo;
import com.zcxk.rmcp.core.entity.Community;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * @author linqingwei
 * @date 2021-07-19 9:45
 */
@Mapper
public interface CommunityMapper {

    /**
    * community:小区信息
    * @author Andy
    * @date 14:49 2021/8/3
    * @param community:
    * @return int
    **/
    int insertCommunity(Community community);

    /**
    * 修改小区信息
    * @author Andy
    * @date 14:49 2021/8/3
    * @param community:
    * @return int
    **/
    int updateByPrimaryKeySelective(Community community);

    /**
    *  查询名字是否唯一
    * @author Andy
    * @date 14:49 2021/8/3
    * @param community:
    * @return int
    **/
    int findByNameUnique(Community community);

    /**
    * 查询code
    * @author Andy
    * @date 14:49 2021/8/3
    * @param tenantId:
    * @return java.lang.String
    **/
    String getMaxCodeBySiteId(@Param("tenantId") String tenantId);

    /**
    * 查询小区信息
    * @author Andy
    * @date 14:49 2021/8/3
    * @param id:
    * @return com.zcxk.rmcp.core.entity.Community
    **/
    Community findCommunity(Integer id);

    /**
    * 查询小区集合
    * @author Andy
    * @date 14:50 2021/8/3
    * @param community:
    * @param query:
    * @return java.util.List<com.zcxk.rmcp.api.vo.CommunityVo>
    **/
    List<CommunityVo> listCommunity(@Param("dto") Community community, @Param("condition") UserCondition query);

    /**
    * 查询名字
    * @author Andy
    * @date 14:50 2021/8/3
    * @param tenantId:
    * @param name:
    * @return com.zcxk.rmcp.core.entity.Community
    **/
    Community findByName(@Param("tenantId") String tenantId, @Param("name") String name);
}