客户账户添加客户类型、客户名称筛选
parent
29845ad96c
commit
6bbe80db09
|
|
@ -41,7 +41,9 @@ public class SysuserController extends Controller {
|
|||
Integer del = getInt("del", Const.LOGIC_DEL_VALID); // 默认显示未删除的
|
||||
Integer type = getInt("type");
|
||||
Integer entity_id = getInt("entity_id");
|
||||
renderJson(Result.object(SysuserSyncService.me.find(pp, name, phone, del, type, entity_id)));
|
||||
Integer customer_type = getInt("customer_type");
|
||||
String customer_name = get("customer_name");
|
||||
renderJson(Result.object(SysuserSyncService.me.find(pp, name, phone, del, type, entity_id, customer_type, customer_name)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -295,7 +295,8 @@ public class SysuserSyncService extends BaseService {
|
|||
return sysuser;
|
||||
}
|
||||
|
||||
public Page<Record> find(PageParam pp, String name, String phone, Integer del, Integer type, Integer entity_id) {
|
||||
public Page<Record> find(PageParam pp, String name, String phone, Integer del, Integer type, Integer entity_id, Integer customer_type, String customer_name) {
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
StringBuilder sqlbuf = new StringBuilder();
|
||||
sqlbuf.append(" from (\n");
|
||||
sqlbuf.append("select \n");
|
||||
|
|
@ -313,7 +314,31 @@ public class SysuserSyncService extends BaseService {
|
|||
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
||||
sqlbuf.append(") a\n");
|
||||
sqlbuf.append("where 1 = 1");
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (type != null && type == UserTypeEnum.CUSTOMER.getTypeid()) {
|
||||
sqlbuf.setLength(0);
|
||||
sqlbuf.append(" from ( \n");
|
||||
sqlbuf.append(" select \n");
|
||||
sqlbuf.append(" u.id, u.phone, u.name, u.type, u.del, u.entity_id, c.name customer_name, c.texpayer_name, c.invoice_type, t.id customer_type, t.name customer_type_name \n");
|
||||
sqlbuf.append(" from sysuser u \n");
|
||||
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
||||
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
||||
sqlbuf.append(" union all\n");
|
||||
sqlbuf.append(" select o.sn id, o.customer_phone phone, '零散客户' name, 3 type, 0 del, null entity_id, o.customer_name, o.customer_texpayer_name texpayer_name, o.invoice_type, 99 customer_type, '零散' customer_type_name \n");
|
||||
sqlbuf.append(" from order_temp o \n");
|
||||
|
||||
sqlbuf.append(") a\n");
|
||||
sqlbuf.append("where 1 = 1");
|
||||
if (StrKit.notBlank(customer_name)) {
|
||||
sqlbuf.append(" and a.customer_name like ? \n");
|
||||
paraList.add("%" + customer_name.trim() + "%");
|
||||
}
|
||||
|
||||
if (customer_type != null && customer_type >= 0) {
|
||||
sqlbuf.append(" and a.customer_type = ? \n");
|
||||
paraList.add(customer_type);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(name)) {
|
||||
sqlbuf.append(" and a.name like ? \n");
|
||||
|
|
|
|||
|
|
@ -153,8 +153,9 @@ public class SysuserController extends Controller {
|
|||
Integer del = getInt("del", Const.LOGIC_DEL_VALID); // 默认显示未删除的
|
||||
Integer type = getInt("type");
|
||||
Integer entity_id = getInt("entity_id");
|
||||
Integer customer_type = getInt("customer_type");
|
||||
String customer_name = get("customer_name");
|
||||
renderJson(Result.object(SysuserSyncService.me.find(pp, name, phone, del, type, entity_id, customer_name)));
|
||||
renderJson(Result.object(SysuserSyncService.me.find(pp, name, phone, del, type, entity_id, customer_type, customer_name)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -817,7 +817,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
return sysuser;
|
||||
}
|
||||
|
||||
public Page<Record> find(PageParam pp, String name, String phone, Integer del, Integer type, Integer entity_id, String customer_name) {
|
||||
public Page<Record> find(PageParam pp, String name, String phone, Integer del, Integer type, Integer entity_id, Integer customer_type, String customer_name) {
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
StringBuilder sqlbuf = new StringBuilder();
|
||||
|
||||
|
|
@ -840,19 +840,27 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
|
||||
if (type != null && type == UserTypeEnum.CUSTOMER.getTypeid()) {
|
||||
sqlbuf.setLength(0);
|
||||
|
||||
sqlbuf.append(" from (\n");
|
||||
sqlbuf.append("select \n");
|
||||
sqlbuf.append(" u.id, u.phone, u.name, u.type, u.role, u.del, u.entity_id, c.name customer_name, c.texpayer_name, c.invoice_type \n");
|
||||
sqlbuf.append(" from ( \n");
|
||||
sqlbuf.append(" select \n");
|
||||
sqlbuf.append(" u.id, u.phone, u.name, u.type, u.del, u.entity_id, c.name customer_name, c.texpayer_name, c.invoice_type, t.id customer_type, t.name customer_type_name \n");
|
||||
sqlbuf.append(" from sysuser u \n");
|
||||
sqlbuf.append(" left join customer c on u.entity_id = c.id\n");
|
||||
sqlbuf.append(" left join customer_type t on c.customer_type_id = t.id\n");
|
||||
sqlbuf.append(" union all\n");
|
||||
sqlbuf.append(" select o.sn id, o.customer_phone phone, '零散客户' name, 3 type, 0 del, null entity_id, o.customer_name, o.customer_texpayer_name texpayer_name, o.invoice_type, 99 customer_type, '零散' customer_type_name \n");
|
||||
sqlbuf.append(" from order_temp o \n");
|
||||
|
||||
sqlbuf.append(") a\n");
|
||||
sqlbuf.append("where 1 = 1");
|
||||
|
||||
if (StrKit.notBlank(customer_name)) {
|
||||
sqlbuf.append(" and a.customer_name like ? \n");
|
||||
paraList.add("%" + customer_name.trim() + "%");
|
||||
}
|
||||
|
||||
if (customer_type != null && customer_type >= 0) {
|
||||
sqlbuf.append(" and a.customer_type = ? \n");
|
||||
paraList.add(customer_type);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(name)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue