From eb1af5f77f2c16e580173553e548ff4e41653e4e Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 十一月 2022 17:02:13 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/data/DictController.java | 143 +++++++++-------- src/main/java/com/lf/server/entity/data/DictEntity.java | 57 ++++++ src/main/java/com/lf/server/service/all/BaseQueryService.java | 6 src/main/resources/mapper/all/BaseQueryMapper.xml | 4 src/main/java/com/lf/server/mapper/data/DictMapper.java | 58 +++--- data/db_fn.sql | 36 +++- data/db_tab.sql | 11 + src/main/java/com/lf/server/controller/all/BaseQueryController.java | 14 + 说明.txt | 10 + src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java | 8 + src/main/resources/mapper/data/DictMapper.xml | 59 ++++--- src/main/java/com/lf/server/service/data/DictService.java | 61 ++++--- 12 files changed, 306 insertions(+), 161 deletions(-) diff --git a/data/db_fn.sql b/data/db_fn.sql index 1b57438..f9966dd 100644 --- a/data/db_fn.sql +++ b/data/db_fn.sql @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------------------------------ 1.鏌ヨ杩炴帴鏁� +----------------------------------------------------------------------------------------------------- 0.鏌ヨ杩炴帴鏁� show max_connections; select count(1) from pg_stat_activity; @@ -152,7 +152,27 @@ select fn_rec_array(1, 'dep'); select fn_rec_array(10, 'dir'); select * from lf.sys_user a where a.depid=ANY(fn_rec_array(15,'dep')); ------------------------------------------------------------------------------------------------------ g.绱㈠紩 +----------------------------------------------------------------------------------------------------- g.鑾峰彇瀹炰綋鍚� +create or replace function fn_get_entity(tab varchar) +returns varchar as $$ + declare + str varchar; + rs varchar = ''; + begin + foreach str in array (select string_to_array(tab, '_')) loop + if (length(rs) = 0 or length(str) = 1) then + rs = rs || str; + else + rs = rs || initcap(str); + end if; + end loop; + + return rs; + end; +$$ language plpgsql; + +select fn_get_entity('dlg_25w_boua_s'); select fn_get_entity('dlg_25w_vega'); +----------------------------------------------------------------------------------------------------- h.绱㈠紩 alter table lf.sys_role_user add constraint idx_unique_role_user unique (roleid, userid); -- 鑱斿悎鍞竴绱㈠紩 insert into lf.sys_role_user (roleid,userid) values (1,1); -- 娴嬭瘯 select * from lf.sys_role_user; @@ -168,7 +188,7 @@ alter table lf.sys_role_menu_auth add constraint idx_unique_role_menu_auth unique (roleid,menu_auth_id); -- 鑱斿悎鍞竴绱㈠紩 insert into lf.sys_role_menu_auth (roleid,menu_auth_id) values (1,1); select * from lf.sys_role_menu_auth; ------------------------------------------------------------------------------------------------------ +----------------------------------------------------------------------------------------------------- i.鑱斿悎鏌ヨ select a.*,fn_uname(a.create_user) createUserName,fn_uname(a.update_user) updateUserName from lf.sys_blacklist a order by a.id; select * from lf.sys_user a where uname like '%' and a.depid=ANY(fn_rec_array(1,'dep')); select * from lf.sys_user a left join lf.sys_role_user b on a.id=b.userid @@ -195,7 +215,7 @@ update lf.sys_operate set modular1='杩愮淮绠$悊',modular2='璧勬簮绠$悊' where position('/res/select' in url)>0 and (modular1 is null or modular2 is null); delete from lf.sys_operate where modular1 is null or modular2 is null; ------------------------------------------------------------------------------------------------------ +----------------------------------------------------------------------------------------------------- j.鏌ヨ鎺堟潈 select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a; -- 鏍规嵁鐢ㄦ埛Uid鏌ヨ璧勬簮 @@ -229,7 +249,7 @@ inner join lf.sys_menu e on d.menuid = e.id inner join lf.sys_auth f on d.authid = f.id where a.uid = 'admin'; ----------------------------------------------------------------------------------------------- 鏁版嵁缁熻 +---------------------------------------------------------------------------------------------- k.鏁版嵁缁熻 select modular2,count(*) from lf.sys_operate group by modular2; select to_char(optime,'yyyy-mm-dd') as optime,count(*) from lf.sys_login where optime between (select optime - interval '30 day') @@ -249,11 +269,9 @@ and ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326)) -select st_astext(geom) from bd.dlg_25w_hfcl limit 10; -select * from lf.sys_attach where 1=1 limit 1 -select * from lf.sys_download; -select * from lf.sys_user; + + diff --git a/data/db_tab.sql b/data/db_tab.sql index 8a0f2b1..dab4081 100644 --- a/data/db_tab.sql +++ b/data/db_tab.sql @@ -686,6 +686,11 @@ create_time timestamp(6) without time zone default now(), update_user integer, update_time timestamp(6) without time zone, + tabletype varchar(20), + unit varchar(50), + domain_na varchar(100), + showtype smallint, + editable smallint, bak varchar(1024) ); comment on table lf.sys_dict is '闄勪欢琛�'; @@ -703,6 +708,11 @@ comment on column lf.sys_dict.create_time is '鍒涘缓鏃堕棿'; comment on column lf.sys_dict.update_user is '鏇存柊浜篒D'; comment on column lf.sys_dict.update_time is '鏇存柊鏃堕棿'; +comment on column lf.sys_dict.tabletype is '琛ㄧ被鍨�'; +comment on column lf.sys_dict.unit is '鍗曚綅'; +comment on column lf.sys_dict.domain_na is '鍊煎煙鍚嶇О'; +comment on column lf.sys_dict.showtype is '鏄剧ず绫诲瀷'; +comment on column lf.sys_dict.editable is '鏄惁鍙紪杈�'; comment on column lf.sys_dict.bak is '澶囨敞'; /* alter sequence lf.sys_dict_id_seq restart with 300; update lf.sys_dict set create_user=1,create_time=now() where 1=1; @@ -710,6 +720,7 @@ select count(*) from lf.sys_dict where tab='sys_user'; select * from lf.sys_dict order by ns,tab,order_num limit 10 offset 0; +select distinct ns,fn_get_entity(tab) tab,tab_desc,tabletype from lf.sys_dict order by tab; ----------------------------------------------------------------------------------------------------- 21.鏍峰紡琛� -- DROP TABLE IF EXISTS lf.sys_style; create table lf.sys_style( diff --git a/src/main/java/com/lf/server/controller/all/BaseQueryController.java b/src/main/java/com/lf/server/controller/all/BaseQueryController.java index fdc376b..f6d4a8e 100644 --- a/src/main/java/com/lf/server/controller/all/BaseQueryController.java +++ b/src/main/java/com/lf/server/controller/all/BaseQueryController.java @@ -7,6 +7,7 @@ import com.lf.server.aspect.SysLog; import com.lf.server.entity.all.ResponseMsg; import com.lf.server.entity.ctrl.IdNameEntity; +import com.lf.server.entity.data.DictEntity; import com.lf.server.helper.AesHelper; import com.lf.server.helper.StringHelper; import com.lf.server.mapper.all.BasicMapper; @@ -184,4 +185,17 @@ return fail(ex.getMessage(), null); } } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夎〃") + @GetMapping(value = "/selectTabs") + public ResponseMsg<List<DictEntity>> selectTabs() { + try { + List<DictEntity> list = baseQueryService.selectTabs(); + + return success(list); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } } diff --git a/src/main/java/com/lf/server/controller/data/DictController.java b/src/main/java/com/lf/server/controller/data/DictController.java index 3a4937f..88ce47e 100644 --- a/src/main/java/com/lf/server/controller/data/DictController.java +++ b/src/main/java/com/lf/server/controller/data/DictController.java @@ -19,8 +19,7 @@ /** * 瀛楀吀绠$悊 - * @author SWS + WWW - * @date 2022-09.26 + * @author WWW */ @Api(tags = "鏁版嵁绠$悊\\瀛楀吀绠$悊") @RestController @@ -35,12 +34,13 @@ @SysLog() @ApiOperation(value = "鏌ヨ璁板綍鏁�") @ApiImplicitParams({ - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", required = false, example = "") + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", required = false, example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda") }) @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String tab) { + public ResponseMsg<Integer> selectCount(String ns, String tab) { try { - int count = dictService.selectCount(tab); + int count = dictService.selectCount(ns, tab); return success(count); } catch (Exception ex) { @@ -51,18 +51,19 @@ @SysLog() @ApiOperation(value = "鍒嗛〉鏌ヨ") @ApiImplicitParams({ - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") }) @GetMapping(value = "/selectByPage") - public ResponseMsg<List<DictEntity>> selectByPage(String tab, Integer pageSize, Integer pageIndex) { + public ResponseMsg<List<DictEntity>> selectByPage(String ns, String tab, Integer pageSize, Integer pageIndex) { try { if (pageSize < 1 || pageIndex < 1) { return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); } - List<DictEntity> rs = dictService.selectByPage(tab, pageSize, pageSize * (pageIndex - 1)); + List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); return success(rs); } catch (Exception ex) { @@ -73,23 +74,24 @@ @SysLog() @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") @ApiImplicitParams({ - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") }) @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<DictEntity>> selectByPageAndCount(String tab, Integer pageSize, Integer pageIndex) { + public ResponseMsg<List<DictEntity>> selectByPageAndCount(String ns, String tab, Integer pageSize, Integer pageIndex) { try { if (pageSize < 1 || pageIndex < 1) { return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); } - int count = dictService.selectCount(tab); + int count = dictService.selectCount(ns, tab); if (count == 0) { return success(0, null); } - List<DictEntity> rs = dictService.selectByPage(tab, pageSize, pageSize * (pageIndex - 1)); + List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); return success(count, rs); } catch (Exception ex) { @@ -98,19 +100,48 @@ } @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<DictEntity>> selectAll() { + try { + List<DictEntity> list = dictService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<DictEntity> selectById(int id) { + try { + DictEntity entity = dictService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() @ApiOperation(value = "鎻掑叆涓�鏉�") @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.DictEntity", paramType = "body", example = "") + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") }) - @PostMapping(value = "/insertDict", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDict(@RequestBody DictEntity entity, HttpServletRequest req) { + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody DictEntity entity, HttpServletRequest req) { try { UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { entity.setCreateUser(ue.getId()); } - int count = dictService.insertDict(entity); + int count = dictService.insert(entity); return success(count); } catch (Exception ex) { @@ -121,10 +152,10 @@ @SysLog() @ApiOperation(value = "鎻掑叆澶氭潯") @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<DictEntity>", paramType = "body", example = "") + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") }) - @PostMapping(value = "/insertDicts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDicts(@RequestBody List<DictEntity> list, HttpServletRequest req) { + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<DictEntity> list, HttpServletRequest req) { try { UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { @@ -133,7 +164,7 @@ } } - int count = dictService.insertDicts(list); + int count = dictService.inserts(list); return success(count); } catch (Exception ex) { @@ -146,10 +177,10 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") }) - @GetMapping(value = "/deleteDict") - public ResponseMsg<Integer> deleteDict(int id) { + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { try { - int count = dictService.deleteDict(id); + int count = dictService.delete(id); return success(count); } catch (Exception ex) { @@ -160,16 +191,16 @@ @SysLog() @ApiOperation(value = "鍒犻櫎澶氭潯") @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") }) - @GetMapping(value = "/deleteDicts") - public ResponseMsg<Integer> deleteDicts(@RequestParam List<Integer> ids) { + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { try { if (ids == null || ids.isEmpty()) { return fail("id鏁扮粍涓嶈兘涓虹┖", -1); } - int count = dictService.deleteDicts(ids); + int count = dictService.deletes(ids); return success(count); } catch (Exception ex) { @@ -180,18 +211,18 @@ @SysLog() @ApiOperation(value = "鏇存柊涓�鏉�") @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body", example = "") + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") }) @ResponseBody - @PostMapping(value = "/updateDict", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateDict(@RequestBody DictEntity entity, HttpServletRequest req) { + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody DictEntity entity, HttpServletRequest req) { try { UserEntity ue = tokenService.getCurrentUser(req); - { + if (ue != null) { entity.setUpdateUser(ue.getId()); } - int count = dictService.updateDict(entity); + int count = dictService.update(entity); return success(count); } catch (Exception ex) { @@ -200,44 +231,26 @@ } @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiOperation(value = "鏇存柊澶氭潯") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") }) - @GetMapping(value = "/selectDict") - public ResponseMsg<DictEntity> selectDict(int id) { + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<DictEntity> list, HttpServletRequest req) { try { - DictEntity de = dictService.selectDict(id); + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DictEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } - return success(de); + int count = dictService.updates(list); + + return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectDictAll") - public ResponseMsg<List<DictEntity>> selectDictAll() { - try { - List<DictEntity> list = dictService.selectDictAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楀吀涓殑鎵�鏈夎〃鍚�") - @GetMapping(value = "/selectDictTab") - public ResponseMsg<List<DictEntity>> selectDictTab() { - try { - List<DictEntity> list = dictService.selectDictTab(); - - return success(list); - } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex.getMessage(), -1); } } } diff --git a/src/main/java/com/lf/server/entity/data/DictEntity.java b/src/main/java/com/lf/server/entity/data/DictEntity.java index 7d18eb1..09db527 100644 --- a/src/main/java/com/lf/server/entity/data/DictEntity.java +++ b/src/main/java/com/lf/server/entity/data/DictEntity.java @@ -5,10 +5,8 @@ /** * 瀛楀吀绠$悊 - * @author sws - * @date 2022-09-26 + * @author WWW */ - public class DictEntity implements Serializable { private static final long serialVersionUID = -343890141066128689L; @@ -40,7 +38,20 @@ private Timestamp updateTime; + private String tabletype; + + private String unit; + + private String domainNa; + + private int showtype; + + private int editable; + private String bak; + + public DictEntity() { + } public int getId() { return id; @@ -154,6 +165,46 @@ this.updateTime = updateTime; } + public String getTabletype() { + return tabletype; + } + + public void setTabletype(String tabletype) { + this.tabletype = tabletype; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getDomainNa() { + return domainNa; + } + + public void setDomainNa(String domainNa) { + this.domainNa = domainNa; + } + + public int getShowtype() { + return showtype; + } + + public void setShowtype(int showtype) { + this.showtype = showtype; + } + + public int getEditable() { + return editable; + } + + public void setEditable(int editable) { + this.editable = editable; + } + public String getBak() { return bak; } diff --git a/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java b/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java index 864baca..ec34ad3 100644 --- a/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java +++ b/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java @@ -1,6 +1,7 @@ package com.lf.server.mapper.all; import com.lf.server.entity.ctrl.IdNameEntity; +import com.lf.server.entity.data.DictEntity; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @@ -28,4 +29,11 @@ * @return 瀹炰綋绫婚泦鍚� */ public List<IdNameEntity> selectDepFuzzy(String name); + + /** + * 鏌ヨ鎵�鏈夎〃 + * + * @return + */ + public List<DictEntity> selectTabs(); } diff --git a/src/main/java/com/lf/server/mapper/data/DictMapper.java b/src/main/java/com/lf/server/mapper/data/DictMapper.java index 893ab54..c80cf36 100644 --- a/src/main/java/com/lf/server/mapper/data/DictMapper.java +++ b/src/main/java/com/lf/server/mapper/data/DictMapper.java @@ -8,8 +8,7 @@ /** * 瀛楀吀绠$悊 - * @author sws - * @date 2022-09-26 + * @author WWW */ @Mapper @Repository @@ -17,28 +16,45 @@ /** * 鏌ヨ璁板綍鏁� * + * @param ns 琛ㄧ┖闂� * @param tab 琛ㄥ悕 * @return 璁板綍鏁� */ - public Integer selectCount(String tab); + public Integer selectCount(String ns, String tab); /** * 鍒嗛〉鏌ヨ * + * @param ns 琛ㄧ┖闂� * @param tab 琛ㄥ悕 * @param limit 璁板綍琛� * @param offset 鍋忕Щ閲� * @return 鍒楄〃 */ - public List<DictEntity> selectByPage(String tab, Integer limit, Integer offset); + public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<DictEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public DictEntity selectById(int id); /** * 鎻掑叆涓�鏉� * - * @param dictEntity + * @param entity * @return */ - public Integer insertDict(DictEntity dictEntity); + public Integer insert(DictEntity entity); /** * 鎻掑叆澶氭潯 @@ -46,7 +62,7 @@ * @param list * @return */ - public Integer insertDicts(List<DictEntity> list); + public Integer inserts(List<DictEntity> list); /** * 鍒犻櫎涓�鏉� @@ -54,7 +70,7 @@ * @param id * @return */ - public Integer deleteDict(int id); + public Integer delete(int id); /** * 鍒犻櫎澶氭潯 @@ -62,35 +78,21 @@ * @param ids * @return */ - public Integer deleteDicts(List<Integer> ids); + public Integer deletes(List<Integer> ids); /** * 鏇存柊涓�鏉� * - * @param dictEntity + * @param entity * @return */ - public Integer updateDict(DictEntity dictEntity); + public Integer update(DictEntity entity); /** - * 鏌ヨ鍗曟潯鏁版嵁 + * 鏇存柊澶氭潯 * - * @param id + * @param list * @return */ - public DictEntity selectDict(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<DictEntity> selectDictAll(); - - /** - * 鏌ヨ琛ㄦ牸涓枃鍚� - * - * @return - */ - public List<DictEntity> selectDictTab(); + public Integer updates(List<DictEntity> list); } diff --git a/src/main/java/com/lf/server/service/all/BaseQueryService.java b/src/main/java/com/lf/server/service/all/BaseQueryService.java index 306d2f9..40d5d62 100644 --- a/src/main/java/com/lf/server/service/all/BaseQueryService.java +++ b/src/main/java/com/lf/server/service/all/BaseQueryService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.lf.server.entity.ctrl.IdNameEntity; +import com.lf.server.entity.data.DictEntity; import com.lf.server.helper.AesHelper; import com.lf.server.helper.ClassHelper; import com.lf.server.helper.StringHelper; @@ -218,4 +219,9 @@ return baseQueryMapper.selectDepFuzzy(name); } + + @Override + public List<DictEntity> selectTabs() { + return baseQueryMapper.selectTabs(); + } } diff --git a/src/main/java/com/lf/server/service/data/DictService.java b/src/main/java/com/lf/server/service/data/DictService.java index 022ffc3..aa3af30 100644 --- a/src/main/java/com/lf/server/service/data/DictService.java +++ b/src/main/java/com/lf/server/service/data/DictService.java @@ -1,6 +1,7 @@ package com.lf.server.service.data; import com.lf.server.entity.data.DictEntity; +import com.lf.server.helper.StringHelper; import com.lf.server.mapper.data.DictMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -8,9 +9,8 @@ import java.util.List; /** - * 瀛楀吀绠$悊 - * @author sws - * @date 2022-09-26 + * 瀛楀吀 + * @author WWW */ @Service public class DictService implements DictMapper { @@ -18,53 +18,58 @@ DictMapper dictMapper; @Override - public Integer selectCount(String tab) { - return dictMapper.selectCount(tab); + public Integer selectCount(String ns, String tab) { + ns = StringHelper.isNull(ns) ? null : ns.trim(); + tab = StringHelper.getLikeStr(tab); + + return dictMapper.selectCount(ns, tab); } @Override - public List<DictEntity> selectByPage(String tab, Integer limit, Integer offset) { - return dictMapper.selectByPage(tab, limit, offset); + public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset) { + ns = StringHelper.isNull(ns) ? null : ns.trim(); + tab = StringHelper.getLikeStr(tab); + + return dictMapper.selectByPage(ns, tab, limit, offset); } @Override - public Integer insertDict(DictEntity dictEntity) { - return dictMapper.insertDict(dictEntity); + public List<DictEntity> selectAll() { + return dictMapper.selectAll(); } @Override - public Integer insertDicts(List<DictEntity> dictEntity) { - return dictMapper.insertDicts(dictEntity); + public DictEntity selectById(int id) { + return dictMapper.selectById(id); } @Override - public Integer deleteDict(int id) { - return dictMapper.deleteDict(id); + public Integer insert(DictEntity entity) { + return dictMapper.insert(entity); } @Override - public Integer deleteDicts(List<Integer> ids) { - return dictMapper.deleteDicts(ids); + public Integer inserts(List<DictEntity> list) { + return dictMapper.inserts(list); } @Override - public Integer updateDict(DictEntity dictEntity) { - return dictMapper.updateDict(dictEntity); - } - - - @Override - public DictEntity selectDict(int id) { - return dictMapper.selectDict(id); + public Integer delete(int id) { + return dictMapper.delete(id); } @Override - public List<DictEntity> selectDictAll() { - return dictMapper.selectDictAll(); + public Integer deletes(List<Integer> ids) { + return dictMapper.deletes(ids); } @Override - public List<DictEntity> selectDictTab() { - return dictMapper.selectDictTab(); + public Integer update(DictEntity entity) { + return dictMapper.update(entity); } -} \ No newline at end of file + + @Override + public Integer updates(List<DictEntity> list) { + return dictMapper.updates(list); + } +} diff --git a/src/main/resources/mapper/all/BaseQueryMapper.xml b/src/main/resources/mapper/all/BaseQueryMapper.xml index 69aa1d6..42e70a1 100644 --- a/src/main/resources/mapper/all/BaseQueryMapper.xml +++ b/src/main/resources/mapper/all/BaseQueryMapper.xml @@ -20,4 +20,8 @@ </where> order by order_num limit 10 </select> + + <select id="selectTabs" resultType="com.lf.server.entity.data.DictEntity"> + select distinct ns,fn_get_entity(tab) tab,tab_desc,tabletype from lf.sys_dict order by tab; + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/data/DictMapper.xml b/src/main/resources/mapper/data/DictMapper.xml index 115f233..d09222b 100644 --- a/src/main/resources/mapper/data/DictMapper.xml +++ b/src/main/resources/mapper/data/DictMapper.xml @@ -1,5 +1,5 @@ <?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"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.lf.server.mapper.data.DictMapper"> <!--<resultMap id="resultMap" type="com.lf.server.entity.data.DictEntity"> <id property="id" column="id"></id> @@ -11,71 +11,76 @@ <result property="updateTime" column="update_time"></result> </resultMap>--> - <!-- 缁熻琛屾暟 --> <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String"> select count(*) from lf.sys_dict <where> + ns = #{ns} <if test="tab != null"> - tab = #{tab} + and tab like #{tab} </if> </where> </select> - <!-- 鍒嗛〉鏌ヨ --> <select id="selectByPage" resultType="com.lf.server.entity.data.DictEntity"> select * from lf.sys_dict <where> + ns = #{ns} <if test="tab != null"> - tab = #{tab} + and tab like #{tab} </if> </where> - order by ns,tab,order_num + order by id limit #{limit} offset #{offset} </select> - <select id="selectDictTab" resultType="com.lf.server.entity.data.DictEntity"> - select Distinct tab,tab_desc from lf.sys_dict; - </select> - - <select id="selectDictAll" resultType="com.lf.server.entity.data.DictEntity"> + <select id="selectAll" resultType="com.lf.server.entity.data.DictEntity"> select * from lf.sys_dict order by id; </select> - <select id="selectDict" resultType="com.lf.server.entity.data.DictEntity"> + <select id="selectById" resultType="com.lf.server.entity.data.DictEntity"> select * from lf.sys_dict where id = #{id} </select> - <insert id="insertDict" parameterType="com.lf.server.entity.data.DictEntity"> + <insert id="insert" parameterType="com.lf.server.entity.data.DictEntity"> insert into lf.sys_dict - (ns,tab,tab_desc,field,alias,type,len,precision,order_num,create_user,create_time,bak) + (ns,tab,tab_desc,field,alias,type,len,precision,order_num,create_user,create_time,tabletype,unit,domain_na,showtype,editable,bak) values - (#{ns},#{tab},#{tabDesc},#{field},#{alias},#{type},#{len},#{precision},#{orderNum},#{createUser}, - now(),#{bak}); + (#{ns},#{tab},#{tabDesc},#{field},#{alias},#{type},#{len},#{precision},#{orderNum},#{createUser},now(),#{tabletype},#{unit},#{domainNa},#{showtype},#{editable},#{bak}) </insert> - <insert id="insertDicts"> - insert into lf.sys_dict - (ns,tab,tab_desc,field,alias,type,len,precision,order_num,create_user,create_time,bak) - values + <insert id="inserts"> + insert into lf.sys_dict + (ns,tab,tab_desc,field,alias,type,len,precision,order_num,create_user,create_time,tabletype,unit,domain_na,showtype,editable,bak) + values <foreach collection="list" item="item" index="index" separator=","> - (#{item.ns},#{item.tab},#{item.tabDesc},#{item.field},#{item.alias},#{item.type},#{item.len}, - #{item.precision},#{item.orderNum},#{item.createUser},now(),#{item.bak}) + (#{item.ns},#{item.tab},#{item.tabDesc},#{item.field},#{item.alias},#{item.type},#{item.len},#{item.precision},#{item.orderNum},#{item.createUser},now(),#{item.tabletype},#{item.unit},#{item.domainNa},#{item.showtype},#{item.editable},#{item.bak}) </foreach> </insert> - <delete id="deleteDict"> + <delete id="delete"> delete from lf.sys_dict where id = #{id} </delete> - <delete id="deleteDicts"> + <delete id="deletes"> delete from lf.sys_dict where id in <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> #{id} </foreach> </delete> - <update id="updateDict"> - update lf.sys_dict set ns=#{ns},tab=#{tab},tab_desc=#{tabDesc},field=#{field},alias=#{alias},type=#{type}, - len=#{len},precision=#{precision}, order_num=#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} + <update id="update"> + update lf.sys_dict + set ns=#{ns},tab=#{tab},tab_desc=#{tabDesc},field=#{field},alias=#{alias},type=#{type},len=#{len},precision=#{precision},order_num=#{orderNum},update_user=#{updateUser},update_time=now(),tabletype=#{tabletype},unit=#{unit},domain_na=#{domainNa},showtype=#{showtype},editable=#{editable},bak=#{bak} + where id=#{id} + </update> + + <update id="updates"> + <foreach collection="list" item="item" index="index" separator=";"> + update lf.sys_dict + <set> + ns=#{item.ns},tab=#{item.tab},tab_desc=#{item.tabDesc},field=#{item.field},alias=#{item.alias},type=#{item.type},len=#{item.len},precision=#{item.precision},order_num=#{item.orderNum},update_user=#{item.updateUser},update_time=now(),tabletype=#{item.tabletype},unit=#{item.unit},domain_na=#{item.domainNa},showtype=#{item.showtype},editable=#{item.editable},bak=#{item.bak} + </set> + where id = #{item.id} + </foreach> </update> </mapper> \ No newline at end of file diff --git "a/\350\257\264\346\230\216.txt" "b/\350\257\264\346\230\216.txt" index 8c8f7d7..8ee1499 100644 --- "a/\350\257\264\346\230\216.txt" +++ "b/\350\257\264\346\230\216.txt" @@ -30,7 +30,15 @@ 29.寮�鍙戞壒閲忎慨鏀圭敤鎴峰瘑鐮佹帴鍙� 30.寮�鍙戜笂浼燬hp鏂囦欢鍔熻兘 31.浣跨敤Gdal璇诲彇Shp鏂囦欢锛岃鍙栧悗鍒犻櫎鏂囦欢 < - +32. +33. +34. +35. +36. +37. +38. +39. +40. ----------------------------------------------- .瀵圭敤鎴枫�佽彍鍗曘�佽鑹层�佽祫婧愯繘琛屾巿鏉� .娣诲姞鏌ヨ瑙掕壊銆佽彍鍗曘�佽祫婧愭潈闄愭帴鍙� -- Gitblit v1.9.3