From ccda8b2733a2fabb8c23c062583b1437d6866379 Mon Sep 17 00:00:00 2001
From: cy <1664593601@qq.com>
Date: 星期四, 09 十一月 2023 11:47:48 +0800
Subject: [PATCH] feat: 增加查询角色类
---
consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer_mapper.java | 351 +++++++++++++++++++
consum-base/src/main/java/com/consum/base/service/FinSysServerImpl.java | 96 +++++
consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java | 102 +++++
consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer.java | 304 ++++++++++++++++
consum-base/src/main/java/com/consum/base/pojo/FinSysServerSearchParam.java | 24 +
consum-base/src/main/java/com/consum/base/pojo/FinSysServerVo.java | 176 +++++++++
6 files changed, 1,053 insertions(+), 0 deletions(-)
diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java
new file mode 100644
index 0000000..be7b9be
--- /dev/null
+++ b/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java
@@ -0,0 +1,102 @@
+package com.consum.base.controller;
+
+import com.consum.base.BaseController;
+import com.consum.base.pojo.FinSysServerSearchParam;
+import com.consum.base.pojo.FinSysServerVo;
+import com.consum.base.service.FinSysServerImpl;
+import com.consum.model.po.FinSysServer;
+import com.walker.db.page.GenericPager;
+import com.walker.db.page.ListPageContext;
+import com.walker.db.page.PageSearch;
+import com.walker.infrastructure.utils.DateUtils;
+import com.walker.infrastructure.utils.NumberGenerator;
+import com.walker.web.ResponseValue;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/pc/fin/sys/server")
+public class FinSysServerController extends BaseController {
+
+ private FinSysServerImpl finSysServerImpl;
+ @Autowired
+ public void setfinSysCategory(FinSysServerImpl finSysServerImpl){
+ this.finSysServerImpl= finSysServerImpl;
+ }
+
+ /**
+ * @Description 鏍规嵁DataScop鏌ヨ鏁版嵁淇℃伅
+ * @Author wh
+ * @Date 2023/9/13 9:27
+ */
+ @GetMapping("/selectByDataScope")
+ public ResponseValue selectByDataScope(Integer dataScope){
+ return ResponseValue.success(finSysServerImpl.getByDataScope(dataScope));
+ }
+
+ /**
+ * 鏌ヨ宸︿晶鏍�
+ * @return
+ */
+ @GetMapping("/select/tree")
+ public ResponseValue selectFinSysCategoryTree(){
+
+ List<FinSysServerVo> finSysCategoryVos = finSysServerImpl.queryAllCategory();
+ if(finSysCategoryVos!=null){
+ return ResponseValue.success(finSysCategoryVos);
+ }
+ return ResponseValue.error("鏈煡璇㈠埌鏁版嵁锛�");
+
+ }
+
+ @GetMapping("/select/detail")
+ public ResponseValue selectById(@RequestParam(name = "id") Long Id){
+ FinSysServer finSysServer = this.finSysServerImpl.get(new FinSysServer(Id));
+ if (finSysServer == null) return ResponseValue.error("鏌ヨ澶辫触锛�");
+ return ResponseValue.success("鏌ヨ鎴愬姛!",finSysServer);
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ * @param param
+ * @return
+ */
+ @RequestMapping("/select/list")
+ public ResponseValue finSysServerList(FinSysServerSearchParam param){
+ PageSearch pageSearch = ListPageContext.getPageSearch();
+
+ GenericPager<FinSysServer> pager = this.finSysServerImpl.selectServerListByPage(param);
+ return ResponseValue.success(pager);
+ }
+
+ /**
+ * 娣诲姞
+ * @param finSysServer
+ * @return
+ */
+ @PostMapping("/insert")
+ public ResponseValue addFinSysServer(@RequestBody FinSysServer finSysServer){
+ if(finSysServer==null) return ResponseValue.error("鍙傛暟涓虹┖");
+ finSysServer.setId(NumberGenerator.getLongSequenceNumber());
+ finSysServer.setCreatedTime(DateUtils.getDateTimeNumber(System.currentTimeMillis()));
+ finSysServer.setCreatedBy(this.getCurrentUser().getUser_name());
+ finSysServer.setLv(finSysServer.getParentId()+1);
+ int num = this.finSysServerImpl.insert(finSysServer);
+ if(num>0) return ResponseValue.success(1);
+ return ResponseValue.error("鎻掑叆澶辫触锛�");
+ }
+ /**
+ * 缂栬緫
+ */
+ @PostMapping("/edit")
+ public ResponseValue editFinSysServer(@RequestBody FinSysServer finSysServer){
+ if (finSysServer==null) return ResponseValue.error("鍙傛暟涓虹┖");
+// if(finSysServer.getLvType()!=null) {
+// finSysServer.setLv(Long.valueOf(finSysServer.getLvType()));
+// }
+ int num = this.finSysServerImpl.save(finSysServer);
+ return num>0 ? ResponseValue.success(1):ResponseValue.error("缂栬緫澶辫触锛�");
+ }
+}
diff --git a/consum-base/src/main/java/com/consum/base/pojo/FinSysServerSearchParam.java b/consum-base/src/main/java/com/consum/base/pojo/FinSysServerSearchParam.java
new file mode 100644
index 0000000..ebe3823
--- /dev/null
+++ b/consum-base/src/main/java/com/consum/base/pojo/FinSysServerSearchParam.java
@@ -0,0 +1,24 @@
+package com.consum.base.pojo;
+
+import com.walker.web.param.ParamRequest;
+
+public class FinSysServerSearchParam extends ParamRequest {
+ private Long parentId;
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+}
diff --git a/consum-base/src/main/java/com/consum/base/pojo/FinSysServerVo.java b/consum-base/src/main/java/com/consum/base/pojo/FinSysServerVo.java
new file mode 100644
index 0000000..c35e9bd
--- /dev/null
+++ b/consum-base/src/main/java/com/consum/base/pojo/FinSysServerVo.java
@@ -0,0 +1,176 @@
+package com.consum.base.pojo;
+
+import java.util.List;
+
+public class FinSysServerVo {
+// // 涓婚敭
+// private Long id = null;
+// // 灞炴�у垪琛�
+// // private Long createTime = null;
+// private Long createdTime = null;
+// // private String createUser = null;
+// private String createdBy = null;
+// private String name = null;
+// private String code = null;
+// //private Integer level = null;
+// private Integer lvType=null;
+// private Long lv = null;
+// private Long status = null;
+// private Long delFlag = null;
+// private Long parentId = null;
+// private List<FinSysServerVo> children=null;
+//
+// public FinSysServerVo() {
+// }
+//
+// public Long getId() {
+// return id;
+// }
+//
+// public void setId(Long id) {
+// this.id = id;
+// }
+//
+// public Long getCreatedTime() {
+// return createdTime;
+// }
+//
+// public void setCreatedTime(Long createdTime) {
+// this.createdTime = createdTime;
+// }
+//
+// public String getCreatedBy() {
+// return createdBy;
+// }
+//
+// public void setCreatedBy(String createdBy) {
+// this.createdBy = createdBy;
+// }
+//
+// public String getName() {
+// return name;
+// }
+//
+// public void setName(String name) {
+// this.name = name;
+// }
+//
+// public String getCode() {
+// return code;
+// }
+//
+// public void setCode(String code) {
+// this.code = code;
+// }
+//
+// public Integer getLvType() {
+// return lvType;
+// }
+//
+// public void setLvType(Integer lvType) {
+// this.lvType = lvType;
+// }
+//
+// public Long getLv() {
+// return lv;
+// }
+//
+// public void setLv(Long lv) {
+// this.lv = lv;
+// }
+//
+// public Long getStatus() {
+// return status;
+// }
+//
+// public void setStatus(Long status) {
+// this.status = status;
+// }
+//
+// public Long getDelFlag() {
+// return delFlag;
+// }
+//
+// public void setDelFlag(Long delFlag) {
+// this.delFlag = delFlag;
+// }
+//
+// public Long getParentId() {
+// return parentId;
+// }
+//
+// public void setParentId(Long parentId) {
+// this.parentId = parentId;
+// }
+//
+// public List<FinSysServerVo> getChildren() {
+// return children;
+// }
+//
+// public void setChildren(List<FinSysServerVo> children) {
+// this.children = children;
+// }
+//
+// @Override
+// public String toString() {
+// return "FinSysCategoryVo{" +
+// "id=" + id +
+// ", createdTime=" + createdTime +
+// ", createdBy='" + createdBy + '\'' +
+// ", name='" + name + '\'' +
+// ", code='" + code + '\'' +
+// ", lvType=" + lvType +
+// ", lv=" + lv +
+// ", status=" + status +
+// ", delFlag=" + delFlag +
+// ", parentId=" + parentId +
+// ", children=" + children +
+// '}';
+// }
+ private Long id;
+ private String label;
+ private Long parentId;
+ private List<FinSysServerVo> children;
+
+ public FinSysServerVo(Long id, String label, Long parentId, List<FinSysServerVo> children) {
+ this.id = id;
+ this.label = label;
+ this.parentId = parentId;
+ this.children = children;
+ }
+
+ public FinSysServerVo() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+
+ public List<FinSysServerVo> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<FinSysServerVo> children) {
+ this.children = children;
+ }
+}
diff --git a/consum-base/src/main/java/com/consum/base/service/FinSysServerImpl.java b/consum-base/src/main/java/com/consum/base/service/FinSysServerImpl.java
new file mode 100644
index 0000000..a55fa5c
--- /dev/null
+++ b/consum-base/src/main/java/com/consum/base/service/FinSysServerImpl.java
@@ -0,0 +1,96 @@
+package com.consum.base.service;
+
+import com.consum.base.pojo.FinSysServerSearchParam;
+import com.consum.base.pojo.FinSysServerVo;
+import com.consum.model.po.FinSysServer;
+import com.iplatform.model.po.S_role;
+import com.walker.db.page.GenericPager;
+import com.walker.jdbc.service.BaseServiceImpl;
+import com.walker.jdbc.util.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class FinSysServerImpl extends BaseServiceImpl {
+ private static final String SELECT_TREE_ALL = "select * from FIN_SYS_SERVER";
+ private static final String SELECT_CHILD_BY_ID = "select * from FIN_SYS_SERVER where 1=1";
+
+ // private static final String S
+ /**
+ * 鏌ヨ鎵�鏈夋湇鍔$洰褰�
+ *
+ * @return
+ * @date 2023-07-11
+ */
+ public List<FinSysServerVo> queryAllCategory() {
+ List<FinSysServer> finSysCategories = this.select(SELECT_TREE_ALL, new Object[] {}, new FinSysServer());
+ List<FinSysServerVo> result = null;
+ if (finSysCategories != null) {
+ List<FinSysServerVo> finSysCategoryVos = finSysCategories.stream().map(category -> {
+ FinSysServerVo finSysCategoryVo = new FinSysServerVo();
+ // BeanUtils.copyProperties(category, finSysCategoryVo);
+ finSysCategoryVo.setId(category.getId());
+ finSysCategoryVo.setLabel(category.getName());
+ finSysCategoryVo.setParentId(category.getParentId());
+ return finSysCategoryVo;
+ }).collect(Collectors.toList());
+ result = finSysCategoryVos.stream().filter(c -> c.getParentId() == 0).map(tree -> {
+ tree.setChildren(getChildren(tree, finSysCategoryVos));
+ return tree;
+ }).collect(Collectors.toList());
+ }
+ return result;
+ }
+
+ private List<FinSysServerVo> getChildren(FinSysServerVo tree, List<FinSysServerVo> finSysCategoryVos) {
+ return finSysCategoryVos.stream().filter(c -> c.getParentId() == tree.getId()).map(m -> {
+ m.setChildren(getChildren(m, finSysCategoryVos));
+ return m;
+ }).collect(Collectors.toList());
+ }
+
+ /**
+ * 鏍规嵁id鏌ヨ褰撲笅鑿滃崟鎵�灞炲瓙鑿滃崟
+ */
+ public List<FinSysServer> findChildById(Long parentId) {
+ List<FinSysServer> children = this.select(SELECT_CHILD_BY_ID, new Object[] {parentId}, new FinSysServer());
+ return children;
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param param
+ * @return
+ */
+ public GenericPager<FinSysServer> selectServerListByPage(FinSysServerSearchParam param) {
+ Map<String, Object> parameter = new HashMap();
+ StringBuilder sql = new StringBuilder(SELECT_CHILD_BY_ID);
+ if (param.getName() != null && StringUtils.isNotEmpty(param.getName())) {
+ sql.append(" and NAME like :name");
+ parameter.put("name", StringUtils.CHAR_PERCENT + param.getName() + StringUtils.CHAR_PERCENT);
+ }
+ if (param.getParentId() != null) {
+ sql.append(" and PARENT_ID = :parentId");
+ parameter.put("parentId", param.getParentId());
+ }
+ return this.selectSplit(sql.toString(), parameter, new FinSysServer());
+
+ }
+
+ /**
+ * @Description 鏍规嵁DataScope鏌ヨ淇℃伅
+ * @Author wh
+ * @Date 2023/9/13 9:35
+ */
+ public List<S_role> getByDataScope(Integer dataScope) {
+ Map<String, Object> parameter = new HashMap();
+ String sql = "SELECT * FROM S_ROLE sr WHERE status=0 and DATA_SCOPE = :dataScope";
+ parameter.put("dataScope", dataScope);
+ return this.select(sql.toString(), parameter, new S_role());
+ }
+}
diff --git a/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer.java b/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer.java
new file mode 100644
index 0000000..72f6956
--- /dev/null
+++ b/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer.java
@@ -0,0 +1,304 @@
+
+package com.consum.model.po;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.walker.jdbc.BasePo;
+
+/**
+ * 琛ㄥ悕:FIN_SYS_SERVER *
+ * @author genrator
+ */
+@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
+public class FinSysServer extends BasePo<FinSysServer> {
+ // 搴忓垪鍖栫増鏈彿
+ private static final long serialVersionUID = 1L;
+
+ // 涓婚敭
+ private Long id = null;
+ @JsonIgnore
+ protected boolean isset_id = false;
+
+ // 灞炴�у垪琛�
+ private Long parentId = null;
+ @JsonIgnore
+ protected boolean isset_parentId = false;
+
+ private String name = null;
+ @JsonIgnore
+ protected boolean isset_name = false;
+
+ private String code = null;
+ @JsonIgnore
+ protected boolean isset_code = false;
+
+ private Integer lvType = null;
+ @JsonIgnore
+ protected boolean isset_lvType = false;
+
+ private Long lv = null;
+ @JsonIgnore
+ protected boolean isset_lv = false;
+
+ private Long status = null;
+ @JsonIgnore
+ protected boolean isset_status = false;
+
+ private Long delFlag = null;
+ @JsonIgnore
+ protected boolean isset_delFlag = false;
+
+ private String createdBy = null;
+ @JsonIgnore
+ protected boolean isset_createdBy = false;
+
+ private Long createdTime = null;
+ @JsonIgnore
+ protected boolean isset_createdTime = false;
+
+ private String description = null;
+ @JsonIgnore
+ protected boolean isset_description = false;
+
+ /**
+ * 榛樿鏋勯�犲嚱鏁�
+ */
+ public FinSysServer() {
+ }
+
+ /**
+ * 鏍规嵁涓婚敭鏋勯�犲璞�
+ */
+ public FinSysServer(Long id) {
+ this.setId(id);
+ }
+
+ /**
+ * 璁剧疆涓婚敭鍊�
+ */
+ @Override
+ public void setPkValue(Object value) {
+ this.setId((Long) value);
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ this.isset_id = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyId() {
+ return this.id == null;
+ }
+
+ public Long getParentId() {
+ return this.parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ this.isset_parentId = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyParentId() {
+ return this.parentId == null;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ this.isset_name = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyName() {
+ return this.name == null || this.name.length() == 0;
+ }
+
+ public String getCode() {
+ return this.code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ this.isset_code = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyCode() {
+ return this.code == null || this.code.length() == 0;
+ }
+
+ public Integer getLvType() {
+ return this.lvType;
+ }
+
+ public void setLvType(Integer lvType) {
+ this.lvType = lvType;
+ this.isset_lvType = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyLvType() {
+ return this.lvType == null;
+ }
+
+ public Long getLv() {
+ return this.lv;
+ }
+
+ public void setLv(Long lv) {
+ this.lv = lv;
+ this.isset_lv = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyLv() {
+ return this.lv == null;
+ }
+
+ public Long getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(Long status) {
+ this.status = status;
+ this.isset_status = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyStatus() {
+ return this.status == null;
+ }
+
+ public Long getDelFlag() {
+ return this.delFlag;
+ }
+
+ public void setDelFlag(Long delFlag) {
+ this.delFlag = delFlag;
+ this.isset_delFlag = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyDelFlag() {
+ return this.delFlag == null;
+ }
+
+ public String getCreatedBy() {
+ return this.createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ this.isset_createdBy = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyCreatedBy() {
+ return this.createdBy == null || this.createdBy.length() == 0;
+ }
+
+ public Long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ public void setCreatedTime(Long createdTime) {
+ this.createdTime = createdTime;
+ this.isset_createdTime = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyCreatedTime() {
+ return this.createdTime == null;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ this.isset_description = true;
+ }
+
+ @JsonIgnore
+ public boolean isEmptyDescription() {
+ return this.description == null || this.description.length() == 0;
+ }
+
+ /**
+ * 閲嶅啓 toString() 鏂规硶
+ */
+ @Override
+ public String toString() {
+ return new StringBuilder()
+ .append("id=").append(this.id)
+ .append("parentId=").append(this.parentId)
+ .append("name=").append(this.name)
+ .append("code=").append(this.code)
+ .append("lvType=").append(this.lvType)
+ .append("lv=").append(this.lv)
+ .append("status=").append(this.status)
+ .append("delFlag=").append(this.delFlag)
+ .append("createdBy=").append(this.createdBy)
+ .append("createdTime=").append(this.createdTime)
+ .append("description=").append(this.description)
+ .toString();
+ }
+
+ /**
+ * 鍏嬮殕
+ */
+ public FinSysServer $clone() {
+ FinSysServer fin_sys_server = new FinSysServer();
+
+ // 鏁版嵁搴撳悕绉�
+ //fin_sys_server.setDatabaseName_(this.getDatabaseName_());
+
+ // 涓婚敭
+ if (this.isset_id) {
+ fin_sys_server.setId(this.getId());
+ }
+ // 鏅�氬睘鎬�
+ if (this.isset_parentId) {
+ fin_sys_server.setParentId(this.getParentId());
+ }
+ if (this.isset_name) {
+ fin_sys_server.setName(this.getName());
+ }
+ if (this.isset_code) {
+ fin_sys_server.setCode(this.getCode());
+ }
+ if (this.isset_lvType) {
+ fin_sys_server.setLvType(this.getLvType());
+ }
+ if (this.isset_lv) {
+ fin_sys_server.setLv(this.getLv());
+ }
+ if (this.isset_status) {
+ fin_sys_server.setStatus(this.getStatus());
+ }
+ if (this.isset_delFlag) {
+ fin_sys_server.setDelFlag(this.getDelFlag());
+ }
+ if (this.isset_createdBy) {
+ fin_sys_server.setCreatedBy(this.getCreatedBy());
+ }
+ if (this.isset_createdTime) {
+ fin_sys_server.setCreatedTime(this.getCreatedTime());
+ }
+ if (this.isset_description) {
+ fin_sys_server.setDescription(this.getDescription());
+ }
+ return fin_sys_server;
+ }
+}
diff --git a/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer_mapper.java b/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer_mapper.java
new file mode 100644
index 0000000..ee0bfda
--- /dev/null
+++ b/consum-model-pojo/src/main/java/com/consum/model/po/FinSysServer_mapper.java
@@ -0,0 +1,351 @@
+package com.consum.model.po;
+
+import com.walker.jdbc.BaseMapper;
+import com.walker.jdbc.ResultSetUtils;
+import com.walker.jdbc.SqlAndParameters;
+import com.walker.jdbc.sqlgen.DeleteBuilder;
+import com.walker.jdbc.sqlgen.InsertBuilder;
+import com.walker.jdbc.sqlgen.SelectBuilder;
+import com.walker.jdbc.sqlgen.UpdateBuilder;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+
+/**
+ * 琛ㄥ悕:FIN_SYS_SERVER *
+ * @author genrator
+ */
+public class FinSysServer_mapper extends FinSysServer implements BaseMapper<FinSysServer> {
+ // 搴忓垪鍖栫増鏈彿
+ private static final long serialVersionUID = 1L;
+
+ public static final RowMapper<FinSysServer> ROW_MAPPER = new FinSysServerRowMapper();
+
+ // 涓婚敭
+ public static final String Id = "id";
+ // 鏅�氬睘鎬�
+ public static final String ParentId = "parent_id";
+ public static final String Name = "name";
+ public static final String Code = "code";
+ public static final String LvType = "lv_type";
+ public static final String Lv = "lv";
+ public static final String Status = "status";
+ public static final String DelFlag = "del_flag";
+ public static final String CreatedBy = "created_by";
+ public static final String CreatedTime = "created_time";
+ public static final String Description = "description";
+
+ /**
+ * 榛樿鏋勯�犲嚱鏁�
+ */
+ public FinSysServer_mapper(FinSysServer finSysServer) {
+ if (finSysServer == null) {
+ throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒");
+ }
+ //涓婚敭
+ if (finSysServer.isset_id) {
+ this.setId(finSysServer.getId());
+ }
+ //鏅�氬睘鎬�
+ if (finSysServer.isset_parentId) {
+ this.setParentId(finSysServer.getParentId());
+ }
+ if (finSysServer.isset_name) {
+ this.setName(finSysServer.getName());
+ }
+ if (finSysServer.isset_code) {
+ this.setCode(finSysServer.getCode());
+ }
+ if (finSysServer.isset_lvType) {
+ this.setLvType(finSysServer.getLvType());
+ }
+ if (finSysServer.isset_lv) {
+ this.setLv(finSysServer.getLv());
+ }
+ if (finSysServer.isset_status) {
+ this.setStatus(finSysServer.getStatus());
+ }
+ if (finSysServer.isset_delFlag) {
+ this.setDelFlag(finSysServer.getDelFlag());
+ }
+ if (finSysServer.isset_createdBy) {
+ this.setCreatedBy(finSysServer.getCreatedBy());
+ }
+ if (finSysServer.isset_createdTime) {
+ this.setCreatedTime(finSysServer.getCreatedTime());
+ }
+ if (finSysServer.isset_description) {
+ this.setDescription(finSysServer.getDescription());
+ }
+ // 鍘绘帀锛�2022-09-07
+ // this.setDatabaseName_(fin_sys_server.getDatabaseName_());
+ }
+
+ /**
+ * 鑾峰彇琛ㄥ悕
+ */
+ @Override
+ public String getTableName_() {
+ String tableName = "fin_sys_server";
+ /**
+ if (StringUtils.isNotEmpty(this.getDatabaseName_())) {
+ return this.getDatabaseName_() + "." + tableName;
+ } else {
+ return tableName;
+ }
+ */
+ return tableName;
+ }
+
+ /**
+ * 鑾峰彇涓婚敭鍚嶇О
+ */
+ @Override
+ public String getPkName_() {
+ return Id;
+ }
+
+ /**
+ * 鑾峰彇涓婚敭鍊�
+ */
+ @Override
+ public Object getPkValue_() {
+ return this.getId();
+ }
+
+ /**
+ * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getInsertSql_() {
+ InsertBuilder ib = new InsertBuilder(this.getTableName_());
+ ib.set(Id, this.getId());
+ ib.set(ParentId, this.getParentId(), this.isset_parentId);
+ ib.set(Name, this.getName(), this.isset_name);
+ ib.set(Code, this.getCode(), this.isset_code);
+ ib.set(LvType, this.getLvType(), this.isset_lvType);
+ ib.set(Lv, this.getLv(), this.isset_lv);
+ ib.set(Status, this.getStatus(), this.isset_status);
+ ib.set(DelFlag, this.getDelFlag(), this.isset_delFlag);
+ ib.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy);
+ ib.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime);
+ ib.set(Description, this.getDescription(), this.isset_description);
+ return ib.genMapSql();
+ }
+
+ /**
+ * 鑾峰彇鏇存柊璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
+ UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
+ ub.set(ParentId, this.getParentId(), this.isset_parentId);
+ ub.set(Name, this.getName(), this.isset_name);
+ ub.set(Code, this.getCode(), this.isset_code);
+ ub.set(LvType, this.getLvType(), this.isset_lvType);
+ ub.set(Lv, this.getLv(), this.isset_lv);
+ ub.set(Status, this.getStatus(), this.isset_status);
+ ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag);
+ ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy);
+ ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime);
+ ub.set(Description, this.getDescription(), this.isset_description);
+ ub.where(this.getPkName_(), this.getPkValue_());
+ return ub.genMapSql();
+ }
+
+ /**
+ * 鑾峰彇鏇存柊璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) {
+ UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
+ ub.set(ParentId, this.getParentId(), this.isset_parentId);
+ ub.set(Name, this.getName(), this.isset_name);
+ ub.set(Code, this.getCode(), this.isset_code);
+ ub.set(LvType, this.getLvType(), this.isset_lvType);
+ ub.set(Lv, this.getLv(), this.isset_lv);
+ ub.set(Status, this.getStatus(), this.isset_status);
+ ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag);
+ ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy);
+ ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime);
+ ub.set(Description, this.getDescription(), this.isset_description);
+ return ub.genMapSql(where, parameters);
+ }
+
+ /**
+ * 鑾峰彇鏇存柊璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
+ UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
+ ub.set(ParentId, this.getParentId(), this.isset_parentId);
+ ub.set(Name, this.getName(), this.isset_name);
+ ub.set(Code, this.getCode(), this.isset_code);
+ ub.set(LvType, this.getLvType(), this.isset_lvType);
+ ub.set(Lv, this.getLv(), this.isset_lv);
+ ub.set(Status, this.getStatus(), this.isset_status);
+ ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag);
+ ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy);
+ ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime);
+ ub.set(Description, this.getDescription(), this.isset_description);
+ return ub.genArraySql(where, parameters);
+ }
+
+ /**
+ * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getDeleteSql_() {
+ DeleteBuilder db = new DeleteBuilder(this.getTableName_());
+ db.where(this.getPkName_(), this.getPkValue_());
+ return db.genMapSql();
+ }
+
+ /**
+ * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) {
+ DeleteBuilder db = new DeleteBuilder(this.getTableName_());
+ return db.genMapSql(where, parameters);
+ }
+
+ /**
+ * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) {
+ DeleteBuilder db = new DeleteBuilder(this.getTableName_());
+ return db.genArraySql(where, parameters);
+ }
+
+ /**
+ * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getSingleSql_() {
+ SelectBuilder sb = new SelectBuilder(this.getTableName_());
+ sb.where(this.getPkName_(), this.getPkValue_());
+ return sb.genMapSql();
+ }
+
+
+ /**
+ * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) {
+ return new SqlAndParameters<>("select id, parent_id, name, code, lv_type, lv, status, del_flag, created_by, created_time, description from " + this.getTableName_() + " " + where, parameters);
+ }
+
+ /**
+ * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁�
+ */
+ @Override
+ public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
+ return new SqlAndParameters<>("select id, parent_id, name, code, lv_type, lv, status, del_flag, created_by, created_time, description from " + this.getTableName_() + " " + where, parameters);
+ }
+
+ /**
+ * 灏唕esultset鐨勪竴琛岃浆鍖栦负po
+ */
+ @Override
+ public FinSysServer mapRow(ResultSet rs, int i) throws SQLException {
+ return ROW_MAPPER.mapRow(rs, i);
+ }
+
+ /**
+ * 鍏嬮殕
+ */
+ public FinSysServer toFinSysServer() {
+ return super.$clone();
+ }
+}
+
+/**
+ * fin_sys_server RowMapper
+ *
+ * @author genrator
+ */
+class FinSysServerRowMapper implements RowMapper<FinSysServer> {
+
+ @Override
+ public FinSysServer mapRow(ResultSet rs, int i) throws SQLException {
+ ResultSetUtils resultSetUtils = new ResultSetUtils();
+ FinSysServer fin_sys_server = new FinSysServer();
+ Integer columnIndex;
+ //涓婚敭
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Id);
+ if (columnIndex > 0) {
+ fin_sys_server.setId(rs.getLong(columnIndex));
+ }
+ //鏅�氬睘鎬�
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.ParentId);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setParentId(null);
+ } else {
+ fin_sys_server.setParentId(rs.getLong(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Name);
+ if (columnIndex > 0) {
+ fin_sys_server.setName(rs.getString(columnIndex));
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Code);
+ if (columnIndex > 0) {
+ fin_sys_server.setCode(rs.getString(columnIndex));
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.LvType);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setLvType(null);
+ } else {
+ fin_sys_server.setLvType(rs.getInt(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Lv);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setLv(null);
+ } else {
+ fin_sys_server.setLv(rs.getLong(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Status);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setStatus(null);
+ } else {
+ fin_sys_server.setStatus(rs.getLong(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.DelFlag);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setDelFlag(null);
+ } else {
+ fin_sys_server.setDelFlag(rs.getLong(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.CreatedBy);
+ if (columnIndex > 0) {
+ fin_sys_server.setCreatedBy(rs.getString(columnIndex));
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.CreatedTime);
+ if (columnIndex > 0) {
+ if (rs.getBigDecimal(columnIndex) == null) {
+ fin_sys_server.setCreatedTime(null);
+ } else {
+ fin_sys_server.setCreatedTime(rs.getLong(columnIndex));
+ }
+ }
+ columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Description);
+ if (columnIndex > 0) {
+ fin_sys_server.setDescription(rs.getString(columnIndex));
+ }
+ return fin_sys_server;
+ }
+}
--
Gitblit v1.9.1