27 changed files with 2004 additions and 140 deletions
-
104chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuMarketInfoController.java
-
109chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysKnowledgeBaseController.java
-
24chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java
-
28chenhai-system/src/main/java/com/chenhai/muhu/domain/MerchantMapInfo.java
-
206chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuMarketInfo.java
-
28chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuServiceGuide.java
-
61chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuMarketInfoMapper.java
-
61chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuMarketInfoService.java
-
95chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuMarketInfoServiceImpl.java
-
187chenhai-system/src/main/java/com/chenhai/system/domain/SysKnowledgeBase.java
-
79chenhai-system/src/main/java/com/chenhai/system/mapper/SysKnowledgeBaseMapper.java
-
69chenhai-system/src/main/java/com/chenhai/system/service/ISysKnowledgeBaseService.java
-
221chenhai-system/src/main/java/com/chenhai/system/service/impl/SysKnowledgeBaseServiceImpl.java
-
65chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java
-
5chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java
-
24chenhai-system/src/main/resources/mapper/muhu/MerchantMapInfoMapper.xml
-
110chenhai-system/src/main/resources/mapper/muhu/MuhuMarketInfoMapper.xml
-
12chenhai-system/src/main/resources/mapper/muhu/MuhuServiceGuideMapper.xml
-
133chenhai-system/src/main/resources/mapper/system/SysKnowledgeBaseMapper.xml
-
2chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml
-
44chenhai-ui/src/api/muhu/market.js
-
10chenhai-ui/src/api/system/base.js
-
11chenhai-ui/src/views/muhu/guide/index.vue
-
8chenhai-ui/src/views/muhu/info/index.vue
-
310chenhai-ui/src/views/muhu/market/index.vue
-
94chenhai-ui/src/views/system/base/index.vue
-
2chenhai-ui/src/views/vet/certificate/index.vue
@ -0,0 +1,104 @@ |
|||||
|
package com.chenhai.web.controller.muhu; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.PutMapping; |
||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import com.chenhai.common.annotation.Log; |
||||
|
import com.chenhai.common.core.controller.BaseController; |
||||
|
import com.chenhai.common.core.domain.AjaxResult; |
||||
|
import com.chenhai.common.enums.BusinessType; |
||||
|
import com.chenhai.muhu.domain.MuhuMarketInfo; |
||||
|
import com.chenhai.muhu.service.IMuhuMarketInfoService; |
||||
|
import com.chenhai.common.utils.poi.ExcelUtil; |
||||
|
import com.chenhai.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 市场信息Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/muhu/market") |
||||
|
public class MuhuMarketInfoController extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private IMuhuMarketInfoService muhuMarketInfoService; |
||||
|
|
||||
|
/** |
||||
|
* 查询市场信息列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:list') or @ss.hasRole('muhu')") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<MuhuMarketInfo> list = muhuMarketInfoService.selectMuhuMarketInfoList(muhuMarketInfo); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出市场信息列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:export') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "市场信息", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response, MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
List<MuhuMarketInfo> list = muhuMarketInfoService.selectMuhuMarketInfoList(muhuMarketInfo); |
||||
|
ExcelUtil<MuhuMarketInfo> util = new ExcelUtil<MuhuMarketInfo>(MuhuMarketInfo.class); |
||||
|
util.exportExcel(response, list, "市场信息数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取市场信息详细信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:query') or @ss.hasRole('muhu')") |
||||
|
@GetMapping(value = "/{id}") |
||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
|
{ |
||||
|
return success(muhuMarketInfoService.selectMuhuMarketInfoById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增市场信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:add') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "市场信息", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult add(@RequestBody MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
return toAjax(muhuMarketInfoService.insertMuhuMarketInfo(muhuMarketInfo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改市场信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:edit') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "市场信息", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult edit(@RequestBody MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
return toAjax(muhuMarketInfoService.updateMuhuMarketInfo(muhuMarketInfo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除市场信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('muhu:market:remove') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "市场信息", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public AjaxResult remove(@PathVariable Long[] ids) |
||||
|
{ |
||||
|
return toAjax(muhuMarketInfoService.deleteMuhuMarketInfoByIds(ids)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,109 @@ |
|||||
|
package com.chenhai.web.controller.system; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import com.chenhai.common.annotation.Log; |
||||
|
import com.chenhai.common.core.controller.BaseController; |
||||
|
import com.chenhai.common.core.domain.AjaxResult; |
||||
|
import com.chenhai.common.enums.BusinessType; |
||||
|
import com.chenhai.system.domain.SysKnowledgeBase; |
||||
|
import com.chenhai.system.service.ISysKnowledgeBaseService; |
||||
|
import com.chenhai.common.utils.poi.ExcelUtil; |
||||
|
import com.chenhai.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 知识库Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/system/base") |
||||
|
public class SysKnowledgeBaseController extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private ISysKnowledgeBaseService sysKnowledgeBaseService; |
||||
|
|
||||
|
/** |
||||
|
* 查询知识库列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:list') or @ss.hasRole('muhu')") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<SysKnowledgeBase> list = sysKnowledgeBaseService.selectSysKnowledgeBaseList(sysKnowledgeBase); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出知识库列表 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:export') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "知识库", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response, SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
List<SysKnowledgeBase> list = sysKnowledgeBaseService.selectSysKnowledgeBaseList(sysKnowledgeBase); |
||||
|
ExcelUtil<SysKnowledgeBase> util = new ExcelUtil<SysKnowledgeBase>(SysKnowledgeBase.class); |
||||
|
util.exportExcel(response, list, "知识库数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取知识库详细信息 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:query') or @ss.hasRole('muhu')") |
||||
|
@GetMapping(value = "/{id}") |
||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
|
{ |
||||
|
return success(sysKnowledgeBaseService.selectSysKnowledgeBaseById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增知识库 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:add') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "知识库", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult add(@RequestBody SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
return toAjax(sysKnowledgeBaseService.insertSysKnowledgeBase(sysKnowledgeBase)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改知识库 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:edit') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "知识库", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult edit(@RequestBody SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
return toAjax(sysKnowledgeBaseService.updateSysKnowledgeBase(sysKnowledgeBase)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除知识库 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:remove') or @ss.hasRole('muhu')") |
||||
|
@Log(title = "知识库", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public AjaxResult remove(@PathVariable Long[] ids) |
||||
|
{ |
||||
|
return toAjax(sysKnowledgeBaseService.deleteSysKnowledgeBaseByIds(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 模糊搜索知识库 |
||||
|
*/ |
||||
|
@PreAuthorize("@ss.hasPermi('system:base:search') or @ss.hasRole('muhu')") |
||||
|
@GetMapping("/search") |
||||
|
public TableDataInfo search(@RequestParam(value = "keyword", required = false) String keyword) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<SysKnowledgeBase> list = sysKnowledgeBaseService.searchSysKnowledgeBaseByKeyword(keyword); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,206 @@ |
|||||
|
package com.chenhai.muhu.domain; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import com.chenhai.common.annotation.Excel; |
||||
|
import com.chenhai.common.core.domain.BaseEntity; |
||||
|
|
||||
|
/** |
||||
|
* 市场信息对象 muhu_market_info |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public class MuhuMarketInfo extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键ID */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 信息标题 */ |
||||
|
@Excel(name = "信息标题") |
||||
|
private String title; |
||||
|
|
||||
|
/** 详细内容/报告正文 */ |
||||
|
@Excel(name = "详细内容/报告正文") |
||||
|
private String content; |
||||
|
|
||||
|
/** 信息类型:1-农牧产品销售;2-饲草料销售;3-畜产品市场价格;4-饲料供应商价格;5-市场趋势报告 */ |
||||
|
@Excel(name = "信息类型:1-农牧产品销售;2-饲草料销售;3-畜产品市场价格;4-饲料供应商价格;5-市场趋势报告") |
||||
|
private String infoType; |
||||
|
|
||||
|
/** 发布来源:1-管理员发布;2-系统关联(如关联管理端的市场动态) */ |
||||
|
@Excel(name = "发布来源:1-管理员发布;2-系统关联", readConverterExp = "如=关联管理端的市场动态") |
||||
|
private String publishSource; |
||||
|
|
||||
|
/** 地区/市场范围 */ |
||||
|
@Excel(name = "地区/市场范围") |
||||
|
private String region; |
||||
|
|
||||
|
/** 附件链接 */ |
||||
|
@Excel(name = "附件链接") |
||||
|
private String attachmentUrl; |
||||
|
|
||||
|
/** 查看次数 */ |
||||
|
@Excel(name = "查看次数") |
||||
|
private Long viewCount; |
||||
|
|
||||
|
/** 发布者ID */ |
||||
|
@Excel(name = "发布者ID") |
||||
|
private Long publishUserId; |
||||
|
|
||||
|
/** 是否置顶(0-否,1-是) */ |
||||
|
@Excel(name = "是否置顶", readConverterExp = "0=-否,1-是") |
||||
|
private String isTop; |
||||
|
|
||||
|
/** 状态(0-下架/隐藏,1-正常发布) */ |
||||
|
@Excel(name = "状态", readConverterExp = "0=-下架/隐藏,1-正常发布") |
||||
|
private String status; |
||||
|
|
||||
|
/** 发布时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") |
||||
|
private Date publishTime; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setTitle(String title) |
||||
|
{ |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() |
||||
|
{ |
||||
|
return title; |
||||
|
} |
||||
|
|
||||
|
public void setContent(String content) |
||||
|
{ |
||||
|
this.content = content; |
||||
|
} |
||||
|
|
||||
|
public String getContent() |
||||
|
{ |
||||
|
return content; |
||||
|
} |
||||
|
|
||||
|
public void setInfoType(String infoType) |
||||
|
{ |
||||
|
this.infoType = infoType; |
||||
|
} |
||||
|
|
||||
|
public String getInfoType() |
||||
|
{ |
||||
|
return infoType; |
||||
|
} |
||||
|
|
||||
|
public void setPublishSource(String publishSource) |
||||
|
{ |
||||
|
this.publishSource = publishSource; |
||||
|
} |
||||
|
|
||||
|
public String getPublishSource() |
||||
|
{ |
||||
|
return publishSource; |
||||
|
} |
||||
|
|
||||
|
public void setRegion(String region) |
||||
|
{ |
||||
|
this.region = region; |
||||
|
} |
||||
|
|
||||
|
public String getRegion() |
||||
|
{ |
||||
|
return region; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentUrl(String attachmentUrl) |
||||
|
{ |
||||
|
this.attachmentUrl = attachmentUrl; |
||||
|
} |
||||
|
|
||||
|
public String getAttachmentUrl() |
||||
|
{ |
||||
|
return attachmentUrl; |
||||
|
} |
||||
|
|
||||
|
public void setViewCount(Long viewCount) |
||||
|
{ |
||||
|
this.viewCount = viewCount; |
||||
|
} |
||||
|
|
||||
|
public Long getViewCount() |
||||
|
{ |
||||
|
return viewCount; |
||||
|
} |
||||
|
|
||||
|
public void setPublishUserId(Long publishUserId) |
||||
|
{ |
||||
|
this.publishUserId = publishUserId; |
||||
|
} |
||||
|
|
||||
|
public Long getPublishUserId() |
||||
|
{ |
||||
|
return publishUserId; |
||||
|
} |
||||
|
|
||||
|
public void setIsTop(String isTop) |
||||
|
{ |
||||
|
this.isTop = isTop; |
||||
|
} |
||||
|
|
||||
|
public String getIsTop() |
||||
|
{ |
||||
|
return isTop; |
||||
|
} |
||||
|
|
||||
|
public void setStatus(String status) |
||||
|
{ |
||||
|
this.status = status; |
||||
|
} |
||||
|
|
||||
|
public String getStatus() |
||||
|
{ |
||||
|
return status; |
||||
|
} |
||||
|
|
||||
|
public void setPublishTime(Date publishTime) |
||||
|
{ |
||||
|
this.publishTime = publishTime; |
||||
|
} |
||||
|
|
||||
|
public Date getPublishTime() |
||||
|
{ |
||||
|
return publishTime; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("title", getTitle()) |
||||
|
.append("content", getContent()) |
||||
|
.append("infoType", getInfoType()) |
||||
|
.append("publishSource", getPublishSource()) |
||||
|
.append("region", getRegion()) |
||||
|
.append("attachmentUrl", getAttachmentUrl()) |
||||
|
.append("viewCount", getViewCount()) |
||||
|
.append("publishUserId", getPublishUserId()) |
||||
|
.append("isTop", getIsTop()) |
||||
|
.append("status", getStatus()) |
||||
|
.append("publishTime", getPublishTime()) |
||||
|
.append("updateTime", getUpdateTime()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.chenhai.muhu.mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.muhu.domain.MuhuMarketInfo; |
||||
|
|
||||
|
/** |
||||
|
* 市场信息Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public interface MuhuMarketInfoMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询市场信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 市场信息 |
||||
|
*/ |
||||
|
public MuhuMarketInfo selectMuhuMarketInfoById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询市场信息列表 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 市场信息集合 |
||||
|
*/ |
||||
|
public List<MuhuMarketInfo> selectMuhuMarketInfoList(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 新增市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 修改市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 删除市场信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteMuhuMarketInfoById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除市场信息 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteMuhuMarketInfoByIds(Long[] ids); |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.chenhai.muhu.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.muhu.domain.MuhuMarketInfo; |
||||
|
|
||||
|
/** |
||||
|
* 市场信息Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public interface IMuhuMarketInfoService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询市场信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 市场信息 |
||||
|
*/ |
||||
|
public MuhuMarketInfo selectMuhuMarketInfoById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询市场信息列表 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 市场信息集合 |
||||
|
*/ |
||||
|
public List<MuhuMarketInfo> selectMuhuMarketInfoList(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 新增市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 修改市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除市场信息 |
||||
|
* |
||||
|
* @param ids 需要删除的市场信息主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteMuhuMarketInfoByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除市场信息信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteMuhuMarketInfoById(Long id); |
||||
|
} |
||||
@ -0,0 +1,95 @@ |
|||||
|
package com.chenhai.muhu.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.common.utils.DateUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.chenhai.muhu.mapper.MuhuMarketInfoMapper; |
||||
|
import com.chenhai.muhu.domain.MuhuMarketInfo; |
||||
|
import com.chenhai.muhu.service.IMuhuMarketInfoService; |
||||
|
|
||||
|
/** |
||||
|
* 市场信息Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class MuhuMarketInfoServiceImpl implements IMuhuMarketInfoService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private MuhuMarketInfoMapper muhuMarketInfoMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询市场信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 市场信息 |
||||
|
*/ |
||||
|
@Override |
||||
|
public MuhuMarketInfo selectMuhuMarketInfoById(Long id) |
||||
|
{ |
||||
|
return muhuMarketInfoMapper.selectMuhuMarketInfoById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询市场信息列表 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 市场信息 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<MuhuMarketInfo> selectMuhuMarketInfoList(MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
return muhuMarketInfoMapper.selectMuhuMarketInfoList(muhuMarketInfo); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
return muhuMarketInfoMapper.insertMuhuMarketInfo(muhuMarketInfo); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改市场信息 |
||||
|
* |
||||
|
* @param muhuMarketInfo 市场信息 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateMuhuMarketInfo(MuhuMarketInfo muhuMarketInfo) |
||||
|
{ |
||||
|
muhuMarketInfo.setUpdateTime(DateUtils.getNowDate()); |
||||
|
return muhuMarketInfoMapper.updateMuhuMarketInfo(muhuMarketInfo); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除市场信息 |
||||
|
* |
||||
|
* @param ids 需要删除的市场信息主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteMuhuMarketInfoByIds(Long[] ids) |
||||
|
{ |
||||
|
return muhuMarketInfoMapper.deleteMuhuMarketInfoByIds(ids); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除市场信息信息 |
||||
|
* |
||||
|
* @param id 市场信息主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteMuhuMarketInfoById(Long id) |
||||
|
{ |
||||
|
return muhuMarketInfoMapper.deleteMuhuMarketInfoById(id); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,187 @@ |
|||||
|
package com.chenhai.system.domain; |
||||
|
|
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import com.chenhai.common.annotation.Excel; |
||||
|
import com.chenhai.common.core.domain.BaseEntity; |
||||
|
|
||||
|
/** |
||||
|
* 知识库对象 sys_knowledge_base |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public class SysKnowledgeBase extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 知识ID */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 知识标题 */ |
||||
|
@Excel(name = "知识标题") |
||||
|
private String title; |
||||
|
|
||||
|
/** 知识类别 */ |
||||
|
@Excel(name = "知识类别") |
||||
|
private String category; |
||||
|
|
||||
|
/** 关键词,逗号分隔(用于搜索) */ |
||||
|
@Excel(name = "关键词,逗号分隔", readConverterExp = "用=于搜索") |
||||
|
private String keywords; |
||||
|
|
||||
|
/** 可能病症,逗号分隔 */ |
||||
|
@Excel(name = "可能病症,逗号分隔") |
||||
|
private String possibleDiseases; |
||||
|
|
||||
|
/** 严重程度:轻度/中度/重度 */ |
||||
|
@Excel(name = "严重程度:轻度/中度/重度") |
||||
|
private String severityLevel; |
||||
|
|
||||
|
/** 建议措施 */ |
||||
|
@Excel(name = "建议措施") |
||||
|
private String suggestions; |
||||
|
|
||||
|
/** 详细内容 */ |
||||
|
@Excel(name = "详细内容") |
||||
|
private String content; |
||||
|
|
||||
|
/** 适用物种,逗号分隔 */ |
||||
|
@Excel(name = "适用物种,逗号分隔") |
||||
|
private String suitableSpecies; |
||||
|
|
||||
|
/** 查看次数 */ |
||||
|
@Excel(name = "查看次数") |
||||
|
private Long viewCount; |
||||
|
|
||||
|
/** 状态(0-草稿 1-已发布) */ |
||||
|
@Excel(name = "状态", readConverterExp = "0=-草稿,1=-已发布") |
||||
|
private String status; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setTitle(String title) |
||||
|
{ |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() |
||||
|
{ |
||||
|
return title; |
||||
|
} |
||||
|
|
||||
|
public void setCategory(String category) |
||||
|
{ |
||||
|
this.category = category; |
||||
|
} |
||||
|
|
||||
|
public String getCategory() |
||||
|
{ |
||||
|
return category; |
||||
|
} |
||||
|
|
||||
|
public void setKeywords(String keywords) |
||||
|
{ |
||||
|
this.keywords = keywords; |
||||
|
} |
||||
|
|
||||
|
public String getKeywords() |
||||
|
{ |
||||
|
return keywords; |
||||
|
} |
||||
|
|
||||
|
public void setPossibleDiseases(String possibleDiseases) |
||||
|
{ |
||||
|
this.possibleDiseases = possibleDiseases; |
||||
|
} |
||||
|
|
||||
|
public String getPossibleDiseases() |
||||
|
{ |
||||
|
return possibleDiseases; |
||||
|
} |
||||
|
|
||||
|
public void setSeverityLevel(String severityLevel) |
||||
|
{ |
||||
|
this.severityLevel = severityLevel; |
||||
|
} |
||||
|
|
||||
|
public String getSeverityLevel() |
||||
|
{ |
||||
|
return severityLevel; |
||||
|
} |
||||
|
|
||||
|
public void setSuggestions(String suggestions) |
||||
|
{ |
||||
|
this.suggestions = suggestions; |
||||
|
} |
||||
|
|
||||
|
public String getSuggestions() |
||||
|
{ |
||||
|
return suggestions; |
||||
|
} |
||||
|
|
||||
|
public void setContent(String content) |
||||
|
{ |
||||
|
this.content = content; |
||||
|
} |
||||
|
|
||||
|
public String getContent() |
||||
|
{ |
||||
|
return content; |
||||
|
} |
||||
|
|
||||
|
public void setSuitableSpecies(String suitableSpecies) |
||||
|
{ |
||||
|
this.suitableSpecies = suitableSpecies; |
||||
|
} |
||||
|
|
||||
|
public String getSuitableSpecies() |
||||
|
{ |
||||
|
return suitableSpecies; |
||||
|
} |
||||
|
|
||||
|
public void setViewCount(Long viewCount) |
||||
|
{ |
||||
|
this.viewCount = viewCount; |
||||
|
} |
||||
|
|
||||
|
public Long getViewCount() |
||||
|
{ |
||||
|
return viewCount; |
||||
|
} |
||||
|
|
||||
|
public void setStatus(String status) |
||||
|
{ |
||||
|
this.status = status; |
||||
|
} |
||||
|
|
||||
|
public String getStatus() |
||||
|
{ |
||||
|
return status; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("title", getTitle()) |
||||
|
.append("category", getCategory()) |
||||
|
.append("keywords", getKeywords()) |
||||
|
.append("possibleDiseases", getPossibleDiseases()) |
||||
|
.append("severityLevel", getSeverityLevel()) |
||||
|
.append("suggestions", getSuggestions()) |
||||
|
.append("content", getContent()) |
||||
|
.append("suitableSpecies", getSuitableSpecies()) |
||||
|
.append("viewCount", getViewCount()) |
||||
|
.append("status", getStatus()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,79 @@ |
|||||
|
package com.chenhai.system.mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.system.domain.SysKnowledgeBase; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* 知识库Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public interface SysKnowledgeBaseMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询知识库 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 知识库 |
||||
|
*/ |
||||
|
public SysKnowledgeBase selectSysKnowledgeBaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询知识库列表 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
public List<SysKnowledgeBase> selectSysKnowledgeBaseList(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 新增知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 修改知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 删除知识库 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysKnowledgeBaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除知识库 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysKnowledgeBaseByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 模糊搜索知识库(单关键词) |
||||
|
* |
||||
|
* @param keyword 搜索关键词 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
public List<SysKnowledgeBase> searchSysKnowledgeBaseByKeyword(String keyword); |
||||
|
|
||||
|
/** |
||||
|
* 模糊搜索知识库(多关键词) |
||||
|
* |
||||
|
* @param keywords 搜索关键词列表 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
public List<SysKnowledgeBase> searchByKeywords(@Param("keywords") List<String> keywords); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
package com.chenhai.system.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.chenhai.system.domain.SysKnowledgeBase; |
||||
|
|
||||
|
/** |
||||
|
* 知识库Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
public interface ISysKnowledgeBaseService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询知识库 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 知识库 |
||||
|
*/ |
||||
|
public SysKnowledgeBase selectSysKnowledgeBaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询知识库列表 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
public List<SysKnowledgeBase> selectSysKnowledgeBaseList(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 新增知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 修改知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除知识库 |
||||
|
* |
||||
|
* @param ids 需要删除的知识库主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysKnowledgeBaseByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除知识库信息 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSysKnowledgeBaseById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 模糊搜索知识库 |
||||
|
* |
||||
|
* @param keyword 搜索关键词 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
public List<SysKnowledgeBase> searchSysKnowledgeBaseByKeyword(String keyword); |
||||
|
} |
||||
@ -0,0 +1,221 @@ |
|||||
|
package com.chenhai.system.service.impl; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import com.chenhai.common.utils.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.chenhai.system.mapper.SysKnowledgeBaseMapper; |
||||
|
import com.chenhai.system.domain.SysKnowledgeBase; |
||||
|
import com.chenhai.system.service.ISysKnowledgeBaseService; |
||||
|
|
||||
|
/** |
||||
|
* 知识库Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2026-01-04 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysKnowledgeBaseServiceImpl implements ISysKnowledgeBaseService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private SysKnowledgeBaseMapper sysKnowledgeBaseMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询知识库 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 知识库 |
||||
|
*/ |
||||
|
@Override |
||||
|
public SysKnowledgeBase selectSysKnowledgeBaseById(Long id) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.selectSysKnowledgeBaseById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询知识库列表 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 知识库 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SysKnowledgeBase> selectSysKnowledgeBaseList(SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.selectSysKnowledgeBaseList(sysKnowledgeBase); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.insertSysKnowledgeBase(sysKnowledgeBase); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改知识库 |
||||
|
* |
||||
|
* @param sysKnowledgeBase 知识库 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateSysKnowledgeBase(SysKnowledgeBase sysKnowledgeBase) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.updateSysKnowledgeBase(sysKnowledgeBase); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除知识库 |
||||
|
* |
||||
|
* @param ids 需要删除的知识库主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSysKnowledgeBaseByIds(Long[] ids) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.deleteSysKnowledgeBaseByIds(ids); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除知识库信息 |
||||
|
* |
||||
|
* @param id 知识库主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSysKnowledgeBaseById(Long id) |
||||
|
{ |
||||
|
return sysKnowledgeBaseMapper.deleteSysKnowledgeBaseById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 模糊搜索知识库 |
||||
|
* |
||||
|
* @param keyword 搜索关键词 |
||||
|
* @return 知识库集合 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SysKnowledgeBase> searchSysKnowledgeBaseByKeyword(String keyword) { |
||||
|
System.out.println("=== 开始搜索 ==="); |
||||
|
System.out.println("原始输入: " + keyword); |
||||
|
|
||||
|
// 1. 关键词提取 |
||||
|
List<String> keywords = extractKeywords(keyword); |
||||
|
System.out.println("提取的关键词: " + keywords); |
||||
|
|
||||
|
// 2. 如果提取到关键词,使用多关键词搜索 |
||||
|
if (!keywords.isEmpty()) { |
||||
|
System.out.println("使用多关键词搜索: " + keywords); |
||||
|
return sysKnowledgeBaseMapper.searchByKeywords(keywords); |
||||
|
} |
||||
|
|
||||
|
// 3. 回退到原逻辑 |
||||
|
System.out.println("使用原单关键词搜索: " + keyword); |
||||
|
return sysKnowledgeBaseMapper.searchSysKnowledgeBaseByKeyword(keyword); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 关键词提取方法(改进版) |
||||
|
*/ |
||||
|
private List<String> extractKeywords(String input) { |
||||
|
if (StringUtils.isEmpty(input)) { |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
// 中文停用词(扩展版) |
||||
|
List<String> stopWords = Arrays.asList( |
||||
|
"我的", "你的", "他的", "她的", "我们的", |
||||
|
"怎么办", "怎么", "如何", "什么", "为什么", "为何", "怎样", |
||||
|
"原因", "症状", "治疗", "预防", "诊断", "救治", |
||||
|
"请问", "求助", "帮忙", "帮帮我", "请问一下", "你好", |
||||
|
"症状", "表现", "特征", "现象", "情况", "问题", |
||||
|
"的", "了", "啊", "呢", "吗", "吧", "呀", "有" |
||||
|
); |
||||
|
|
||||
|
// 移除标点符号 |
||||
|
String cleaned = input.replaceAll("[,。!?、;:'\"(),.]", " "); |
||||
|
|
||||
|
List<String> keywords = new ArrayList<>(); |
||||
|
|
||||
|
// 优先提取兽医领域关键词 |
||||
|
String[] vetKeywords = { |
||||
|
// 症状 |
||||
|
"咳嗽", "发烧", "发热", "腹泻", "拉稀", "呕吐", "厌食", "不吃", "呼吸困难", |
||||
|
"喘气", "打喷嚏", "流鼻涕", "流泪", "眼屎", "皮肤", "瘙痒", "脱毛", "流血", |
||||
|
"肿胀", "溃烂", "瘸腿", "跛行", "抽搐", "痉挛", "昏迷", |
||||
|
// 疾病 |
||||
|
"感染", "炎症", "病毒", "细菌", "寄生虫", "真菌", "传染病", |
||||
|
// 治疗 |
||||
|
"疫苗", "免疫", "驱虫", "消毒", "抗生素", "手术", "治疗", "用药", |
||||
|
// 皮肤病相关(重点!) |
||||
|
"湿疹", "皮炎", "皮肤病", "皮肤", "瘙痒", "痒", "脱毛", "红肿", |
||||
|
"溃烂", "皮疹", "红斑", "水泡", "脓疱", "结痂", "脱屑" |
||||
|
}; |
||||
|
|
||||
|
// 检查是否包含兽医关键词 |
||||
|
for (String vetWord : vetKeywords) { |
||||
|
if (cleaned.contains(vetWord) && !keywords.contains(vetWord)) { |
||||
|
keywords.add(vetWord); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 如果没找到专业词汇,使用简单分词 |
||||
|
if (keywords.isEmpty()) { |
||||
|
// 简单分词:取2-4个字符的组合 |
||||
|
cleaned = cleaned.replaceAll("\\s+", ""); |
||||
|
|
||||
|
for (int len = 4; len >= 2; len--) { |
||||
|
for (int i = 0; i <= cleaned.length() - len; i++) { |
||||
|
String word = cleaned.substring(i, i + len); |
||||
|
if (!stopWords.contains(word) && |
||||
|
!isNumeric(word) && |
||||
|
!keywords.contains(word)) { |
||||
|
keywords.add(word); |
||||
|
break; // 找到一个就跳出内层循环 |
||||
|
} |
||||
|
} |
||||
|
if (!keywords.isEmpty()) break; // 找到一个就跳出外层循环 |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 如果没有提取到任何关键词,使用原输入(过滤停用词后) |
||||
|
if (keywords.isEmpty()) { |
||||
|
String simple = input; |
||||
|
for (String stopWord : stopWords) { |
||||
|
simple = simple.replace(stopWord, ""); |
||||
|
} |
||||
|
simple = simple.trim(); |
||||
|
if (simple.length() >= 2) { |
||||
|
keywords.add(simple); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return keywords.stream() |
||||
|
.limit(5) // 最多5个关键词 |
||||
|
.collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 判断是否为数字 |
||||
|
*/ |
||||
|
private boolean isNumeric(String str) { |
||||
|
if (str == null || str.isEmpty()) { |
||||
|
return false; |
||||
|
} |
||||
|
for (char c : str.toCharArray()) { |
||||
|
if (!Character.isDigit(c)) { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.chenhai.muhu.mapper.MuhuMarketInfoMapper"> |
||||
|
|
||||
|
<resultMap type="MuhuMarketInfo" id="MuhuMarketInfoResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="title" column="title" /> |
||||
|
<result property="content" column="content" /> |
||||
|
<result property="infoType" column="info_type" /> |
||||
|
<result property="publishSource" column="publish_source" /> |
||||
|
<result property="region" column="region" /> |
||||
|
<result property="attachmentUrl" column="attachment_url" /> |
||||
|
<result property="viewCount" column="view_count" /> |
||||
|
<result property="publishUserId" column="publish_user_id" /> |
||||
|
<result property="isTop" column="is_top" /> |
||||
|
<result property="status" column="status" /> |
||||
|
<result property="publishTime" column="publish_time" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectMuhuMarketInfoVo"> |
||||
|
select id, title, content, info_type, publish_source, region, attachment_url, view_count, publish_user_id, is_top, status, publish_time, update_time from muhu_market_info |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectMuhuMarketInfoList" parameterType="MuhuMarketInfo" resultMap="MuhuMarketInfoResult"> |
||||
|
<include refid="selectMuhuMarketInfoVo"/> |
||||
|
<where> |
||||
|
<if test="title != null and title != ''"> and title = #{title}</if> |
||||
|
<if test="content != null and content != ''"> and content = #{content}</if> |
||||
|
<if test="infoType != null and infoType != ''"> and info_type = #{infoType}</if> |
||||
|
<if test="publishSource != null and publishSource != ''"> and publish_source = #{publishSource}</if> |
||||
|
<if test="region != null and region != ''"> and region = #{region}</if> |
||||
|
<if test="attachmentUrl != null and attachmentUrl != ''"> and attachment_url = #{attachmentUrl}</if> |
||||
|
<if test="viewCount != null "> and view_count = #{viewCount}</if> |
||||
|
<if test="publishUserId != null "> and publish_user_id = #{publishUserId}</if> |
||||
|
<if test="isTop != null and isTop != ''"> and is_top = #{isTop}</if> |
||||
|
<if test="status != null and status != ''"> and status = #{status}</if> |
||||
|
<if test="publishTime != null "> and publish_time = #{publishTime}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectMuhuMarketInfoById" parameterType="Long" resultMap="MuhuMarketInfoResult"> |
||||
|
<include refid="selectMuhuMarketInfoVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertMuhuMarketInfo" parameterType="MuhuMarketInfo" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into muhu_market_info |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title,</if> |
||||
|
<if test="content != null and content != ''">content,</if> |
||||
|
<if test="infoType != null and infoType != ''">info_type,</if> |
||||
|
<if test="publishSource != null and publishSource != ''">publish_source,</if> |
||||
|
<if test="region != null">region,</if> |
||||
|
<if test="attachmentUrl != null">attachment_url,</if> |
||||
|
<if test="viewCount != null">view_count,</if> |
||||
|
<if test="publishUserId != null">publish_user_id,</if> |
||||
|
<if test="isTop != null and isTop != ''">is_top,</if> |
||||
|
<if test="status != null and status != ''">status,</if> |
||||
|
<if test="publishTime != null">publish_time,</if> |
||||
|
<if test="updateTime != null">update_time,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">#{title},</if> |
||||
|
<if test="content != null and content != ''">#{content},</if> |
||||
|
<if test="infoType != null and infoType != ''">#{infoType},</if> |
||||
|
<if test="publishSource != null and publishSource != ''">#{publishSource},</if> |
||||
|
<if test="region != null">#{region},</if> |
||||
|
<if test="attachmentUrl != null">#{attachmentUrl},</if> |
||||
|
<if test="viewCount != null">#{viewCount},</if> |
||||
|
<if test="publishUserId != null">#{publishUserId},</if> |
||||
|
<if test="isTop != null and isTop != ''">#{isTop},</if> |
||||
|
<if test="status != null and status != ''">#{status},</if> |
||||
|
<if test="publishTime != null">#{publishTime},</if> |
||||
|
<if test="updateTime != null">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateMuhuMarketInfo" parameterType="MuhuMarketInfo"> |
||||
|
update muhu_market_info |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title = #{title},</if> |
||||
|
<if test="content != null and content != ''">content = #{content},</if> |
||||
|
<if test="infoType != null and infoType != ''">info_type = #{infoType},</if> |
||||
|
<if test="publishSource != null and publishSource != ''">publish_source = #{publishSource},</if> |
||||
|
<if test="region != null">region = #{region},</if> |
||||
|
<if test="attachmentUrl != null">attachment_url = #{attachmentUrl},</if> |
||||
|
<if test="viewCount != null">view_count = #{viewCount},</if> |
||||
|
<if test="publishUserId != null">publish_user_id = #{publishUserId},</if> |
||||
|
<if test="isTop != null and isTop != ''">is_top = #{isTop},</if> |
||||
|
<if test="status != null and status != ''">status = #{status},</if> |
||||
|
<if test="publishTime != null">publish_time = #{publishTime},</if> |
||||
|
<if test="updateTime != null">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteMuhuMarketInfoById" parameterType="Long"> |
||||
|
delete from muhu_market_info where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteMuhuMarketInfoByIds" parameterType="String"> |
||||
|
delete from muhu_market_info where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
</mapper> |
||||
@ -0,0 +1,133 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.chenhai.system.mapper.SysKnowledgeBaseMapper"> |
||||
|
|
||||
|
<resultMap type="SysKnowledgeBase" id="SysKnowledgeBaseResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="title" column="title" /> |
||||
|
<result property="category" column="category" /> |
||||
|
<result property="keywords" column="keywords" /> |
||||
|
<result property="possibleDiseases" column="possible_diseases" /> |
||||
|
<result property="severityLevel" column="severity_level" /> |
||||
|
<result property="suggestions" column="suggestions" /> |
||||
|
<result property="content" column="content" /> |
||||
|
<result property="suitableSpecies" column="suitable_species" /> |
||||
|
<result property="viewCount" column="view_count" /> |
||||
|
<result property="status" column="status" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectSysKnowledgeBaseVo"> |
||||
|
select id, title, category, keywords, possible_diseases, severity_level, suggestions, content, suitable_species, view_count, status from sys_knowledge_base |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectSysKnowledgeBaseList" parameterType="SysKnowledgeBase" resultMap="SysKnowledgeBaseResult"> |
||||
|
<include refid="selectSysKnowledgeBaseVo"/> |
||||
|
<where> |
||||
|
<if test="title != null and title != ''"> and title = #{title}</if> |
||||
|
<if test="category != null and category != ''"> and category = #{category}</if> |
||||
|
<if test="keywords != null and keywords != ''"> and keywords = #{keywords}</if> |
||||
|
<if test="possibleDiseases != null and possibleDiseases != ''"> and possible_diseases = #{possibleDiseases}</if> |
||||
|
<if test="severityLevel != null and severityLevel != ''"> and severity_level = #{severityLevel}</if> |
||||
|
<if test="suggestions != null and suggestions != ''"> and suggestions = #{suggestions}</if> |
||||
|
<if test="content != null and content != ''"> and content = #{content}</if> |
||||
|
<if test="suitableSpecies != null and suitableSpecies != ''"> and suitable_species = #{suitableSpecies}</if> |
||||
|
<if test="viewCount != null "> and view_count = #{viewCount}</if> |
||||
|
<if test="status != null and status != ''"> and status = #{status}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSysKnowledgeBaseById" parameterType="Long" resultMap="SysKnowledgeBaseResult"> |
||||
|
<include refid="selectSysKnowledgeBaseVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertSysKnowledgeBase" parameterType="SysKnowledgeBase" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into sys_knowledge_base |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title,</if> |
||||
|
<if test="category != null and category != ''">category,</if> |
||||
|
<if test="keywords != null">keywords,</if> |
||||
|
<if test="possibleDiseases != null">possible_diseases,</if> |
||||
|
<if test="severityLevel != null">severity_level,</if> |
||||
|
<if test="suggestions != null">suggestions,</if> |
||||
|
<if test="content != null and content != ''">content,</if> |
||||
|
<if test="suitableSpecies != null">suitable_species,</if> |
||||
|
<if test="viewCount != null">view_count,</if> |
||||
|
<if test="status != null">status,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">#{title},</if> |
||||
|
<if test="category != null and category != ''">#{category},</if> |
||||
|
<if test="keywords != null">#{keywords},</if> |
||||
|
<if test="possibleDiseases != null">#{possibleDiseases},</if> |
||||
|
<if test="severityLevel != null">#{severityLevel},</if> |
||||
|
<if test="suggestions != null">#{suggestions},</if> |
||||
|
<if test="content != null and content != ''">#{content},</if> |
||||
|
<if test="suitableSpecies != null">#{suitableSpecies},</if> |
||||
|
<if test="viewCount != null">#{viewCount},</if> |
||||
|
<if test="status != null">#{status},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateSysKnowledgeBase" parameterType="SysKnowledgeBase"> |
||||
|
update sys_knowledge_base |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title = #{title},</if> |
||||
|
<if test="category != null and category != ''">category = #{category},</if> |
||||
|
<if test="keywords != null">keywords = #{keywords},</if> |
||||
|
<if test="possibleDiseases != null">possible_diseases = #{possibleDiseases},</if> |
||||
|
<if test="severityLevel != null">severity_level = #{severityLevel},</if> |
||||
|
<if test="suggestions != null">suggestions = #{suggestions},</if> |
||||
|
<if test="content != null and content != ''">content = #{content},</if> |
||||
|
<if test="suitableSpecies != null">suitable_species = #{suitableSpecies},</if> |
||||
|
<if test="viewCount != null">view_count = #{viewCount},</if> |
||||
|
<if test="status != null">status = #{status},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteSysKnowledgeBaseById" parameterType="Long"> |
||||
|
delete from sys_knowledge_base where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteSysKnowledgeBaseByIds" parameterType="String"> |
||||
|
delete from sys_knowledge_base where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 新增:模糊搜索方法 --> |
||||
|
<select id="searchSysKnowledgeBaseByKeyword" parameterType="String" resultMap="SysKnowledgeBaseResult"> |
||||
|
<include refid="selectSysKnowledgeBaseVo"/> |
||||
|
<where> |
||||
|
<if test="keyword != null and keyword != ''"> |
||||
|
title like concat('%', #{keyword}, '%') |
||||
|
or category like concat('%', #{keyword}, '%') |
||||
|
or keywords like concat('%', #{keyword}, '%') |
||||
|
or possible_diseases like concat('%', #{keyword}, '%') |
||||
|
or suggestions like concat('%', #{keyword}, '%') |
||||
|
or content like concat('%', #{keyword}, '%') |
||||
|
</if> |
||||
|
</where> |
||||
|
order by view_count desc, id desc |
||||
|
</select> |
||||
|
|
||||
|
<!-- 新增:多关键词搜索 --> |
||||
|
<select id="searchByKeywords" parameterType="map" resultMap="SysKnowledgeBaseResult"> |
||||
|
<include refid="selectSysKnowledgeBaseVo"/> |
||||
|
<where> |
||||
|
<foreach collection="keywords" item="kw" open="(" separator=" OR " close=")"> |
||||
|
title like concat('%', #{kw}, '%') |
||||
|
or category like concat('%', #{kw}, '%') |
||||
|
or keywords like concat('%', #{kw}, '%') |
||||
|
or possible_diseases like concat('%', #{kw}, '%') |
||||
|
or suggestions like concat('%', #{kw}, '%') |
||||
|
or content like concat('%', #{kw}, '%') |
||||
|
</foreach> |
||||
|
</where> |
||||
|
order by view_count desc, id desc |
||||
|
</select> |
||||
|
</mapper> |
||||
@ -0,0 +1,44 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询市场信息列表
|
||||
|
export function listMarket(query) { |
||||
|
return request({ |
||||
|
url: '/muhu/market/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询市场信息详细
|
||||
|
export function getMarket(id) { |
||||
|
return request({ |
||||
|
url: '/muhu/market/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增市场信息
|
||||
|
export function addMarket(data) { |
||||
|
return request({ |
||||
|
url: '/muhu/market', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改市场信息
|
||||
|
export function updateMarket(data) { |
||||
|
return request({ |
||||
|
url: '/muhu/market', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除市场信息
|
||||
|
export function delMarket(id) { |
||||
|
return request({ |
||||
|
url: '/muhu/market/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
@ -0,0 +1,310 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
|
<el-form-item label="信息标题" prop="title"> |
||||
|
<el-input |
||||
|
v-model="queryParams.title" |
||||
|
placeholder="请输入信息标题" |
||||
|
clearable |
||||
|
@keyup.enter.native="handleQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
plain |
||||
|
icon="el-icon-plus" |
||||
|
size="mini" |
||||
|
@click="handleAdd" |
||||
|
v-hasPermi="['muhu:market:add']" |
||||
|
>新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
plain |
||||
|
icon="el-icon-edit" |
||||
|
size="mini" |
||||
|
:disabled="single" |
||||
|
@click="handleUpdate" |
||||
|
v-hasPermi="['muhu:market:edit']" |
||||
|
>修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="danger" |
||||
|
plain |
||||
|
icon="el-icon-delete" |
||||
|
size="mini" |
||||
|
:disabled="multiple" |
||||
|
@click="handleDelete" |
||||
|
v-hasPermi="['muhu:market:remove']" |
||||
|
>删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="warning" |
||||
|
plain |
||||
|
icon="el-icon-download" |
||||
|
size="mini" |
||||
|
@click="handleExport" |
||||
|
v-hasPermi="['muhu:market:export']" |
||||
|
>导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="marketList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="信息标题" align="center" prop="title" /> |
||||
|
<el-table-column label="详细内容" align="center" prop="content" /> |
||||
|
<el-table-column label="信息类型" align="center" prop="infoType" /> |
||||
|
<el-table-column label="市场范围" align="center" prop="region" /> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-edit" |
||||
|
@click="handleUpdate(scope.row)" |
||||
|
v-hasPermi="['muhu:market:edit']" |
||||
|
>修改</el-button> |
||||
|
<el-button |
||||
|
size="mini" |
||||
|
type="text" |
||||
|
icon="el-icon-delete" |
||||
|
@click="handleDelete(scope.row)" |
||||
|
v-hasPermi="['muhu:market:remove']" |
||||
|
>删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination |
||||
|
v-show="total>0" |
||||
|
:total="total" |
||||
|
:page.sync="queryParams.pageNum" |
||||
|
:limit.sync="queryParams.pageSize" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
|
||||
|
<!-- 添加或修改市场信息对话框 --> |
||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-form-item label="信息标题" prop="title"> |
||||
|
<el-input v-model="form.title" placeholder="请输入信息标题" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="详细内容"> |
||||
|
<editor v-model="form.content" :min-height="192"/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="信息类型" prop="infoType"> |
||||
|
<el-select v-model="form.infoType" placeholder="请选择信息类型" clearable> |
||||
|
<el-option v-for="dict in dict.type.info_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="市场范围" prop="region"> |
||||
|
<el-input v-model="form.region" placeholder="请输入市场范围" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { listMarket, getMarket, delMarket, addMarket, updateMarket } from "@/api/muhu/market" |
||||
|
|
||||
|
export default { |
||||
|
name: "Market", |
||||
|
dicts: ['info_type'], |
||||
|
data() { |
||||
|
return { |
||||
|
// 遮罩层 |
||||
|
loading: true, |
||||
|
// 选中数组 |
||||
|
ids: [], |
||||
|
// 非单个禁用 |
||||
|
single: true, |
||||
|
// 非多个禁用 |
||||
|
multiple: true, |
||||
|
// 显示搜索条件 |
||||
|
showSearch: true, |
||||
|
// 总条数 |
||||
|
total: 0, |
||||
|
// 市场信息表格数据 |
||||
|
marketList: [], |
||||
|
// 弹出层标题 |
||||
|
title: "", |
||||
|
// 是否显示弹出层 |
||||
|
open: false, |
||||
|
// 查询参数 |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
title: null, |
||||
|
content: null, |
||||
|
infoType: null, |
||||
|
publishSource: null, |
||||
|
region: null, |
||||
|
attachmentUrl: null, |
||||
|
viewCount: null, |
||||
|
publishUserId: null, |
||||
|
isTop: null, |
||||
|
status: null, |
||||
|
publishTime: null, |
||||
|
}, |
||||
|
// 表单参数 |
||||
|
form: {}, |
||||
|
// 表单校验 |
||||
|
rules: { |
||||
|
title: [ |
||||
|
{ required: true, message: "信息标题不能为空", trigger: "blur" } |
||||
|
], |
||||
|
content: [ |
||||
|
{ required: true, message: "详细内容/报告正文不能为空", trigger: "blur" } |
||||
|
], |
||||
|
infoType: [ |
||||
|
{ required: true, message: "信息类型:1-农牧产品销售;2-饲草料销售;3-畜产品市场价格;4-饲料供应商价格;5-市场趋势报告不能为空", trigger: "change" } |
||||
|
], |
||||
|
publishSource: [ |
||||
|
{ required: true, message: "发布来源:1-管理员发布;2-系统关联不能为空", trigger: "blur" } |
||||
|
], |
||||
|
viewCount: [ |
||||
|
{ required: true, message: "查看次数不能为空", trigger: "blur" } |
||||
|
], |
||||
|
publishUserId: [ |
||||
|
{ required: true, message: "发布者ID不能为空", trigger: "blur" } |
||||
|
], |
||||
|
isTop: [ |
||||
|
{ required: true, message: "是否置顶不能为空", trigger: "blur" } |
||||
|
], |
||||
|
status: [ |
||||
|
{ required: true, message: "状态不能为空", trigger: "change" } |
||||
|
], |
||||
|
publishTime: [ |
||||
|
{ required: true, message: "发布时间不能为空", trigger: "blur" } |
||||
|
], |
||||
|
updateTime: [ |
||||
|
{ required: true, message: "更新时间不能为空", trigger: "blur" } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList() |
||||
|
}, |
||||
|
methods: { |
||||
|
/** 查询市场信息列表 */ |
||||
|
getList() { |
||||
|
this.loading = true |
||||
|
listMarket(this.queryParams).then(response => { |
||||
|
this.marketList = response.rows |
||||
|
this.total = response.total |
||||
|
this.loading = false |
||||
|
}) |
||||
|
}, |
||||
|
// 取消按钮 |
||||
|
cancel() { |
||||
|
this.open = false |
||||
|
this.reset() |
||||
|
}, |
||||
|
// 表单重置 |
||||
|
reset() { |
||||
|
this.form = { |
||||
|
id: null, |
||||
|
title: null, |
||||
|
content: null, |
||||
|
infoType: null, |
||||
|
publishSource: null, |
||||
|
region: null, |
||||
|
attachmentUrl: null, |
||||
|
viewCount: null, |
||||
|
publishUserId: null, |
||||
|
isTop: null, |
||||
|
status: null, |
||||
|
publishTime: null, |
||||
|
updateTime: null |
||||
|
} |
||||
|
this.resetForm("form") |
||||
|
}, |
||||
|
/** 搜索按钮操作 */ |
||||
|
handleQuery() { |
||||
|
this.queryParams.pageNum = 1 |
||||
|
this.getList() |
||||
|
}, |
||||
|
/** 重置按钮操作 */ |
||||
|
resetQuery() { |
||||
|
this.resetForm("queryForm") |
||||
|
this.handleQuery() |
||||
|
}, |
||||
|
// 多选框选中数据 |
||||
|
handleSelectionChange(selection) { |
||||
|
this.ids = selection.map(item => item.id) |
||||
|
this.single = selection.length!==1 |
||||
|
this.multiple = !selection.length |
||||
|
}, |
||||
|
/** 新增按钮操作 */ |
||||
|
handleAdd() { |
||||
|
this.reset() |
||||
|
this.open = true |
||||
|
this.title = "添加市场信息" |
||||
|
}, |
||||
|
/** 修改按钮操作 */ |
||||
|
handleUpdate(row) { |
||||
|
this.reset() |
||||
|
const id = row.id || this.ids |
||||
|
getMarket(id).then(response => { |
||||
|
this.form = response.data |
||||
|
this.open = true |
||||
|
this.title = "修改市场信息" |
||||
|
}) |
||||
|
}, |
||||
|
/** 提交按钮 */ |
||||
|
submitForm() { |
||||
|
this.$refs["form"].validate(valid => { |
||||
|
if (valid) { |
||||
|
if (this.form.id != null) { |
||||
|
updateMarket(this.form).then(response => { |
||||
|
this.$modal.msgSuccess("修改成功") |
||||
|
this.open = false |
||||
|
this.getList() |
||||
|
}) |
||||
|
} else { |
||||
|
addMarket(this.form).then(response => { |
||||
|
this.$modal.msgSuccess("新增成功") |
||||
|
this.open = false |
||||
|
this.getList() |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
/** 删除按钮操作 */ |
||||
|
handleDelete(row) { |
||||
|
const ids = row.id || this.ids |
||||
|
this.$modal.confirm('是否确认删除市场信息编号为"' + ids + '"的数据项?').then(function() { |
||||
|
return delMarket(ids) |
||||
|
}).then(() => { |
||||
|
this.getList() |
||||
|
this.$modal.msgSuccess("删除成功") |
||||
|
}).catch(() => {}) |
||||
|
}, |
||||
|
/** 导出按钮操作 */ |
||||
|
handleExport() { |
||||
|
this.download('muhu/market/export', { |
||||
|
...this.queryParams |
||||
|
}, `market_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue