微信小程序查询案例
This commit is contained in:
parent
75d11bb9e3
commit
4247860f69
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
stdiet-custom/src/main
java/com/stdiet/custom/dto/response
resources/mapper/custom
75
stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java
Normal file
75
stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.custom.domain.SysCustomerCase;
|
||||
import com.stdiet.custom.domain.SysCustomerCaseFile;
|
||||
import com.stdiet.custom.dto.response.CustomerCaseResponse;
|
||||
import com.stdiet.custom.service.ISysCustomerCaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wx/customerCase")
|
||||
public class WxCustomerCaseController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerCaseService sysCustomerCaseService;
|
||||
|
||||
/**
|
||||
* 查询微信小程序中展示的客户案例
|
||||
*/
|
||||
@GetMapping("/caseList")
|
||||
public TableDataInfo caseList(SysCustomerCase sysCustomerCase)
|
||||
{
|
||||
startPage();
|
||||
sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null);
|
||||
List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase);
|
||||
List<CustomerCaseResponse> resultList = dealSysCustomerCase(list);
|
||||
return getDataTable(resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户案例文件列表
|
||||
*/
|
||||
@GetMapping("/getFileByCaseId")
|
||||
public AjaxResult getFileByCaseId(@RequestParam("caseId")Long caseId)
|
||||
{
|
||||
CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse();
|
||||
List<SysCustomerCaseFile> list = sysCustomerCaseService.getFileListByCaseId(caseId);
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
for (SysCustomerCaseFile caseFile : list) {
|
||||
fileUrl.add(caseFile.getFileUrl());
|
||||
}
|
||||
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
|
||||
customerCaseResponse.setFileList(downUrlList);
|
||||
return AjaxResult.success(customerCaseResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理返回值
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private List<CustomerCaseResponse> dealSysCustomerCase(List<SysCustomerCase> list){
|
||||
List<CustomerCaseResponse> resultList = new ArrayList<>();
|
||||
for (SysCustomerCase customerCase : list) {
|
||||
CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse();
|
||||
customerCaseResponse.setId(customerCase.getId());
|
||||
customerCaseResponse.setKeyword(customerCase.getKeyword());
|
||||
customerCaseResponse.setName(customerCase.getName());
|
||||
customerCaseResponse.setRemark(customerCase.getRemark());
|
||||
resultList.add(customerCaseResponse);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.stdiet.custom.dto.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CustomerCaseResponse {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String keyword;
|
||||
|
||||
private String remark;
|
||||
|
||||
private List<String> fileList;
|
||||
}
|
@ -37,16 +37,12 @@
|
||||
select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.create_time,sc.name as customer_name from sys_customer_case scc
|
||||
left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0
|
||||
where scc.del_flag = 0
|
||||
<!--<if test="name != null and name != ''">
|
||||
and (scc.name like concat('%', #{name}, '%') OR scc.remark like concat('%', #{name}, '%'))
|
||||
</if>-->
|
||||
<include refid="searchKey">
|
||||
<property name="keywordArray" value="#{keywordArray}"/>
|
||||
</include>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
and sc.name like concat('%', #{customerName}, '%')
|
||||
</if>
|
||||
OR scc.keyword like concat('%', #{name}, '%')
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user