72 lines
2.4 KiB
Java
72 lines
2.4 KiB
Java
|
package com.zcloud.service.xgf.impl;
|
||
|
|
||
|
import com.zcloud.entity.Page;
|
||
|
import com.zcloud.entity.PageData;
|
||
|
import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper;
|
||
|
import com.zcloud.mapper.datasource.xgf.XgfUserMapper;
|
||
|
import com.zcloud.service.xgf.XgfUserService;
|
||
|
import com.zcloud.util.Warden;
|
||
|
import org.apache.commons.lang3.StringUtils;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.util.List;
|
||
|
|
||
|
@Service
|
||
|
public class XgfUserServiceImpl implements XgfUserService {
|
||
|
|
||
|
@Resource
|
||
|
private XgfUserMapper xgfUserMapper;
|
||
|
|
||
|
@Resource
|
||
|
private XgfUserDetailsMapper xgfUserDetailsMapper;
|
||
|
|
||
|
@Override
|
||
|
public void save(PageData pd) throws Exception {
|
||
|
xgfUserMapper.save(pd);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void saveDetail(PageData pd) throws Exception {
|
||
|
xgfUserDetailsMapper.save(pd);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public List<PageData> list(Page page) throws Exception {
|
||
|
return xgfUserDetailsMapper.listPage(page);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
@Transactional
|
||
|
public void init(PageData request) {
|
||
|
List<PageData> list = Warden.getList(request.getString("infoList"));
|
||
|
for (PageData x : list) {
|
||
|
try {
|
||
|
PageData condition = new PageData();
|
||
|
if (StringUtils.isNotBlank(x.getString("USER_ID"))) {
|
||
|
condition.put("USER_ID", x.getString("USER_ID"));
|
||
|
PageData entity = xgfUserMapper.findById(condition);
|
||
|
if (entity == null || entity.size() <= 0) {
|
||
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
||
|
x.put("XGF_USER_DETAILS_ID", x.get("XGF_USER_ID"));
|
||
|
x.put("ISDELETE","0");
|
||
|
xgfUserMapper.save(x);
|
||
|
xgfUserDetailsMapper.save(x);
|
||
|
} else {
|
||
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
||
|
x.put("XGF_USER_DETAILS_ID", x.get("XGF_USER_ID"));
|
||
|
x.put("ISDELETE","0");
|
||
|
xgfUserMapper.edit(x);
|
||
|
xgfUserDetailsMapper.edit(x);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
throw new RuntimeException("保存数据失败");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|