给供应商客户接口增加分页开关
This commit is contained in:
@@ -155,11 +155,12 @@ public class SupplierController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
||||||
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
||||||
|
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
|
||||||
String type = "UserCustomer";
|
String type = "UserCustomer";
|
||||||
Long userId = userService.getUserId(request);
|
Long userId = userService.getUserId(request);
|
||||||
//获取权限信息
|
//获取权限信息
|
||||||
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
|
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
|
||||||
List<Supplier> supplierList = supplierService.findBySelectCus(key, organId);
|
List<Supplier> supplierList = supplierService.findBySelectCus(key, organId, limit);
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if (null != supplierList) {
|
if (null != supplierList) {
|
||||||
boolean customerFlag = systemConfigService.getCustomerFlag();
|
boolean customerFlag = systemConfigService.getCustomerFlag();
|
||||||
@@ -193,7 +194,8 @@ public class SupplierController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
||||||
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
||||||
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId);
|
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
|
||||||
|
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId, limit);
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if (null != supplierList) {
|
if (null != supplierList) {
|
||||||
for (Supplier supplier : supplierList) {
|
for (Supplier supplier : supplierList) {
|
||||||
@@ -224,9 +226,10 @@ public class SupplierController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
||||||
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
||||||
|
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
//1、获取供应商信息
|
//1、获取供应商信息
|
||||||
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId);
|
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId, limit);
|
||||||
if (null != supplierList) {
|
if (null != supplierList) {
|
||||||
for (Supplier supplier : supplierList) {
|
for (Supplier supplier : supplierList) {
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
@@ -239,7 +242,7 @@ public class SupplierController extends BaseController {
|
|||||||
String type = "UserCustomer";
|
String type = "UserCustomer";
|
||||||
Long userId = userService.getUserId(request);
|
Long userId = userService.getUserId(request);
|
||||||
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
|
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
|
||||||
List<Supplier> customerList = supplierService.findBySelectCus(key, organId);
|
List<Supplier> customerList = supplierService.findBySelectCus(key, organId, limit);
|
||||||
if (null != customerList) {
|
if (null != customerList) {
|
||||||
boolean customerFlag = systemConfigService.getCustomerFlag();
|
boolean customerFlag = systemConfigService.getCustomerFlag();
|
||||||
for (Supplier supplier : customerList) {
|
for (Supplier supplier : customerList) {
|
||||||
@@ -272,7 +275,8 @@ public class SupplierController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
|
||||||
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
|
||||||
List<Supplier> supplierList = supplierService.findBySelectRetail(key, organId);
|
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
|
||||||
|
List<Supplier> supplierList = supplierService.findBySelectRetail(key, organId, limit);
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if (null != supplierList) {
|
if (null != supplierList) {
|
||||||
for (Supplier supplier : supplierList) {
|
for (Supplier supplier : supplierList) {
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ public interface SupplierMapperEx {
|
|||||||
|
|
||||||
List<Supplier> findByTypeAndKey(
|
List<Supplier> findByTypeAndKey(
|
||||||
@Param("type") String type,
|
@Param("type") String type,
|
||||||
@Param("key") String key);
|
@Param("key") String key,
|
||||||
|
@Param("limit") Integer limit);
|
||||||
|
|
||||||
Supplier getInfoById(
|
Supplier getInfoById(
|
||||||
@Param("id") Long id);
|
@Param("id") Long id);
|
||||||
|
|||||||
@@ -288,10 +288,10 @@ public class SupplierService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Supplier> findBySelectCus(String key, Long organId)throws Exception {
|
public List<Supplier> findBySelectCus(String key, Long organId, Integer limit)throws Exception {
|
||||||
List<Supplier> list=null;
|
List<Supplier> list=null;
|
||||||
try{
|
try{
|
||||||
list = supplierMapperEx.findByTypeAndKey("客户", key);
|
list = supplierMapperEx.findByTypeAndKey("客户", key, limit);
|
||||||
if(organId!=null) {
|
if(organId!=null) {
|
||||||
list = addOrganToList(list, organId);
|
list = addOrganToList(list, organId);
|
||||||
}
|
}
|
||||||
@@ -301,10 +301,10 @@ public class SupplierService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Supplier> findBySelectSup(String key, Long organId)throws Exception {
|
public List<Supplier> findBySelectSup(String key, Long organId, Integer limit)throws Exception {
|
||||||
List<Supplier> list=null;
|
List<Supplier> list=null;
|
||||||
try{
|
try{
|
||||||
list = supplierMapperEx.findByTypeAndKey("供应商", key);
|
list = supplierMapperEx.findByTypeAndKey("供应商", key, limit);
|
||||||
if(organId!=null) {
|
if(organId!=null) {
|
||||||
list = addOrganToList(list, organId);
|
list = addOrganToList(list, organId);
|
||||||
}
|
}
|
||||||
@@ -314,10 +314,10 @@ public class SupplierService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Supplier> findBySelectRetail(String key, Long organId)throws Exception {
|
public List<Supplier> findBySelectRetail(String key, Long organId, Integer limit)throws Exception {
|
||||||
List<Supplier> list=null;
|
List<Supplier> list=null;
|
||||||
try{
|
try{
|
||||||
list = supplierMapperEx.findByTypeAndKey("会员", key);
|
list = supplierMapperEx.findByTypeAndKey("会员", key, limit);
|
||||||
if(organId!=null) {
|
if(organId!=null) {
|
||||||
list = addOrganToList(list, organId);
|
list = addOrganToList(list, organId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,9 @@
|
|||||||
</if>
|
</if>
|
||||||
and ifnull(delete_flag,'0') !='1'
|
and ifnull(delete_flag,'0') !='1'
|
||||||
order by sort asc, id desc
|
order by sort asc, id desc
|
||||||
limit 0,1000
|
<if test="limit != null">
|
||||||
|
limit 0, 500
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getInfoById" resultType="com.jsh.erp.datasource.entities.Supplier">
|
<select id="getInfoById" resultType="com.jsh.erp.datasource.entities.Supplier">
|
||||||
|
|||||||
Reference in New Issue
Block a user