|
|
@ -1,22 +1,15 @@ |
|
|
|
package com.epmet.modules.partyOrg.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActDao; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActEntity; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActService; |
|
|
|
import com.epmet.resi.partymember.dto.IcPartyActDTO; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.IcPartActTypeDTO; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 党建组织活动 |
|
|
@ -27,56 +20,22 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPartyActEntity> implements IcPartyActService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcPartyActDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcPartyActEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, IcPartyActDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcPartyActDTO> list(Map<String, Object> params) { |
|
|
|
List<IcPartyActEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IcPartyActDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<IcPartyActEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<IcPartyActEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 活动类型列表 |
|
|
|
* |
|
|
|
* @param customerId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public IcPartyActDTO get(String id) { |
|
|
|
IcPartyActEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, IcPartyActDTO.class); |
|
|
|
public List<IcPartActTypeDTO> actTypeList(String customerId) { |
|
|
|
List<IcPartActTypeDTO> list= baseDao.actTypeList(customerId); |
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
return baseDao.actTypeList(Constant.DEFAULT_CUSTOMER); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcPartyActDTO dto) { |
|
|
|
IcPartyActEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActEntity.class); |
|
|
|
insert(entity); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcPartyActDTO dto) { |
|
|
|
IcPartyActEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
} |