package cc.mrbird.febs.mall.controller.clothes;
|
|
import cc.mrbird.febs.common.controller.BaseController;
|
import cc.mrbird.febs.common.entity.FebsConstant;
|
import cc.mrbird.febs.common.utils.FebsUtil;
|
import cc.mrbird.febs.mall.entity.*;
|
import cc.mrbird.febs.mall.mapper.*;
|
import cc.mrbird.febs.mall.service.ClothesTypeService;
|
import cc.mrbird.febs.mall.service.IAdminBannerService;
|
import cc.mrbird.febs.mall.vo.AdminLabelSetVo;
|
import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo;
|
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import lombok.RequiredArgsConstructor;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import java.util.ArrayList;
|
import java.util.HashSet;
|
import java.util.List;
|
import java.util.Set;
|
import java.util.stream.Collectors;
|
|
@Controller("clothesTypeView")
|
@RequestMapping(FebsConstant.VIEW_PREFIX + "modules/clothesType")
|
@RequiredArgsConstructor
|
public class ViewClothesTypeController extends BaseController {
|
|
private final ClothesTypeService clothesTypeService;
|
private final ClothesSizeMapper clothesSizeMapper;
|
private final ClothesPatternMapper clothesPatternMapper;
|
private final ClothesLocationMapper clothesLocationMapper;
|
private final ClothesClothMapper clothesClothMapper;
|
private final ClothesArtMapper clothesArtMapper;
|
private final ClothesTypeArtMapper clothesTypeArtMapper;
|
private final ClothesTypeSizeMapper clothesTypeSizeMapper;
|
private final ClothesTypeClothMapper clothesTypeClothMapper;
|
private final ClothesTypePatternMapper clothesTypePatternMapper;
|
private final ClothesTypeLocationMapper clothesTypeLocationMapper;
|
|
/**
|
* 种类列表
|
*/
|
@GetMapping("typeList")
|
@RequiresPermissions("typeList:view")
|
public String typeList() {
|
|
return FebsUtil.view("modules/clothesType/typeList");
|
}
|
|
/**
|
* 种类新增
|
* @return
|
*/
|
@GetMapping(value = "/typeAdd")
|
@RequiresPermissions("typeAdd:add")
|
public String typeAdd() {
|
|
return FebsUtil.view("modules/clothesType/typeAdd");
|
}
|
|
|
/**
|
* 种类编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("typeInfo/{id}")
|
@RequiresPermissions("typeInfo:view")
|
public String typeInfo(@PathVariable long id, Model model) {
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
model.addAttribute("clothesType", clothesType);
|
return FebsUtil.view("modules/clothesType/typeInfo");
|
}
|
|
/**
|
* 尺码列表
|
*/
|
@GetMapping("sizeList")
|
@RequiresPermissions("sizeList:view")
|
public String sizeList() {
|
|
return FebsUtil.view("modules/clothesType/sizeList");
|
}
|
|
/**
|
* 尺码新增
|
* @return
|
*/
|
@GetMapping(value = "/sizeAdd")
|
@RequiresPermissions("sizeAdd:add")
|
public String sizeAdd() {
|
|
return FebsUtil.view("modules/clothesType/sizeAdd");
|
}
|
|
/**
|
* 尺码编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("sizeInfo/{id}")
|
@RequiresPermissions("sizeInfo:view")
|
public String sizeInfo(@PathVariable long id, Model model) {
|
ClothesSize clothesSize = clothesSizeMapper.selectById(id);
|
model.addAttribute("clothesSize", clothesSize);
|
return FebsUtil.view("modules/clothesType/sizeInfo");
|
}
|
|
/**
|
* 图案列表
|
*/
|
@GetMapping("patternList")
|
@RequiresPermissions("patternList:view")
|
public String patternList() {
|
|
return FebsUtil.view("modules/clothesType/patternList");
|
}
|
|
/**
|
* 图案新增
|
* @return
|
*/
|
@GetMapping(value = "/patternAdd")
|
@RequiresPermissions("patternAdd:add")
|
public String patternAdd() {
|
|
return FebsUtil.view("modules/clothesType/patternAdd");
|
}
|
|
/**
|
* 图案编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("patternInfo/{id}")
|
@RequiresPermissions("patternInfo:view")
|
public String patternInfo(@PathVariable long id, Model model) {
|
ClothesPattern clothesPattern = clothesPatternMapper.selectById(id);
|
model.addAttribute("clothesPattern", clothesPattern);
|
return FebsUtil.view("modules/clothesType/patternInfo");
|
}
|
|
/**
|
* 位置列表
|
*/
|
@GetMapping("locationList")
|
@RequiresPermissions("locationList:view")
|
public String locationList() {
|
|
return FebsUtil.view("modules/clothesType/locationList");
|
}
|
|
/**
|
* 位置新增
|
* @return
|
*/
|
@GetMapping(value = "/locationAdd")
|
@RequiresPermissions("locationAdd:add")
|
public String locationAdd() {
|
|
return FebsUtil.view("modules/clothesType/locationAdd");
|
}
|
|
/**
|
* 位置编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("locationInfo/{id}")
|
@RequiresPermissions("locationInfo:view")
|
public String locationInfo(@PathVariable long id, Model model) {
|
ClothesLocation clothesLocation = clothesLocationMapper.selectById(id);
|
model.addAttribute("clothesLocation", clothesLocation);
|
return FebsUtil.view("modules/clothesType/locationInfo");
|
}
|
|
/**
|
* 布料列表
|
*/
|
@GetMapping("clothList")
|
@RequiresPermissions("clothList:view")
|
public String clothList() {
|
|
return FebsUtil.view("modules/clothesType/clothList");
|
}
|
|
|
/**
|
* 布料新增
|
* @return
|
*/
|
@GetMapping(value = "/clothAdd")
|
@RequiresPermissions("clothAdd:add")
|
public String clothAdd() {
|
|
return FebsUtil.view("modules/clothesType/clothAdd");
|
}
|
|
/**
|
* 布料编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("clothInfo/{id}")
|
@RequiresPermissions("clothInfo:view")
|
public String clothInfo(@PathVariable long id, Model model) {
|
ClothesCloth clothesCloth = clothesClothMapper.selectById(id);
|
model.addAttribute("clothesCloth", clothesCloth);
|
return FebsUtil.view("modules/clothesType/clothInfo");
|
}
|
|
/**
|
* 工艺列表
|
*/
|
@GetMapping("artList")
|
@RequiresPermissions("artList:view")
|
public String artList() {
|
|
return FebsUtil.view("modules/clothesType/artList");
|
}
|
|
|
/**
|
* 工艺新增
|
* @return
|
*/
|
@GetMapping(value = "/artAdd")
|
@RequiresPermissions("artAdd:add")
|
public String artAdd() {
|
|
return FebsUtil.view("modules/clothesType/artAdd");
|
}
|
|
/**
|
* 工艺编辑
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("artInfo/{id}")
|
@RequiresPermissions("artInfo:view")
|
public String artInfo(@PathVariable long id, Model model) {
|
ClothesArt clothesArt = clothesArtMapper.selectById(id);
|
model.addAttribute("clothesArt", clothesArt);
|
return FebsUtil.view("modules/clothesType/artInfo");
|
}
|
|
/**
|
* 工艺配置
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("artSet/{id}")
|
@RequiresPermissions("artSet:view")
|
public String artSet(@PathVariable long id, Model model) {
|
List<AdminClothesTypeInfoVo> vos = new ArrayList<>();
|
Set<Long> artIds = new HashSet<>();
|
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
if(ObjectUtil.isNotEmpty(clothesType)){
|
//右侧数据
|
List<ClothesTypeArt> clothesTypeArts = clothesTypeArtMapper.selectList(
|
Wrappers.lambdaQuery(ClothesTypeArt.class)
|
.eq(ClothesTypeArt::getTypeId, id)
|
);
|
if(CollUtil.isNotEmpty(clothesTypeArts)){
|
//stream流操作happyMemberLabelRecords,获取memberId的set集合
|
artIds = clothesTypeArts.stream().map(ClothesTypeArt::getArtId).collect(Collectors.toSet());
|
}
|
|
//左侧数据
|
List<ClothesArt> clothesArts = clothesArtMapper.selectList(
|
Wrappers.lambdaQuery(ClothesArt.class)
|
.select(ClothesArt::getId, ClothesArt::getName)
|
);
|
if(CollUtil.isNotEmpty(clothesArts)){
|
//stream流操作mallMembers,生成一个新的List<MallMemberVo>
|
vos = clothesArts.stream().map(ClothesArt -> {
|
AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo();
|
vo.setId(ClothesArt.getId());
|
vo.setName(ClothesArt.getName());
|
return vo;
|
}).collect(Collectors.toList());
|
}
|
}
|
|
model.addAttribute("artTypeAll", vos);
|
model.addAttribute("artTypeChoose", artIds);
|
model.addAttribute("typeId", id);
|
return FebsUtil.view("modules/clothesType/artSet");
|
}
|
|
/**
|
* 尺码配置
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("sizeSet/{id}")
|
@RequiresPermissions("sizeSet:view")
|
public String sizeSet(@PathVariable long id, Model model) {
|
List<AdminClothesTypeInfoVo> vos = new ArrayList<>();
|
Set<Long> ids = new HashSet<>();
|
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
if(ObjectUtil.isNotEmpty(clothesType)){
|
//右侧数据
|
List<ClothesTypeSize> lists = clothesTypeSizeMapper.selectList(
|
Wrappers.lambdaQuery(ClothesTypeSize.class)
|
.eq(ClothesTypeSize::getTypeId, id)
|
);
|
|
if (CollUtil.isNotEmpty(lists)){
|
//stream流操作happyMemberLabelRecords,获取memberId的set集合
|
ids = lists.stream().map(ClothesTypeSize::getSizeId).collect(Collectors.toSet());
|
}
|
|
//左侧数据
|
List<ClothesSize> entities = clothesSizeMapper.selectList(
|
Wrappers.lambdaQuery(ClothesSize.class)
|
.select(ClothesSize::getId, ClothesSize::getName)
|
);
|
if(CollUtil.isNotEmpty(entities)){
|
//stream流操作mallMembers,生成一个新的List<MallMemberVo>
|
vos = entities.stream().map(ClothesSize -> {
|
AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo();
|
vo.setId(ClothesSize.getId());
|
vo.setName(ClothesSize.getName());
|
return vo;
|
}).collect(Collectors.toList());
|
}
|
}
|
|
model.addAttribute("sizeTypeAll", vos);
|
model.addAttribute("sizeTypeChoose", ids);
|
model.addAttribute("typeId", id);
|
return FebsUtil.view("modules/clothesType/sizeSet");
|
}
|
|
/**
|
* 布料配置
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("clothSet/{id}")
|
@RequiresPermissions("clothSet:view")
|
public String clothSet(@PathVariable long id, Model model) {
|
List<AdminClothesTypeInfoVo> vos = new ArrayList<>();
|
Set<Long> ids = new HashSet<>();
|
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
if(ObjectUtil.isNotEmpty(clothesType)){
|
//右侧数据
|
List<ClothesTypeCloth> lists = clothesTypeClothMapper.selectList(
|
Wrappers.lambdaQuery(ClothesTypeCloth.class)
|
.eq(ClothesTypeCloth::getTypeId, id)
|
);
|
|
if (CollUtil.isNotEmpty(lists)){
|
//stream流操作happyMemberLabelRecords,获取memberId的set集合
|
ids = lists.stream().map(ClothesTypeCloth::getClothId).collect(Collectors.toSet());
|
|
}
|
|
//左侧数据
|
List<ClothesCloth> entities = clothesClothMapper.selectList(
|
Wrappers.lambdaQuery(ClothesCloth.class)
|
.select(ClothesCloth::getId, ClothesCloth::getName)
|
);
|
if(CollUtil.isNotEmpty(entities)){
|
//stream流操作mallMembers,生成一个新的List<MallMemberVo>
|
vos = entities.stream().map(ClothesCloth -> {
|
AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo();
|
vo.setId(ClothesCloth.getId());
|
vo.setName(ClothesCloth.getName());
|
return vo;
|
}).collect(Collectors.toList());
|
}
|
}
|
|
model.addAttribute("clothTypeAll", vos);
|
model.addAttribute("clothTypeChoose", ids);
|
model.addAttribute("typeId", id);
|
return FebsUtil.view("modules/clothesType/clothSet");
|
}
|
|
/**
|
* 图案文字配置
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("patternSet/{id}")
|
@RequiresPermissions("patternSet:view")
|
public String patternSet(@PathVariable long id, Model model) {
|
List<AdminClothesTypeInfoVo> vos = new ArrayList<>();
|
Set<Long> ids = new HashSet<>();
|
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
if(ObjectUtil.isNotEmpty(clothesType)){
|
//右侧数据
|
List<ClothesTypePattern> lists = clothesTypePatternMapper.selectList(
|
Wrappers.lambdaQuery(ClothesTypePattern.class)
|
.eq(ClothesTypePattern::getTypeId, id)
|
);
|
|
if (CollUtil.isNotEmpty(lists)){
|
//stream流操作happyMemberLabelRecords,获取memberId的set集合
|
ids = lists.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet());
|
}
|
|
//左侧数据
|
List<ClothesPattern> entities = clothesPatternMapper.selectList(
|
Wrappers.lambdaQuery(ClothesPattern.class)
|
.select(ClothesPattern::getId, ClothesPattern::getName)
|
);
|
if(CollUtil.isNotEmpty(entities)){
|
//stream流操作mallMembers,生成一个新的List<MallMemberVo>
|
vos = entities.stream().map(ClothesPattern -> {
|
AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo();
|
vo.setId(ClothesPattern.getId());
|
vo.setName(ClothesPattern.getName());
|
return vo;
|
}).collect(Collectors.toList());
|
}
|
}
|
|
model.addAttribute("patternTypeAll", vos);
|
model.addAttribute("patternTypeChoose", ids);
|
model.addAttribute("typeId", id);
|
return FebsUtil.view("modules/clothesType/patternSet");
|
}
|
|
/**
|
* 图案位置配置
|
* @param id
|
* @param model
|
* @return
|
*/
|
@GetMapping("locationSet/{id}")
|
@RequiresPermissions("locationSet:view")
|
public String locationSet(@PathVariable long id, Model model) {
|
List<AdminClothesTypeInfoVo> vos = new ArrayList<>();
|
Set<Long> ids = new HashSet<>();
|
|
ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id);
|
if(ObjectUtil.isNotEmpty(clothesType)){
|
//右侧数据
|
List<ClothesTypeLocation> lists = clothesTypeLocationMapper.selectList(
|
Wrappers.lambdaQuery(ClothesTypeLocation.class)
|
.eq(ClothesTypeLocation::getTypeId, id)
|
);
|
|
if(CollUtil.isNotEmpty(lists)){
|
//stream流操作happyMemberLabelRecords,获取memberId的set集合
|
ids = lists.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet());
|
}
|
|
//左侧数据
|
List<ClothesLocation> entities = clothesLocationMapper.selectList(
|
Wrappers.lambdaQuery(ClothesLocation.class)
|
.select(ClothesLocation::getId, ClothesLocation::getName)
|
);
|
if(CollUtil.isNotEmpty(entities)){
|
//stream流操作mallMembers,生成一个新的List<MallMemberVo>
|
vos = entities.stream().map(ClothesLocation -> {
|
AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo();
|
vo.setId(ClothesLocation.getId());
|
vo.setName(ClothesLocation.getName());
|
return vo;
|
}).collect(Collectors.toList());
|
}
|
}
|
|
model.addAttribute("locationTypeAll", vos);
|
model.addAttribute("locationTypeChoose", ids);
|
model.addAttribute("typeId", id);
|
return FebsUtil.view("modules/clothesType/locationSet");
|
}
|
|
}
|