给租户增加启用禁用功能

This commit is contained in:
季圣华
2021-07-06 22:24:17 +08:00
parent a176f417e4
commit 1db9b94599
12 changed files with 1108 additions and 1263 deletions

View File

@@ -823,6 +823,7 @@ CREATE TABLE `jsh_tenant` (
`login_name` varchar(255) DEFAULT NULL COMMENT '登录名', `login_name` varchar(255) DEFAULT NULL COMMENT '登录名',
`user_num_limit` int(11) DEFAULT NULL COMMENT '用户数量限制', `user_num_limit` int(11) DEFAULT NULL COMMENT '用户数量限制',
`bills_num_limit` int(11) DEFAULT NULL COMMENT '单据数量限制', `bills_num_limit` int(11) DEFAULT NULL COMMENT '单据数量限制',
`enabled` bit(1) DEFAULT 1 COMMENT '启用 0-禁用 1-启用',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='租户'; ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='租户';
@@ -830,7 +831,7 @@ CREATE TABLE `jsh_tenant` (
-- ---------------------------- -- ----------------------------
-- Records of jsh_tenant -- Records of jsh_tenant
-- ---------------------------- -- ----------------------------
INSERT INTO `jsh_tenant` VALUES ('13', '63', 'jsh', '20', '2000', '2021-02-17 23:19:17'); INSERT INTO `jsh_tenant` VALUES ('13', '63', 'jsh', '20', '2000', 1, '2021-02-17 23:19:17');
-- ---------------------------- -- ----------------------------
-- Table structure for jsh_unit -- Table structure for jsh_unit

View File

@@ -1118,4 +1118,11 @@ alter table jsh_account_head add discount_money decimal(24,6) DEFAULT NULL COMME
-- by jishenghua -- by jishenghua
-- 给商品表增加附件名称字段 -- 给商品表增加附件名称字段
-- -------------------------------------------------------- -- --------------------------------------------------------
alter table jsh_material add img_name varchar(500) DEFAULT NULL COMMENT '图片名称' after remark; alter table jsh_material add img_name varchar(500) DEFAULT NULL COMMENT '图片名称' after remark;
-- --------------------------------------------------------
-- 时间 2021年7月6日
-- by jishenghua
-- 给租户表增加字段enabled
-- --------------------------------------------------------
alter table jsh_tenant add enabled bit(1) DEFAULT 1 COMMENT '启用 0-禁用 1-启用' after bills_num_limit;

View File

@@ -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);
}
}
}

View File

@@ -107,6 +107,9 @@ public class UserController {
case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
msgTip = "access service error"; msgTip = "access service error";
break; break;
case ExceptionCodeConstants.UserExceptionCode.BLACK_TENANT:
msgTip = "tenant is black";
break;
case ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT: case ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT:
msgTip = "user can login"; msgTip = "user can login";
//验证通过 可以登录放入session记录登录日志 //验证通过 可以登录放入session记录登录日志

View File

@@ -1,197 +1,75 @@
package com.jsh.erp.datasource.entities; package com.jsh.erp.datasource.entities;
import java.util.Date; import java.util.Date;
public class Tenant { public class Tenant {
/** private Long id;
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.id private Long tenantId;
*
* @mbggenerated private String loginName;
*/
private Long id; private Integer userNumLimit;
/** private Integer billsNumLimit;
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.tenant_id private Boolean enabled;
*
* @mbggenerated private Date createTime;
*/
private Long tenantId; public Long getId() {
return id;
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.login_name public void setId(Long id) {
* this.id = id;
* @mbggenerated }
*/
private String loginName; public Long getTenantId() {
return tenantId;
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.user_num_limit public void setTenantId(Long tenantId) {
* this.tenantId = tenantId;
* @mbggenerated }
*/
private Integer userNumLimit; public String getLoginName() {
return loginName;
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.bills_num_limit public void setLoginName(String loginName) {
* this.loginName = loginName == null ? null : loginName.trim();
* @mbggenerated }
*/
private Integer billsNumLimit; public Integer getUserNumLimit() {
return userNumLimit;
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.create_time public void setUserNumLimit(Integer userNumLimit) {
* this.userNumLimit = userNumLimit;
* @mbggenerated }
*/
private Date createTime; public Integer getBillsNumLimit() {
return billsNumLimit;
/** }
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.id public void setBillsNumLimit(Integer billsNumLimit) {
* this.billsNumLimit = billsNumLimit;
* @return the value of jsh_tenant.id }
*
* @mbggenerated public Boolean getEnabled() {
*/ return enabled;
public Long getId() { }
return id;
} public void setEnabled(Boolean enabled) {
this.enabled = enabled;
/** }
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.id public Date getCreateTime() {
* return createTime;
* @param id the value for jsh_tenant.id }
*
* @mbggenerated public void setCreateTime(Date createTime) {
*/ this.createTime = createTime;
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;
}
} }

View File

@@ -1,96 +1,30 @@
package com.jsh.erp.datasource.mappers; package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Tenant; import com.jsh.erp.datasource.entities.Tenant;
import com.jsh.erp.datasource.entities.TenantExample; import com.jsh.erp.datasource.entities.TenantExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
public interface TenantMapper { public interface TenantMapper {
/** long countByExample(TenantExample example);
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_tenant int deleteByExample(TenantExample example);
*
* @mbggenerated int deleteByPrimaryKey(Long id);
*/
int countByExample(TenantExample example); int insert(Tenant record);
/** int insertSelective(Tenant record);
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_tenant List<Tenant> selectByExample(TenantExample example);
*
* @mbggenerated Tenant selectByPrimaryKey(Long id);
*/
int deleteByExample(TenantExample example); int updateByExampleSelective(@Param("record") Tenant record, @Param("example") TenantExample example);
/** 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 int updateByPrimaryKeySelective(Tenant record);
*
* @mbggenerated int updateByPrimaryKey(Tenant record);
*/
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);
} }

View File

@@ -264,17 +264,22 @@ public class DepotHeadService {
} }
} }
} }
/**删除单据子表数据*/ //对于零售出库单据,更新会员的预收款信息
try { if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{id}); && BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
//更新当前库存 if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())) {
List<DepotItem> list = depotItemService.getListByHeaderId(id); if (depotHead.getOrganId() != null) {
for (DepotItem depotItem : list) { supplierService.updateAdvanceIn(depotHead.getOrganId(), depotHead.getTotalPrice().abs());
Long tenantId = redisService.getTenantId(request); }
depotItemService.updateCurrentStock(depotItem, tenantId);
} }
} 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()); batchDeleteDepotHeadByIds(id.toString());

View File

@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.mappers.TenantMapper;
import com.jsh.erp.datasource.mappers.TenantMapperEx; import com.jsh.erp.datasource.mappers.TenantMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools; import com.jsh.erp.utils.Tools;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -15,6 +16,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -30,6 +33,9 @@ public class TenantService {
@Resource @Resource
private TenantMapperEx tenantMapperEx; private TenantMapperEx tenantMapperEx;
@Resource
private LogService logService;
@Value("${tenant.userNumLimit}") @Value("${tenant.userNumLimit}")
private Integer userNumLimit; private Integer userNumLimit;
@@ -161,4 +167,28 @@ public class TenantService {
} }
return tenant; 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;
}
} }

View File

@@ -295,6 +295,11 @@ public class UserService {
if(list.get(0).getStatus()!=0) { if(list.get(0).getStatus()!=0) {
return ExceptionCodeConstants.UserExceptionCode.BLACK_USER; 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) { } catch (Exception e) {
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e); logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);

View File

@@ -16,7 +16,7 @@ public interface ExceptionCodeConstants {
public static final int USER_PASSWORD_ERROR = 2; public static final int USER_PASSWORD_ERROR = 2;
/** /**
* 被加入黑名单 * 用户被加入黑名单
*/ */
public static final int BLACK_USER = 3; 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 USER_ACCESS_EXCEPTION = 5;
/**
* 租户被加入黑名单
*/
public static final int BLACK_TENANT = 6;
} }
} }

View File

