mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
调整 mapper 命名,避免可能的冲突
This commit is contained in:
parent
891ed3d055
commit
9148170926
@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AddressMapper extends BaseMapperX<MemberAddressDO> {
|
public interface MemberAddressMapper extends BaseMapperX<MemberAddressDO> {
|
||||||
|
|
||||||
default MemberAddressDO selectByIdAndUserId(Long id, Long userId) {
|
default MemberAddressDO selectByIdAndUserId(Long id, Long userId) {
|
||||||
return selectOne(MemberAddressDO::getId, id, MemberAddressDO::getUserId, userId);
|
return selectOne(MemberAddressDO::getId, id, MemberAddressDO::getUserId, userId);
|
@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreate
|
|||||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.address.AddressMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.address.MemberAddressMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -26,21 +26,21 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ADDRESS_NO
|
|||||||
public class AddressServiceImpl implements AddressService {
|
public class AddressServiceImpl implements AddressService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AddressMapper addressMapper;
|
private MemberAddressMapper memberAddressMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createAddress(Long userId, AppAddressCreateReqVO createReqVO) {
|
public Long createAddress(Long userId, AppAddressCreateReqVO createReqVO) {
|
||||||
// 如果添加的是默认收件地址,则将原默认地址修改为非默认
|
// 如果添加的是默认收件地址,则将原默认地址修改为非默认
|
||||||
if (Boolean.TRUE.equals(createReqVO.getDefaultStatus())) {
|
if (Boolean.TRUE.equals(createReqVO.getDefaultStatus())) {
|
||||||
List<MemberAddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
List<MemberAddressDO> addresses = memberAddressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||||
addresses.forEach(address -> addressMapper.updateById(new MemberAddressDO().setId(address.getId()).setDefaultStatus(false)));
|
addresses.forEach(address -> memberAddressMapper.updateById(new MemberAddressDO().setId(address.getId()).setDefaultStatus(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
MemberAddressDO address = AddressConvert.INSTANCE.convert(createReqVO);
|
MemberAddressDO address = AddressConvert.INSTANCE.convert(createReqVO);
|
||||||
address.setUserId(userId);
|
address.setUserId(userId);
|
||||||
addressMapper.insert(address);
|
memberAddressMapper.insert(address);
|
||||||
// 返回
|
// 返回
|
||||||
return address.getId();
|
return address.getId();
|
||||||
}
|
}
|
||||||
@ -53,14 +53,14 @@ public class AddressServiceImpl implements AddressService {
|
|||||||
|
|
||||||
// 如果修改的是默认收件地址,则将原默认地址修改为非默认
|
// 如果修改的是默认收件地址,则将原默认地址修改为非默认
|
||||||
if (Boolean.TRUE.equals(updateReqVO.getDefaultStatus())) {
|
if (Boolean.TRUE.equals(updateReqVO.getDefaultStatus())) {
|
||||||
List<MemberAddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
List<MemberAddressDO> addresses = memberAddressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||||
addresses.stream().filter(u -> !u.getId().equals(updateReqVO.getId())) // 排除自己
|
addresses.stream().filter(u -> !u.getId().equals(updateReqVO.getId())) // 排除自己
|
||||||
.forEach(address -> addressMapper.updateById(new MemberAddressDO().setId(address.getId()).setDefaultStatus(false)));
|
.forEach(address -> memberAddressMapper.updateById(new MemberAddressDO().setId(address.getId()).setDefaultStatus(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
MemberAddressDO updateObj = AddressConvert.INSTANCE.convert(updateReqVO);
|
MemberAddressDO updateObj = AddressConvert.INSTANCE.convert(updateReqVO);
|
||||||
addressMapper.updateById(updateObj);
|
memberAddressMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +68,7 @@ public class AddressServiceImpl implements AddressService {
|
|||||||
// 校验存在,校验是否能够操作
|
// 校验存在,校验是否能够操作
|
||||||
validAddressExists(userId, id);
|
validAddressExists(userId, id);
|
||||||
// 删除
|
// 删除
|
||||||
addressMapper.deleteById(id);
|
memberAddressMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validAddressExists(Long userId, Long id) {
|
private void validAddressExists(Long userId, Long id) {
|
||||||
@ -80,17 +80,17 @@ public class AddressServiceImpl implements AddressService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberAddressDO getAddress(Long userId, Long id) {
|
public MemberAddressDO getAddress(Long userId, Long id) {
|
||||||
return addressMapper.selectByIdAndUserId(id, userId);
|
return memberAddressMapper.selectByIdAndUserId(id, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberAddressDO> getAddressList(Long userId) {
|
public List<MemberAddressDO> getAddressList(Long userId) {
|
||||||
return addressMapper.selectListByUserIdAndDefaulted(userId, null);
|
return memberAddressMapper.selectListByUserIdAndDefaulted(userId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberAddressDO getDefaultUserAddress(Long userId) {
|
public MemberAddressDO getDefaultUserAddress(Long userId) {
|
||||||
List<MemberAddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
List<MemberAddressDO> addresses = memberAddressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||||
return CollUtil.getFirst(addresses);
|
return CollUtil.getFirst(addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.GROUP_NOT_
|
|||||||
public class MemberGroupServiceImpl implements MemberGroupService {
|
public class MemberGroupServiceImpl implements MemberGroupService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberGroupMapper groupMapper;
|
private MemberGroupMapper memberGroupMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserService memberUserService;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
public Long createGroup(MemberGroupCreateReqVO createReqVO) {
|
public Long createGroup(MemberGroupCreateReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
MemberGroupDO group = MemberGroupConvert.INSTANCE.convert(createReqVO);
|
MemberGroupDO group = MemberGroupConvert.INSTANCE.convert(createReqVO);
|
||||||
groupMapper.insert(group);
|
memberGroupMapper.insert(group);
|
||||||
// 返回
|
// 返回
|
||||||
return group.getId();
|
return group.getId();
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
validateGroupExists(updateReqVO.getId());
|
validateGroupExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
MemberGroupDO updateObj = MemberGroupConvert.INSTANCE.convert(updateReqVO);
|
MemberGroupDO updateObj = MemberGroupConvert.INSTANCE.convert(updateReqVO);
|
||||||
groupMapper.updateById(updateObj);
|
memberGroupMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,11 +60,11 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
// 校验分组下是否有用户
|
// 校验分组下是否有用户
|
||||||
validateGroupHasUser(id);
|
validateGroupHasUser(id);
|
||||||
// 删除
|
// 删除
|
||||||
groupMapper.deleteById(id);
|
memberGroupMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateGroupExists(Long id) {
|
void validateGroupExists(Long id) {
|
||||||
if (groupMapper.selectById(id) == null) {
|
if (memberGroupMapper.selectById(id) == null) {
|
||||||
throw exception(GROUP_NOT_EXISTS);
|
throw exception(GROUP_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberGroupDO getGroup(Long id) {
|
public MemberGroupDO getGroup(Long id) {
|
||||||
return groupMapper.selectById(id);
|
return memberGroupMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,17 +86,17 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
|||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return ListUtil.empty();
|
return ListUtil.empty();
|
||||||
}
|
}
|
||||||
return groupMapper.selectBatchIds(ids);
|
return memberGroupMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MemberGroupDO> getGroupPage(MemberGroupPageReqVO pageReqVO) {
|
public PageResult<MemberGroupDO> getGroupPage(MemberGroupPageReqVO pageReqVO) {
|
||||||
return groupMapper.selectPage(pageReqVO);
|
return memberGroupMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberGroupDO> getGroupListByStatus(Integer status) {
|
public List<MemberGroupDO> getGroupListByStatus(Integer status) {
|
||||||
return groupMapper.selectListByStatus(status);
|
return memberGroupMapper.selectListByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
|||||||
public class MemberLevelServiceImpl implements MemberLevelService {
|
public class MemberLevelServiceImpl implements MemberLevelService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberLevelMapper levelMapper;
|
private MemberLevelMapper memberLevelMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private MemberLevelRecordService memberLevelRecordService;
|
private MemberLevelRecordService memberLevelRecordService;
|
||||||
@Resource
|
@Resource
|
||||||
@ -57,7 +57,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
MemberLevelDO level = MemberLevelConvert.INSTANCE.convert(createReqVO);
|
MemberLevelDO level = MemberLevelConvert.INSTANCE.convert(createReqVO);
|
||||||
levelMapper.insert(level);
|
memberLevelMapper.insert(level);
|
||||||
// 返回
|
// 返回
|
||||||
return level.getId();
|
return level.getId();
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
MemberLevelDO updateObj = MemberLevelConvert.INSTANCE.convert(updateReqVO);
|
MemberLevelDO updateObj = MemberLevelConvert.INSTANCE.convert(updateReqVO);
|
||||||
levelMapper.updateById(updateObj);
|
memberLevelMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,12 +81,12 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
// 校验分组下是否有用户
|
// 校验分组下是否有用户
|
||||||
validateLevelHasUser(id);
|
validateLevelHasUser(id);
|
||||||
// 删除
|
// 删除
|
||||||
levelMapper.deleteById(id);
|
memberLevelMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
MemberLevelDO validateLevelExists(Long id) {
|
MemberLevelDO validateLevelExists(Long id) {
|
||||||
MemberLevelDO levelDO = levelMapper.selectById(id);
|
MemberLevelDO levelDO = memberLevelMapper.selectById(id);
|
||||||
if (levelDO == null) {
|
if (levelDO == null) {
|
||||||
throw exception(LEVEL_NOT_EXISTS);
|
throw exception(LEVEL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void validateConfigValid(Long id, String name, Integer level, Integer experience) {
|
void validateConfigValid(Long id, String name, Integer level, Integer experience) {
|
||||||
List<MemberLevelDO> list = levelMapper.selectList();
|
List<MemberLevelDO> list = memberLevelMapper.selectList();
|
||||||
// 校验名称唯一
|
// 校验名称唯一
|
||||||
validateNameUnique(list, id, name);
|
validateNameUnique(list, id, name);
|
||||||
// 校验等级唯一
|
// 校验等级唯一
|
||||||
@ -160,7 +160,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberLevelDO getLevel(Long id) {
|
public MemberLevelDO getLevel(Long id) {
|
||||||
return id != null && id > 0 ? levelMapper.selectById(id) : null;
|
return id != null && id > 0 ? memberLevelMapper.selectById(id) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -168,17 +168,17 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return levelMapper.selectBatchIds(ids);
|
return memberLevelMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberLevelDO> getLevelList(MemberLevelListReqVO listReqVO) {
|
public List<MemberLevelDO> getLevelList(MemberLevelListReqVO listReqVO) {
|
||||||
return levelMapper.selectList(listReqVO);
|
return memberLevelMapper.selectList(listReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberLevelDO> getLevelListByStatus(Integer status) {
|
public List<MemberLevelDO> getLevelListByStatus(Integer status) {
|
||||||
return levelMapper.selectListByStatus(status);
|
return memberLevelMapper.selectListByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,23 +21,23 @@ import java.util.List;
|
|||||||
public class MemberPointConfigServiceImpl implements MemberPointConfigService {
|
public class MemberPointConfigServiceImpl implements MemberPointConfigService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberPointConfigMapper pointConfigMapper;
|
private MemberPointConfigMapper memberPointConfigMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void savePointConfig(MemberPointConfigSaveReqVO saveReqVO) {
|
public void savePointConfig(MemberPointConfigSaveReqVO saveReqVO) {
|
||||||
// 存在,则进行更新
|
// 存在,则进行更新
|
||||||
MemberPointConfigDO dbConfig = getPointConfig();
|
MemberPointConfigDO dbConfig = getPointConfig();
|
||||||
if (dbConfig != null) {
|
if (dbConfig != null) {
|
||||||
pointConfigMapper.updateById(MemberPointConfigConvert.INSTANCE.convert(saveReqVO).setId(dbConfig.getId()));
|
memberPointConfigMapper.updateById(MemberPointConfigConvert.INSTANCE.convert(saveReqVO).setId(dbConfig.getId()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 不存在,则进行插入
|
// 不存在,则进行插入
|
||||||
pointConfigMapper.insert(MemberPointConfigConvert.INSTANCE.convert(saveReqVO));
|
memberPointConfigMapper.insert(MemberPointConfigConvert.INSTANCE.convert(saveReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberPointConfigDO getPointConfig() {
|
public MemberPointConfigDO getPointConfig() {
|
||||||
List<MemberPointConfigDO> list = pointConfigMapper.selectList();
|
List<MemberPointConfigDO> list = memberPointConfigMapper.selectList();
|
||||||
return CollectionUtils.getFirst(list);
|
return CollectionUtils.getFirst(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
|||||||
public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberPointRecordMapper recordMapper;
|
private MemberPointRecordMapper memberPointRecordMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private MemberPointConfigService memberPointConfigService;
|
private MemberPointConfigService memberPointConfigService;
|
||||||
|
|
||||||
@ -55,12 +55,12 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
|||||||
userIds = convertSet(users, MemberUserDO::getId);
|
userIds = convertSet(users, MemberUserDO::getId);
|
||||||
}
|
}
|
||||||
// 执行查询
|
// 执行查询
|
||||||
return recordMapper.selectPage(pageReqVO, userIds);
|
return memberPointRecordMapper.selectPage(pageReqVO, userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, PageParam pageVO) {
|
public PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, PageParam pageVO) {
|
||||||
return recordMapper.selectPage(userId, pageVO);
|
return memberPointRecordMapper.selectPage(userId, pageVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,7 +86,7 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
|||||||
.setUserId(userId).setBizId(bizId).setBizType(bizType.getType())
|
.setUserId(userId).setBizId(bizId).setBizType(bizType.getType())
|
||||||
.setTitle(bizType.getName()).setDescription(StrUtil.format(bizType.getDescription(), point))
|
.setTitle(bizType.getName()).setDescription(StrUtil.format(bizType.getDescription(), point))
|
||||||
.setPoint(point).setTotalPoint(totalPoint);
|
.setPoint(point).setTotalPoint(totalPoint);
|
||||||
recordMapper.insert(record);
|
memberPointRecordMapper.insert(record);
|
||||||
|
|
||||||
// 3. 更新用户积分
|
// 3. 更新用户积分
|
||||||
memberUserService.updateUserPoint(userId, totalPoint);
|
memberUserService.updateUserPoint(userId, totalPoint);
|
||||||
|
@ -26,7 +26,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_CO
|
|||||||
public class MemberSignInConfigServiceImpl implements MemberSignInConfigService {
|
public class MemberSignInConfigServiceImpl implements MemberSignInConfigService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberSignInConfigMapper signInConfigMapper;
|
private MemberSignInConfigMapper memberSignInConfigMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createSignInConfig(MemberSignInConfigCreateReqVO createReqVO) {
|
public Long createSignInConfig(MemberSignInConfigCreateReqVO createReqVO) {
|
||||||
@ -35,7 +35,7 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
|
|||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
MemberSignInConfigDO signInConfig = MemberSignInConfigConvert.INSTANCE.convert(createReqVO);
|
MemberSignInConfigDO signInConfig = MemberSignInConfigConvert.INSTANCE.convert(createReqVO);
|
||||||
signInConfigMapper.insert(signInConfig);
|
memberSignInConfigMapper.insert(signInConfig);
|
||||||
// 返回
|
// 返回
|
||||||
return signInConfig.getId();
|
return signInConfig.getId();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
|
|||||||
|
|
||||||
// 判断更新
|
// 判断更新
|
||||||
MemberSignInConfigDO updateObj = MemberSignInConfigConvert.INSTANCE.convert(updateReqVO);
|
MemberSignInConfigDO updateObj = MemberSignInConfigConvert.INSTANCE.convert(updateReqVO);
|
||||||
signInConfigMapper.updateById(updateObj);
|
memberSignInConfigMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,11 +57,11 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
validateSignInConfigExists(id);
|
validateSignInConfigExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
signInConfigMapper.deleteById(id);
|
memberSignInConfigMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateSignInConfigExists(Long id) {
|
private void validateSignInConfigExists(Long id) {
|
||||||
if (signInConfigMapper.selectById(id) == null) {
|
if (memberSignInConfigMapper.selectById(id) == null) {
|
||||||
throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
|
throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
|
|||||||
* @param id 编号,只有更新的时候会传递
|
* @param id 编号,只有更新的时候会传递
|
||||||
*/
|
*/
|
||||||
private void validateSignInConfigDayDuplicate(Integer day, Long id) {
|
private void validateSignInConfigDayDuplicate(Integer day, Long id) {
|
||||||
MemberSignInConfigDO config = signInConfigMapper.selectByDay(day);
|
MemberSignInConfigDO config = memberSignInConfigMapper.selectByDay(day);
|
||||||
// 1. 新增时,config 非空,则说明重复
|
// 1. 新增时,config 非空,则说明重复
|
||||||
if (id == null && config != null) {
|
if (id == null && config != null) {
|
||||||
throw exception(SIGN_IN_CONFIG_EXISTS);
|
throw exception(SIGN_IN_CONFIG_EXISTS);
|
||||||
@ -86,19 +86,19 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberSignInConfigDO getSignInConfig(Long id) {
|
public MemberSignInConfigDO getSignInConfig(Long id) {
|
||||||
return signInConfigMapper.selectById(id);
|
return memberSignInConfigMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List <MemberSignInConfigDO> getSignInConfigList() {
|
public List <MemberSignInConfigDO> getSignInConfigList() {
|
||||||
List<MemberSignInConfigDO> list = signInConfigMapper.selectList();
|
List<MemberSignInConfigDO> list = memberSignInConfigMapper.selectList();
|
||||||
list.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
|
list.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberSignInConfigDO> getSignInConfigList(Integer status) {
|
public List<MemberSignInConfigDO> getSignInConfigList(Integer status) {
|
||||||
List<MemberSignInConfigDO> list = signInConfigMapper.selectListByStatus(status);
|
List<MemberSignInConfigDO> list = memberSignInConfigMapper.selectListByStatus(status);
|
||||||
list.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
|
list.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
|||||||
public class MemberSignInRecordServiceImpl implements MemberSignInRecordService {
|
public class MemberSignInRecordServiceImpl implements MemberSignInRecordService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberSignInRecordMapper signInRecordMapper;
|
private MemberSignInRecordMapper memberSignInRecordMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserApi memberUserApi;
|
||||||
@ -46,12 +46,12 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|||||||
userIds = convertSet(users, MemberUserRespDTO::getId);
|
userIds = convertSet(users, MemberUserRespDTO::getId);
|
||||||
}
|
}
|
||||||
// 分页查询
|
// 分页查询
|
||||||
return signInRecordMapper.selectPage(pageReqVO, userIds);
|
return memberSignInRecordMapper.selectPage(pageReqVO, userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MemberSignInRecordDO> getSignRecordPage(Long userId, PageParam pageParam) {
|
public PageResult<MemberSignInRecordDO> getSignRecordPage(Long userId, PageParam pageParam) {
|
||||||
return signInRecordMapper.selectPage(userId, pageParam);
|
return memberSignInRecordMapper.selectPage(userId, pageParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
|||||||
public class MemberTagServiceImpl implements MemberTagService {
|
public class MemberTagServiceImpl implements MemberTagService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberTagMapper tagMapper;
|
private MemberTagMapper memberTagMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserService memberUserService;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
validateTagNameUnique(null, createReqVO.getName());
|
validateTagNameUnique(null, createReqVO.getName());
|
||||||
// 插入
|
// 插入
|
||||||
MemberTagDO tag = MemberTagConvert.INSTANCE.convert(createReqVO);
|
MemberTagDO tag = MemberTagConvert.INSTANCE.convert(createReqVO);
|
||||||
tagMapper.insert(tag);
|
memberTagMapper.insert(tag);
|
||||||
// 返回
|
// 返回
|
||||||
return tag.getId();
|
return tag.getId();
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
validateTagNameUnique(updateReqVO.getId(), updateReqVO.getName());
|
validateTagNameUnique(updateReqVO.getId(), updateReqVO.getName());
|
||||||
// 更新
|
// 更新
|
||||||
MemberTagDO updateObj = MemberTagConvert.INSTANCE.convert(updateReqVO);
|
MemberTagDO updateObj = MemberTagConvert.INSTANCE.convert(updateReqVO);
|
||||||
tagMapper.updateById(updateObj);
|
memberTagMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,11 +64,11 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
// 校验标签下是否有用户
|
// 校验标签下是否有用户
|
||||||
validateTagHasUser(id);
|
validateTagHasUser(id);
|
||||||
// 删除
|
// 删除
|
||||||
tagMapper.deleteById(id);
|
memberTagMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateTagExists(Long id) {
|
private void validateTagExists(Long id) {
|
||||||
if (tagMapper.selectById(id) == null) {
|
if (memberTagMapper.selectById(id) == null) {
|
||||||
throw exception(TAG_NOT_EXISTS);
|
throw exception(TAG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
if (StrUtil.isBlank(name)) {
|
if (StrUtil.isBlank(name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MemberTagDO tag = tagMapper.selelctByName(name);
|
MemberTagDO tag = memberTagMapper.selelctByName(name);
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberTagDO getTag(Long id) {
|
public MemberTagDO getTag(Long id) {
|
||||||
return tagMapper.selectById(id);
|
return memberTagMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -108,17 +108,17 @@ public class MemberTagServiceImpl implements MemberTagService {
|
|||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return ListUtil.empty();
|
return ListUtil.empty();
|
||||||
}
|
}
|
||||||
return tagMapper.selectBatchIds(ids);
|
return memberTagMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MemberTagDO> getTagPage(MemberTagPageReqVO pageReqVO) {
|
public PageResult<MemberTagDO> getTagPage(MemberTagPageReqVO pageReqVO) {
|
||||||
return tagMapper.selectPage(pageReqVO);
|
return memberTagMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MemberTagDO> getTagList() {
|
public List<MemberTagDO> getTagList() {
|
||||||
return tagMapper.selectList();
|
return memberTagMapper.selectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
|||||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.address.AddressMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.address.MemberAddressMapper;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class AddressServiceImplTest extends BaseDbUnitTest {
|
|||||||
private AddressServiceImpl addressService;
|
private AddressServiceImpl addressService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AddressMapper addressMapper;
|
private MemberAddressMapper addressMapper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAddress_success() {
|
public void testCreateAddress_success() {
|
||||||
|
Loading…
Reference in New Issue
Block a user