package com.klp.pltcm.controller; import java.util.List; import java.util.Arrays; import lombok.RequiredArgsConstructor; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.*; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import com.klp.common.annotation.RepeatSubmit; import com.klp.common.annotation.Log; import com.klp.common.core.controller.BaseController; import com.klp.common.core.domain.PageQuery; import com.klp.common.core.domain.R; import com.klp.common.core.validate.AddGroup; import com.klp.common.core.validate.EditGroup; import com.klp.common.enums.BusinessType; import com.klp.common.utils.poi.ExcelUtil; import com.klp.pltcm.domain.vo.ModStrategyVo; import com.klp.pltcm.domain.bo.ModStrategyBo; import com.klp.pltcm.service.IModStrategyService; import com.klp.common.core.page.TableDataInfo; /** * 策略关联 * * @author klp * @date 2026-07-06 */ @Validated @RequiredArgsConstructor @RestController @RequestMapping("/pltcm/strategy") public class ModStrategyController extends BaseController { private final IModStrategyService iModStrategyService; /** * 查询策略关联列表 */ @GetMapping("/list") public TableDataInfo list(ModStrategyBo bo, PageQuery pageQuery) { return iModStrategyService.queryPageList(bo, pageQuery); } /** * 导出策略关联列表 */ @Log(title = "策略关联", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(ModStrategyBo bo, HttpServletResponse response) { List list = iModStrategyService.queryList(bo); ExcelUtil.exportExcel(list, "策略关联", ModStrategyVo.class, response); } /** * 获取策略关联详细信息 * * @param id 主键 */ @GetMapping("/{id}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) { return R.ok(iModStrategyService.queryById(id)); } /** * 新增策略关联 */ @Log(title = "策略关联", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody ModStrategyBo bo) { return toAjax(iModStrategyService.insertByBo(bo)); } /** * 修改策略关联 */ @Log(title = "策略关联", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody ModStrategyBo bo) { return toAjax(iModStrategyService.updateByBo(bo)); } /** * 删除策略关联 * * @param ids 主键串 */ @Log(title = "策略关联", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) { return toAjax(iModStrategyService.deleteWithValidByIds(Arrays.asList(ids), true)); } }