当前位置: 首页 > news >正文

域名访问网站啥意思网络广告宣传平台

域名访问网站啥意思,网络广告宣传平台,做网站备案的公司,成都美食网站设计论文文章目录 输入筛选框实现效果图需求前端工具版本添加依赖main.js导入依赖 代码 后端代码对应 sql对应 mapper.xml 文件的动态 sql 输入筛选框实现 效果图 需求 通过筛选框,选择公司,传入后端,后端根据公司名称去文章的内容中进行模糊查询 …

文章目录

  • 输入筛选框实现
    • 效果图
    • 需求
    • 前端
      • 工具版本
        • 添加依赖
        • main.js导入依赖
      • 代码
    • 后端代码
      • 对应 sql
      • 对应 mapper.xml 文件的动态 sql

输入筛选框实现

效果图

在这里插入图片描述

需求

通过筛选框,选择公司,传入后端,后端根据公司名称去文章的内容中进行模糊查询

前端

工具版本

  • node.js v16.6.0
  • vue3

ui 使用 Element-Plus 实现

添加依赖

在 package.json 添加依赖,并 npm i 导入

"element-plus": "^1.1.0-beta.15",

main.js导入依赖

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { createApp } from 'vue'; // 使用 createApp 替换 Vue 的导入方式
import App from './App.vue';... const app = createApp(App); // 使用 createApp 创建 Vue 应用
app.use(ElementPlus)
app.mount('#app'); // 挂载 Vue 应用到 DOM 节点

代码

<el-selectv-model="companyCondition"multiplefilterableplaceholder="选择公司"style="width: 240px"collapse-tagsclearable@change="handleChangeCompany"
><el-optionv-for="item in companyOptions":key="item.value":label="item.label":value="item.value"/>
</el-select>
// script 对应数据
const companyOptions = ref([])
companyOptions.value = [{value: '阿里巴巴', label: '阿里巴巴'}, {value: '腾讯', label: '腾讯'}, {value: '字节跳动', label: '字节跳动'}]
let companyCondition = ref("")// 公司筛选框
const handleChangeCompany = () => {console.log(companyCondition.value)let condition = {pageNo: page.value,pageSize: size.value,param: {company: companyCondition.value}}// 使用 axios 向后端发送请求进行查询axios.post('/interview-experience/selectByCondition',condition).then(res => {console.log(res)// ...})
}

后端代码

前端发送查询的 company 名称为数组,后端使用 like 进行查询,通过 or 拼接即可

前端传入数据格式为:

param: {company: ['公司1', '公司2', '公司3']
}

对应 sql

select * from article where article.job_id = ? and (article.content like '公司1' or article.content like '公司2' or article.content like '公司3')

对应 mapper.xml 文件的动态 sql

<select id="selectByCondition" parameterType="com.javagpt.back.dto.InterviewArticleDto" resultMap="ArticleVOMap">select article.id                id,article.user_id           user_id,article.title             title,article.new_title         new_title,article.content           content,article.new_content       new_content,article.type              type,article.status            status,article.has_edit          has_edit,article.is_anonymous_flag is_anonymous_flag,article.create_at         create_at,article.edit_time         edit_time,article.job_id            job_id,article.content_type      content_type,article.source_id         source_id,career.name               career_namefrom interview_experience_article articleleft join career career on article.job_id = career.id<where><if test="dto.jobId != null and dto.jobId != ''">and article.job_id = #{dto.jobId,jdbcType=INTEGER}</if><if test="dto.company != null and dto.company.size > 0">and (<trim prefixOverrides="or"><foreach collection="dto.company" item="company">or article.content like concat('%',#{company,jdbcType=VARCHAR},'%')</foreach></trim>)</if></where>
</select>

在动态 sql 中 dto.company 就是我们通过前端传入的 param.company 的数组,不要关心命名,看一下动态 sql 怎么写就可以。

我们这里说的是第二个 <if> 标签里的语句

注意:

  1. <where> 标签可以过滤掉后边的第一个 and,因此 <if> 标签中可以直接添加 and,但是这里我们要拼接多个 or ,所以还要在外边加上左括号 ( ,因此这里 and 要和 左括号中间距离一个空格,要不然 where 标签过滤不掉后边的第一个 and。
  2. <foreach> 标签要生成多个 or 语句,因此每个语句前边都直接添加上 or,通过 <trim> 标签的 prefixOverrides 来去掉后边的第一个 or 即可
http://www.dt0577.cn/news/4536.html

相关文章:

  • 做推送用什么网站最火的网络推广平台
  • 可以做砍价活动的网站hao123网址之家官网
  • 自助健站什么是网站推广
  • 临沂门户网站制作什么是竞价
  • 免费做网站的好不好厦门seo服务
  • 强生网站还要怎样做哪里有网页设计公司
  • 成都网站建设龙兵网络优化大师手机版下载
  • 影视cms系统排名seo赚钱吗
  • 哪个网站音乐做的最好的关键词排名怎样
  • 英迈寰球网站建设郑州seo软件
  • 信息化建设 网站厦门关键词优化网站
  • 做别人一样的网站关键词搜索量排名
  • 单页面销售网站百度地图导航2022最新版下载
  • 网站建设与制作教程网络广告宣传怎么做
  • 网站可以用什么语言开发做中超最新积分榜
  • 郑州网站建设推荐美软科技微信推广多少钱一次
  • 网站建设费用无形资产如何摊销短视频营销策略
  • 有哪些html网页设计的比赛郑州seo询搜点网络效果佳
  • 建设工程消防验收网站seoul是什么国家
  • 网站模板下载源码谷歌首页
  • 武汉网站关键词常用的seo工具的是有哪些
  • WordPress博客reBorn专业seo服务商
  • 电影网站制作教程好不好百度seo刷排名网址
  • wordpress 缓存查询搜索引擎外部链接优化
  • 做独立购物网站优化关键词排名公司
  • 个人网站源码模板学seo推广
  • 做民宿加盟哪些网站比较好新闻网站软文平台
  • 东莞网站优化排名系统建立一个网站需要多少钱?
  • 发布网站的两种方法推广公司简介
  • 主题 外贸网站 模板下载网站流量统计工具