dev
parent
7b9c715d84
commit
ff4ae6fbf3
|
|
@ -22,8 +22,17 @@ public class CustomerService extends BaseService {
|
|||
public static final CustomerService me = new CustomerService();
|
||||
|
||||
public Page<Record> find(PageParam pp, String name, Integer del, Integer type) {
|
||||
String selectsql = "select * ";
|
||||
String fromsql = "from customer t where 1=1 \n";
|
||||
String selectsql = "select t.*, a.name receiver_name, a.phone receiver_phone, a.address receiver_address ";
|
||||
String fromsql = "from customer t\n" +
|
||||
" left join (\n" +
|
||||
" select t.* from customer_receiver t\n" +
|
||||
" left join (\n" +
|
||||
" select max(t.id) customer_receiver_id, t.customer_id from customer_receiver t\n" +
|
||||
" group by t.customer_id\n" +
|
||||
" ) a on a.customer_receiver_id = t.id and t.customer_id = a.customer_id\n" +
|
||||
" where a.customer_receiver_id is not null\n" +
|
||||
" ) a on a.customer_id = t.id \n" +
|
||||
" where 1=1 \n";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if(del == null){
|
||||
|
|
@ -38,7 +47,6 @@ public class CustomerService extends BaseService {
|
|||
paraList.add("%" + name + "%");
|
||||
}
|
||||
|
||||
|
||||
if(type != null){
|
||||
fromsql += " and t.type = ? \n";
|
||||
paraList.add(type);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class CustomerValidator extends CrudParamValidator {
|
|||
validateString("name", 1, 128, "name", "name 长度 1~128");
|
||||
validateString("address", 0, 256, "address", "address 长度 0~256");
|
||||
validateString("phone", 0, 11, "phone", "phone 长度 0~11");
|
||||
validateString("texpayer_name", 0, 255, "texpayer_name", "texpayer_name 长度 0~255");
|
||||
validateString("texpayer_name", 1, 255, "texpayer_name", "texpayer_name 长度 0~255");
|
||||
|
||||
validateString("texpayer_num", 0, 20, "texpayer_num", "texpayer_num 长度 0~20");
|
||||
validateString("bank_name", 0, 128, "bank_name", "bank_name 长度 0~128");
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class CustomerSyncService extends BaseSyncService {
|
|||
if (model.getName() != null) {
|
||||
Customer chk = model.findByColumns("name");
|
||||
|
||||
if (!model.getId().equals(chk.getId())) {
|
||||
if (chk != null && !model.getId().equals(chk.getId())) {
|
||||
return Result.failed("名称已存在");
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ public class CustomerSyncService extends BaseSyncService {
|
|||
if (model.getTexpayerName() != null) {
|
||||
Customer chk = model.findByColumns("texpayer_name");
|
||||
|
||||
if (!model.getId().equals(chk.getId())) {
|
||||
if (chk != null && !model.getId().equals(chk.getId())) {
|
||||
return Result.failed("名称已存在");
|
||||
}
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ public class CustomerSyncService extends BaseSyncService {
|
|||
if (model.getTexpayerNum() != null) {
|
||||
Customer chk = model.findByColumns("texpayer_num");
|
||||
|
||||
if (!model.getId().equals(chk.getId())) {
|
||||
if (chk != null && !model.getId().equals(chk.getId())) {
|
||||
return Result.failed("税号已存在");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue