项目库crud
This commit is contained in:
+126
@@ -0,0 +1,126 @@
|
||||
package com.jero.modules.projectLibrary.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.projectLibrary.entity.LawsProjectLibrary;
|
||||
import com.jero.modules.projectLibrary.service.ILawsProjectLibraryService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 项目库
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="项目库")
|
||||
@RestController
|
||||
@RequestMapping("/projectLibrary/lawsProjectLibrary")
|
||||
@Slf4j
|
||||
public class LawsProjectLibraryController extends JeroController<LawsProjectLibrary, ILawsProjectLibraryService> {
|
||||
@Autowired
|
||||
private ILawsProjectLibraryService lawsProjectLibraryService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "项目库-分页列表查询")
|
||||
@ApiOperation(value="项目库-分页列表查询", notes="项目库-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<LawsProjectLibrary>> queryPageList(LawsProjectLibrary lawsProjectLibrary,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
lawsProjectLibrary.setDelFlag("0");
|
||||
IPage<LawsProjectLibrary> pageList = lawsProjectLibraryService.queryPage(lawsProjectLibrary, pageNo, pageSize, req);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@AutoLog(value = "项目库-添加")
|
||||
@ApiOperation(value="项目库-添加", notes="项目库-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibrary.setDelFlag("0");
|
||||
lawsProjectLibraryService.add(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@AutoLog(value = "项目库-编辑")
|
||||
@ApiOperation(value="项目库-编辑", notes="项目库-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibraryService.editById(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@AutoLog(value = "项目库-通过id删除")
|
||||
@ApiOperation(value="项目库-通过id删除", notes="项目库-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
lawsProjectLibraryService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@AutoLog(value = "项目库-批量删除")
|
||||
@ApiOperation(value="项目库-批量删除", notes="项目库-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
this.lawsProjectLibraryService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@AutoLog(value = "项目库-通过id查询")
|
||||
@ApiOperation(value="项目库-通过id查询", notes="项目库-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<LawsProjectLibrary> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
LawsProjectLibrary lawsProjectLibrary = lawsProjectLibraryService.queryById(id);
|
||||
if(lawsProjectLibrary==null) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "No corresponding data found!" : "未找到对应数据");
|
||||
}
|
||||
return Result.OK(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, LawsProjectLibrary lawsProjectLibrary) {
|
||||
return super.exportXls(request, lawsProjectLibrary, LawsProjectLibrary.class, "项目库");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user