@@ -1,288 +1,243 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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" > <mapper namespace="com.jsh.erp.datasource.mappers.TenantMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" > <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant">
<!-- <id column="id" jdbcType="BIGINT" property="id" />
WARNING - @mbggenerated <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
This element is automatically generated by MyBatis Generator, do not modify. <result column="login_name" jdbcType="VARCHAR" property="loginName" />
--> <result column="user_num_limit" jdbcType="INTEGER" property="userNumLimit" />
<id column="id" property="id" jdbcType="BIGINT" /> <result column="bills_num_limit" jdbcType="INTEGER" property="billsNumLimit" />
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" /> <result column="enabled" jdbcType="BIT" property="enabled" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" /> </resultMap>
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" /> <sql id="Example_Where_Clause">
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <where>
</resultMap> <foreach collection="oredCriteria" item="criteria" separator="or">
<sql id="Example_Where_Clause" > <if test="criteria.valid">
<!-- <trim prefix="(" prefixOverrides="and" suffix=")">
WARNING - @mbggenerated <foreach collection="criteria.criteria" item="criterion">
This element is automatically generated by MyBatis Generator, do not modify. <choose>
--> <when test="criterion.noValue">
<where > and ${criterion.condition}
<foreach collection="oredCriteria" item="criteria" separator="or" > </when>
<if test="criteria.valid" > <when test="criterion.singleValue">
<trim prefix="(" suffix=")" prefixOverrides="and" > and ${criterion.condition} #{criterion.value}
<foreach collection="criteria.criteria" item="criterion" > </when>
<choose > <when test="criterion.betweenValue">
<when test="criterion.noValue" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition} </when>
</when> <when test="criterion.listValue">
<when test="criterion.singleValue" > and ${criterion.condition}
and ${criterion.condition} #{criterion.value} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
</when> #{listItem}
<when test="criterion.betweenValue" > </foreach>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when>
</when> </choose>
<when test="criterion.listValue" > </foreach>
and ${criterion.condition} </trim>
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > </if>
#{listItem} </foreach>
</foreach> </where>
</when> </sql>
</choose> <sql id="Update_By_Example_Where_Clause">
</foreach> <where>
</trim> <foreach collection="example.oredCriteria" item="criteria" separator="or">
</if> <if test="criteria.valid">
</foreach> <trim prefix="(" prefixOverrides="and" suffix=")">
</where> <foreach collection="criteria.criteria" item="criterion">
</sql> <choose>
<sql id="Update_By_Example_Where_Clause" > <when test="criterion.noValue">
<!-- and ${criterion.condition}
WARNING - @mbggenerated </when>
This element is automatically generated by MyBatis Generator, do not modify. <when test="criterion.singleValue">
--> and ${criterion.condition} #{criterion.value}
<where > </when>
<foreach collection="example.oredCriteria" item="criteria" separator="or" > <when test="criterion.betweenValue">
<if test="criteria.valid" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<trim prefix="(" suffix=")" prefixOverrides="and" > </when>
<foreach collection="criteria.criteria" item="criterion" > <when test="criterion.listValue">
<choose > and ${criterion.condition}
<when test="criterion.noValue" > <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
and ${criterion.condition} #{listItem}
</when> </foreach>
<when test="criterion.singleValue" > </when>
and ${criterion.condition} #{criterion.value} </choose>
</when> </foreach>
<when test="criterion.betweenValue" > </trim>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </if>
</when> </foreach>
<when test="criterion.listValue" > </where>
and ${criterion.condition} </sql>
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > <sql id="Base_Column_List">
#{listItem} id, tenant_id, login_name, user_num_limit, bills_num_limit, enabled, create_time
</foreach> </sql>
</when> <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultMap="BaseResultMap">
</choose> select
</foreach> <if test="distinct">
</trim> distinct
</if> </if>
</foreach> <include refid="Base_Column_List" />
</where> from jsh_tenant
</sql> <if test="_parameter != null">
<sql id="Base_Column_List" > <include refid="Example_Where_Clause" />
<!-- </if>
WARNING - @mbggenerated <if test="orderByClause != null">
This element is automatically generated by MyBatis Generator, do not modify. order by ${orderByClause}
--> </if>
id, tenant_id, login_name, user_num_limit, bills_num_limit, create_time </select>
</sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" > select
<!-- <include refid="Base_Column_List" />
WARNING - @mbggenerated from jsh_tenant
This element is automatically generated by MyBatis Generator, do not modify. where id = #{id,jdbcType=BIGINT}
--> </select>
select <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<if test="distinct" > delete from jsh_tenant
distinct where id = #{id,jdbcType=BIGINT}
</if> </delete>
<include refid="Base_Column_List" /> <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample">
from jsh_tenant delete from jsh_tenant
<if test="_parameter != null" > <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null" > </delete>
order by ${orderByClause} <insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant">
</if> insert into jsh_tenant (id, tenant_id, login_name,
</select> user_num_limit, bills_num_limit, enabled,
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > create_time)
<!-- values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
WARNING - @mbggenerated #{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{enabled,jdbcType=BIT},
This element is automatically generated by MyBatis Generator, do not modify. #{createTime,jdbcType=TIMESTAMP})
--> </insert>
select <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant">
<include refid="Base_Column_List" /> insert into jsh_tenant
from jsh_tenant <trim prefix="(" suffix=")" suffixOverrides=",">
where id = #{id,jdbcType=BIGINT} <if test="id != null">
</select> id,
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > </if>
<!-- <if test="tenantId != null">
WARNING - @mbggenerated tenant_id,
This element is automatically generated by MyBatis Generator, do not modify. </if>
--> <if test="loginName != null">
delete from jsh_tenant login_name,
where id = #{id,jdbcType=BIGINT} </if>
</delete> <if test="userNumLimit != null">
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" > user_num_limit,
<!-- </if>
WARNING - @mbggenerated <if test="billsNumLimit != null">
This element is automatically generated by MyBatis Generator, do not modify. bills_num_limit,
--> </if>
delete from jsh_tenant <if test="enabled != null">
<if test="_parameter != null" > enabled,
<include refid="Example_Where_Clause" /> </if>
</if> <if test="createTime != null">
</delete> create_time,
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" > </if>
<!-- </trim>
WARNING - @mbggenerated <trim prefix="values (" suffix=")" suffixOverrides=",">
This element is automatically generated by MyBatis Generator, do not modify. <if test="id != null">
--> #{id,jdbcType=BIGINT},
insert into jsh_tenant (id, tenant_id, login_name, </if>
user_num_limit, bills_num_limit, create_time <if test="tenantId != null">
) #{tenantId,jdbcType=BIGINT},
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR}, </if>
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP} <if test="loginName != null">
) #{loginName,jdbcType=VARCHAR},
</insert> </if>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" > <if test="userNumLimit != null">
<!-- #{userNumLimit,jdbcType=INTEGER},
WARNING - @mbggenerated </if>
This element is automatically generated by MyBatis Generator, do not modify. <if test="billsNumLimit != null">
--> #{billsNumLimit,jdbcType=INTEGER},
insert into jsh_tenant </if>
<trim prefix="(" suffix=")" suffixOverrides="," > <if test="enabled != null">
<if test="id != null" > #{enabled,jdbcType=BIT},
id, </if>
</if> <if test="createTime != null">
<if test="tenantId != null" > #{createTime,jdbcType=TIMESTAMP},
tenant_id, </if>
</if> </trim>
<if test="loginName != null" > </insert>
login_name, <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Long">
</if> select count(*) from jsh_tenant
<if test="userNumLimit != null" > <if test="_parameter != null">
user_num_limit, <include refid="Example_Where_Clause" />
</if> </if>
<if test="billsNumLimit != null" > </select>
bills_num_limit, <update id="updateByExampleSelective" parameterType="map">
</if> update jsh_tenant
<if test="createTime != null" > <set>
create_time, <if test="record.id != null">
</if> id = #{record.id,jdbcType=BIGINT},
</trim> </if>
<trim prefix="values (" suffix=")" suffixOverrides="," > <if test="record.tenantId != null">
<if test="id != null" > tenant_id = #{record.tenantId,jdbcType=BIGINT},
#{id,jdbcType=BIGINT}, </if>
</if> <if test="record.loginName != null">
<if test="tenantId != null" > login_name = #{record.loginName,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, </if>
</if> <if test="record.userNumLimit != null">
<if test="loginName != null" > user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
#{loginName,jdbcType=VARCHAR}, </if>
</if> <if test="record.billsNumLimit != null">
<if test="userNumLimit != null" > bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
#{userNumLimit,jdbcType=INTEGER}, </if>
</if> <if test="record.enabled != null">
<if test="billsNumLimit != null" > enabled = #{record.enabled,jdbcType=BIT},
#{billsNumLimit,jdbcType=INTEGER}, </if>
</if> <if test="record.createTime != null">
<if test="createTime != null" > create_time = #{record.createTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, </if>
</if> </set>
</trim> <if test="_parameter != null">
</insert> <include refid="Update_By_Example_Where_Clause" />
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" > </if>
<!-- </update>
WARNING - @mbggenerated <update id="updateByExample" parameterType="map">
This element is automatically generated by MyBatis Generator, do not modify. update jsh_tenant
--> set id = #{record.id,jdbcType=BIGINT},
select count(*) from jsh_tenant tenant_id = #{record.tenantId,jdbcType=BIGINT},
<if test="_parameter != null" > login_name = #{record.loginName,jdbcType=VARCHAR},
<include refid="Example_Where_Clause" /> user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
</if> bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
</select> enabled = #{record.enabled,jdbcType=BIT},
<update id="updateByExampleSelective" parameterType="map" > create_time = #{record.createTime,jdbcType=TIMESTAMP}
<!-- <if test="_parameter != null">
WARNING - @mbggenerated <include refid="Update_By_Example_Where_Clause" />
This element is automatically generated by MyBatis Generator, do not modify. </if>
--> </update>
update jsh_tenant <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant">
<set > update jsh_tenant
<if test="record.id != null" > <set>
id = #{record.id,jdbcType=BIGINT}, <if test="tenantId != null">
</if> tenant_id = #{tenantId,jdbcType=BIGINT},
<if test="record.tenantId != null" > </if>
tenant_id = #{record.tenantId,jdbcType=BIGINT}, <if test="loginName != null">
</if> login_name = #{loginName,jdbcType=VARCHAR},
<if test="record.loginName != null" > </if>
login_name = #{record.loginName,jdbcType=VARCHAR}, <if test="userNumLimit != null">
</if> user_num_limit = #{userNumLimit,jdbcType=INTEGER},
<if test="record.userNumLimit != null" > </if>
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER}, <if test="billsNumLimit != null">
</if> bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
<if test="record.billsNumLimit != null" > </if>
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER}, <if test="enabled != null">
</if> enabled = #{enabled,jdbcType=BIT},
<if test="record.createTime != null" > </if>
create_time = #{record.createTime,jdbcType=TIMESTAMP}, <if test="createTime != null">
</if> create_time = #{createTime,jdbcType=TIMESTAMP},
</set> </if>
<if test="_parameter != null" > </set>
<include refid="Update_By_Example_Where_Clause" /> where id = #{id,jdbcType=BIGINT}
</if> </update>
</update> <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant">
<update id="updateByExample" parameterType="map" > update jsh_tenant
<!-- set tenant_id = #{tenantId,jdbcType=BIGINT},
WARNING - @mbggenerated login_name = #{loginName,jdbcType=VARCHAR},
This element is automatically generated by MyBatis Generator, do not modify. user_num_limit = #{userNumLimit,jdbcType=INTEGER},
--> bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
update jsh_tenant enabled = #{enabled,jdbcType=BIT},
set id = #{record.id,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=TIMESTAMP}
tenant_id = #{record.tenantId,jdbcType=BIGINT}, where id = #{id,jdbcType=BIGINT}
login_name = #{record.loginName,jdbcType=VARCHAR}, </update>
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>
</mapper> </mapper>