| | |
| | | import com.panzhihua.common.model.dtos.community.ComCvtCategoryDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComCvtCategoryDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.model.vos.community.ComCvtCategoryVO; |
| | | import com.panzhihua.service_community.dao.ComCvtCategoryDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComCvtCategoryDO; |
| | | import com.panzhihua.service_community.service.ComCvtCategoryService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @description: |
| | |
| | | if(null!=comCvtCategoryDO){ |
| | | return R.fail("分类名称重复"); |
| | | } |
| | | comCvtCategoryDO = new ComCvtCategoryDO(); |
| | | BeanUtils.copyProperties(comCvtCategoryDTO,comCvtCategoryDO); |
| | | int count = comCvtCategoryDAO.insert(comCvtCategoryDO); |
| | | if(count<1){ |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R allComCvtCategory() { |
| | | List<ComCvtCategoryVO> comCvtCategoryVOS = new ArrayList<>(); |
| | | List<ComCvtCategoryDO> categoryDOS = comCvtCategoryDAO.selectList(new QueryWrapper<ComCvtCategoryDO>().lambda().orderByDesc(ComCvtCategoryDO::getWeight)); |
| | | if (!ObjectUtils.isEmpty(categoryDOS)) { |
| | | categoryDOS.forEach(categoryDO -> { |
| | | ComCvtCategoryVO comCvtCategoryVO=new ComCvtCategoryVO(); |
| | | BeanUtils.copyProperties(categoryDO,comCvtCategoryVO); |
| | | comCvtCategoryVOS.add(comCvtCategoryVO); |
| | | }); |
| | | } |
| | | return R.ok(comCvtCategoryVOS); |
| | | } |
| | | } |