src/main/java/com/lf/server/config/InitConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/controller/all/BaseQueryController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/entity/ctrl/IdNameEntity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/mapper/all/BasicMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/service/all/BaseQueryService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/lf/server/config/InitConfig.java
@@ -13,6 +13,7 @@ import com.lf.server.mapper.bd.DlgAgnpMapper; import com.lf.server.service.all.BaseQueryService; import com.lf.server.service.all.PermsService; import com.lf.server.service.show.LocateService; import com.lf.server.service.sys.ArgsService; import com.lf.server.service.sys.BlacklistService; import org.apache.commons.logging.Log; @@ -53,6 +54,9 @@ @Autowired BaseQueryService baseQueryService; @Autowired LocateService locateService; @Override public void run(ApplicationArguments args) { // noinspection AlibabaRemoveCommentedCode @@ -85,11 +89,13 @@ } private void testMybatisPlus() { String s1 = locateService.selectWktById(1); String tabName = baseQueryService.getTabName(dlgAgnpMapper); List<String> list0 = dlgAgnpMapper.selectFuzzy(tabName, "name", "%å¿%"); List<String> list0 = dlgAgnpMapper.selectFieldFuzzy(tabName, "name", "%å¿%"); DlgAgnpEntity dlg = dlgAgnpMapper.selectById(1); String wkt = dlgAgnpMapper.selectWktById("bd.dlg_agnp", 2); String wkt = dlgAgnpMapper.selectWktById(tabName, 2); Map<String, Object> map = new HashMap<String, Object>(3); map.put("gid", 2); src/main/java/com/lf/server/controller/all/BaseQueryController.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.lf.server.aspect.SysLog; import com.lf.server.entity.all.ResponseMsg; import com.lf.server.entity.ctrl.IdNameEntity; import com.lf.server.helper.AesHelper; import com.lf.server.helper.StringHelper; import com.lf.server.mapper.all.BasicMapper; @@ -118,14 +119,14 @@ } @SysLog() @ApiOperation(value = "æ¨¡ç³æç´¢") @ApiOperation(value = "æ¨¡ç³æç´¢åæ®µ") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "æ å°åç§°", dataType = "String", paramType = "query", example = "dlgAgnp"), @ApiImplicitParam(name = "field", value = "åæ®µ", dataType = "String", paramType = "query", example = "name"), @ApiImplicitParam(name = "value", value = "å¼", dataType = "String", paramType = "query", example = "'å¿'") }) @GetMapping(value = "/selectFuzzy") public ResponseMsg<List<String>> selectFuzzy(String name, String field, String value) { @GetMapping(value = "/selectFieldFuzzy") public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) { try { BasicMapper baseMapper = baseQueryService.getBasicMapper(name); if (baseMapper == null) { @@ -141,7 +142,39 @@ } value = value == null ? StringHelper.getLikeStr("") : StringHelper.getLikeStr(value.replace("'", "")); List<String> rs = baseMapper.selectFuzzy(tab, field, value); List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value); return success(rs); } catch (Exception ex) { return fail(ex.getMessage(), null); } } @SysLog() @ApiOperation(value = "æ¨¡ç³æç´¢ç¨æ·") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "ç¨æ·å", dataType = "String", paramType = "query", example = "室") }) @GetMapping(value = "/selectFieldFuzzy") public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) { try { List<IdNameEntity> rs = null; return success(rs); } catch (Exception ex) { return fail(ex.getMessage(), null); } } @SysLog() @ApiOperation(value = "æ¨¡ç³æç´¢åä½") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "åä½å", dataType = "String", paramType = "query", example = "å¸") }) @GetMapping(value = "/selectFieldFuzzy") public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) { try { List<IdNameEntity> rs = null; return success(rs); } catch (Exception ex) { src/main/java/com/lf/server/entity/ctrl/IdNameEntity.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,30 @@ package com.lf.server.entity.ctrl; /** * ID-åç§°å®ä½ç±» * @author WWW */ public class IdNameEntity { private Integer id; private String name; public IdNameEntity() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } src/main/java/com/lf/server/mapper/all/BasicMapper.java
@@ -13,7 +13,7 @@ */ public interface BasicMapper<T> extends BaseMapper<T> { /** * æ¨¡ç³æç´¢ * æ¨¡ç³æç´¢åæ®µ * * @param tab 表å * @param field åæ®µ @@ -21,5 +21,5 @@ * @return ç»æå表 */ @Select("select ${field} from ${tab} where ${field} like #{value} order by ${field} limit 10") public List<String> selectFuzzy(@Param("tab") String tab, @Param("field") String field, @Param("value") String value); public List<String> selectFieldFuzzy(@Param("tab") String tab, @Param("field") String field, @Param("value") String value); } src/main/java/com/lf/server/service/all/BaseQueryService.java
@@ -1,6 +1,6 @@ package com.lf.server.service.all; import cn.hutool.db.meta.Table; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.lf.server.helper.AesHelper; import com.lf.server.helper.ClassHelper; @@ -188,9 +188,9 @@ return null; } Table annotation = (Table) clazz.getAnnotation(Table.class); TableName annotation = (TableName) clazz.getAnnotation(TableName.class); String tabName = annotation.getTableName(); String tabName = annotation.value(); if (tabName != null && !tabMap.containsKey(className)) { tabMap.put(className, tabName); }