提交 efbfed13 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 1e4e3566
package cn.ibizlab.core.uaa.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[实体]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZUSERAUTH",resultMap = "SysUserAuthResultMap")
public class SysUserAuth extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 标识
*/
@DEField(name = "authid" , isKeyField=true)
@TableId(value= "authid",type=IdType.ASSIGN_UUID)
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 用户标识
*/
@TableField(value = "userid")
@JSONField(name = "userid")
@JsonProperty("userid")
private String userid;
/**
* 认证类型
*/
@DEField(name = "identity_type")
@TableField(value = "identity_type")
@JSONField(name = "identity_type")
@JsonProperty("identity_type")
private String identityType;
/**
* 认证标识
*/
@TableField(value = "identifier")
@JSONField(name = "identifier")
@JsonProperty("identifier")
private String identifier;
/**
* 凭据
*/
@TableField(value = "credential")
@JSONField(name = "credential")
@JsonProperty("credential")
private String credential;
/**
* 用户
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.uaa.domain.SysUser user;
/**
* 设置 [用户标识]
*/
public void setUserid(String userid){
this.userid = userid ;
this.modify("userid",userid);
}
/**
* 设置 [认证类型]
*/
public void setIdentityType(String identityType){
this.identityType = identityType ;
this.modify("identity_type",identityType);
}
/**
* 设置 [认证标识]
*/
public void setIdentifier(String identifier){
this.identifier = identifier ;
this.modify("identifier",identifier);
}
/**
* 设置 [凭据]
*/
public void setCredential(String credential){
this.credential = credential ;
this.modify("credential",credential);
}
/**
* 获取 [标识]
*/
public String getId(){
if(ObjectUtils.isEmpty(id)){
id=(String)getDefaultKey(true);
}
return id;
}
@Override
public Serializable getDefaultKey(boolean gen) {
if((!ObjectUtils.isEmpty(this.getUserid()))&&(!ObjectUtils.isEmpty(this.getIdentityType())))
return DigestUtils.md5DigestAsHex(String.format("%s||%s" ,this.getUserid(),this.getIdentityType()).getBytes());
return null;
}
}
package cn.ibizlab.core.uaa.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.uaa.domain.SysUserAuth;
/**
* 关系型数据实体[SysUserAuth] 查询条件对象
*/
@Slf4j
@Data
public class SysUserAuthSearchContext extends QueryWrapperContext<SysUserAuth> {
private String n_userid_eq;//[用户标识]
public void setN_userid_eq(String n_userid_eq) {
this.n_userid_eq = n_userid_eq;
if(!ObjectUtils.isEmpty(this.n_userid_eq)){
this.getSearchCond().eq("userid", n_userid_eq);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
}
}
}
package cn.ibizlab.core.uaa.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.HashMap;
import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.uaa.domain.SysUserAuth;
import cn.ibizlab.core.uaa.filter.SysUserAuthSearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface SysUserAuthMapper extends BaseMapper<SysUserAuth>{
Page<SysUserAuth> searchDefault(IPage page, @Param("srf") SysUserAuthSearchContext context, @Param("ew") Wrapper<SysUserAuth> wrapper) ;
@Override
SysUserAuth selectById(Serializable id);
@Override
int insert(SysUserAuth entity);
@Override
int updateById(@Param(Constants.ENTITY) SysUserAuth entity);
@Override
int update(@Param(Constants.ENTITY) SysUserAuth entity, @Param("ew") Wrapper<SysUserAuth> updateWrapper);
@Override
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<SysUserAuth> selectByUserid(@Param("userid") Serializable userid) ;
}
package cn.ibizlab.core.uaa.service;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cache.annotation.CacheEvict;
import cn.ibizlab.core.uaa.domain.SysUserAuth;
import cn.ibizlab.core.uaa.filter.SysUserAuthSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[SysUserAuth] 服务对象接口
*/
public interface ISysUserAuthService extends IService<SysUserAuth>{
boolean create(SysUserAuth et) ;
void createBatch(List<SysUserAuth> list) ;
boolean update(SysUserAuth et) ;
void updateBatch(List<SysUserAuth> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
SysUserAuth get(String key) ;
SysUserAuth getDraft(SysUserAuth et) ;
boolean checkKey(SysUserAuth et) ;
boolean save(SysUserAuth et) ;
void saveBatch(List<SysUserAuth> list) ;
Page<SysUserAuth> searchDefault(SysUserAuthSearchContext context) ;
List<SysUserAuth> selectByUserid(String userid) ;
void removeByUserid(String userid) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return select * from table where id = '1'
*/
List<JSONObject> select(String sql, Map param);
/**
*自定义SQL
* @param sql update table set name ='test' where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return update table set name ='test' where id = '1'
*/
boolean execute(String sql, Map param);
}
package cn.ibizlab.core.uaa.service.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.math.BigInteger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import cn.ibizlab.core.uaa.domain.SysUserAuth;
import cn.ibizlab.core.uaa.filter.SysUserAuthSearchContext;
import cn.ibizlab.core.uaa.service.ISysUserAuthService;
import cn.ibizlab.util.helper.CachedBeanCopier;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.uaa.mapper.SysUserAuthMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
/**
* 实体[实体] 服务对象接口实现
*/
@Slf4j
@Service("SysUserAuthServiceImpl")
public class SysUserAuthServiceImpl extends ServiceImpl<SysUserAuthMapper, SysUserAuth> implements ISysUserAuthService {
@Autowired
@Lazy
protected cn.ibizlab.core.uaa.service.ISysUserService sysuserService;
protected int batchSize = 500;
@Override
@Transactional
public boolean create(SysUserAuth et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<SysUserAuth> list) {
this.saveOrUpdateBatch(list,batchSize);
}
@Override
@Transactional
public boolean update(SysUserAuth et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("authid",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void updateBatch(List<SysUserAuth> list) {
updateBatchById(list,batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public SysUserAuth get(String key) {
SysUserAuth et = getById(key);
if(et==null){
et=new SysUserAuth();
et.setId(key);
}
else{
}
return et;
}
@Override
public SysUserAuth getDraft(SysUserAuth et) {
return et;
}
@Override
public boolean checkKey(SysUserAuth et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(SysUserAuth et) {
if(!saveOrUpdate(et))
return false;
return true;
}
@Override
@Transactional
public boolean saveOrUpdate(SysUserAuth et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override
public boolean saveBatch(Collection<SysUserAuth> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<SysUserAuth> list) {
saveOrUpdateBatch(list,batchSize);
}
@Override
public List<SysUserAuth> selectByUserid(String userid) {
return baseMapper.selectByUserid(userid);
}
@Override
public void removeByUserid(String userid) {
this.remove(new QueryWrapper<SysUserAuth>().eq("userid",userid));
}
/**
* 查询集合 DEFAULT
*/
@Override
public Page<SysUserAuth> searchDefault(SysUserAuthSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUserAuth> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond());
return new PageImpl<SysUserAuth>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
@Override
public List<JSONObject> select(String sql, Map param){
return this.baseMapper.selectBySQL(sql,param);
}
@Override
@Transactional
public boolean execute(String sql , Map param){
if (sql == null || sql.isEmpty()) {
return false;
}
if (sql.toLowerCase().trim().startsWith("insert")) {
return this.baseMapper.insertBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("update")) {
return this.baseMapper.updateBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("delete")) {
return this.baseMapper.deleteBySQL(sql,param);
}
log.warn("暂未支持的SQL语法");
return true;
}
}
......@@ -45,6 +45,9 @@ import org.springframework.util.StringUtils;
@Service("SysUserServiceImpl")
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
@Autowired
@Lazy
protected cn.ibizlab.core.uaa.service.ISysUserAuthService sysuserauthService;
@Autowired
@Lazy
protected cn.ibizlab.core.uaa.service.ISysUserRoleService sysuserroleService;
......
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${dbinst.getUserName()} [in template "CODETEMPL_zh_CN" at line 28, column 24]
----
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<!--输出实体[SYS_AUTHLOG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_authlog-40-1">
<createTable tableName="IBZAUTHLOG">
<column name="LOGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_AUTHLOG_LOGID"/>
</column>
<column name="USERNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="PERSONNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="DOMAIN" remarks="" type="VARCHAR(100)">
</column>
<column name="AUTHTIME" remarks="" type="DATETIME">
</column>
<column name="IPADDR" remarks="" type="VARCHAR(100)">
</column>
<column name="MACADDR" remarks="" type="VARCHAR(100)">
</column>
<column name="USERAGENT" remarks="" type="VARCHAR(100)">
</column>
<column name="AUTHCODE" remarks="" type="VARCHAR(15)">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PSSYSTEM]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_pssystem-39-2">
<createTable tableName="IBZPSSYSTEM">
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_PSSYSTEM_PSSYSTEMID"/>
</column>
<column name="PSSYSTEMNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="SYSSTRUCTURE" remarks="" type="TEXT(1048576)">
</column>
<column name="APPS" remarks="" type="TEXT(1048576)">
</column>
<column name="MD5CHECK" remarks="" type="VARCHAR(100)">
</column>
<column name="SHOWORDER" remarks="" type="INT">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PERMISSION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_permission-219-3">
<createTable tableName="IBZPERMISSION">
<column name="SYS_PERMISSIONID" remarks="" type="VARCHAR(200)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_PERMISSION_SYS_PERMISSI"/>
</column>
<column name="SYS_PERMISSIONNAME" remarks="" type="VARCHAR(200)">
</column>
<column name="PERMISSIONTYPE" remarks="" type="VARCHAR(60)">
</column>
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
</column>
<column name="ENABLE" remarks="" type="INT">
</column>
<column name="CREATEDATE" remarks="" type="DATETIME">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role-117-4">
<createTable tableName="IBZROLE">
<column name="SYS_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_SYS_ROLEID"/>
</column>
<column name="SYS_ROLENAME" remarks="" type="VARCHAR(200)">
</column>
<column name="MEMO" remarks="" type="VARCHAR(100)">
</column>
<column name="PROLEID" remarks="" type="VARCHAR(100)">
</column>
<column name="CREATEDATE" remarks="" type="DATETIME">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
<column name="CREATEMAN" remarks="" type="VARCHAR(60)">
</column>
<column name="UPDATEMAN" remarks="" type="VARCHAR(60)">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_ROLE_PERMISSION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role_permission-98-5">
<createTable tableName="IBZROLE_PERMISSION">
<column name="SYS_ROLE_PERMISSIONID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_PERMISSION_SYS_ROL"/>
</column>
<column name="SYS_ROLEID" remarks="" type="VARCHAR(100)">
</column>
<column name="SYS_PERMISSIONID" remarks="" type="VARCHAR(200)">
</column>
<column name="CREATEDATE" remarks="" type="DATETIME">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_USER_AUTH]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_user_auth-10-6">
<createTable tableName="IBZUSERAUTH">
<column name="AUTHID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_USER_AUTH_AUTHID"/>
</column>
<column name="USERID" remarks="" type="VARCHAR(100)">
</column>
<column name="IDENTITY_TYPE" remarks="" type="VARCHAR(100)">
</column>
<column name="IDENTIFIER" remarks="" type="VARCHAR(200)">
</column>
<column name="CREDENTIAL" remarks="" type="VARCHAR(500)">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_USER_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_user_role-72-7">
<createTable tableName="IBZUSER_ROLE">
<column name="SYS_USER_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_USER_ROLE_SYS_USER_ROLE"/>
</column>
<column name="SYS_ROLEID" remarks="" type="VARCHAR(100)">
</column>
<column name="SYS_USERID" remarks="" type="VARCHAR(100)">
</column>
<column name="CREATEDATE" remarks="" type="DATETIME">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_AUTHLOG]外键关系 -->
<!--输出实体[SYS_PSSYSTEM]外键关系 -->
<!--输出实体[SYS_PERMISSION]外键关系 -->
<!--输出实体[SYS_ROLE]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_role-117-8">
<addForeignKeyConstraint baseColumnNames="PROLEID" baseTableName="IBZROLE" constraintName="DER1N_SYS_ROLE_SYS_ROLE_PROLEI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_ROLEID" referencedTableName="IBZROLE" validate="true"/>
</changeSet>
<!--输出实体[SYS_ROLE_PERMISSION]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_role_permission-98-9">
<addForeignKeyConstraint baseColumnNames="SYS_PERMISSIONID" baseTableName="IBZROLE_PERMISSION" constraintName="DER1N_SYS_ROLE_PERMISSION_SYS_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_PERMISSIONID" referencedTableName="IBZPERMISSION" validate="true"/>
</changeSet>
<!--输出实体[SYS_USER_AUTH]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_user_auth-10-11">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZUSERAUTH" constraintName="DER1N_SYS_USER_AUTH_SYS_USER_U" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZUSER" validate="true"/>
</changeSet>
<!--输出实体[SYS_USER_ROLE]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_user_role-72-12">
<addForeignKeyConstraint baseColumnNames="SYS_ROLEID" baseTableName="IBZUSER_ROLE" constraintName="DER1N_SYS_USER_ROLE_SYS_ROLE_S" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_ROLEID" referencedTableName="IBZROLE" validate="true"/>
</changeSet>
</databaseChangeLog>
......@@ -4,6 +4,9 @@
<mapper namespace="cn.ibizlab.core.uaa.mapper.SysRoleMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="SysRoleResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PROLEID`, t11.`SYS_ROLENAME` AS `PROLENAME`, t1.`SYS_ROLEID`, t1.`SYS_ROLENAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZROLE` t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID ) t1 where sys_roleid=#{id}]]>
</select>
<select id="selectById" resultMap="SysRoleResultMap" databaseId="oracle">
<![CDATA[select t1.* from (SELECT t1.CREATEDATE, t1.CREATEMAN, t1.MEMO, t1.PROLEID, t11.SYS_ROLENAME AS PROLENAME, t1.SYS_ROLEID, t1.SYS_ROLENAME, t1.UPDATEDATE, t1.UPDATEMAN FROM IBZROLE t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID ) t1 where sys_roleid=#{id}]]>
</select>
......@@ -38,7 +41,7 @@
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`MEMO`, t1.`PROLEID`, t11.`SYS_ROLENAME` AS `PROLENAME`, t1.`SYS_ROLEID`, t1.`SYS_ROLENAME`, t1.`UPDATEDATE` FROM `IBZROLE` t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PROLEID`, t11.`SYS_ROLENAME` AS `PROLENAME`, t1.`SYS_ROLEID`, t1.`SYS_ROLENAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZROLE` t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID
]]>
</sql>
<!--数据查询[Default]-->
......@@ -52,6 +55,11 @@
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PROLEID`, t11.`SYS_ROLENAME` AS `PROLENAME`, t1.`SYS_ROLEID`, t1.`SYS_ROLENAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZROLE` t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="oracle">
<![CDATA[ SELECT t1.CREATEDATE, t1.CREATEMAN, t1.MEMO, t1.PROLEID, t11.SYS_ROLENAME AS PROLENAME, t1.SYS_ROLEID, t1.SYS_ROLENAME, t1.UPDATEDATE, t1.UPDATEMAN FROM IBZROLE t1 LEFT JOIN IBZROLE t11 ON t1.PROLEID = t11.SYS_ROLEID
]]>
......
<?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="cn.ibizlab.core.uaa.mapper.SysUserAuthMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="SysUserAuthResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`AUTHID`, t1.`CREDENTIAL`, t1.`IDENTIFIER`, t1.`IDENTITY_TYPE`, t1.`USERID` FROM `IBZUSERAUTH` t1 ) t1 where authid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="SysUserAuthResultMap" type="cn.ibizlab.core.uaa.domain.SysUserAuth" autoMapping="true">
<id property="id" column="authid" /><!--主键字段映射-->
<result property="userid" column="userid" />
<result property="identityType" column="identity_type" />
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association property="user" javaType="cn.ibizlab.core.uaa.domain.SysUser" column="userid" select="cn.ibizlab.core.uaa.mapper.SysUserMapper.selectById" fetchType="lazy"></association>
</resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_SYS_USER_AUTH_SYS_USER_USERID] -->
<select id="selectByUserid" resultMap="SysUserAuthResultMap">
select t1.* from (
<include refid="Default" />
) t1
where userid=#{userid}
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.core.uaa.filter.SysUserAuthSearchContext" resultMap="SysUserAuthResultMap">
select t1.* from (
<include refid="Default" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`AUTHID`, t1.`CREDENTIAL`, t1.`IDENTIFIER`, t1.`IDENTITY_TYPE`, t1.`USERID` FROM `IBZUSERAUTH` t1
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`AUTHID`, t1.`CREDENTIAL`, t1.`IDENTIFIER`, t1.`IDENTITY_TYPE`, t1.`USERID` FROM `IBZUSERAUTH` t1
]]>
</sql>
</mapper>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册