src/main/java/com/whyc/dto/SoftDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/SoftwareMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/Software.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/SoftwareService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/SoftwareMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/dto/SoftDto.java
New file @@ -0,0 +1,13 @@ package com.whyc.dto; import com.whyc.pojo.Software; import lombok.Data; import java.io.Serializable; import java.util.List; @Data public class SoftDto implements Serializable { private String fileUrl; private List<Software> softwares; } src/main/java/com/whyc/mapper/SoftwareMapper.java
@@ -2,5 +2,10 @@ import com.whyc.pojo.Software; import java.util.List; public interface SoftwareMapper extends CustomMapper<Software>{ //查询软件列表的信息 List getFileUrl(String fileName, String applyMaterialCode, String applyModel, String owner); } src/main/java/com/whyc/pojo/Software.java
@@ -1,10 +1,12 @@ package com.whyc.pojo; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import org.apache.ibatis.type.Alias; import java.util.Date; import java.util.List; @TableName(schema = "db_doc",value = "tb_software") @Alias("Software") @@ -35,6 +37,7 @@ @ApiModelProperty("适用机型-规格型号") private String applyModel; @ApiModelProperty("发布说明") private String releaseNotes; @@ -144,4 +147,5 @@ public void setExcelUrl(String excelUrl) { this.excelUrl = excelUrl; } } src/main/java/com/whyc/service/SoftwareService.java
@@ -93,21 +93,7 @@ //查询软件列表的信息 public Response getAllSoftware(String fileName,String applyMaterialCode,String applyModel,String owner, int pageCurr, int pageSize) { PageHelper.startPage(pageCurr,pageSize); QueryWrapper wrapper=new QueryWrapper(); if(fileName!=null&&!fileName.isEmpty()){ wrapper.like("file_name",fileName); } if(applyMaterialCode!=null&&!applyMaterialCode.isEmpty()){ wrapper.like("apply_material_code",applyMaterialCode); } if(applyModel!=null&&!applyModel.isEmpty()){ wrapper.like("apply_model",applyModel); } if(owner!=null&&!owner.isEmpty()){ wrapper.like("owner",owner); } wrapper.orderByDesc("create_time"); List list=mapper.selectList(wrapper); List list=mapper.getFileUrl(fileName,applyMaterialCode,applyModel,owner); PageInfo pageInfo=new PageInfo(list); return new Response().setII(1,list.size()>0,pageInfo,"软件信息返回"); } src/main/resources/mapper/SoftwareMapper.xml
New file @@ -0,0 +1,31 @@ <?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.whyc.mapper.SoftwareMapper"> <resultMap id="softwares" type="softDto"> <result column="file_url" property="fileUrl"></result> <collection property="softwares" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Software" column="{fileUrl=file_url}" select="selectSoftWare"> </collection> </resultMap> <select id="getFileUrl" resultMap="softwares"> select distinct file_url from tb_software <where> 1=1 <if test="fileName!=null&&fileName!=''"> and file_name like '%${fileName}%' </if> <if test="applyMaterialCode!=null&&applyMaterialCode!=''"> and apply_material_code like '%${applyMaterialCode}%' </if> <if test="applyModel!=null&&applyModel!=''"> and apply_model like '%${applyModel}%' </if> <if test="owner!=null&&owner!=''"> and owner like '%${owner}%' </if> </where> </select> <select id="selectSoftWare" resultType="software"> select * from tb_software where file_url=#{fileUrl} </select> </mapper>