package com.terra.lfdcexp.controller; import java.util.Arrays; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.terra.lfdcexp.config.R; import com.terra.lfdcexp.entity.SysUserEntity; import com.terra.lfdcexp.entity.WeilanMonEntity; import com.terra.lfdcexp.service.WeilanMonService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * ${comments} * * @author chenshun * @email sunlightcs@gmail.com * @date 2023-12-05 16:11:48 */ @Api(tags = "WeilanMonController") @RestController @RequestMapping("generator/weilanmon") public class WeilanMonController { @Autowired private WeilanMonService weilanMonService; /** * 列表 */ @PostMapping("/list") @ApiOperation(value = "generator:weilanmon:list", notes = "") public R list(@RequestBody WeilanMonEntity params){ if( params != null && params.getFId() != null ) return R.ok().put("page", weilanMonService.list(new QueryWrapper().eq("f_id",params.getFId()))); return R.ok().put("page", weilanMonService.list()); } /** * 信息 */ @PostMapping("/info/{id}") @ApiOperation(value = "generator:weilanmon:info", notes = "") public R info(@PathVariable("id") Integer id){ WeilanMonEntity weilanMon = weilanMonService.getById(id); return R.ok().put("weilanMon", weilanMon); } /** * 保存 */ @PostMapping("/save") @ApiOperation(value = "generator:weilanmon:save", notes = "") public R save(@RequestBody WeilanMonEntity weilanMon){ weilanMonService.save(weilanMon); return R.ok(); } /** * 修改 */ @PostMapping("/update") @ApiOperation(value = "generator:weilanmon:update", notes = "") public R update(@RequestBody WeilanMonEntity weilanMon){ weilanMonService.updateById(weilanMon); return R.ok(); } /** * 删除 */ @PostMapping("/delete") @ApiOperation(value = "generator:weilanmon:delete", notes = "") public R delete(@RequestBody Integer[] ids){ weilanMonService.removeByIds(Arrays.asList(ids)); return R.ok(); } @PostMapping("/deleteByString") @ApiOperation(value = "generator:weilanmon:deleteByString", notes = "") public R deleteByString(String ids){ if( ids == null || ids.split(",").length == 0 ) return R.error("ids is null"); weilanMonService.removeByIds(Arrays.asList(ids.split(","))); return R.ok(); } }