Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
duckula
duckula-ops
提交
837b0d71
duckula-ops
项目概览
duckula
/
duckula-ops
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
duckula-ops
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
837b0d71
编写于
6月 24, 2021
作者:
偏锋书生
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sql过滤,动态sqlsource有问题
上级
0843aa6f
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
1779 addition
and
40 deletion
+1779
-40
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysOrg.java
.../wicp/tams/app/duckula/controller/bean/models/SysOrg.java
+25
-1
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysOrgExample.java
...ams/app/duckula/controller/bean/models/SysOrgExample.java
+60
-0
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysTenant.java
...cp/tams/app/duckula/controller/bean/models/SysTenant.java
+279
-0
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysTenantExample.java
.../app/duckula/controller/bean/models/SysTenantExample.java
+772
-0
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysUser.java
...wicp/tams/app/duckula/controller/bean/models/SysUser.java
+26
-1
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysUserExample.java
...ms/app/duckula/controller/bean/models/SysUserExample.java
+60
-0
src/main/java/net/wicp/tams/app/duckula/controller/config/MybatisPlusConfig.java
...tams/app/duckula/controller/config/MybatisPlusConfig.java
+75
-11
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysOrgMapper.java
...et/wicp/tams/app/duckula/controller/dao/SysOrgMapper.java
+7
-5
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysTenantMapper.java
...wicp/tams/app/duckula/controller/dao/SysTenantMapper.java
+132
-0
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysUserMapper.java
...t/wicp/tams/app/duckula/controller/dao/SysUserMapper.java
+6
-4
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInit.java
...wicp/tams/app/duckula/controller/service/ContextInit.java
+5
-1
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInitDo.java
...cp/tams/app/duckula/controller/service/ContextInitDo.java
+5
-6
src/main/java/net/wicp/tams/duckula/ops/App.java
src/main/java/net/wicp/tams/duckula/ops/App.java
+3
-2
src/main/java/net/wicp/tams/duckula/ops/beans/SessionBean.java
...ain/java/net/wicp/tams/duckula/ops/beans/SessionBean.java
+9
-0
src/main/java/net/wicp/tams/duckula/ops/services/AppModule.java
...in/java/net/wicp/tams/duckula/ops/services/AppModule.java
+22
-5
src/main/resources/mybatis/primary/sqlmap/SysOrgMapper.xml
src/main/resources/mybatis/primary/sqlmap/SysOrgMapper.xml
+16
-2
src/main/resources/mybatis/primary/sqlmap/SysTenantMapper.xml
...main/resources/mybatis/primary/sqlmap/SysTenantMapper.xml
+261
-0
src/main/resources/mybatis/primary/sqlmap/SysUserMapper.xml
src/main/resources/mybatis/primary/sqlmap/SysUserMapper.xml
+16
-2
未找到文件。
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysOrg.java
浏览文件 @
837b0d71
...
...
@@ -42,13 +42,18 @@ public class SysOrg {
* @mbg.generated
*/
private
String
address
;
/**
* Database Column Remarks: 租户 This field was generated by MyBatis Generator. This field corresponds to the database column sys_org.tenant_id
* @mbg.generated
*/
private
Long
tenantId
;
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
* @mbg.generated
*/
public
SysOrg
(
Long
id
,
Long
parentId
,
String
orgIdPath
,
String
orgName
,
String
orgCode
,
String
unitType
,
String
address
)
{
String
address
,
Long
tenantId
)
{
this
.
id
=
id
;
this
.
parentId
=
parentId
;
this
.
orgIdPath
=
orgIdPath
;
...
...
@@ -56,6 +61,7 @@ public class SysOrg {
this
.
orgCode
=
orgCode
;
this
.
unitType
=
unitType
;
this
.
address
=
address
;
this
.
tenantId
=
tenantId
;
}
/**
...
...
@@ -191,4 +197,22 @@ public class SysOrg {
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column sys_org.tenant_id
* @return the value of sys_org.tenant_id
* @mbg.generated
*/
public
Long
getTenantId
()
{
return
tenantId
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column sys_org.tenant_id
* @param tenantId the value for sys_org.tenant_id
* @mbg.generated
*/
public
void
setTenantId
(
Long
tenantId
)
{
this
.
tenantId
=
tenantId
;
}
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysOrgExample.java
浏览文件 @
837b0d71
...
...
@@ -631,6 +631,66 @@ public class SysOrgExample {
addCriterion
(
"address not between"
,
value1
,
value2
,
"address"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIsNull
()
{
addCriterion
(
"tenant_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIsNotNull
()
{
addCriterion
(
"tenant_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id ="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id <>"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdGreaterThan
(
Long
value
)
{
addCriterion
(
"tenant_id >"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id >="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdLessThan
(
Long
value
)
{
addCriterion
(
"tenant_id <"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id <="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"tenant_id in"
,
values
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"tenant_id not in"
,
values
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"tenant_id between"
,
value1
,
value2
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"tenant_id not between"
,
value1
,
value2
,
"tenantId"
);
return
(
Criteria
)
this
;
}
}
/**
...
...
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysTenant.java
0 → 100644
浏览文件 @
837b0d71
package
net.wicp.tams.app.duckula.controller.bean.models
;
import
java.util.Date
;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_tenant
*/
public
class
SysTenant
{
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.id
*
* @mbg.generated
*/
private
Long
id
;
/**
* Database Column Remarks:
* 租户编码
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.code
*
* @mbg.generated
*/
private
String
code
;
/**
* Database Column Remarks:
* 租户名
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.name
*
* @mbg.generated
*/
private
String
name
;
/**
* Database Column Remarks:
* 创建时间
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.create_name
*
* @mbg.generated
*/
private
String
createName
;
/**
* Database Column Remarks:
* 租户状态
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.status
*
* @mbg.generated
*/
private
String
status
;
/**
* Database Column Remarks:
* 状态改变时间
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.status_time
*
* @mbg.generated
*/
private
Date
statusTime
;
/**
* Database Column Remarks:
* 操作原因
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_tenant.operate_reason
*
* @mbg.generated
*/
private
String
operateReason
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
public
SysTenant
(
Long
id
,
String
code
,
String
name
,
String
createName
,
String
status
,
Date
statusTime
,
String
operateReason
)
{
this
.
id
=
id
;
this
.
code
=
code
;
this
.
name
=
name
;
this
.
createName
=
createName
;
this
.
status
=
status
;
this
.
statusTime
=
statusTime
;
this
.
operateReason
=
operateReason
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
public
SysTenant
()
{
super
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.id
*
* @return the value of sys_tenant.id
*
* @mbg.generated
*/
public
Long
getId
()
{
return
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.id
*
* @param id the value for sys_tenant.id
*
* @mbg.generated
*/
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.code
*
* @return the value of sys_tenant.code
*
* @mbg.generated
*/
public
String
getCode
()
{
return
code
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.code
*
* @param code the value for sys_tenant.code
*
* @mbg.generated
*/
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.name
*
* @return the value of sys_tenant.name
*
* @mbg.generated
*/
public
String
getName
()
{
return
name
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.name
*
* @param name the value for sys_tenant.name
*
* @mbg.generated
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.create_name
*
* @return the value of sys_tenant.create_name
*
* @mbg.generated
*/
public
String
getCreateName
()
{
return
createName
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.create_name
*
* @param createName the value for sys_tenant.create_name
*
* @mbg.generated
*/
public
void
setCreateName
(
String
createName
)
{
this
.
createName
=
createName
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.status
*
* @return the value of sys_tenant.status
*
* @mbg.generated
*/
public
String
getStatus
()
{
return
status
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.status
*
* @param status the value for sys_tenant.status
*
* @mbg.generated
*/
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.status_time
*
* @return the value of sys_tenant.status_time
*
* @mbg.generated
*/
public
Date
getStatusTime
()
{
return
statusTime
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.status_time
*
* @param statusTime the value for sys_tenant.status_time
*
* @mbg.generated
*/
public
void
setStatusTime
(
Date
statusTime
)
{
this
.
statusTime
=
statusTime
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_tenant.operate_reason
*
* @return the value of sys_tenant.operate_reason
*
* @mbg.generated
*/
public
String
getOperateReason
()
{
return
operateReason
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_tenant.operate_reason
*
* @param operateReason the value for sys_tenant.operate_reason
*
* @mbg.generated
*/
public
void
setOperateReason
(
String
operateReason
)
{
this
.
operateReason
=
operateReason
;
}
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysTenantExample.java
0 → 100644
浏览文件 @
837b0d71
此差异已折叠。
点击以展开。
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysUser.java
浏览文件 @
837b0d71
...
...
@@ -74,13 +74,19 @@ public class SysUser {
* @mbg.generated
*/
private
String
duties
;
/**
* Database Column Remarks: 租户id This field was generated by MyBatis Generator. This field corresponds to the database column sys_user.tenant_id
* @mbg.generated
*/
private
Long
tenantId
;
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table sys_user
* @mbg.generated
*/
public
SysUser
(
Long
id
,
String
userName
,
String
password
,
String
gender
,
String
email
,
String
mobile
,
String
status
,
Long
orgId
,
String
remark
,
Date
createTime
,
Date
updateTime
,
String
minusRole
,
String
duties
)
{
Long
orgId
,
String
remark
,
Date
createTime
,
Date
updateTime
,
String
minusRole
,
String
duties
,
Long
tenantId
)
{
this
.
id
=
id
;
this
.
userName
=
userName
;
this
.
password
=
password
;
...
...
@@ -94,6 +100,7 @@ public class SysUser {
this
.
updateTime
=
updateTime
;
this
.
minusRole
=
minusRole
;
this
.
duties
=
duties
;
this
.
tenantId
=
tenantId
;
}
/**
...
...
@@ -337,4 +344,22 @@ public class SysUser {
public
void
setDuties
(
String
duties
)
{
this
.
duties
=
duties
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column sys_user.tenant_id
* @return the value of sys_user.tenant_id
* @mbg.generated
*/
public
Long
getTenantId
()
{
return
tenantId
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column sys_user.tenant_id
* @param tenantId the value for sys_user.tenant_id
* @mbg.generated
*/
public
void
setTenantId
(
Long
tenantId
)
{
this
.
tenantId
=
tenantId
;
}
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/bean/models/SysUserExample.java
浏览文件 @
837b0d71
...
...
@@ -1032,6 +1032,66 @@ public class SysUserExample {
addCriterion
(
"duties not between"
,
value1
,
value2
,
"duties"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIsNull
()
{
addCriterion
(
"tenant_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIsNotNull
()
{
addCriterion
(
"tenant_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id ="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id <>"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdGreaterThan
(
Long
value
)
{
addCriterion
(
"tenant_id >"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id >="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdLessThan
(
Long
value
)
{
addCriterion
(
"tenant_id <"
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"tenant_id <="
,
value
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"tenant_id in"
,
values
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"tenant_id not in"
,
values
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"tenant_id between"
,
value1
,
value2
,
"tenantId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"tenant_id not between"
,
value1
,
value2
,
"tenantId"
);
return
(
Criteria
)
this
;
}
}
/**
...
...
src/main/java/net/wicp/tams/app/duckula/controller/config/MybatisPlusConfig.java
浏览文件 @
837b0d71
package
net.wicp.tams.app.duckula.controller.config
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.sql.DataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.type.JdbcType
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.mybatis.spring.transaction.SpringManagedTransactionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
com.baomidou.mybatisplus.core.MybatisConfiguration
;
import
com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize
;
import
net.wicp.tams.common.mybatis.intercepts.SqlInterceptor
;
@Configuration
@MapperScan
(
"net.wicp.tams.app.duckula.controller.dao.*"
)
public
class
MybatisPlusConfig
{
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
// paginationInterceptor.setLimit(500);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor
.
setCountSqlParser
(
new
JsqlParserCountOptimize
(
true
));
return
paginationInterceptor
;
}
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
// paginationInterceptor.setLimit(500);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor
.
setCountSqlParser
(
new
JsqlParserCountOptimize
(
true
));
return
paginationInterceptor
;
}
@Autowired
private
DataSource
datasource
;
@Bean
@Primary
public
SqlSessionFactory
mybatisSqlSessionFactory
()
throws
Exception
{
SqlSessionFactoryBean
sqlSessionFactoryBean
=
new
SqlSessionFactoryBean
();
sqlSessionFactoryBean
.
setDataSource
(
datasource
);
// sqlSessionFactoryBean.setTypeAliasesPackage("net.wicp.tams.app.duckula.controller.bean.models");
// if (StringUtil.isNotNull(Conf.get("common.jdbc.mybatis.mapperLocations"))) {
// sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
// .getResources(Conf.get("common.jdbc.mybatis.mapperLocations")));
// }
MybatisConfiguration
configuration
=
new
MybatisConfiguration
();
configuration
.
setDefaultScriptingLanguage
(
MybatisXMLLanguageDriver
.
class
);
configuration
.
setJdbcTypeForNull
(
JdbcType
.
NULL
);
sqlSessionFactoryBean
.
setConfiguration
(
configuration
);
sqlSessionFactoryBean
.
setTypeAliasesPackage
(
"net.wicp.tams.app.duckula.controller.bean.models"
);
sqlSessionFactoryBean
.
setMapperLocations
(
resolveMapperLocations
());
sqlSessionFactoryBean
.
setPlugins
(
new
SqlInterceptor
());
sqlSessionFactoryBean
.
setTransactionFactory
(
new
SpringManagedTransactionFactory
());
return
sqlSessionFactoryBean
.
getObject
();
}
public
Resource
[]
resolveMapperLocations
()
{
ResourcePatternResolver
resourceResolver
=
new
PathMatchingResourcePatternResolver
();
List
<
String
>
mapperLocations
=
new
ArrayList
<>();
mapperLocations
.
add
(
"classpath:mybatis/primary/sqlmap/*.xml"
);
// mapperLocations.add("classpath*:com/pab/cc/ces/mapper/*Mapper*.xml");
// mapperLocations.add("classpath*:com/pab/cc/ams/mapper/*Mapper*.xml");
List
<
Resource
>
resources
=
new
ArrayList
();
if
(
mapperLocations
!=
null
)
{
for
(
String
mapperLocation
:
mapperLocations
)
{
try
{
Resource
[]
mappers
=
resourceResolver
.
getResources
(
mapperLocation
);
resources
.
addAll
(
Arrays
.
asList
(
mappers
));
}
catch
(
IOException
e
)
{
// ignore
}
}
}
return
resources
.
toArray
(
new
Resource
[
resources
.
size
()]);
}
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysOrgMapper.java
浏览文件 @
837b0d71
...
...
@@ -39,10 +39,11 @@ public interface SysOrgMapper extends BaseMapper<SysOrg>{
* This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
* @mbg.generated
*/
@Insert
({
"insert into sys_org (id, parent_id, "
,
"org_id_path, org_name, "
,
"org_code, unit_type, "
,
"address)"
,
"values (#{id,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, "
,
@Insert
({
"insert into sys_org (id, parent_id, "
,
"org_id_path, org_name, "
,
"org_code, unit_type, "
,
"
address, tenant_id)"
,
"
values (#{id,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, "
,
"#{orgIdPath,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, "
,
"#{orgCode,jdbcType=VARCHAR}, #{unitType,jdbcType=VARCHAR}, "
,
"#{address,jdbcType=VARCHAR})"
})
"#{orgCode,jdbcType=VARCHAR}, #{unitType,jdbcType=VARCHAR}, "
,
"#{address,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})"
})
int
insert
(
SysOrg
record
);
/**
...
...
@@ -61,7 +62,7 @@ public interface SysOrgMapper extends BaseMapper<SysOrg>{
* This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
* @mbg.generated
*/
@Select
({
"select"
,
"id, parent_id, org_id_path, org_name, org_code, unit_type, address"
,
"from sys_org"
,
@Select
({
"select"
,
"id, parent_id, org_id_path, org_name, org_code, unit_type, address
, tenant_id
"
,
"from sys_org"
,
"where id = #{id,jdbcType=BIGINT}"
})
@ResultMap
(
"net.wicp.tams.app.duckula.controller.dao.SysOrgMapper.BaseResultMap"
)
SysOrg
selectByPrimaryKey
(
Long
id
);
...
...
@@ -91,6 +92,7 @@ public interface SysOrgMapper extends BaseMapper<SysOrg>{
@Update
({
"update sys_org"
,
"set parent_id = #{parentId,jdbcType=BIGINT},"
,
"org_id_path = #{orgIdPath,jdbcType=VARCHAR},"
,
"org_name = #{orgName,jdbcType=VARCHAR},"
,
"org_code = #{orgCode,jdbcType=VARCHAR},"
,
"unit_type = #{unitType,jdbcType=VARCHAR},"
,
"address = #{address,jdbcType=VARCHAR}"
,
"where id = #{id,jdbcType=BIGINT}"
})
"address = #{address,jdbcType=VARCHAR},"
,
"tenant_id = #{tenantId,jdbcType=BIGINT}"
,
"where id = #{id,jdbcType=BIGINT}"
})
int
updateByPrimaryKey
(
SysOrg
record
);
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysTenantMapper.java
0 → 100644
浏览文件 @
837b0d71
package
net.wicp.tams.app.duckula.controller.dao
;
import
java.util.List
;
import
net.wicp.tams.app.duckula.controller.bean.models.SysTenant
;
import
net.wicp.tams.app.duckula.controller.bean.models.SysTenantExample
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Update
;
public
interface
SysTenantMapper
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
long
countByExample
(
SysTenantExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
int
deleteByExample
(
SysTenantExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
@Delete
({
"delete from sys_tenant"
,
"where id = #{id,jdbcType=BIGINT}"
})
int
deleteByPrimaryKey
(
Long
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
@Insert
({
"insert into sys_tenant (id, code, "
,
"name, create_name, "
,
"status, status_time, "
,
"operate_reason)"
,
"values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, "
,
"#{name,jdbcType=VARCHAR}, #{createName,jdbcType=VARCHAR}, "
,
"#{status,jdbcType=VARCHAR}, #{statusTime,jdbcType=TIMESTAMP}, "
,
"#{operateReason,jdbcType=VARCHAR})"
})
int
insert
(
SysTenant
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
int
insertSelective
(
SysTenant
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
List
<
SysTenant
>
selectByExample
(
SysTenantExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
@Select
({
"select"
,
"id, code, name, create_name, status, status_time, operate_reason"
,
"from sys_tenant"
,
"where id = #{id,jdbcType=BIGINT}"
})
@ResultMap
(
"net.wicp.tams.app.duckula.controller.dao.SysTenantMapper.BaseResultMap"
)
SysTenant
selectByPrimaryKey
(
Long
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
int
updateByExampleSelective
(
@Param
(
"record"
)
SysTenant
record
,
@Param
(
"example"
)
SysTenantExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
int
updateByExample
(
@Param
(
"record"
)
SysTenant
record
,
@Param
(
"example"
)
SysTenantExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
int
updateByPrimaryKeySelective
(
SysTenant
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_tenant
*
* @mbg.generated
*/
@Update
({
"update sys_tenant"
,
"set code = #{code,jdbcType=VARCHAR},"
,
"name = #{name,jdbcType=VARCHAR},"
,
"create_name = #{createName,jdbcType=VARCHAR},"
,
"status = #{status,jdbcType=VARCHAR},"
,
"status_time = #{statusTime,jdbcType=TIMESTAMP},"
,
"operate_reason = #{operateReason,jdbcType=VARCHAR}"
,
"where id = #{id,jdbcType=BIGINT}"
})
int
updateByPrimaryKey
(
SysTenant
record
);
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/dao/SysUserMapper.java
浏览文件 @
837b0d71
...
...
@@ -40,12 +40,13 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @mbg.generated
*/
@Insert
({
"insert into sys_user (id, user_name, "
,
"password, gender, "
,
"email, mobile, status, "
,
"org_id, remark, create_time, "
,
"update_time, minus_role, "
,
"duties)"
,
"org_id, remark, create_time, "
,
"update_time, minus_role, "
,
"duties
, tenant_id
)"
,
"values (#{id,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, "
,
"#{password,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, "
,
"#{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, "
,
"#{orgId,jdbcType=BIGINT}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, "
,
"#{updateTime,jdbcType=TIMESTAMP}, #{minusRole,jdbcType=VARCHAR}, "
,
"#{duties,jdbcType=VARCHAR})"
})
"#{updateTime,jdbcType=TIMESTAMP}, #{minusRole,jdbcType=VARCHAR}, "
,
"#{duties,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})"
})
int
insert
(
SysUser
record
);
/**
...
...
@@ -65,7 +66,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @mbg.generated
*/
@Select
({
"select"
,
"id, user_name, password, gender, email, mobile, status, org_id, remark, create_time, "
,
"update_time, minus_role, duties"
,
"from sys_user"
,
"where id = #{id,jdbcType=BIGINT}"
})
"update_time, minus_role, duties
, tenant_id
"
,
"from sys_user"
,
"where id = #{id,jdbcType=BIGINT}"
})
@ResultMap
(
"net.wicp.tams.app.duckula.controller.dao.SysUserMapper.BaseResultMap"
)
SysUser
selectByPrimaryKey
(
Long
id
);
...
...
@@ -97,6 +98,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"status = #{status,jdbcType=VARCHAR},"
,
"org_id = #{orgId,jdbcType=BIGINT},"
,
"remark = #{remark,jdbcType=VARCHAR},"
,
"create_time = #{createTime,jdbcType=TIMESTAMP},"
,
"update_time = #{updateTime,jdbcType=TIMESTAMP},"
,
"minus_role = #{minusRole,jdbcType=VARCHAR},"
,
"duties = #{duties,jdbcType=VARCHAR}"
,
"where id = #{id,jdbcType=BIGINT}"
})
"duties = #{duties,jdbcType=VARCHAR},"
,
"tenant_id = #{tenantId,jdbcType=BIGINT}"
,
"where id = #{id,jdbcType=BIGINT}"
})
int
updateByPrimaryKey
(
SysUser
record
);
}
\ No newline at end of file
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInit.java
浏览文件 @
837b0d71
...
...
@@ -3,6 +3,7 @@ package net.wicp.tams.app.duckula.controller.service;
import
javax.servlet.ServletContext
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,10 +18,13 @@ public class ContextInit implements ApplicationContextAware, ServletContextAware
public
static
volatile
String
pagePath
;
// page页面存放的根目录
public
static
volatile
String
webRootPath
;
// Webroot所在目录
@Autowired
private
SysGlobalMapper
sysGlobalMapper
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
SysGlobalMapper
sysGlobalMapper
=
applicationContext
.
getBean
(
SysGlobalMapper
.
class
);
//
SysGlobalMapper sysGlobalMapper = applicationContext.getBean(SysGlobalMapper.class);
SysGlobal
sysGlobal
=
sysGlobalMapper
.
selectById
(
1
l
);
if
(
sysGlobal
!=
null
)
{
ConfigGlobleName
.
putAwsConfig
(
sysGlobal
);
...
...
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInitDo.java
浏览文件 @
837b0d71
...
...
@@ -11,12 +11,11 @@ public class ContextInitDo implements IContextInit {
@Override
public
void
init
(
ApplicationContext
applicationContext
)
{
/*
* SysGlobalMapper sysGlobalMapper = applicationContext.get
* .getBean(SysGlobalMapper.class); SysGlobal sysGlobal =
* sysGlobalMapper.selectById(1l); if(sysGlobal!=null) {
* ConfigGlobleName.putAwsConfig(sysGlobal); }
*/
// SysGlobalMapper sysGlobalMapper = applicationContext.getBean(SysGlobalMapper.class);
// SysGlobal sysGlobal = sysGlobalMapper.selectById(1l);
// if (sysGlobal != null) {
// ConfigGlobleName.putAwsConfig(sysGlobal);
// }
}
}
src/main/java/net/wicp/tams/duckula/ops/App.java
浏览文件 @
837b0d71
package
net.wicp.tams.duckula.ops
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
...
...
@@ -16,7 +15,7 @@ import net.wicp.tams.common.spring.autoconfig.annotation.EnableTams;
@SpringBootApplication
@ComponentScan
(
basePackages
=
{
"net.wicp.tams.app.duckula.controller"
,
"net.wicp.tams.duckula.ops"
})
@ImportResource
(
"classpath:beanRefContext.xml"
)
@MapperScan
(
"net.wicp.tams.app.duckula.controller.dao"
)
//
@MapperScan("net.wicp.tams.app.duckula.controller.dao")
@EnableTams
public
class
App
extends
SpringBootServletInitializer
{
@Override
...
...
@@ -29,6 +28,8 @@ public class App extends SpringBootServletInitializer {
Conf
.
overProp
(
"common.spring.autoconfig.property.path"
,
"abs:/data/duckula-data/conf/duckula-ops.properties"
);
Conf
.
overProp
(
"common.spring.autoconfig.contextInit.duckulaops"
,
"net.wicp.tams.app.duckula.controller.service.ContextInitDo"
);
// 注意:SQL拦截需要db信息查列名与配置的拦截列名匹配,它也url后面的配置是一样的
Conf
.
overProp
(
"common.jdbc.datasource.default.defaultdb"
,
"duckula"
);
SpringApplication
application
=
new
SpringApplication
(
App
.
class
);
application
.
setApplicationContextClass
(
AnnotationConfigWebApplicationContext
.
class
);
BusiTools
.
printAscill
();
...
...
src/main/java/net/wicp/tams/duckula/ops/beans/SessionBean.java
浏览文件 @
837b0d71
...
...
@@ -14,4 +14,13 @@ public class SessionBean {
private
SysUser
sysUser
;
private
List
<
Long
>
roles
;
// 此用户拥有的角色
private
JSONArray
modules
;
// 此用户拥有的模块
/***
* 得到租户
*
* @return
*/
public
Long
getTenantId
()
{
return
this
.
sysUser
.
getTenantId
();
}
}
src/main/java/net/wicp/tams/duckula/ops/services/AppModule.java
浏览文件 @
837b0d71
...
...
@@ -11,6 +11,7 @@ import org.apache.tapestry5.http.services.Request;
import
org.apache.tapestry5.http.services.RequestFilter
;
import
org.apache.tapestry5.http.services.RequestHandler
;
import
org.apache.tapestry5.http.services.Response
;
import
org.apache.tapestry5.http.services.Session
;
import
org.apache.tapestry5.ioc.ServiceBinder
;
import
org.apache.tapestry5.ioc.annotations.Contribute
;
import
org.apache.tapestry5.ioc.annotations.Local
;
...
...
@@ -19,8 +20,12 @@ import org.apache.tapestry5.ioc.services.SymbolProvider;
import
org.slf4j.Logger
;
import
net.wicp.tams.cas.SymbolConstantsCas
;
import
net.wicp.tams.common.Conf
;
import
net.wicp.tams.common.thread.threadlocal.PerThreadValue
;
import
net.wicp.tams.common.thread.threadlocal.PerthreadManager
;
import
net.wicp.tams.duckula.ops.ajax.AjaxImpl
;
import
net.wicp.tams.duckula.ops.ajax.IAjax
;
import
net.wicp.tams.duckula.ops.beans.SessionBean
;
/**
* This module is automatically included as part of the Tapestry IoC Registry,
...
...
@@ -67,12 +72,9 @@ public class AppModule {
// the hidden field data stored in forms to encrypt and digitally sign
// client-side data.
configuration
.
add
(
SymbolConstants
.
HMAC_PASSPHRASE
,
"change this immediately-"
+
UUID
.
randomUUID
());
configuration
.
add
(
SymbolConstantsCas
.
conf_cas_db
,
"duckula"
);
// 示例,需要配置全局db
}
/**
* Use annotation or method naming convention:
...
...
@@ -109,6 +111,21 @@ public class AppModule {
public
RequestFilter
buildTimingFilter
(
final
Logger
log
)
{
return
new
RequestFilter
()
{
public
boolean
service
(
Request
request
,
Response
response
,
RequestHandler
handler
)
throws
IOException
{
Session
session
=
request
.
getSession
(
false
);
if
(
session
!=
null
)
{
// 把租户ID放到线程上下文中
SessionBean
sessionBean
=
(
SessionBean
)
session
.
getAttribute
(
"sso:net.wicp.tams.duckula.ops.beans.SessionBean"
);
if
(
sessionBean
!=
null
)
{
Long
tenantId
=
sessionBean
.
getTenantId
();
PerThreadValue
<
String
>
tenantValue
=
PerthreadManager
.
getInstance
()
.
createValue
(
Conf
.
get
(
"common.jdbc.sqlIntercept.colname.tenant_id"
),
String
.
class
);
tenantValue
.
set
(
String
.
valueOf
(
tenantId
));
}
}
long
startTime
=
System
.
currentTimeMillis
();
try
{
...
...
@@ -147,6 +164,6 @@ public class AppModule {
public
static
void
contributeIgnoredPathsFilter
(
Configuration
<
String
>
configuration
)
{
configuration
.
add
(
"/connector"
);
configuration
.
add
(
"/websocket"
);
configuration
.
add
(
"/websocket"
);
}
}
src/main/resources/mybatis/primary/sqlmap/SysOrgMapper.xml
浏览文件 @
837b0d71
...
...
@@ -14,6 +14,7 @@
<arg
column=
"org_code"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"unit_type"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"address"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"tenant_id"
javaType=
"java.lang.Long"
jdbcType=
"BIGINT"
/>
</constructor>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
...
...
@@ -87,7 +88,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, parent_id, org_id_path, org_name, org_code, unit_type, address
id, parent_id, org_id_path, org_name, org_code, unit_type, address
, tenant_id
</sql>
<select
id=
"selectByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysOrgExample"
resultMap=
"BaseResultMap"
>
<!--
...
...
@@ -145,6 +146,9 @@
<if
test=
"address != null"
>
address,
</if>
<if
test=
"tenantId != null"
>
tenant_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
...
...
@@ -168,6 +172,9 @@
<if
test=
"address != null"
>
#{address,jdbcType=VARCHAR},
</if>
<if
test=
"tenantId != null"
>
#{tenantId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysOrgExample"
resultType=
"java.lang.Long"
>
...
...
@@ -208,6 +215,9 @@
<if
test=
"record.address != null"
>
address = #{record.address,jdbcType=VARCHAR},
</if>
<if
test=
"record.tenantId != null"
>
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -225,7 +235,8 @@
org_name = #{record.orgName,jdbcType=VARCHAR},
org_code = #{record.orgCode,jdbcType=VARCHAR},
unit_type = #{record.unitType,jdbcType=VARCHAR},
address = #{record.address,jdbcType=VARCHAR}
address = #{record.address,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -255,6 +266,9 @@
<if
test=
"address != null"
>
address = #{address,jdbcType=VARCHAR},
</if>
<if
test=
"tenantId != null"
>
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
...
...
src/main/resources/mybatis/primary/sqlmap/SysTenantMapper.xml
0 → 100644
浏览文件 @
837b0d71
<?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=
"net.wicp.tams.app.duckula.controller.dao.SysTenantMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenant"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<constructor>
<idArg
column=
"id"
javaType=
"java.lang.Long"
jdbcType=
"BIGINT"
/>
<arg
column=
"code"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"name"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"create_name"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"status"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"status_time"
javaType=
"java.util.Date"
jdbcType=
"TIMESTAMP"
/>
<arg
column=
"operate_reason"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
</constructor>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, code, name, create_name, status, status_time, operate_reason
</sql>
<select
id=
"selectByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenantExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from sys_tenant
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<delete
id=
"deleteByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenantExample"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from sys_tenant
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insertSelective"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenant"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into sys_tenant
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"code != null"
>
code,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"createName != null"
>
create_name,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"statusTime != null"
>
status_time,
</if>
<if
test=
"operateReason != null"
>
operate_reason,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"code != null"
>
#{code,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"createName != null"
>
#{createName,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=VARCHAR},
</if>
<if
test=
"statusTime != null"
>
#{statusTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"operateReason != null"
>
#{operateReason,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenantExample"
resultType=
"java.lang.Long"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from sys_tenant
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update sys_tenant
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.code != null"
>
code = #{record.code,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
name = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.createName != null"
>
create_name = #{record.createName,jdbcType=VARCHAR},
</if>
<if
test=
"record.status != null"
>
status = #{record.status,jdbcType=VARCHAR},
</if>
<if
test=
"record.statusTime != null"
>
status_time = #{record.statusTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.operateReason != null"
>
operate_reason = #{record.operateReason,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update sys_tenant
set id = #{record.id,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
create_name = #{record.createName,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
status_time = #{record.statusTime,jdbcType=TIMESTAMP},
operate_reason = #{record.operateReason,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysTenant"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update sys_tenant
<set>
<if
test=
"code != null"
>
code = #{code,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"createName != null"
>
create_name = #{createName,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=VARCHAR},
</if>
<if
test=
"statusTime != null"
>
status_time = #{statusTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"operateReason != null"
>
operate_reason = #{operateReason,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/primary/sqlmap/SysUserMapper.xml
浏览文件 @
837b0d71
...
...
@@ -20,6 +20,7 @@
<arg
column=
"update_time"
javaType=
"java.util.Date"
jdbcType=
"TIMESTAMP"
/>
<arg
column=
"minus_role"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"duties"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<arg
column=
"tenant_id"
javaType=
"java.lang.Long"
jdbcType=
"BIGINT"
/>
</constructor>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
...
...
@@ -94,7 +95,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_name, password, gender, email, mobile, status, org_id, remark, create_time,
update_time, minus_role, duties
update_time, minus_role, duties
, tenant_id
</sql>
<select
id=
"selectByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysUserExample"
resultMap=
"BaseResultMap"
>
<!--
...
...
@@ -170,6 +171,9 @@
<if
test=
"duties != null"
>
duties,
</if>
<if
test=
"tenantId != null"
>
tenant_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
...
...
@@ -211,6 +215,9 @@
<if
test=
"duties != null"
>
#{duties,jdbcType=VARCHAR},
</if>
<if
test=
"tenantId != null"
>
#{tenantId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"net.wicp.tams.app.duckula.controller.bean.models.SysUserExample"
resultType=
"java.lang.Long"
>
...
...
@@ -269,6 +276,9 @@
<if
test=
"record.duties != null"
>
duties = #{record.duties,jdbcType=VARCHAR},
</if>
<if
test=
"record.tenantId != null"
>
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -292,7 +302,8 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
minus_role = #{record.minusRole,jdbcType=VARCHAR},
duties = #{record.duties,jdbcType=VARCHAR}
duties = #{record.duties,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -340,6 +351,9 @@
<if
test=
"duties != null"
>
duties = #{duties,jdbcType=VARCHAR},
</if>
<if
test=
"tenantId != null"
>
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录