给客户、供应商、会员增加创建人字段,并进行权限控制

This commit is contained in:
季圣华
2023-06-21 19:42:02 +08:00
parent 1b7379fde9
commit fae5e6970b
9 changed files with 138 additions and 24 deletions

View File

@@ -47,6 +47,8 @@ public class Supplier {
private String sort;
private Long creator;
private Long tenantId;
private String deleteFlag;
@@ -227,6 +229,14 @@ public class Supplier {
this.sort = sort == null ? null : sort.trim();
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getTenantId() {
return tenantId;
}

View File

@@ -1555,6 +1555,66 @@ public class SupplierExample {
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(Long value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(Long value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(Long value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(Long value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(Long value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(Long value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<Long> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<Long> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(Long value1, Long value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(Long value1, Long value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;

View File

@@ -14,6 +14,7 @@ public interface SupplierMapperEx {
@Param("type") String type,
@Param("phonenum") String phonenum,
@Param("telephone") String telephone,
@Param("creatorArray") String[] creatorArray,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -21,7 +22,8 @@ public interface SupplierMapperEx {
@Param("supplier") String supplier,
@Param("type") String type,
@Param("phonenum") String phonenum,
@Param("telephone") String telephone);
@Param("telephone") String telephone,
@Param("creatorArray") String[] creatorArray);
List<Supplier> findByAll(
@Param("supplier") String supplier,

View File

@@ -37,8 +37,8 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
String order = QueryUtils.order(map);
return supplierService.select(supplier, type, phonenum, telephone, QueryUtils.offset(map), QueryUtils.rows(map));
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.select(supplier, type, phonenum, telephone, roleType, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@@ -48,7 +48,8 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
return supplierService.countSupplier(supplier, type, phonenum, telephone);
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.countSupplier(supplier, type, phonenum, telephone, roleType);
}
@Override

View File

@@ -98,10 +98,11 @@ public class SupplierService {
return list;
}
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, int offset, int rows) throws Exception{
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, String roleType, int offset, int rows) throws Exception{
List<Supplier> resList = new ArrayList<Supplier>();
try{
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, offset, rows);
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray, offset, rows);
for(Supplier s : list) {
Integer supplierId = s.getId().intValue();
String beginTime = Tools.getYearBegin();
@@ -153,10 +154,11 @@ public class SupplierService {
return resList;
}
public Long countSupplier(String supplier, String type, String phonenum, String telephone) throws Exception{
public Long countSupplier(String supplier, String type, String phonenum, String telephone, String roleType) throws Exception{
Long result=null;
try{
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone);
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, creatorArray);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -169,6 +171,8 @@ public class SupplierService {
int result=0;
try{
supplier.setEnabled(true);
User userInfo=userService.getCurrentUser();
supplier.setCreator(userInfo==null?null:userInfo.getId());
result=supplierMapper.insertSelective(supplier);
//新增客户时给当前用户自动授权
if("客户".equals(supplier.getType())) {