修复通道查询BUG

结构优化
648540858 2023-11-07 18:27:57 +08:00
parent 887f20524f
commit 2f9bd859f4
2 changed files with 8 additions and 3 deletions

View File

@ -332,14 +332,14 @@ public interface CommonGbChannelMapper {
@Param("groupDeviceIdForNew") String groupDeviceIdForNew);
@Select("<script> "+
"select * from wvp_common_gb_channel where common_gb_civilCode = '#{regionDeviceId}'" +
"select * from wvp_common_gb_channel where common_gb_civilCode = #{regionDeviceId}" +
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
"</script>")
List<CommonGbChannel> getChannelsInRegion(@Param("regionDeviceId") String regionDeviceId,
@Param("query") String query);
@Select("<script> "+
"select * from wvp_common_gb_channel where common_gb_business_group_id = '#{groupDeviceId}'" +
"select * from wvp_common_gb_channel where common_gb_business_group_id = #{groupDeviceId}" +
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
"</script>")
List<CommonGbChannel> queryChannelListInGroup(@Param("groupDeviceId") String groupDeviceId,
@ -349,5 +349,5 @@ public interface CommonGbChannelMapper {
"select * from wvp_common_gb_channel where 1=1 " +
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
"</script>")
List<CommonGbChannel> query(String query);
List<CommonGbChannel> query(@Param("query") String query);
}

View File

@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,6 +56,10 @@ public class CommonChannelController {
@RequestParam(required = true) int page,
@RequestParam(required = true) int count ){
if (ObjectUtils.isEmpty(query)) {
query = null;
}
assert !ObjectUtils.isEmpty(groupDeviceId);
return commonGbChannelService.queryChannelListInGroup(groupDeviceId, query, page, count);
}