| File was renamed from src/main/java/org/springblade/modules/house/service/impl/HouseholdLabelServiceImpl.java |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.house.dto.UserHouseLabelDTO; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.entity.HouseholdLabelEntity; |
| | | import org.springblade.modules.house.vo.HouseholdLabelVO; |
| | | import org.springblade.modules.house.mapper.HouseholdLabelMapper; |
| | | import org.springblade.modules.house.service.IHouseholdLabelService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.modules.house.mapper.UserHouseLabelMapper; |
| | | import org.springblade.modules.house.service.IUserHouseLabelService; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @since 2023-10-28 |
| | | */ |
| | | @Service |
| | | public class HouseholdLabelServiceImpl extends ServiceImpl<HouseholdLabelMapper, HouseholdLabelEntity> implements IHouseholdLabelService { |
| | | public class UserHouseLabelServiceImpl extends ServiceImpl<UserHouseLabelMapper, UserHouseLabelEntity> implements IUserHouseLabelService { |
| | | |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Override |
| | | public IPage<HouseholdLabelVO> selectHouseholdLabelPage(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel) { |
| | | return page.setRecords(baseMapper.selectHouseholdLabelPage(page, householdLabel)); |
| | | return page.setRecords(baseMapper.selectHouseLabelPage(page, householdLabel)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean saveOrUpdateHouseholdLabel(HouseholdLabelEntity householdLabel) { |
| | | public boolean saveOrUpdateHouseholdLabel(UserHouseLabelEntity householdLabel) { |
| | | // 查询标签名称 |
| | | LabelEntity labelEntity = labelService.getById(householdLabel.getLabelId()); |
| | | householdLabel.setLabelName(labelEntity.getLabelName()); |
| | | // 判断同一个住户同一个标签是否已存在,已存在则更新,不存在则新增 |
| | | QueryWrapper<HouseholdLabelEntity> queryWrapper = new QueryWrapper<>(); |
| | | QueryWrapper<UserHouseLabelEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("household_id",householdLabel.getHouseholdId()) |
| | | .eq("label_id",householdLabel.getLabelId()); |
| | | HouseholdLabelEntity one = getOne(queryWrapper); |
| | | UserHouseLabelEntity one = getOne(queryWrapper); |
| | | if (null != one){ |
| | | householdLabel.setId(one.getId()); |
| | | // 更新 |
| | |
| | | // 插入 |
| | | return save(householdLabel); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> selectUserLabelList(UserHouseLabelDTO userHouseLabelDTO) { |
| | | List<Integer> userLabelList = baseMapper.getUserLabelList(userHouseLabelDTO); |
| | | return userLabelList; |
| | | } |
| | | } |