package com.nuvole.four.mapper; import com.nuvole.four.domain.ChannelOrgConfig; import com.nuvole.four.domain.dto.ChannelOrgConfigDto; import com.nuvole.four.domain.dto.ConfigOrgDetailChannel; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; public interface ChannelOrgConfigMapper { int deleteByPrimaryKey(Long id); int insert(ChannelOrgConfig record); int insertSelective(ChannelOrgConfig record); ChannelOrgConfig selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(ChannelOrgConfig record); int updateByPrimaryKey(ChannelOrgConfig record); /** * 查询机构通道配置列表 * 仅包含当前orgId的下级,不包含(二三四级等) * * @param orgId 选择的机构ID * @param orgName 查询条件机构名称 */ List selectAllList(@Param("orgId")Long orgId, @Param("orgName") String orgName); /** * 通过条件查询数据 * * @param orgId 选择的机构ID * @param channelId 选择的通道ID */ @Select({"select * from channel_org_config where org_id = #{orgId} and channel_info_id = #{channelId} "}) ChannelOrgConfig selectByOrgIdAndChannelId(@Param("orgId") Long orgId,@Param("channelId") Long channelId); /** * 通过orgId查询 默认的通道配置 * 同一orgId对应的默认通道仅有一条 */ @Select({"select * from channel_org_config where default_or_not = 1 and org_id = #{orgId} "}) ChannelOrgConfig queryDefaultChannelByOrgId(@Param("orgId") Long orgId); /** * 方法描述: 查询ChannelOrgConfig表的所有数据 * * @date 2024-04-11 20:42 **/ List selectAll(ChannelOrgConfig config); /** * 方法描述: 根据orgId、orgPId查询所有有效的机构通道配置数据 * * @date 2024-04-12 9:53 **/ @Select("(select a.org_id orgId,a.channel_info_id channelInfoId,a.`status`,a.default_or_not defaultOrNot,b.channel_name channelName,b.channel_code channelCode from channel_org_config a left join channel_info b on a.channel_info_id = b.id where a.org_id = #{pId} and a.`status` = 1 and b.`status` = 0) " + " union " + "(select a.org_id orgId,a.channel_info_id channelInfoId,a.`status`,a.default_or_not defaultOrNot,b.channel_name channelName,b.channel_code channelCode from channel_org_config a left join channel_info b on a.channel_info_id = b.id where a.org_id = #{orgId} and a.`status` = 1 and b.`status` = 0) ") List selectValidByCondition(@Param("orgId") Long orgId,@Param("pId") Long pId); /** * 方法描述:查询机构层级 =省市 查询展示的所有通道。 * * @date 2024-04-12 10:20 **/ @Select("select ci.id,ci.channel_name,ci.channel_code channelCode,ci.id channelInfoId,IFNULL(coc.status,0) status,IFNULL(coc.default_or_not,0) defaultOrNot from channel_info ci LEFT JOIN channel_org_config coc on ci.id = coc.channel_info_id and coc.org_id = #{orgId} where ci.`status` = 0 GROUP BY ci.id") List selectAllAndChannelInfo(@Param("orgId") Long orgId); }