Commit ecd6b00a authored by 刘林's avatar 刘林

fix(tcm):根据extend、Type、name模糊查询字典

parent 2487fc15
......@@ -20,7 +20,6 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
......@@ -115,16 +114,23 @@ public class DataDictionaryController extends BaseController {
}
/**
* 根据extend集合和Type查询
* 根据extend、Type、name模糊查询字典
*
* @param extendList
* @param extend
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getDictByExtendsAndType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据extend集合和Type查询", notes = "根据extend集合和Type查询")
public List<DataDictionary> getDictByExtendsAndType(@RequestParam("extendList") List<String> extendList, @RequestParam("type") String type) {
return iDataDictionaryService.getDictByExtendsAndType(extendList, type);
@RequestMapping(value = "/getDictByExtendAndTypePage", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据extend、Type、name模糊查询字典", notes = "根据extend、Type、name模糊查询字典")
public IPage<DataDictionary> getDictByExtendAndTypePage(@RequestParam("extend") String extend,
@RequestParam("type") String type,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<DataDictionary> page = new Page<DataDictionary>();
page.setCurrent(current);
page.setSize(size);
return iDataDictionaryService.getDictByExtendsAndTypePage(extend, type, name, page);
}
/**
......
package com.yeejoin.amos.boot.biz.common.dao.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import org.apache.ibatis.annotations.Param;
/**
* 数据字典 Mapper 接口
......@@ -35,6 +37,5 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
public List<DataDictionary> getFirefightersJobTitle(String type);
List<DataDictionary> getDictByExtendsAndType(List<String> extendList, String type);
IPage<DataDictionary> getDictByExtendsAndTypePage(Page<?> page, @Param("type") String type, @Param("extend") String extend, @Param("name") String name);
}
package com.yeejoin.amos.boot.biz.common.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import java.util.List;
/**
......@@ -32,5 +33,5 @@ public interface IDataDictionaryService {
DataDictionary getByExtend(String groupId, String type);
List<DataDictionary> getDictByExtendsAndType(List<String> extendList, String type);
IPage<DataDictionary> getDictByExtendsAndTypePage(String extend, String type, String name, Page<DataDictionary> page);
}
......@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.biz.common.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.dto.DataDictionaryDto;
......@@ -16,7 +18,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection;
import java.util.List;
......@@ -198,7 +199,7 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
}
@Override
public List<DataDictionary> getDictByExtendsAndType(List<String> extendList, String type) {
return dataDictionaryMapper.getDictByExtendsAndType(extendList,type);
public IPage<DataDictionary> getDictByExtendsAndTypePage(String extend, String type, String name, Page<DataDictionary> page) {
return dataDictionaryMapper.getDictByExtendsAndTypePage(page, type, extend,name);
}
}
......@@ -113,17 +113,15 @@ WHERE
</select>
<select id="getDictByExtendsAndType" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT cbb.*
FROM cb_data_dictionary cbb
WHERE cbb.is_delete = 0
AND cbb.type = #{type}
AND (
<foreach collection="extendList" item="item" separator=" OR ">
FIND_IN_SET(#{item}, cbb.extend)
</foreach>
)
ORDER BY cbb.sort_num
<select id="getDictByExtendsAndTypePage" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT *
FROM cb_data_dictionary
WHERE type = #{type}
<if test="extend != null and extend != ''">
AND #{extend} = ANY(string_to_array(extend, ','))
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment