|
|
@ -25,7 +25,9 @@ import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.dto.psychology.PsychologistDTO; |
|
|
|
import com.elink.esua.epdc.modules.psychology.dao.PsychologistDao; |
|
|
|
import com.elink.esua.epdc.modules.psychology.dao.PsychologistTitleRelationDao; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologistTitleRelationEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.redis.PsychologistRedis; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologistService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -33,6 +35,7 @@ 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; |
|
|
@ -49,6 +52,9 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
@Autowired |
|
|
|
private PsychologistRedis psychologistRedis; |
|
|
|
|
|
|
|
@Resource |
|
|
|
PsychologistTitleRelationDao psychologistTitleRelationDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PsychologistDTO> page(Map<String, Object> params) { |
|
|
|
IPage<PsychologistEntity> page = getPage(params); |
|
|
@ -82,8 +88,17 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(PsychologistDTO dto) { |
|
|
|
List<String> relation = dto.getTitles(); |
|
|
|
PsychologistEntity entity = ConvertUtils.sourceToTarget(dto, PsychologistEntity.class); |
|
|
|
insert(entity); |
|
|
|
int num = baseDao.insert(entity); |
|
|
|
if (num > 0 && relation != null && relation.size() > 0) { |
|
|
|
relation.forEach(item -> { |
|
|
|
PsychologistTitleRelationEntity psychologistTitleRelationEntity = new PsychologistTitleRelationEntity(); |
|
|
|
psychologistTitleRelationEntity.setPsychologistId(entity.getId()); |
|
|
|
psychologistTitleRelationEntity.setTitleId(item); |
|
|
|
psychologistTitleRelationDao.insert(psychologistTitleRelationEntity); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|