管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-12-23 17abb629a1921058e1a6ed5562e9d94e74b8dffc
1
已添加10个文件
已修改2个文件
1296 ■■■■■ 文件已修改
data/db_fn.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_tab.sql 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/ApplyController.java 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/FlowController.java 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/show/ApplyEntity.java 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/show/FlowEntity.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/show/ApplyMapper.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/show/FlowMapper.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/ApplyService.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/FlowService.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/show/ApplyMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/show/FlowMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_fn.sql
@@ -355,8 +355,8 @@
select count(*) from lf.sys_downlog a inner join lf.sys_user b on a.create_user = b.id inner join lf.sys_download c on a.downid = c.id
WHERE 1 = 1 and b.uname like '%管理员%' and c.type = 3 and a.create_time >= ? and a.create_time <= ?
select * from lf.sys_download
select * from lf.sys_downlog
select * from lf.sys_download where id in (80,100);
select * from lf.sys_downlog;
data/db_tab.sql
@@ -1035,6 +1035,64 @@
-- insert into lf.sys_downlog(downid,ip,create_user) values (100,'192.168.20.39',1);
select * from lf.sys_downlog;
----------------------------------------------------------------------------------------------------- 30.数据申请表
-- drop table if exists lf.sys_apply;
create table lf.sys_apply (
    id serial primary key,
    userid integer default 0,
    depids varchar(100),
    tables varchar(1000),
    wkt varchar(4000),
    status integer default 0,
    count integer default 0,
    descr varchar(50),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone
);
comment on table lf.sys_apply is '数据申请表';
comment on column lf.sys_apply.id is '主键ID';
comment on column lf.sys_apply.userid is '用户ID';
comment on column lf.sys_apply.depids is '单位ID';
comment on column lf.sys_apply.tables is '表名';
comment on column lf.sys_apply.wkt is 'WKT';
comment on column lf.sys_apply.status is '状态:-10-作废,-1-打回,0-申请中,1~9,审核中,10-通过';
comment on column lf.sys_apply.count is '审核总数';
comment on column lf.sys_apply.descr is '描述';
comment on column lf.sys_apply.create_user is '创建人id';
comment on column lf.sys_apply.create_time is '创建时间';
comment on column lf.sys_apply.update_user is '更新人id';
comment on column lf.sys_apply.update_time is '更新时间';
select * from lf.sys_apply;
----------------------------------------------------------------------------------------------------- 31.申请流程表
-- drop table if exists lf.sys_flow;
create table lf.sys_flow (
    id serial primary key,
    applyid integer,
    depid integer,
    userid integer,
    status integer default 0,
    descr varchar(50),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone
);
comment on table lf.sys_flow is '申请流程表';
comment on column lf.sys_flow.id is '主键id';
comment on column lf.sys_flow.applyid is '申请ID';
comment on column lf.sys_flow.depid is '单位ID';
comment on column lf.sys_flow.userid is '用户ID';
comment on column lf.sys_flow.status is '状态:-1-打回,0-申请中,1-通过';
comment on column lf.sys_flow.descr is '描述';
comment on column lf.sys_flow.create_user is '创建人id';
comment on column lf.sys_flow.create_time is '创建时间';
comment on column lf.sys_flow.update_user is '更新人id';
comment on column lf.sys_flow.update_time is '更新时间';
select * from lf.sys_flow;
----------------------------------------------------------------------------------------------------- å…ƒæ•°æ®æµ‹è¯•表 *
-- drop table if exists md.md_zxcg;
create table md.md_zxcg(
src/main/java/com/lf/server/controller/show/ApplyController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,253 @@
package com.lf.server.controller.show;
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.show.ApplyEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.service.show.ApplyService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * æ•°æ®ç”³è¯·
 * @author WWW
 */
@Api(tags = "运维管理\\数据申请")
@RestController
@RequestMapping("/apply")
public class ApplyController extends BaseController {
    @Autowired
    ApplyService applyService;
    @Autowired
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(Integer userid) {
        try {
            int count = applyService.selectCount(userid);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", example = ""),
            @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<ApplyEntity>> selectByPage(Integer userid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<ApplyEntity> rs = applyService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", example = ""),
            @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<ApplyEntity>> selectByPageAndCount(Integer userid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = applyService.selectCount(userid);
            if (count == 0) {
                return success(0, null);
            }
            List<ApplyEntity> rs = applyService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<ApplyEntity>> selectAll() {
        try {
            List<ApplyEntity> list = applyService.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<ApplyEntity> selectById(int id) {
        try {
            ApplyEntity entity = applyService.selectById(id);
            return success(entity);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "ApplyEntity", paramType = "body")
    })
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insert(@RequestBody ApplyEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setCreateUser(ue.getId());
            }
            int count = applyService.insert(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "ApplyEntity", paramType = "body")
    })
    @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> inserts(@RequestBody List<ApplyEntity> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for (ApplyEntity entity : list) {
                    entity.setCreateUser(ue.getId());
                }
            }
            int count = applyService.inserts(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/delete")
    public ResponseMsg<Integer> delete(int id) {
        try {
            int count = applyService.delete(id);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
    })
    @GetMapping(value = "/deletes")
    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) {
        try {
            if (ids == null || ids.isEmpty()) {
                return fail("id数组不能为空", -1);
            }
            int count = applyService.deletes(ids);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "ApplyEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> update(@RequestBody ApplyEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUpdateUser(ue.getId());
            }
            int count = applyService.update(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "ApplyEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> updates(@RequestBody List<ApplyEntity> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for (ApplyEntity entity : list) {
                    entity.setUpdateUser(ue.getId());
                }
            }
            int count = applyService.updates(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
}
src/main/java/com/lf/server/controller/show/FlowController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,253 @@
package com.lf.server.controller.show;
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.show.FlowEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.service.show.FlowService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * ç”³è¯·æµç¨‹
 * @author WWW
 */
@Api(tags = "运维管理\\申请流程")
@RestController
@RequestMapping("/flow")
public class FlowController extends BaseController {
    @Autowired
    FlowService flowService;
    @Autowired
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(Integer userid) {
        try {
            int count = flowService.selectCount(userid);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", example = ""),
            @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<FlowEntity>> selectByPage(Integer userid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<FlowEntity> rs = flowService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", example = ""),
            @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<FlowEntity>> selectByPageAndCount(Integer userid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = flowService.selectCount(userid);
            if (count == 0) {
                return success(0, null);
            }
            List<FlowEntity> rs = flowService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<FlowEntity>> selectAll() {
        try {
            List<FlowEntity> list = flowService.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<FlowEntity> selectById(int id) {
        try {
            FlowEntity entity = flowService.selectById(id);
            return success(entity);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "FlowEntity", paramType = "body")
    })
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insert(@RequestBody FlowEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setCreateUser(ue.getId());
            }
            int count = flowService.insert(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "FlowEntity", paramType = "body")
    })
    @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> inserts(@RequestBody List<FlowEntity> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for (FlowEntity entity : list) {
                    entity.setCreateUser(ue.getId());
                }
            }
            int count = flowService.inserts(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/delete")
    public ResponseMsg<Integer> delete(int id) {
        try {
            int count = flowService.delete(id);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
    })
    @GetMapping(value = "/deletes")
    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) {
        try {
            if (ids == null || ids.isEmpty()) {
                return fail("id数组不能为空", -1);
            }
            int count = flowService.deletes(ids);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "FlowEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> update(@RequestBody FlowEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUpdateUser(ue.getId());
            }
            int count = flowService.update(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "FlowEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> updates(@RequestBody List<FlowEntity> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for (FlowEntity entity : list) {
                    entity.setUpdateUser(ue.getId());
                }
            }
            int count = flowService.updates(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
}
src/main/java/com/lf/server/entity/show/ApplyEntity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,135 @@
package com.lf.server.entity.show;
import java.io.Serializable;
import java.sql.Timestamp;
/**
 * æ•°æ®ç”³è¯·
 * @author WWW
 */
public class ApplyEntity implements Serializable {
    private static final long serialVersionUID = -681840196569375744L;
    private int id;
    private int userid;
    private String depids;
    private String tables;
    private String wkt;
    private int status;
    private int count;
    private String descr;
    private int createUser;
    private Timestamp createTime;
    private int updateUser;
    private Timestamp updateTime;
    public ApplyEntity() {
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public int getUserid() {
        return userid;
    }
    public void setUserid(int userid) {
        this.userid = userid;
    }
    public String getDepids() {
        return depids;
    }
    public void setDepids(String depids) {
        this.depids = depids;
    }
    public String getTables() {
        return tables;
    }
    public void setTables(String tables) {
        this.tables = tables;
    }
    public String getWkt() {
        return wkt;
    }
    public void setWkt(String wkt) {
        this.wkt = wkt;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
    public String getDescr() {
        return descr;
    }
    public void setDescr(String descr) {
        this.descr = descr;
    }
    public int getCreateUser() {
        return createUser;
    }
    public void setCreateUser(int createUser) {
        this.createUser = createUser;
    }
    public Timestamp getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
    public int getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(int updateUser) {
        this.updateUser = updateUser;
    }
    public Timestamp getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }
}
src/main/java/com/lf/server/entity/show/FlowEntity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,115 @@
package com.lf.server.entity.show;
import java.io.Serializable;
import java.sql.Timestamp;
/**
 * ç”³è¯·æµç¨‹
 * @author WWW
 */
public class FlowEntity implements Serializable {
    private static final long serialVersionUID = -267684465864526336L;
    private int id;
    private int applyid;
    private int depid;
    private int userid;
    private int status;
    private String descr;
    private int createUser;
    private Timestamp createTime;
    private int updateUser;
    private Timestamp updateTime;
    public FlowEntity() {
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public int getApplyid() {
        return applyid;
    }
    public void setApplyid(int applyid) {
        this.applyid = applyid;
    }
    public int getDepid() {
        return depid;
    }
    public void setDepid(int depid) {
        this.depid = depid;
    }
    public int getUserid() {
        return userid;
    }
    public void setUserid(int userid) {
        this.userid = userid;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getDescr() {
        return descr;
    }
    public void setDescr(String descr) {
        this.descr = descr;
    }
    public int getCreateUser() {
        return createUser;
    }
    public void setCreateUser(int createUser) {
        this.createUser = createUser;
    }
    public Timestamp getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
    public int getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(int updateUser) {
        this.updateUser = updateUser;
    }
    public Timestamp getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }
}
src/main/java/com/lf/server/mapper/show/ApplyMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package com.lf.server.mapper.show;
import com.lf.server.entity.show.ApplyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * æ•°æ®ç”³è¯·
 * @author WWW
 */
@Mapper
@Repository
public interface ApplyMapper {
    /**
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param userid ç”¨æˆ·ID
     * @return è®°å½•æ•°
     */
    public Integer selectCount(Integer userid);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param userid   ç”¨æˆ·ID
     * @param limit  è®°å½•æ•°
     * @param offset åç§»é‡
     * @return åˆ—表
     */
    public List<ApplyEntity> selectByPage(Integer userid, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢æ‰€æœ‰
     *
     * @return
     */
    public List<ApplyEntity> selectAll();
    /**
     * æ ¹æ®ID查询
     *
     * @param id
     * @return
     */
    public ApplyEntity selectById(int id);
    /**
     * æ’入一条
     *
     * @param entity
     * @return
     */
    public Integer insert(ApplyEntity entity);
    /**
     * æ’入多条
     *
     * @param list
     * @return
     */
    public Integer inserts(List<ApplyEntity> list);
    /**
     * åˆ é™¤ä¸€æ¡
     *
     * @param id
     * @return
     */
    public Integer delete(int id);
    /**
     * åˆ é™¤å¤šæ¡
     *
     * @param ids
     * @return
     */
    public Integer deletes(List<Integer> ids);
    /**
     * æ›´æ–°ä¸€æ¡
     *
     * @param entity
     * @return
     */
    public Integer update(ApplyEntity entity);
    /**
     * æ›´æ–°å¤šæ¡
     *
     * @param list
     * @return
     */
    public Integer updates(List<ApplyEntity> list);
}
src/main/java/com/lf/server/mapper/show/FlowMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package com.lf.server.mapper.show;
import com.lf.server.entity.show.FlowEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * ç”³è¯·æµç¨‹
 * @author WWW
 */
@Mapper
@Repository
public interface FlowMapper {
    /**
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param userid ç”¨æˆ·ID
     * @return è®°å½•æ•°
     */
    public Integer selectCount(Integer userid);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param userid   ç”¨æˆ·ID
     * @param limit  è®°å½•æ•°
     * @param offset åç§»é‡
     * @return åˆ—表
     */
    public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢æ‰€æœ‰
     *
     * @return
     */
    public List<FlowEntity> selectAll();
    /**
     * æ ¹æ®ID查询
     *
     * @param id
     * @return
     */
    public FlowEntity selectById(int id);
    /**
     * æ’入一条
     *
     * @param entity
     * @return
     */
    public Integer insert(FlowEntity entity);
    /**
     * æ’入多条
     *
     * @param list
     * @return
     */
    public Integer inserts(List<FlowEntity> list);
    /**
     * åˆ é™¤ä¸€æ¡
     *
     * @param id
     * @return
     */
    public Integer delete(int id);
    /**
     * åˆ é™¤å¤šæ¡
     *
     * @param ids
     * @return
     */
    public Integer deletes(List<Integer> ids);
    /**
     * æ›´æ–°ä¸€æ¡
     *
     * @param entity
     * @return
     */
    public Integer update(FlowEntity entity);
    /**
     * æ›´æ–°å¤šæ¡
     *
     * @param list
     * @return
     */
    public Integer updates(List<FlowEntity> list);
}
src/main/java/com/lf/server/service/show/ApplyService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.lf.server.service.show;
import com.lf.server.entity.show.ApplyEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.show.ApplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * æ•°æ®ç”³è¯·
 * @author WWW
 */
@Service
public class ApplyService implements ApplyMapper {
    @Autowired
    ApplyMapper applyMapper;
    @Override
    public Integer selectCount(Integer userid) {
        return applyMapper.selectCount(userid);
    }
    @Override
    public List<ApplyEntity> selectByPage(Integer userid, Integer limit, Integer offset) {
        return applyMapper.selectByPage(userid, limit, offset);
    }
    @Override
    public List<ApplyEntity> selectAll() {
        return applyMapper.selectAll();
    }
    @Override
    public ApplyEntity selectById(int id) {
        return applyMapper.selectById(id);
    }
    @Override
    public Integer insert(ApplyEntity entity) {
        return applyMapper.insert(entity);
    }
    @Override
    public Integer inserts(List<ApplyEntity> list) {
        return applyMapper.inserts(list);
    }
    @Override
    public Integer delete(int id) {
        return applyMapper.delete(id);
    }
    @Override
    public Integer deletes(List<Integer> ids) {
        return applyMapper.deletes(ids);
    }
    @Override
    public Integer update(ApplyEntity entity) {
        return applyMapper.update(entity);
    }
    @Override
    public Integer updates(List<ApplyEntity> list) {
        return applyMapper.updates(list);
    }
}
src/main/java/com/lf/server/service/show/FlowService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.lf.server.service.show;
import com.lf.server.entity.show.FlowEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.show.FlowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * ç”³è¯·æµç¨‹
 * @author WWW
 */
@Service
public class FlowService implements FlowMapper {
    @Autowired
    FlowMapper flowMapper;
    @Override
    public Integer selectCount(Integer userid) {
        return flowMapper.selectCount(userid);
    }
    @Override
    public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset) {
        return flowMapper.selectByPage(userid, limit, offset);
    }
    @Override
    public List<FlowEntity> selectAll() {
        return flowMapper.selectAll();
    }
    @Override
    public FlowEntity selectById(int id) {
        return flowMapper.selectById(id);
    }
    @Override
    public Integer insert(FlowEntity entity) {
        return flowMapper.insert(entity);
    }
    @Override
    public Integer inserts(List<FlowEntity> list) {
        return flowMapper.inserts(list);
    }
    @Override
    public Integer delete(int id) {
        return flowMapper.delete(id);
    }
    @Override
    public Integer deletes(List<Integer> ids) {
        return flowMapper.deletes(ids);
    }
    @Override
    public Integer update(FlowEntity entity) {
        return flowMapper.update(entity);
    }
    @Override
    public Integer updates(List<FlowEntity> list) {
        return flowMapper.updates(list);
    }
}
src/main/resources/mapper/show/ApplyMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
<?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">
<mapper namespace="com.lf.server.mapper.show.ApplyMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_apply
        <where>
            <if test="userid != null">
                userid = #{userid}
            </if>
        </where>
    </select>
    <select id="selectByPage" resultType="com.lf.server.entity.show.ApplyEntity">
        select * from lf.sys_apply
        <where>
            <if test="userid != null">
                userid = #{userid}
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset}
    </select>
    <select id="selectAll" resultType="com.lf.server.entity.show.ApplyEntity">
        select * from lf.sys_apply order by id;
    </select>
    <select id="selectById" resultType="com.lf.server.entity.show.ApplyEntity">
        select * from lf.sys_apply where id = #{id}
    </select>
    <insert id="insert" parameterType="com.lf.server.entity.show.ApplyEntity">
       insert into lf.sys_apply
       (userid,depids,tables,wkt,status,count,descr,create_user,create_time)
       values
       (#{userid},#{depids},#{tables},#{wkt},#{status},#{count},#{descr},#{createUser},now())
    </insert>
    <insert id="inserts">
        insert into lf.sys_apply
        (userid,depids,tables,wkt,status,count,descr,create_user,create_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.userid},#{item.depids},#{item.tables},#{item.wkt},#{item.status},#{item.count},#{item.descr},#{item.createUser},now())
        </foreach>
    </insert>
    <delete id="delete">
        delete from lf.sys_apply where id = #{id}
    </delete>
    <delete id="deletes">
        delete from lf.sys_apply where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <update id="update">
        update lf.sys_apply
        set userid=#{userid},depids=#{depids},tables=#{tables},wkt=#{wkt},status=#{status},count=#{count},descr=#{descr},update_user=#{updateUser},update_time=now()
        where id=#{id}
    </update>
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_apply
            <set>
                userid=#{item.userid},depids=#{item.depids},tables=#{item.tables},wkt=#{item.wkt},status=#{item.status},count=#{item.count},descr=#{item.descr},update_user=#{item.updateUser},update_time=now()
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>
src/main/resources/mapper/show/FlowMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
<?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">
<mapper namespace="com.lf.server.mapper.show.FlowMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_flow
        <where>
            <if test="userid != null">
                userid = #{userid}
            </if>
        </where>
    </select>
    <select id="selectByPage" resultType="com.lf.server.entity.show.FlowEntity">
        select * from lf.sys_flow
        <where>
            <if test="userid != null">
                userid = #{userid}
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset}
    </select>
    <select id="selectAll" resultType="com.lf.server.entity.show.FlowEntity">
        select * from lf.sys_flow order by id;
    </select>
    <select id="selectById" resultType="com.lf.server.entity.show.FlowEntity">
        select * from lf.sys_flow where id = #{id}
    </select>
    <insert id="insert" parameterType="com.lf.server.entity.show.FlowEntity">
       insert into lf.sys_flow
       (applyid,depid,userid,status,descr,create_user,create_time)
       values
       (#{applyid},#{depid},#{userid},#{status},#{descr},#{createUser},now())
    </insert>
    <insert id="inserts">
        insert into lf.sys_flow
        (applyid,depid,userid,status,descr,create_user,create_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.applyid},#{item.depid},#{item.userid},#{item.status},#{item.descr},#{item.createUser},now())
        </foreach>
    </insert>
    <delete id="delete">
        delete from lf.sys_flow where id = #{id}
    </delete>
    <delete id="deletes">
        delete from lf.sys_flow where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <update id="update">
        update lf.sys_flow
        set applyid=#{applyid},depid=#{depid},userid=#{userid},status=#{status},descr=#{descr},update_user=#{updateUser},update_time=now()
        where id=#{id}
    </update>
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_flow
            <set>
                applyid=#{item.applyid},depid=#{item.depid},userid=#{item.userid},status=#{item.status},descr=#{item.descr},update_user=#{item.updateUser},update_time=now()
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>