|
@@ -4,10 +4,13 @@ import com.xingxi.common.annotation.Log;
|
|
|
import com.xingxi.common.core.controller.BaseController;
|
|
import com.xingxi.common.core.controller.BaseController;
|
|
|
import com.xingxi.common.core.domain.AjaxResult;
|
|
import com.xingxi.common.core.domain.AjaxResult;
|
|
|
import com.xingxi.common.core.page.TableDataInfo;
|
|
import com.xingxi.common.core.page.TableDataInfo;
|
|
|
|
|
+import com.xingxi.common.core.text.Convert;
|
|
|
import com.xingxi.common.enums.BusinessType;
|
|
import com.xingxi.common.enums.BusinessType;
|
|
|
import com.xingxi.common.utils.poi.ExcelUtil;
|
|
import com.xingxi.common.utils.poi.ExcelUtil;
|
|
|
import com.xingxi.master.merchant.domain.MerchantProd;
|
|
import com.xingxi.master.merchant.domain.MerchantProd;
|
|
|
import com.xingxi.master.merchant.service.IMerchantProdService;
|
|
import com.xingxi.master.merchant.service.IMerchantProdService;
|
|
|
|
|
+import com.xingxi.web.controller.master.merchant.domain.MerchantProdVo;
|
|
|
|
|
+import com.xingxi.web.controller.master.merchant.service.IMerchantProdVoService;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.ui.ModelMap;
|
|
@@ -23,93 +26,67 @@ import java.util.List;
|
|
|
* @date 2025-03-09
|
|
* @date 2025-03-09
|
|
|
*/
|
|
*/
|
|
|
@Controller
|
|
@Controller
|
|
|
-@RequestMapping("/master/merchant/product")
|
|
|
|
|
|
|
+@RequestMapping("/master/merchant/prod")
|
|
|
public class MerchantProdController extends BaseController {
|
|
public class MerchantProdController extends BaseController {
|
|
|
- private final String prefix = "master/merchant/product";
|
|
|
|
|
|
|
+ private final String prefix = "master/merchant/prod";
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
- private IMerchantProdService merchantProdService;
|
|
|
|
|
|
|
+ private IMerchantProdVoService merchantProdVoService;
|
|
|
|
|
|
|
|
- @RequiresPermissions("system:merchant:product:view")
|
|
|
|
|
- @GetMapping()
|
|
|
|
|
- public String prod() {
|
|
|
|
|
- return prefix + "/product";
|
|
|
|
|
|
|
+ @RequiresPermissions("master:merchant:prod:view")
|
|
|
|
|
+ @GetMapping("/view/{mercId}")
|
|
|
|
|
+ public String prod(@PathVariable("mercId") Long mercId, ModelMap mMap) {
|
|
|
|
|
+ mMap.put("mercId", mercId);
|
|
|
|
|
+ return prefix + "/merchantProd";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询店铺商品列表
|
|
* 查询店铺商品列表
|
|
|
*/
|
|
*/
|
|
|
- @RequiresPermissions("system:merchant:product:list")
|
|
|
|
|
|
|
+ @RequiresPermissions("master:merchant:prod:list")
|
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public TableDataInfo list(MerchantProd merchantProd) {
|
|
|
|
|
|
|
+ public TableDataInfo list(MerchantProdVo merchantProdVo) {
|
|
|
startPage();
|
|
startPage();
|
|
|
- List<MerchantProd> list = merchantProdService.selectMerchantProdList(merchantProd);
|
|
|
|
|
|
|
+ List<MerchantProdVo> list = merchantProdVoService.selectMerchantProdVoList(merchantProdVo);
|
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 导出店铺商品列表
|
|
|
|
|
- */
|
|
|
|
|
- @RequiresPermissions("system:merchant:product:export")
|
|
|
|
|
- @Log(title = "店铺商品", businessType = BusinessType.EXPORT)
|
|
|
|
|
- @PostMapping("/export")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public AjaxResult export(MerchantProd merchantProd) {
|
|
|
|
|
- List<MerchantProd> list = merchantProdService.selectMerchantProdList(merchantProd);
|
|
|
|
|
- ExcelUtil<MerchantProd> util = new ExcelUtil<>(MerchantProd.class);
|
|
|
|
|
- return util.exportExcel(list, "店铺商品数据");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 新增店铺商品
|
|
|
|
|
- */
|
|
|
|
|
- @GetMapping("/add")
|
|
|
|
|
- public String add() {
|
|
|
|
|
- return prefix + "/add";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 新增保存店铺商品
|
|
|
|
|
- */
|
|
|
|
|
- @RequiresPermissions("system:merchant:product:add")
|
|
|
|
|
- @Log(title = "店铺商品", businessType = BusinessType.INSERT)
|
|
|
|
|
- @PostMapping("/add")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public AjaxResult addSave(MerchantProd merchantProd) {
|
|
|
|
|
- return toAjax(merchantProdService.insertMerchantProd(merchantProd));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* 修改店铺商品
|
|
* 修改店铺商品
|
|
|
*/
|
|
*/
|
|
|
- @RequiresPermissions("system:merchant:product:edit")
|
|
|
|
|
- @GetMapping("/edit/{mercProdId}")
|
|
|
|
|
- public String edit(@PathVariable("mercProdId") Long mercProdId, ModelMap mMap) {
|
|
|
|
|
- MerchantProd merchantProd = merchantProdService.selectMerchantProdByMercProdId(mercProdId);
|
|
|
|
|
- mMap.put("merchantProd", merchantProd);
|
|
|
|
|
|
|
+ @RequiresPermissions("master:merchant:prod:edit")
|
|
|
|
|
+ @GetMapping("/edit/{mercId}")
|
|
|
|
|
+ public String edit(@PathVariable("mercId") Long mercId, ModelMap mMap) {
|
|
|
|
|
+ List<MerchantProdVo> merchantProdVoList = merchantProdVoService.selectMerchantProdVoByMercId(mercId);
|
|
|
|
|
+ mMap.put("mercId", mercId);
|
|
|
|
|
+ mMap.put("merchantProdVoList", merchantProdVoList);
|
|
|
return prefix + "/edit";
|
|
return prefix + "/edit";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 修改保存店铺商品
|
|
* 修改保存店铺商品
|
|
|
*/
|
|
*/
|
|
|
- @RequiresPermissions("system:merchant:product:edit")
|
|
|
|
|
|
|
+ @RequiresPermissions("master:merchant:prod:edit")
|
|
|
@Log(title = "店铺商品", businessType = BusinessType.UPDATE)
|
|
@Log(title = "店铺商品", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/edit")
|
|
@PostMapping("/edit")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public AjaxResult editSave(MerchantProd merchantProd) {
|
|
|
|
|
- return toAjax(merchantProdService.updateMerchantProd(merchantProd));
|
|
|
|
|
|
|
+ public AjaxResult editSave(@RequestBody MerchantProdVo merchantProdVo) {
|
|
|
|
|
+ return toAjax(merchantProdVoService.updateMerchantProdVo(merchantProdVo));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 删除店铺商品
|
|
* 删除店铺商品
|
|
|
*/
|
|
*/
|
|
|
- @RequiresPermissions("system:merchant:product:remove")
|
|
|
|
|
|
|
+ @RequiresPermissions("master:merchant:prod:remove")
|
|
|
@Log(title = "店铺商品", businessType = BusinessType.DELETE)
|
|
@Log(title = "店铺商品", businessType = BusinessType.DELETE)
|
|
|
@PostMapping("/remove")
|
|
@PostMapping("/remove")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public AjaxResult remove(String ids) {
|
|
public AjaxResult remove(String ids) {
|
|
|
- return toAjax(merchantProdService.deleteMerchantProdByMercProdIds(ids));
|
|
|
|
|
|
|
+ if (ids.indexOf(",") > 0) {
|
|
|
|
|
+ return toAjax(merchantProdVoService.logicDeleteMerchantProdByMercProdIds(Convert.toStrArray(ids)));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return toAjax(merchantProdVoService.logicDeleteMerchantProdByMercProdId(Long.parseLong(ids)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|