给租户增加启用禁用功能
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Tenant;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.entities.UserEx;
|
||||
import com.jsh.erp.datasource.vo.TreeNodeEx;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.redis.RedisService;
|
||||
import com.jsh.erp.service.tenant.TenantService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
/**
|
||||
* @author ji_sheng_hua 华夏erp
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/tenant")
|
||||
public class TenantController {
|
||||
private Logger logger = LoggerFactory.getLogger(TenantController.class);
|
||||
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
/**
|
||||
* 批量设置状态-启用或者禁用
|
||||
* @param jsonObject
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/batchSetStatus")
|
||||
public String batchSetStatus(@RequestBody JSONObject jsonObject,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Boolean status = jsonObject.getBoolean("status");
|
||||
String ids = jsonObject.getString("ids");
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int res = tenantService.batchSetStatus(status, ids);
|
||||
if(res > 0) {
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,9 @@ public class UserController {
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
|
||||
msgTip = "access service error";
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.BLACK_TENANT:
|
||||
msgTip = "tenant is black";
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT:
|
||||
msgTip = "user can login";
|
||||
//验证通过 ,可以登录,放入session,记录登录日志
|
||||
|
||||
@@ -1,197 +1,75 @@
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Tenant {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.login_name
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.user_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Integer userNumLimit;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.bills_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Integer billsNumLimit;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_tenant.create_time
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.id
|
||||
*
|
||||
* @return the value of jsh_tenant.id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.id
|
||||
*
|
||||
* @param id the value for jsh_tenant.id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.tenant_id
|
||||
*
|
||||
* @return the value of jsh_tenant.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.tenant_id
|
||||
*
|
||||
* @param tenantId the value for jsh_tenant.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.login_name
|
||||
*
|
||||
* @return the value of jsh_tenant.login_name
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.login_name
|
||||
*
|
||||
* @param loginName the value for jsh_tenant.login_name
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName == null ? null : loginName.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.user_num_limit
|
||||
*
|
||||
* @return the value of jsh_tenant.user_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Integer getUserNumLimit() {
|
||||
return userNumLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.user_num_limit
|
||||
*
|
||||
* @param userNumLimit the value for jsh_tenant.user_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setUserNumLimit(Integer userNumLimit) {
|
||||
this.userNumLimit = userNumLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.bills_num_limit
|
||||
*
|
||||
* @return the value of jsh_tenant.bills_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Integer getBillsNumLimit() {
|
||||
return billsNumLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.bills_num_limit
|
||||
*
|
||||
* @param billsNumLimit the value for jsh_tenant.bills_num_limit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setBillsNumLimit(Integer billsNumLimit) {
|
||||
this.billsNumLimit = billsNumLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_tenant.create_time
|
||||
*
|
||||
* @return the value of jsh_tenant.create_time
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_tenant.create_time
|
||||
*
|
||||
* @param createTime the value for jsh_tenant.create_time
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Tenant {
|
||||
private Long id;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private String loginName;
|
||||
|
||||
private Integer userNumLimit;
|
||||
|
||||
private Integer billsNumLimit;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName == null ? null : loginName.trim();
|
||||
}
|
||||
|
||||
public Integer getUserNumLimit() {
|
||||
return userNumLimit;
|
||||
}
|
||||
|
||||
public void setUserNumLimit(Integer userNumLimit) {
|
||||
this.userNumLimit = userNumLimit;
|
||||
}
|
||||
|
||||
public Integer getBillsNumLimit() {
|
||||
return billsNumLimit;
|
||||
}
|
||||
|
||||
public void setBillsNumLimit(Integer billsNumLimit) {
|
||||
this.billsNumLimit = billsNumLimit;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,96 +1,30 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.Tenant;
|
||||
import com.jsh.erp.datasource.entities.TenantExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface TenantMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int countByExample(TenantExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int deleteByExample(TenantExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int insert(Tenant record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int insertSelective(Tenant record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
List<Tenant> selectByExample(TenantExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
Tenant selectByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("record") Tenant record, @Param("example") TenantExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByExample(@Param("record") Tenant record, @Param("example") TenantExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(Tenant record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_tenant
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByPrimaryKey(Tenant record);
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.Tenant;
|
||||
import com.jsh.erp.datasource.entities.TenantExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface TenantMapper {
|
||||
long countByExample(TenantExample example);
|
||||
|
||||
int deleteByExample(TenantExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(Tenant record);
|
||||
|
||||
int insertSelective(Tenant record);
|
||||
|
||||
List<Tenant> selectByExample(TenantExample example);
|
||||
|
||||
Tenant selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") Tenant record, @Param("example") TenantExample example);
|
||||
|
||||
int updateByExample(@Param("record") Tenant record, @Param("example") TenantExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(Tenant record);
|
||||
|
||||
int updateByPrimaryKey(Tenant record);
|
||||
}
|
||||
@@ -264,17 +264,22 @@ public class DepotHeadService {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**删除单据子表数据*/
|
||||
try {
|
||||
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{id});
|
||||
//更新当前库存
|
||||
List<DepotItem> list = depotItemService.getListByHeaderId(id);
|
||||
for (DepotItem depotItem : list) {
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
depotItemService.updateCurrentStock(depotItem, tenantId);
|
||||
//对于零售出库单据,更新会员的预收款信息
|
||||
if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&& BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
|
||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())) {
|
||||
if (depotHead.getOrganId() != null) {
|
||||
supplierService.updateAdvanceIn(depotHead.getOrganId(), depotHead.getTotalPrice().abs());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
/**删除单据子表数据*/
|
||||
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{id});
|
||||
//更新当前库存
|
||||
List<DepotItem> list = depotItemService.getListByHeaderId(id);
|
||||
for (DepotItem depotItem : list) {
|
||||
Long tenantId = redisService.getTenantId(request);
|
||||
depotItemService.updateCurrentStock(depotItem, tenantId);
|
||||
}
|
||||
/**删除单据主表信息*/
|
||||
batchDeleteDepotHeadByIds(id.toString());
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.mappers.TenantMapper;
|
||||
import com.jsh.erp.datasource.mappers.TenantMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@@ -15,6 +16,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -30,6 +33,9 @@ public class TenantService {
|
||||
@Resource
|
||||
private TenantMapperEx tenantMapperEx;
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
@Value("${tenant.userNumLimit}")
|
||||
private Integer userNumLimit;
|
||||
|
||||
@@ -161,4 +167,28 @@ public class TenantService {
|
||||
}
|
||||
return tenant;
|
||||
}
|
||||
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
int result=0;
|
||||
try{
|
||||
String statusStr ="";
|
||||
if(status) {
|
||||
statusStr ="批量启用";
|
||||
} else {
|
||||
statusStr ="批量禁用";
|
||||
}
|
||||
logService.insertLog("用户",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ids).append("-").append(statusStr).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
Tenant tenant = new Tenant();
|
||||
tenant.setEnabled(status);
|
||||
TenantExample example = new TenantExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
result = tenantMapper.updateByExampleSelective(tenant, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +295,11 @@ public class UserService {
|
||||
if(list.get(0).getStatus()!=0) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.BLACK_USER;
|
||||
}
|
||||
Long tenantId = list.get(0).getTenantId();
|
||||
Tenant tenant = tenantService.getTenantByTenantId(tenantId);
|
||||
if(tenant!=null && tenant.getEnabled()!=null && !tenant.getEnabled()) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.BLACK_TENANT;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface ExceptionCodeConstants {
|
||||
public static final int USER_PASSWORD_ERROR = 2;
|
||||
|
||||
/**
|
||||
* 被加入黑名单
|
||||
* 用户被加入黑名单
|
||||
*/
|
||||
public static final int BLACK_USER = 3;
|
||||
|
||||
@@ -29,5 +29,10 @@ public interface ExceptionCodeConstants {
|
||||
* 访问数据库异常
|
||||
*/
|
||||
public static final int USER_ACCESS_EXCEPTION = 5;
|
||||
|
||||
/**
|
||||
* 租户被加入黑名单
|
||||
*/
|
||||
public static final int BLACK_TENANT = 6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,288 +1,243 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.TenantMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="id" property="id" jdbcType="BIGINT" />
|
||||
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" />
|
||||
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
|
||||
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" />
|
||||
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
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="(" suffix=")" prefixOverrides="and" >
|
||||
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
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="(" suffix=")" prefixOverrides="and" >
|
||||
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, tenant_id, login_name, user_num_limit, bills_num_limit, create_time
|
||||
</sql>
|
||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<if test="distinct" >
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_tenant
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null" >
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_tenant
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from jsh_tenant
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from jsh_tenant
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into jsh_tenant (id, tenant_id, login_name,
|
||||
user_num_limit, bills_num_limit, create_time
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
|
||||
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into jsh_tenant
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
id,
|
||||
</if>
|
||||
<if test="tenantId != null" >
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="loginName != null" >
|
||||
login_name,
|
||||
</if>
|
||||
<if test="userNumLimit != null" >
|
||||
user_num_limit,
|
||||
</if>
|
||||
<if test="billsNumLimit != null" >
|
||||
bills_num_limit,
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tenantId != null" >
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="loginName != null" >
|
||||
#{loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userNumLimit != null" >
|
||||
#{userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billsNumLimit != null" >
|
||||
#{billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select count(*) from jsh_tenant
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update jsh_tenant
|
||||
<set >
|
||||
<if test="record.id != null" >
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.tenantId != null" >
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.loginName != null" >
|
||||
login_name = #{record.loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userNumLimit != null" >
|
||||
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.billsNumLimit != null" >
|
||||
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.createTime != null" >
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update jsh_tenant
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
login_name = #{record.loginName,jdbcType=VARCHAR},
|
||||
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
|
||||
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP}
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update jsh_tenant
|
||||
<set >
|
||||
<if test="tenantId != null" >
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="loginName != null" >
|
||||
login_name = #{loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userNumLimit != null" >
|
||||
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billsNumLimit != null" >
|
||||
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant" >
|
||||
<!--
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update jsh_tenant
|
||||
set tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
login_name = #{loginName,jdbcType=VARCHAR},
|
||||
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
|
||||
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.TenantMapper">
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="login_name" jdbcType="VARCHAR" property="loginName" />
|
||||
<result column="user_num_limit" jdbcType="INTEGER" property="userNumLimit" />
|
||||
<result column="bills_num_limit" jdbcType="INTEGER" property="billsNumLimit" />
|
||||
<result column="enabled" jdbcType="BIT" property="enabled" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<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">
|
||||
<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">
|
||||
id, tenant_id, login_name, user_num_limit, bills_num_limit, enabled, create_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_tenant
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_tenant
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from jsh_tenant
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample">
|
||||
delete from jsh_tenant
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant">
|
||||
insert into jsh_tenant (id, tenant_id, login_name,
|
||||
user_num_limit, bills_num_limit, enabled,
|
||||
create_time)
|
||||
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
|
||||
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{enabled,jdbcType=BIT},
|
||||
#{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant">
|
||||
insert into jsh_tenant
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="loginName != null">
|
||||
login_name,
|
||||
</if>
|
||||
<if test="userNumLimit != null">
|
||||
user_num_limit,
|
||||
</if>
|
||||
<if test="billsNumLimit != null">
|
||||
bills_num_limit,
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="loginName != null">
|
||||
#{loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userNumLimit != null">
|
||||
#{userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billsNumLimit != null">
|
||||
#{billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
#{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Long">
|
||||
select count(*) from jsh_tenant
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update jsh_tenant
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.loginName != null">
|
||||
login_name = #{record.loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userNumLimit != null">
|
||||
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.billsNumLimit != null">
|
||||
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.enabled != null">
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update jsh_tenant
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
login_name = #{record.loginName,jdbcType=VARCHAR},
|
||||
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
|
||||
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant">
|
||||
update jsh_tenant
|
||||
<set>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="loginName != null">
|
||||
login_name = #{loginName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userNumLimit != null">
|
||||
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billsNumLimit != null">
|
||||
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant">
|
||||
update jsh_tenant
|
||||
set tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
login_name = #{loginName,jdbcType=VARCHAR},
|
||||
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
|
||||
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user