Commit 61175b07 authored by 赵啸非's avatar 赵啸非

添加皮肤分辨率与预览模块

parent 593e99cb
package com.mortals.xhx.module.skin.model; package com.mortals.xhx.module.skin.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.skin.model.vo.SkinCategoryVo; import com.mortals.xhx.module.skin.model.vo.SkinCategoryVo;
/** /**
* 系统皮肤分类实体对象 * 系统皮肤分类实体对象
......
package com.mortals.xhx.module.skin.model.vo; package com.mortals.xhx.module.skin.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.skin.model.SkinBaseEntity;
import com.mortals.xhx.module.skin.model.SkinCategoryEntity; import com.mortals.xhx.module.skin.model.SkinCategoryEntity;
import lombok.Data; import lombok.Data;
...@@ -13,5 +14,6 @@ import java.util.List; ...@@ -13,5 +14,6 @@ import java.util.List;
*/ */
@Data @Data
public class SkinCategoryVo extends BaseEntityLong { public class SkinCategoryVo extends BaseEntityLong {
private List<SkinBaseEntity> skinBaseList;
} }
\ No newline at end of file
package com.mortals.xhx.module.skin.service.impl; package com.mortals.xhx.module.skin.service.impl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.skin.model.SkinBaseEntity;
import com.mortals.xhx.module.skin.model.SkinBaseQuery;
import com.mortals.xhx.module.skin.model.SkinCategoryQuery; import com.mortals.xhx.module.skin.model.SkinCategoryQuery;
import com.mortals.xhx.module.skin.service.SkinBaseService;
import com.mortals.xhx.module.skin.service.SkinFieldService; import com.mortals.xhx.module.skin.service.SkinFieldService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,28 +16,48 @@ import com.mortals.xhx.module.skin.model.SkinCategoryEntity; ...@@ -12,28 +16,48 @@ import com.mortals.xhx.module.skin.model.SkinCategoryEntity;
import com.mortals.xhx.module.skin.service.SkinCategoryService; import com.mortals.xhx.module.skin.service.SkinCategoryService;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* SkinCategoryService * SkinCategoryService
* 系统皮肤分类 service实现 * 系统皮肤分类 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-05-24 * @date 2022-05-24
*/ */
@Service("skinCategoryService") @Service("skinCategoryService")
public class SkinCategoryServiceImpl extends AbstractCRUDServiceImpl<SkinCategoryDao, SkinCategoryEntity, Long> implements SkinCategoryService { public class SkinCategoryServiceImpl extends AbstractCRUDServiceImpl<SkinCategoryDao, SkinCategoryEntity, Long> implements SkinCategoryService {
@Autowired @Autowired
private SkinFieldService skinFieldService; private SkinFieldService skinFieldService;
@Autowired
private SkinBaseService skinBaseService;
@Override @Override
protected void validData(SkinCategoryEntity entity, Context context) throws AppException { protected void validData(SkinCategoryEntity entity, Context context) throws AppException {
//搜索种类名称唯一 //搜索种类名称唯一
SkinCategoryEntity skinCategoryEntity = this.selectOne(new SkinCategoryQuery().name(entity.getName())); SkinCategoryEntity skinCategoryEntity = this.selectOne(new SkinCategoryQuery().name(entity.getName()));
if(!ObjectUtils.isEmpty(skinCategoryEntity)&&entity.newEntity()){ if (!ObjectUtils.isEmpty(skinCategoryEntity) && entity.newEntity()) {
throw new AppException("分类名称已存在"); throw new AppException("分类名称已存在");
} }
super.validData(entity, context); super.validData(entity, context);
} }
@Override
protected void findAfter(SkinCategoryEntity entity, PageInfo pageInfo, Context context, List<SkinCategoryEntity> list) throws AppException {
list.stream().forEach(item -> {
List<SkinBaseEntity> skinBaseEntities = skinBaseService.find(new SkinBaseQuery().categoryId(entity.getId()));
entity.setSkinBaseList(skinBaseEntities);
});
super.findAfter(entity, pageInfo, context, list);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
SkinBaseQuery skinBaseQuery = new SkinBaseQuery();
skinBaseQuery.setCategoryIdList(Arrays.asList(ids));
Long[] skinBaseIds = this.skinBaseService.find(skinBaseQuery, context).stream().map(item -> item.getId()).toArray(Long[]::new);
this.skinBaseService.remove(skinBaseIds, context);
super.removeAfter(ids, context, result);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment