apzl_leasing/src_tenwa/com/tenwa/customer/controller/account/CustomerAccountController.java
2018-06-03 22:26:41 +08:00

65 lines
1.8 KiB
Java

package com.tenwa.customer.controller.account;
import java.util.List;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
public class CustomerAccountController {
private String customer_id="";
private String id="";
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomer_id() {
return customer_id;
}
public void setCustomer_id(String customer_id) {
this.customer_id = customer_id;
}
/**
* 新增时查询当前客户有无主账户
* @param tx
* @return
* @throws Exception
*/
public String selectAccount(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME);
tx.join(bom);
//查询当前客户有无主账户
List<BizObject> CUSTOMER_ACCOUNTS = bom.createQuery("customerid=:customerid and is_main='yes'").setParameter("customerid",customer_id).getResultList(false);
if(CUSTOMER_ACCOUNTS != null && CUSTOMER_ACCOUNTS.size() > 0){
return "true";
}
return "false";
}
/**
* 修改时查询当前客户有无主账户
* @param tx
* @return
* @throws Exception
*/
public String selectEditAccount(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME);
tx.join(bom);
//修改时查询当前客户有无主账户
List<BizObject> CUSTOMER_ACCOUNTS = bom.createQuery("customerid=:customerid and id<>:id and is_main='yes' ").setParameter("customerid",customer_id).setParameter("id",id).getResultList(false);
if(CUSTOMER_ACCOUNTS != null && CUSTOMER_ACCOUNTS.size() > 0){
return "true";
}
return "false";
}
}