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

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

@@ -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())) {