VehiclePermitMapper.java 2.33 KB
package cn.com.glsx.admin.modules.mapper;

import cn.com.glsx.admin.modules.entity.VehiclePermit;
import cn.com.glsx.admin.modules.model.view.VehiclePermitDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

@Mapper
public interface VehiclePermitMapper extends CommonBaseMapper<VehiclePermit> {

    /**
     * 获取授权数据
     *
     * @param receiverId
     * @param contentType
     * @return
     */
    List<VehiclePermit> selectByReceiverIdAndContentType(@Param("receiverId") Long receiverId, @Param("contentType") Integer contentType);

    /**
     * 获取被授权人的全部未删除授权数据,包含未生效及已过期数据
     *
     * @param receiverId 被授权人id
     * @param contentType 授权内容类型
     * @return 全部未删除授权数据
     */
    List<VehiclePermit> selectAllByReceiverIdAndContentType(@Param("receiverId") Long receiverId,
                                                            @Param("contentType") Integer contentType);

    /**
     * 获取授权数据
     *
     * @param receiverId
     * @param contentType
     * @return
     */
    List<VehiclePermitDTO> selectPermitVehicleByReceiverId(@Param("receiverId") Long receiverId, @Param("contentType") Integer contentType);

    /**
     * 批量新增或续期指定授权数据
     *
     * @param list
     * @return
     */
    int insertOrUpdatePermits(@Param("list") List<VehiclePermit> list);

    /**
     * 批量新增长期授权,已存在的授权(包括限时授权)保持不变
     *
     * @param list 长期授权数据
     * @return 新增数量
     */
    int insertLongTermPermitsIfAbsent(@Param("list") List<VehiclePermit> list);

    /**
     * 删除授权数据
     *
     * @param contentIds
     * @param receiverId
     * @param contentType
     * @return
     */
    int deleteExistedPermit(@Param("contentIds") Collection<Long> contentIds, @Param("receiverId") Long receiverId, @Param("contentType") Integer contentType);

    /**
     * 删除被授权人的授权数据
     *
     * @param receiverId
     * @param contentType
     * @return
     */
    int deletePermitByReceiverId(@Param("receiverId") Long receiverId, @Param("contentType") Integer contentType);

}