forked from gitee/vben-java
oracle与sqlserver数据库匹配
This commit is contained in:
@@ -30,7 +30,7 @@ public class DeSuppMain extends BaseMainEntity {
|
||||
//数据字典示例
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("供应商资质")
|
||||
private String level;
|
||||
private String grade;
|
||||
|
||||
//ManyToOne示例
|
||||
@ManyToOne
|
||||
|
||||
@@ -191,7 +191,11 @@ public class JdbcDao {
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> findMapList(Sqler sqler) {
|
||||
return jdbcTemplate.queryForList(sqler.getSql(), sqler.getParams());
|
||||
if ("oracle".equals(DB_TYPE)) {
|
||||
return jdbcTemplate.queryForList(sqler.getLowerCaseSql(), sqler.getParams());
|
||||
} else{
|
||||
return jdbcTemplate.queryForList(sqler.getSql(), sqler.getParams());
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> findMapList(String sql, Object... args) {
|
||||
|
||||
@@ -35,12 +35,6 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
return jdbcDao.findMapList(sqler);
|
||||
}
|
||||
|
||||
//查询MapList数据
|
||||
@Transactional(readOnly = true)
|
||||
public List<Map<String, Object>> findMapList(String sql, Object... args) {
|
||||
return jdbcDao.findMapList(sql, args);
|
||||
}
|
||||
|
||||
//根据ID判断数据库实体是否存在
|
||||
@Transactional(readOnly = true)
|
||||
public boolean existsById(String id) {
|
||||
|
||||
@@ -29,12 +29,6 @@ public abstract class BaseService<T extends BaseEntity> {
|
||||
return jdbcDao.findMapList(sqler);
|
||||
}
|
||||
|
||||
//查询MapList数据
|
||||
@Transactional(readOnly = true)
|
||||
public List<Map<String, Object>> findMapList(String sql,Object... args) {
|
||||
return jdbcDao.findMapList(sql,args);
|
||||
}
|
||||
|
||||
//根据ID判断数据库实体是否存在
|
||||
@Transactional(readOnly = true)
|
||||
public boolean existsById(String id) {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class PrimaryJpaConfig {
|
||||
private Map<String, Object> getVendorProperties() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// map.put("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect");
|
||||
// map.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect");
|
||||
map.put("hibernate.hbm2ddl.auto", DDL_AUTO);
|
||||
map.put("hibernate.physical_naming_strategy", "vboot.core.framework.jpa.VbootNamingStrategy");
|
||||
map.put("hibernate.use_sql_comments", true);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class AuthcPortalHandler {
|
||||
|
||||
//获取门户集合
|
||||
public List<Zportal> findPortalList(String conds) {
|
||||
String sql = "select distinct m.name,m.id from sys_portal_main m inner join sys_portal_role r on r.porid=m.id" +
|
||||
String sql = "select distinct m.name,m.id,m.ornum from sys_portal_main m inner join sys_portal_role r on r.porid=m.id" +
|
||||
" inner join sys_portal_role_org ro on ro.rid=r.id where m.avtag=1 and ro.oid in (" + conds + ") order by m.ornum";
|
||||
return jdbcDao.getTp().query(sql, new BeanPropertyRowMapper<>(Zportal.class));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class AssNumMainApi {
|
||||
@GetMapping
|
||||
@ApiOperation("查询编号策略分页")
|
||||
public R get(String name) {
|
||||
Sqler sqler = new Sqler("t.*","ass_num_main");
|
||||
Sqler sqler = new Sqler("t.id,t.label,t.name,t.nflag,t.cudat,t.crtim,t.uptim","ass_num_main");
|
||||
sqler.addLike("t.name",name);
|
||||
sqler.addSelect("t.nupre,t.nunex,t.numod");
|
||||
return R.ok(service.findPageData(sqler)) ;
|
||||
|
||||
@@ -32,10 +32,11 @@ public class BpmProcMainApi {
|
||||
public R zbpm(String proid) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//审批记录
|
||||
String sql = "select t.id,t.crtim,t.facna,t.facno,t.opnot,t.opinf,o.name as haman from bpm_audit_main t " +
|
||||
"inner join sys_org o on o.id=t.haman " +
|
||||
"where t.proid=? order by t.crtim";
|
||||
List<Map<String, Object>> audits = jdbcDao.findMapList(sql, proid);
|
||||
Sqler sqler=new Sqler("t.id,t.crtim,t.facna,t.facno,t.opnot,t.opinf,o.name as haman","bpm_audit_main");
|
||||
sqler.addInnerJoin("","sys_org o","o.id=t.haman");
|
||||
sqler.addEqual("t.proid",proid);
|
||||
sqler.addOrder("t.crtim");
|
||||
List<Map<String, Object>> audits = jdbcDao.findMapList(sqler);
|
||||
map.put("audits", audits);
|
||||
|
||||
//历史处理人
|
||||
@@ -55,7 +56,12 @@ public class BpmProcMainApi {
|
||||
" inner join bpm_task_main n on n.nodid=t.id " +
|
||||
"inner join sys_org o on o.id=n.exman " +
|
||||
"where t.proid=? and n.actag=1 order by n.ornum";
|
||||
List<Map<String, Object>> tasks = jdbcDao.findMapList(sql2, proid);
|
||||
Sqler sqler2=new Sqler("n.id as tasid,t.id as nodid,o.name exnam,n.exman,t.proid,t.facno,t.facna","bpm_node_main");
|
||||
sqler2.addInnerJoin("","bpm_task_main n","n.nodid=t.id");
|
||||
sqler2.addInnerJoin("","sys_org o","o.id=n.exman");
|
||||
sqler2.addWhere("t.proid=? and n.actag=1",proid);
|
||||
sqler2.addOrder("n.ornum");
|
||||
List<Map<String, Object>> tasks = jdbcDao.findMapList(sqler2);
|
||||
String cuExmen = "";
|
||||
boolean cutag = false;
|
||||
String userid = XuserUtil.getUserId();
|
||||
@@ -114,7 +120,7 @@ public class BpmProcMainApi {
|
||||
//返回当前节点之前的已走过的节点
|
||||
@GetMapping("refnodes")
|
||||
public R refNodes(String proid, String facno) {
|
||||
String sql = "select distinct t.facno id,t.facna name,t.haman exman from bpm_audit_main t " +
|
||||
String sql = "select distinct t.facno \"id\",t.facna \"name\",t.haman \"exman\" from bpm_audit_main t " +
|
||||
"where proid=? and opkey in('dsubmit','pass') order by t.crtim";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, proid);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
@@ -134,7 +140,8 @@ public class BpmProcMainApi {
|
||||
"inner join bpm_proc_main m on m.temid=t.id where m.id=?";
|
||||
String orxml = jdbcDao.findOneString(xmlSql, proid);
|
||||
|
||||
String sql = "select distinct t.facno id from bpm_node_hist t where proid=? order by sttim";
|
||||
// String sql = "select distinct t.facno id from bpm_node_hist t where proid=? order by sttim";
|
||||
String sql = "select distinct t.facno id from bpm_node_hist t where proid=?";
|
||||
List<String> nodeList = jdbcDao.findStringList(sql, proid);
|
||||
|
||||
List<Zinp> allLineList = hand.GetAllLineList(orxml);
|
||||
|
||||
@@ -2,6 +2,7 @@ package vboot.core.module.bpm.task.main;
|
||||
|
||||
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.Zinp;
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
@@ -50,12 +51,14 @@ public class BpmTaskMainService {
|
||||
}
|
||||
if (!"(".equals(ids)) {
|
||||
ids = ids.substring(0, ids.length() - 1) + ")";
|
||||
String sql =
|
||||
"select n.id as tasid,t.id as nodid,o.name exnam,n.exman,t.proid,t.facno,t.facna from bpm_node_main t" +
|
||||
" inner join bpm_task_main n on n.nodid=t.id " +
|
||||
"inner join sys_org o on o.id=n.exman " +
|
||||
"where t.proid in " + ids + " and n.actag=1 order by t.proid, n.ornum";
|
||||
List<Map<String, Object>> tasks = jdbcDao.findMapList(sql);
|
||||
Sqler sqler=new Sqler("n.id as tasid,t.id as nodid,o.name exnam,n.exman,t.proid,t.facno,t.facna","bpm_node_main");
|
||||
sqler.addInnerJoin("","bpm_task_main n","n.nodid=t.id");
|
||||
sqler.addInnerJoin("","sys_org o","o.id=n.exman");
|
||||
sqler.addWhere("t.proid in " + ids + " and n.actag=1");
|
||||
sqler.addOrder("t.proid");
|
||||
sqler.addOrder("n.ornum");
|
||||
|
||||
List<Map<String, Object>> tasks = jdbcDao.findMapList(sqler);
|
||||
|
||||
List<Zinp> list = new ArrayList<>();
|
||||
String proid = "";
|
||||
|
||||
@@ -29,14 +29,16 @@ public class GenOrgReceService {
|
||||
|
||||
//1.如果当前数量小于10,则去数据库查询最新的差额记录数
|
||||
if (reces.size() < 10) {
|
||||
Sqler sqler = new Sqler("t.*", "sys_org_rece", 1, 10 - reces.size());
|
||||
Sqler sqler = new Sqler("t.id,t.userid,t.orgid,t.uptim", "sys_org_rece", 1, 10 - reces.size());
|
||||
sqler.addDescOrder("t.uptim");
|
||||
sqler.addEqual("t.userid", userid);
|
||||
List<SysOrgRece> list;
|
||||
if ("mysql".equals(jdbcDao.getDbType())) {
|
||||
list = jdbcDao.getTp().query(sqler.getMysqlPagingSql(), sqler.getParams(), new BeanPropertyRowMapper<>(SysOrgRece.class));
|
||||
} else {
|
||||
} else if("oracle".equals(jdbcDao.getDbType())) {
|
||||
list = jdbcDao.getTp().query(sqler.getOraclePagingLowerCaseSql(), sqler.getParams(), new BeanPropertyRowMapper<>(SysOrgRece.class));
|
||||
}else{
|
||||
list = jdbcDao.getTp().query(sqler.getSqlserverPagingSql(), sqler.getParams(), new BeanPropertyRowMapper<>(SysOrgRece.class));
|
||||
}
|
||||
//去重
|
||||
for (SysOrgRece dbRece : list) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package vboot.core.module.gen.org.root;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.ZidName;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -20,7 +21,7 @@ public class GenOrgMainApi {
|
||||
//根据部门ID,查询下级所有的部门,岗位,用户
|
||||
@GetMapping()
|
||||
public R get(String deptid, Integer type, String name) {
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
List<ZidName> mapList = new ArrayList<>();
|
||||
if(XstrUtil.isBlank(name)&& XstrUtil.isBlank(deptid)){
|
||||
return R.ok(mapList);
|
||||
}
|
||||
@@ -31,7 +32,7 @@ public class GenOrgMainApi {
|
||||
}else{
|
||||
deptSqler.addEqual("t.pid", deptid);
|
||||
}
|
||||
mapList.addAll(jdbcDao.findMapList(deptSqler));
|
||||
mapList.addAll(jdbcDao.findIdNameList(deptSqler));
|
||||
}
|
||||
if ((type & 4) != 0) {//岗位
|
||||
Sqler postSqler = new Sqler("sys_org_post");
|
||||
@@ -40,7 +41,7 @@ public class GenOrgMainApi {
|
||||
}else{
|
||||
postSqler.addEqual("t.deptid", deptid);
|
||||
}
|
||||
mapList.addAll(jdbcDao.findMapList(postSqler));
|
||||
mapList.addAll(jdbcDao.findIdNameList(postSqler));
|
||||
}
|
||||
if ((type & 8) != 0) {//用户
|
||||
Sqler userSqler = new Sqler("sys_org_user");
|
||||
@@ -49,7 +50,7 @@ public class GenOrgMainApi {
|
||||
}else{
|
||||
userSqler.addEqual("t.deptid", deptid);
|
||||
}
|
||||
mapList.addAll(jdbcDao.findMapList(userSqler));
|
||||
mapList.addAll(jdbcDao.findIdNameList(userSqler));
|
||||
}
|
||||
return R.ok(mapList);
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ public class GenAuthApi {
|
||||
map.put("note", note);
|
||||
|
||||
//主页弹框通知
|
||||
String note2Sql = "select n.id,r.org from sys_por_note n inner join sys_por_note_org o on o.id=n.id left join sys_por_note_reader r on r.id=n.id AND r.org = '"+zuser.getId()+"' where n.label='sa2' and n.avtag=1 and o.org in (" + zuser.getConds() + ")";
|
||||
List<Map<String, Object>> note2List = jdbcDao.findMapList(note2Sql);
|
||||
if(note2List.size()>0){
|
||||
if(note2List.get(0).get("org")==null){
|
||||
map.put("note2", note2List.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
// String note2Sql = "select n.id,r.org from sys_por_note n inner join sys_por_note_org o on o.id=n.id left join sys_por_note_reader r on r.id=n.id AND r.org = '"+zuser.getId()+"' where n.label='sa2' and n.avtag=1 and o.org in (" + zuser.getConds() + ")";
|
||||
// List<Map<String, Object>> note2List = jdbcDao.findMapList(note2Sql);
|
||||
// if(note2List.size()>0){
|
||||
// if(note2List.get(0).get("org")==null){
|
||||
// map.put("note2", note2List.get(0).get("id"));
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
map.put("zuser", zuser);
|
||||
|
||||
@@ -16,10 +16,11 @@ public class MonLogLoginApi {
|
||||
@GetMapping
|
||||
@ApiOperation("查询登录日志分页")
|
||||
public R get(String name) {
|
||||
Sqler sqlHelper = new Sqler("t.*", "mon_log_login");
|
||||
sqlHelper.addLike("t.name", name);
|
||||
sqlHelper.addOrder("t.crtim desc");
|
||||
return R.ok(jdbcDao.findPageData(sqlHelper));
|
||||
Sqler sqler = new Sqler("t.id,t.name,t.usnam,t.ip,t.crtim,t.addre,t.usession,t.onkey", "mon_log_login");
|
||||
sqler.addSelect("t.ageos,t.agbro,t.agdet");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.crtim desc");
|
||||
return R.ok(jdbcDao.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
|
||||
@@ -18,7 +18,8 @@ public class MonLogOperApi {
|
||||
@GetMapping
|
||||
@ApiOperation("查询操作日志分页")
|
||||
public R get() {
|
||||
Sqler sqler = new Sqler("t.*", "mon_log_oper");
|
||||
Sqler sqler = new Sqler("t.id,t.name,t.useid,t.method,t.param,t.type,t.ip,t.addre", "mon_log_oper");
|
||||
sqler.addSelect("t.agbro,t.ageos,t.time,t.crtim");
|
||||
sqler.addOrder("t.crtim desc");
|
||||
sqler.addLeftJoin("u.name as usena,u.usnam","sys_org_user u","u.id=t.useid");
|
||||
return R.ok(jdbcDao.findPageData(sqler));
|
||||
|
||||
@@ -23,11 +23,11 @@ public class SysTodoDone {
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("待办id")
|
||||
private String tid;
|
||||
private String todoid;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("用户id")
|
||||
private String uid;
|
||||
private String userid;
|
||||
|
||||
@Column(updatable = false)
|
||||
@ApiModelProperty("完成时间")
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SysTodoHist {
|
||||
|
||||
@Column(length = 8)
|
||||
@ApiModelProperty("紧急度")
|
||||
private String level;
|
||||
private String grade;
|
||||
|
||||
@Column(length = 128)
|
||||
@ApiModelProperty("模型分类")
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SysTodoMain {
|
||||
|
||||
@Column(length = 8)
|
||||
@ApiModelProperty("紧急度")
|
||||
private String level;
|
||||
private String grade;
|
||||
|
||||
@Column(length = 128)
|
||||
@ApiModelProperty("模型分类")
|
||||
|
||||
@@ -30,23 +30,23 @@ public class SysTodoMainService {
|
||||
|
||||
SysTodoUser todoTarget = new SysTodoUser();
|
||||
todoTarget.setId(XstrUtil.getUUID());
|
||||
todoTarget.setTid(todo.getId());
|
||||
todoTarget.setUid(znode.getExman());
|
||||
todoTarget.setTodoid(todo.getId());
|
||||
todoTarget.setUserid(znode.getExman());
|
||||
repo.save(todo);
|
||||
targetRepo.save(todoTarget);
|
||||
}
|
||||
|
||||
public void doneTodo(Zbpm zbpm) {
|
||||
String sql = "select m.id,t.id as tid from sys_todo_main m inner join sys_todo_user t on t.tid=m.id " +
|
||||
"where t.uid=? and m.modid=?";
|
||||
String sql = "select m.id,t.id as tid from sys_todo_main m inner join sys_todo_user t on t.todoid=m.id " +
|
||||
"where t.userid=? and m.modid=?";
|
||||
Map<String, Object> map = jdbcDao.findMap(sql, zbpm.getHaman(), zbpm.getProid());
|
||||
String delsql = "delete from sys_todo_user where id=?";
|
||||
jdbcDao.update(delsql, map.get("tid"));
|
||||
|
||||
SysTodoDone done = new SysTodoDone();
|
||||
done.setId(XstrUtil.getUUID());
|
||||
done.setTid("" + map.get("id"));
|
||||
done.setUid(zbpm.getHaman());
|
||||
done.setTodoid("" + map.get("id"));
|
||||
done.setUserid(zbpm.getHaman());
|
||||
doneRepo.save(done);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ public class SysTodoUser {
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("待办ID")
|
||||
private String tid;
|
||||
private String todoid;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("用户ID")
|
||||
private String uid;
|
||||
private String userid;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@ spring.datasource.primary.jpa.hbm2ddl.auto=update
|
||||
spring.datasource.primary.dbType=mysql
|
||||
spring.datasource.primary.validationQuery=SELECT 1 FROM DUAL
|
||||
spring.datasource.primary.driver-class-name=com.mysql.jdbc.Driver
|
||||
#spring.datasource.primary.url=jdbc:mysql://127.0.0.1:3306/dw?characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.primary.username=root
|
||||
#spring.datasource.primary.password=123456
|
||||
spring.datasource.primary.url=jdbc:mysql://127.0.0.1:3306/vboot-java?characterEncoding=utf-8&useSSL=false
|
||||
spring.datasource.primary.username=root
|
||||
spring.datasource.primary.password=123456
|
||||
@@ -59,7 +56,6 @@ spring.datasource.primary.password=123456
|
||||
#spring.datasource.primary.username=sa
|
||||
#spring.datasource.primary.password=123456
|
||||
|
||||
|
||||
#应用初始化类型
|
||||
#-- sa:组织架构只包含一个sa管理员与一个vben的演示账户
|
||||
#--demo:除了以上数据还包含了一些demo部门与demo用户
|
||||
|
||||
Reference in New Issue
Block a user