管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-02 eb1af5f77f2c16e580173553e548ff4e41653e4e
1
已修改12个文件
467 ■■■■■ 文件已修改
data/db_fn.sql 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_tab.sql 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/all/BaseQueryController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/DictController.java 143 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/data/DictEntity.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/data/DictMapper.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/all/BaseQueryService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/DictService.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/all/BaseQueryMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/DictMapper.xml 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
说明.txt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
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 '更新人ID';
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(
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);
        }
    }
}
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);
        }
    }
}
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;
    }
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();
}
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);
}
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();
    }
}
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);
    }
}
    @Override
    public Integer updates(List<DictEntity> list) {
        return dictMapper.updates(list);
    }
}
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>
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>
˵Ã÷.txt
@@ -30,7 +30,15 @@
29.开发批量修改用户密码接口
30.开发上传Shp文件功能
31.使用Gdal读取Shp文件,读取后删除文件 <
32.
33.
34.
35.
36.
37.
38.
39.
40.
-----------------------------------------------
.对用户、菜单、角色、资源进行授权
.添加查询角色、菜单、资源权限接口