| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientProductCategoryVO; |
| | | import com.panzhihua.service_community.dao.ConvenientProductCategoryDAO; |
| | | import com.panzhihua.service_community.dao.ConvenientProductDAO; |
| | | import com.panzhihua.service_community.model.dos.ConvenientProductCategoryDO; |
| | | import com.panzhihua.service_community.model.dos.ConvenientProductDO; |
| | | import com.panzhihua.service_community.service.ConvenientProductCategoryService; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class ConvenientProductCategoryServiceImpl extends ServiceImpl<ConvenientProductCategoryDAO, ConvenientProductCategoryDO> implements ConvenientProductCategoryService { |
| | | |
| | | @Resource |
| | | private ConvenientProductDAO convenientProductDAO; |
| | | |
| | | @Override |
| | | public R addProductCategory(ConvenientProductCategoryDTO convenientProductCategoryDTO) { |
| | |
| | | if (isNull(convenientProductCategoryDO)) { |
| | | return R.fail("分类id不存在"); |
| | | } |
| | | int quotedCount = convenientProductDAO.selectCount(new QueryWrapper<ConvenientProductDO>() |
| | | .lambda().eq(ConvenientProductDO::getCategoryId, categoryId).eq(ConvenientProductDO::getIsDel, false)); |
| | | if (quotedCount > 0) { |
| | | return R.fail("该分类名称已被引用,无法删除!"); |
| | | } |
| | | convenientProductCategoryDO.setIsDel(true); |
| | | convenientProductCategoryDO.setUpdatedBy(operator); |
| | | int result = this.baseMapper.updateById(convenientProductCategoryDO); |