|
|
@ -7,13 +7,18 @@ import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO; |
|
|
|
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; |
|
|
|
import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao; |
|
|
|
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao; |
|
|
|
import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity; |
|
|
|
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; |
|
|
|
import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
@ -27,6 +32,8 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderDao, PowerAxisLeaderEntity> implements PowerAxisLeaderService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
PowerAxisStructLeaderDao powerAxisStructLeaderDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PowerAxisLeaderDTO> page(Map<String, Object> params) { |
|
|
@ -63,14 +70,30 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(PowerAxisLeaderDTO dto) { |
|
|
|
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); |
|
|
|
insert(entity); |
|
|
|
boolean i = insert(entity); |
|
|
|
if(i){ |
|
|
|
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity(); |
|
|
|
leaderEntity.setCustomerId(dto.getCustomerId()); |
|
|
|
leaderEntity.setLeaderId(entity.getId()); |
|
|
|
leaderEntity.setStructReferenceId(dto.getStructReferenceId()); |
|
|
|
powerAxisStructLeaderDao.insert(leaderEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(PowerAxisLeaderDTO dto) { |
|
|
|
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); |
|
|
|
updateById(entity); |
|
|
|
boolean i = updateById(entity); |
|
|
|
if(i){ |
|
|
|
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity(); |
|
|
|
leaderEntity.setLeaderId(entity.getId()); |
|
|
|
leaderEntity.setStructReferenceId(dto.getStructReferenceId()); |
|
|
|
leaderEntity.setCustomerId(dto.getCustomerId()); |
|
|
|
leaderEntity.setId(powerAxisStructLeaderDao.queryId(leaderEntity)); |
|
|
|
System.out.println(leaderEntity.getId()); |
|
|
|
powerAxisStructLeaderDao.updateById(leaderEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -80,4 +103,11 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PowerAxisSimpleListDTO> getSimpleList(List<String> ids) { |
|
|
|
List<PowerAxisSimpleListDTO> list = baseDao.getSimpleList(ids); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |