package com.dsh.guns.modular.system.controller.code;
|
|
|
import com.dsh.course.feignClient.other.model.Banner;
|
import com.dsh.guns.config.UserExt;
|
import com.dsh.guns.modular.system.model.HomeModule;
|
import com.dsh.guns.modular.system.service.IHomeModuleService;
|
import com.dsh.guns.modular.system.service.IStoreService;
|
import com.dsh.guns.modular.system.util.ResultUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@Controller
|
@RequestMapping("/tHomeModule")
|
public class HomeModuleController {
|
|
@Autowired
|
private IHomeModuleService homeModuleService;
|
@Autowired
|
private IStoreService storeService;
|
|
private String PREFIX = "/system/tHomeModule/";
|
|
|
@RequestMapping("/tHomeModule_platformSet/{id}")
|
public String tHomeModulePlatformSet(@PathVariable Integer id, Model model) {
|
HomeModule data = homeModuleService.getById(id);
|
List<Map<String, Object>> pages = storeService.typeChange(data.getModel());
|
List<Map<String, Object>> types = storeService.typeChangeOne(data.getJumpPage());
|
// type=1 查看详情 type=2 编辑
|
model.addAttribute("type",2);
|
Integer roleType = UserExt.getUser().getObjectType();
|
model.addAttribute("roleType",roleType);
|
model.addAttribute("data",data);
|
model.addAttribute("pages",pages);
|
model.addAttribute("types",types);
|
return PREFIX + "tHomeModule.html";
|
}
|
|
@ResponseBody
|
@RequestMapping("/updateHomeModule")
|
public ResultUtil updateAdvertisement(@RequestBody HomeModule homeModule) {
|
if (homeModule.getType().equals("请选择")){
|
homeModule.setType(null);
|
}
|
if (homeModule.getPage().equals("请选择")){
|
homeModule.setPage(null);
|
}
|
return ResultUtil.success(homeModuleService.updateById(homeModule));
|
}
|
|
}
|