Commit 1db9b945 authored by 季圣华's avatar 季圣华
Browse files

给租户增加启用禁用功能

parent a176f417
...@@ -823,6 +823,7 @@ CREATE TABLE `jsh_tenant` ( ...@@ -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` ( ...@@ -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
......
...@@ -1118,4 +1118,11 @@ alter table jsh_account_head add discount_money decimal(24,6) DEFAULT NULL COMME ...@@ -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;
\ No newline at end of file
-- --------------------------------------------------------
-- 时间 2021年7月6日
-- by jishenghua
-- 给租户表增加字段enabled
-- --------------------------------------------------------
alter table jsh_tenant add enabled bit(1) DEFAULT 1 COMMENT '启用 0-禁用 1-启用' after bills_num_limit;
\ No newline at end of file
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 { ...@@ -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,记录登录日志
......
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;
}
} }
\ No newline at end of file
package com.jsh.erp.datasource.entities; package com.jsh.erp.datasource.entities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public class TenantExample { public class TenantExample {
/** protected String orderByClause;
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_tenant protected boolean distinct;
*
* @mbggenerated protected List<Criteria> oredCriteria;
*/
protected String orderByClause; public TenantExample() {
oredCriteria = new ArrayList<>();
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_tenant public void setOrderByClause(String orderByClause) {
* this.orderByClause = orderByClause;
* @mbggenerated }
*/
protected boolean distinct; public String getOrderByClause() {
return orderByClause;
/** }
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_tenant public void setDistinct(boolean distinct) {
* this.distinct = distinct;
* @mbggenerated }
*/
protected List<Criteria> oredCriteria; public boolean isDistinct() {
return distinct;
/** }
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_tenant public List<Criteria> getOredCriteria() {
* return oredCriteria;
* @mbggenerated }
*/
public TenantExample() { public void or(Criteria criteria) {
oredCriteria = new ArrayList<Criteria>(); oredCriteria.add(criteria);
} }
/** public Criteria or() {
* This method was generated by MyBatis Generator. Criteria criteria = createCriteriaInternal();
* This method corresponds to the database table jsh_tenant oredCriteria.add(criteria);
* return criteria;
* @mbggenerated }
*/
public void setOrderByClause(String orderByClause) { public Criteria createCriteria() {
this.orderByClause = orderByClause; Criteria criteria = createCriteriaInternal();
} if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
/** }
* This method was generated by MyBatis Generator. return criteria;
* This method corresponds to the database table jsh_tenant }
*
* @mbggenerated protected Criteria createCriteriaInternal() {
*/ Criteria criteria = new Criteria();
public String getOrderByClause() { return criteria;
return orderByClause; }
}
public void clear() {
/** oredCriteria.clear();
* This method was generated by MyBatis Generator. orderByClause = null;
* This method corresponds to the database table jsh_tenant distinct = false;
* }
* @mbggenerated
*/ protected abstract static class GeneratedCriteria {
public void setDistinct(boolean distinct) { protected List<Criterion> criteria;
this.distinct = distinct;
} protected GeneratedCriteria() {
super();
/** criteria = new ArrayList<>();
* This method was generated by MyBatis Generator. }
* This method corresponds to the database table jsh_tenant
* public boolean isValid() {
* @mbggenerated return criteria.size() > 0;
*/ }
public boolean isDistinct() {
return distinct; public List<Criterion> getAllCriteria() {
} return criteria;
}
/**
* This method was generated by MyBatis Generator. public List<Criterion> getCriteria() {
* This method corresponds to the database table jsh_tenant return criteria;
* }
* @mbggenerated
*/ protected void addCriterion(String condition) {
public List<Criteria> getOredCriteria() { if (condition == null) {
return oredCriteria; throw new RuntimeException("Value for condition cannot be null");
} }
criteria.add(new Criterion(condition));
/** }
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_tenant protected void addCriterion(String condition, Object value, String property) {
* if (value == null) {
* @mbggenerated throw new RuntimeException("Value for " + property + " cannot be null");
*/ }
public void or(Criteria criteria) { criteria.add(new Criterion(condition, value));
oredCriteria.add(criteria); }
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
/** if (value1 == null || value2 == null) {
* This method was generated by MyBatis Generator. throw new RuntimeException("Between values for " + property + " cannot be null");
* This method corresponds to the database table jsh_tenant }
* criteria.add(new Criterion(condition, value1, value2));
* @mbggenerated }
*/
public Criteria or() { public Criteria andIdIsNull() {
Criteria criteria = createCriteriaInternal(); addCriterion("id is null");
oredCriteria.add(criteria); return (Criteria) this;
return criteria; }
}
public Criteria andIdIsNotNull() {
/** addCriterion("id is not null");
* This method was generated by MyBatis Generator. return (Criteria) this;
* This method corresponds to the database table jsh_tenant }
*
* @mbggenerated public Criteria andIdEqualTo(Long value) {
*/ addCriterion("id =", value, "id");
public Criteria createCriteria() { return (Criteria) this;
Criteria criteria = createCriteriaInternal(); }
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria); public Criteria andIdNotEqualTo(Long value) {
} addCriterion("id <>", value, "id");
return criteria; return (Criteria) this;
} }
/** public Criteria andIdGreaterThan(Long value) {
* This method was generated by MyBatis Generator. addCriterion("id >", value, "id");
* This method corresponds to the database table jsh_tenant return (Criteria) this;
* }
* @mbggenerated
*/ public Criteria andIdGreaterThanOrEqualTo(Long value) {
protected Criteria createCriteriaInternal() { addCriterion("id >=", value, "id");
Criteria criteria = new Criteria(); return (Criteria) this;
return criteria; }
}
public Criteria andIdLessThan(Long value) {
/** addCriterion("id <", value, "id");
* This method was generated by MyBatis Generator. return (Criteria) this;
* This method corresponds to the database table jsh_tenant }
*
* @mbggenerated public Criteria andIdLessThanOrEqualTo(Long value) {
*/ addCriterion("id <=", value, "id");
public void clear() { return (Criteria) this;
oredCriteria.clear(); }
orderByClause = null;
distinct = false; public Criteria andIdIn(List<Long> values) {
} addCriterion("id in", values, "id");
return (Criteria) this;
/** }
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_tenant public Criteria andIdNotIn(List<Long> values) {
* addCriterion("id not in", values, "id");
* @mbggenerated return (Criteria) this;
*/ }
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria; public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
protected GeneratedCriteria() { return (Criteria) this;
super(); }
criteria = new ArrayList<Criterion>();
} public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
public boolean isValid() { return (Criteria) this;
return criteria.size() > 0; }
}
public Criteria andTenantIdIsNull() {
public List<Criterion> getAllCriteria() { addCriterion("tenant_id is null");
return criteria; return (Criteria) this;
} }
public List<Criterion> getCriteria() { public Criteria andTenantIdIsNotNull() {
return criteria; addCriterion("tenant_id is not null");
} return (Criteria) this;
}
protected void addCriterion(String condition) {
if (condition == null) { public Criteria andTenantIdEqualTo(Long value) {
throw new RuntimeException("Value for condition cannot be null"); addCriterion("tenant_id =", value, "tenantId");
} return (Criteria) this;
criteria.add(new Criterion(condition)); }
}
public Criteria andTenantIdNotEqualTo(Long value) {
protected void addCriterion(String condition, Object value, String property) { addCriterion("tenant_id <>", value, "tenantId");
if (value == null) { return (Criteria) this;
throw new RuntimeException("Value for " + property + " cannot be null"); }
}
criteria.add(new Criterion(condition, value)); public Criteria andTenantIdGreaterThan(Long value) {
} addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
protected void addCriterion(String condition, Object value1, Object value2, String property) { }
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null"); public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
} addCriterion("tenant_id >=", value, "tenantId");
criteria.add(new Criterion(condition, value1, value2)); return (Criteria) this;
} }
public Criteria andIdIsNull() { public Criteria andTenantIdLessThan(Long value) {
addCriterion("id is null"); addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdIsNotNull() { public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("id is not null"); addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdEqualTo(Long value) { public Criteria andTenantIdIn(List<Long> values) {
addCriterion("id =", value, "id"); addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotEqualTo(Long value) { public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("id <>", value, "id"); addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThan(Long value) { public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("id >", value, "id"); addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThanOrEqualTo(Long value) { public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("id >=", value, "id"); addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThan(Long value) { public Criteria andLoginNameIsNull() {
addCriterion("id <", value, "id"); addCriterion("login_name is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThanOrEqualTo(Long value) { public Criteria andLoginNameIsNotNull() {
addCriterion("id <=", value, "id"); addCriterion("login_name is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdIn(List<Long> values) { public Criteria andLoginNameEqualTo(String value) {
addCriterion("id in", values, "id"); addCriterion("login_name =", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotIn(List<Long> values) { public Criteria andLoginNameNotEqualTo(String value) {
addCriterion("id not in", values, "id"); addCriterion("login_name <>", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdBetween(Long value1, Long value2) { public Criteria andLoginNameGreaterThan(String value) {
addCriterion("id between", value1, value2, "id"); addCriterion("login_name >", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotBetween(Long value1, Long value2) { public Criteria andLoginNameGreaterThanOrEqualTo(String value) {
addCriterion("id not between", value1, value2, "id"); addCriterion("login_name >=", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdIsNull() { public Criteria andLoginNameLessThan(String value) {
addCriterion("tenant_id is null"); addCriterion("login_name <", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdIsNotNull() { public Criteria andLoginNameLessThanOrEqualTo(String value) {
addCriterion("tenant_id is not null"); addCriterion("login_name <=", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdEqualTo(Long value) { public Criteria andLoginNameLike(String value) {
addCriterion("tenant_id =", value, "tenantId"); addCriterion("login_name like", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdNotEqualTo(Long value) { public Criteria andLoginNameNotLike(String value) {
addCriterion("tenant_id <>", value, "tenantId"); addCriterion("login_name not like", value, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdGreaterThan(Long value) { public Criteria andLoginNameIn(List<String> values) {
addCriterion("tenant_id >", value, "tenantId"); addCriterion("login_name in", values, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) { public Criteria andLoginNameNotIn(List<String> values) {
addCriterion("tenant_id >=", value, "tenantId"); addCriterion("login_name not in", values, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdLessThan(Long value) { public Criteria andLoginNameBetween(String value1, String value2) {
addCriterion("tenant_id <", value, "tenantId"); addCriterion("login_name between", value1, value2, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdLessThanOrEqualTo(Long value) { public Criteria andLoginNameNotBetween(String value1, String value2) {
addCriterion("tenant_id <=", value, "tenantId"); addCriterion("login_name not between", value1, value2, "loginName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdIn(List<Long> values) { public Criteria andUserNumLimitIsNull() {
addCriterion("tenant_id in", values, "tenantId"); addCriterion("user_num_limit is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdNotIn(List<Long> values) { public Criteria andUserNumLimitIsNotNull() {
addCriterion("tenant_id not in", values, "tenantId"); addCriterion("user_num_limit is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdBetween(Long value1, Long value2) { public Criteria andUserNumLimitEqualTo(Integer value) {
addCriterion("tenant_id between", value1, value2, "tenantId"); addCriterion("user_num_limit =", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTenantIdNotBetween(Long value1, Long value2) { public Criteria andUserNumLimitNotEqualTo(Integer value) {
addCriterion("tenant_id not between", value1, value2, "tenantId"); addCriterion("user_num_limit <>", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameIsNull() { public Criteria andUserNumLimitGreaterThan(Integer value) {
addCriterion("login_name is null"); addCriterion("user_num_limit >", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameIsNotNull() { public Criteria andUserNumLimitGreaterThanOrEqualTo(Integer value) {
addCriterion("login_name is not null"); addCriterion("user_num_limit >=", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameEqualTo(String value) { public Criteria andUserNumLimitLessThan(Integer value) {
addCriterion("login_name =", value, "loginName"); addCriterion("user_num_limit <", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameNotEqualTo(String value) { public Criteria andUserNumLimitLessThanOrEqualTo(Integer value) {
addCriterion("login_name <>", value, "loginName"); addCriterion("user_num_limit <=", value, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameGreaterThan(String value) { public Criteria andUserNumLimitIn(List<Integer> values) {
addCriterion("login_name >", value, "loginName"); addCriterion("user_num_limit in", values, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameGreaterThanOrEqualTo(String value) { public Criteria andUserNumLimitNotIn(List<Integer> values) {
addCriterion("login_name >=", value, "loginName"); addCriterion("user_num_limit not in", values, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameLessThan(String value) { public Criteria andUserNumLimitBetween(Integer value1, Integer value2) {
addCriterion("login_name <", value, "loginName"); addCriterion("user_num_limit between", value1, value2, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameLessThanOrEqualTo(String value) { public Criteria andUserNumLimitNotBetween(Integer value1, Integer value2) {
addCriterion("login_name <=", value, "loginName"); addCriterion("user_num_limit not between", value1, value2, "userNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameLike(String value) { public Criteria andBillsNumLimitIsNull() {
addCriterion("login_name like", value, "loginName"); addCriterion("bills_num_limit is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameNotLike(String value) { public Criteria andBillsNumLimitIsNotNull() {
addCriterion("login_name not like", value, "loginName"); addCriterion("bills_num_limit is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameIn(List<String> values) { public Criteria andBillsNumLimitEqualTo(Integer value) {
addCriterion("login_name in", values, "loginName"); addCriterion("bills_num_limit =", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameNotIn(List<String> values) { public Criteria andBillsNumLimitNotEqualTo(Integer value) {
addCriterion("login_name not in", values, "loginName"); addCriterion("bills_num_limit <>", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameBetween(String value1, String value2) { public Criteria andBillsNumLimitGreaterThan(Integer value) {
addCriterion("login_name between", value1, value2, "loginName"); addCriterion("bills_num_limit >", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLoginNameNotBetween(String value1, String value2) { public Criteria andBillsNumLimitGreaterThanOrEqualTo(Integer value) {
addCriterion("login_name not between", value1, value2, "loginName"); addCriterion("bills_num_limit >=", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitIsNull() { public Criteria andBillsNumLimitLessThan(Integer value) {
addCriterion("user_num_limit is null"); addCriterion("bills_num_limit <", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitIsNotNull() { public Criteria andBillsNumLimitLessThanOrEqualTo(Integer value) {
addCriterion("user_num_limit is not null"); addCriterion("bills_num_limit <=", value, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitEqualTo(Integer value) { public Criteria andBillsNumLimitIn(List<Integer> values) {
addCriterion("user_num_limit =", value, "userNumLimit"); addCriterion("bills_num_limit in", values, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitNotEqualTo(Integer value) { public Criteria andBillsNumLimitNotIn(List<Integer> values) {
addCriterion("user_num_limit <>", value, "userNumLimit"); addCriterion("bills_num_limit not in", values, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitGreaterThan(Integer value) { public Criteria andBillsNumLimitBetween(Integer value1, Integer value2) {
addCriterion("user_num_limit >", value, "userNumLimit"); addCriterion("bills_num_limit between", value1, value2, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitGreaterThanOrEqualTo(Integer value) { public Criteria andBillsNumLimitNotBetween(Integer value1, Integer value2) {
addCriterion("user_num_limit >=", value, "userNumLimit"); addCriterion("bills_num_limit not between", value1, value2, "billsNumLimit");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitLessThan(Integer value) { public Criteria andEnabledIsNull() {
addCriterion("user_num_limit <", value, "userNumLimit"); addCriterion("enabled is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitLessThanOrEqualTo(Integer value) { public Criteria andEnabledIsNotNull() {
addCriterion("user_num_limit <=", value, "userNumLimit"); addCriterion("enabled is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitIn(List<Integer> values) { public Criteria andEnabledEqualTo(Boolean value) {
addCriterion("user_num_limit in", values, "userNumLimit"); addCriterion("enabled =", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitNotIn(List<Integer> values) { public Criteria andEnabledNotEqualTo(Boolean value) {
addCriterion("user_num_limit not in", values, "userNumLimit"); addCriterion("enabled <>", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitBetween(Integer value1, Integer value2) { public Criteria andEnabledGreaterThan(Boolean value) {
addCriterion("user_num_limit between", value1, value2, "userNumLimit"); addCriterion("enabled >", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserNumLimitNotBetween(Integer value1, Integer value2) { public Criteria andEnabledGreaterThanOrEqualTo(Boolean value) {
addCriterion("user_num_limit not between", value1, value2, "userNumLimit"); addCriterion("enabled >=", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitIsNull() { public Criteria andEnabledLessThan(Boolean value) {
addCriterion("bills_num_limit is null"); addCriterion("enabled <", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitIsNotNull() { public Criteria andEnabledLessThanOrEqualTo(Boolean value) {
addCriterion("bills_num_limit is not null"); addCriterion("enabled <=", value, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitEqualTo(Integer value) { public Criteria andEnabledIn(List<Boolean> values) {
addCriterion("bills_num_limit =", value, "billsNumLimit"); addCriterion("enabled in", values, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitNotEqualTo(Integer value) { public Criteria andEnabledNotIn(List<Boolean> values) {
addCriterion("bills_num_limit <>", value, "billsNumLimit"); addCriterion("enabled not in", values, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitGreaterThan(Integer value) { public Criteria andEnabledBetween(Boolean value1, Boolean value2) {
addCriterion("bills_num_limit >", value, "billsNumLimit"); addCriterion("enabled between", value1, value2, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitGreaterThanOrEqualTo(Integer value) { public Criteria andEnabledNotBetween(Boolean value1, Boolean value2) {
addCriterion("bills_num_limit >=", value, "billsNumLimit"); addCriterion("enabled not between", value1, value2, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitLessThan(Integer value) { public Criteria andCreateTimeIsNull() {
addCriterion("bills_num_limit <", value, "billsNumLimit"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitLessThanOrEqualTo(Integer value) { public Criteria andCreateTimeIsNotNull() {
addCriterion("bills_num_limit <=", value, "billsNumLimit"); addCriterion("create_time is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitIn(List<Integer> values) { public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("bills_num_limit in", values, "billsNumLimit"); addCriterion("create_time =", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitNotIn(List<Integer> values) { public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("bills_num_limit not in", values, "billsNumLimit"); addCriterion("create_time <>", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitBetween(Integer value1, Integer value2) { public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("bills_num_limit between", value1, value2, "billsNumLimit"); addCriterion("create_time >", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBillsNumLimitNotBetween(Integer value1, Integer value2) { public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("bills_num_limit not between", value1, value2, "billsNumLimit"); addCriterion("create_time >=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeIsNull() { public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time is null"); addCriterion("create_time <", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeIsNotNull() { public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time is not null"); addCriterion("create_time <=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeEqualTo(Date value) { public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time =", value, "createTime"); addCriterion("create_time in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeNotEqualTo(Date value) { public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time <>", value, "createTime"); addCriterion("create_time not in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeGreaterThan(Date value) { public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time >", value, "createTime"); addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time >=", value, "createTime"); addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this; return (Criteria) this;
} }
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime"); public static class Criteria extends GeneratedCriteria {
return (Criteria) this; protected Criteria() {
} super();
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) { }
addCriterion("create_time <=", value, "createTime");
return (Criteria) this; public static class Criterion {
} private String condition;
public Criteria andCreateTimeIn(List<Date> values) { private Object value;
addCriterion("create_time in", values, "createTime");
return (Criteria) this; private Object secondValue;
}
private boolean noValue;
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime"); private boolean singleValue;
return (Criteria) this;
} private boolean betweenValue;
public Criteria andCreateTimeBetween(Date value1, Date value2) { private boolean listValue;
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this; private String typeHandler;
}
public String getCondition() {
public Criteria andCreateTimeNotBetween(Date value1, Date value2) { return condition;
addCriterion("create_time not between", value1, value2, "createTime"); }
return (Criteria) this;
} public Object getValue() {
} return value;
}
/**
* This class was generated by MyBatis Generator. public Object getSecondValue() {
* This class corresponds to the database table jsh_tenant return secondValue;
* }
* @mbggenerated do_not_delete_during_merge
*/ public boolean isNoValue() {
public static class Criteria extends GeneratedCriteria { return noValue;
}
protected Criteria() {
super(); public boolean isSingleValue() {
} return singleValue;
} }
/** public boolean isBetweenValue() {
* This class was generated by MyBatis Generator. return betweenValue;
* This class corresponds to the database table jsh_tenant }
*
* @mbggenerated public boolean isListValue() {
*/ return listValue;
public static class Criterion { }
private String condition;
public String getTypeHandler() {
private Object value; return typeHandler;
}
private Object secondValue;
protected Criterion(String condition) {
private boolean noValue; super();
this.condition = condition;
private boolean singleValue; this.typeHandler = null;
this.noValue = true;
private boolean betweenValue; }
private boolean listValue; protected Criterion(String condition, Object value, String typeHandler) {
super();
private String typeHandler; this.condition = condition;
this.value = value;
public String getCondition() { this.typeHandler = typeHandler;
return condition; if (value instanceof List<?>) {
} this.listValue = true;
} else {
public Object getValue() { this.singleValue = true;
return value; }
} }
public Object getSecondValue() { protected Criterion(String condition, Object value) {
return secondValue; this(condition, value, null);
} }
public boolean isNoValue() { protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
return noValue; super();
} this.condition = condition;
this.value = value;
public boolean isSingleValue() { this.secondValue = secondValue;
return singleValue; this.typeHandler = typeHandler;
} this.betweenValue = true;
}
public boolean isBetweenValue() {
return betweenValue; protected Criterion(String condition, Object value, Object secondValue) {
} this(condition, value, secondValue, null);
}
public boolean isListValue() { }
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} }
\ No newline at end of file
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);
} }
\ No newline at end of file
...@@ -264,17 +264,22 @@ public class DepotHeadService { ...@@ -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());
......
...@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.mappers.TenantMapper; ...@@ -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; ...@@ -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 { ...@@ -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 { ...@@ -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;
}
} }
...@@ -295,6 +295,11 @@ public class UserService { ...@@ -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);
......
...@@ -16,7 +16,7 @@ public interface ExceptionCodeConstants { ...@@ -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 { ...@@ -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;
} }
} }
<?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>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment