中英文切换与添加按钮权限

This commit is contained in:
caozhen
2023-09-18 10:52:25 +08:00
parent 7b4de0c1bd
commit 8c91c6adc1
11 changed files with 60 additions and 29 deletions
@@ -14,6 +14,7 @@ import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
@@ -68,7 +69,7 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
HttpServletRequest req) {
String projectId = lawsAssess.getProjectId();
if (StringUtils.isBlank(projectId)){
return Result.error("请在项目内查询!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
lawsAssess.setDelFlag("0");
IPage<LawsAssess> pageList = lawsAssessService.queryPage(lawsAssess, pageNo, pageSize, req);
@@ -114,7 +115,7 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
String domesticStandardId = lawsAssessAddVo.getDomesticStandardId();
String overseasStandardId = lawsAssessAddVo.getOverseasStandardId();
if (StringUtils.isNotBlank(domesticStandardId) && StringUtils.isNotBlank(overseasStandardId)){
return Result.error("请至少选择一个标准进行调取!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
//查询当前项目已绑定的标准,为了不造成重复绑定
//查询该项目下所有未删除的标准
@@ -184,9 +185,6 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
lawsAssesses.add(lawsAssess);
}
}
if (lawsAssesses.isEmpty()){
return Result.error("调取标准全部存在,请重新选择标准!");
}
lawsAssessService.saveBatch(lawsAssesses);
return Result.OK("操作成功!");
}
@@ -200,7 +198,7 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
public Result<T> copy(@Validated @RequestBody LawsAssessAddVo lawsAssessAddVo) {
String copyProjectId = lawsAssessAddVo.getCopyProjectId();
if (StringUtils.isBlank(copyProjectId)){
return Result.error("请至少选择一个项目进行复制!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
Date now = new Date();
List<LawsAssess> lawsAssesses = new ArrayList<>();
@@ -236,9 +234,6 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
assess.setUpdateTime(now);
lawsAssesses.add(assess);
}
if (lawsAssesses.isEmpty()){
return Result.error("复制项目标准全部存在,请重新选择项目!");
}
lawsAssessService.saveBatch(lawsAssesses);
return Result.OK("操作成功!");
}
@@ -253,10 +248,10 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
@PostMapping(value = "/delete")
public Result<T> delete(@RequestBody Map<String, String> map) {
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
return Result.error("请选择数据!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
lawsAssessService.deleteById(map.get("id"));
return Result.OK("删除成功!");
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@@ -284,7 +279,7 @@ public class LawsAssessController extends JeroController<LawsAssess, ILawsAssess
dos = lawsAssessService.list(queryWrapper);
}
if (dos.isEmpty()){
throw new JeroBootException("请选择数据导出!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
this.assignment(dos);
@@ -6,6 +6,9 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon;
import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet;
import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -83,7 +86,7 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
@PostMapping(value = "/add")
public Result<T> add(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) {
lawsEvaluationNotMetService.add(lawsEvaluationNotMet);
return Result.OK("操作成功!");
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
@@ -97,7 +100,7 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
@PostMapping(value = "/edit")
public Result<T> edit(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) {
lawsEvaluationNotMetService.editById(lawsEvaluationNotMet);
return Result.OK("操作成功!");
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
@@ -111,10 +114,10 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
@PostMapping(value = "/delete")
public Result<T> delete(@RequestBody Map<String, String> map) {
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
return Result.error("请选择数据!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
lawsEvaluationNotMetService.deleteById(map.get("id"));
return Result.OK("删除成功!");
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
@@ -128,10 +131,10 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
@PostMapping(value = "/deleteBatch")
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
return Result.error("请选择数据!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
this.lawsEvaluationNotMetService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
return Result.OK("批量删除成功!");
return Result.OK(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
}
/**
@@ -146,7 +149,7 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
public Result<LawsEvaluationNotMet> queryById(@RequestParam(name="id",required=true) String id) {
LawsEvaluationNotMet lawsEvaluationNotMet = lawsEvaluationNotMetService.queryById(id);
if(lawsEvaluationNotMet==null) {
return Result.error("未找到对应数据");
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
return Result.OK(lawsEvaluationNotMet);
}
@@ -24,6 +24,7 @@ import com.jero.modules.system.service.ISysUserService;
import com.sun.deploy.net.URLEncoder;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -54,6 +55,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 分页列表查询
*/
@RequiresPermissions("vehicleItemLibrary:search")
@AutoLog(value = "项目库-分页列表查询")
@ApiOperation(value="项目库-分页列表查询", notes="项目库-分页列表查询")
@GetMapping(value = "/page")
@@ -69,6 +71,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 添加
*/
@RequiresPermissions("vehicleItemLibrary:add")
@AutoLog(value = "项目库-添加")
@ApiOperation(value="项目库-添加", notes="项目库-添加")
@PostMapping(value = "/add")
@@ -81,6 +84,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 编辑
*/
@RequiresPermissions("vehicleItemLibrary:edit")
@AutoLog(value = "项目库-编辑")
@ApiOperation(value="项目库-编辑", notes="项目库-编辑")
@PostMapping(value = "/edit")
@@ -92,12 +96,13 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 通过id删除
*/
@RequiresPermissions("vehicleItemLibrary:delete")
@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!" : "请选择数据!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
lawsProjectLibraryService.deleteById(map.get("id"));
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
@@ -106,6 +111,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 批量删除
*/
@RequiresPermissions("vehicleItemLibrary:batchDel")
@AutoLog(value = "项目库-批量删除")
@ApiOperation(value="项目库-批量删除", notes="项目库-批量删除")
@PostMapping(value = "/deleteBatch")
@@ -114,7 +120,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
this.lawsProjectLibraryService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
return Result.error(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
return Result.OK(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
}
/**
@@ -126,7 +132,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
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!" : "未找到对应数据");
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
return Result.OK(lawsProjectLibrary);
}
@@ -134,6 +140,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
/**
* 导出excel
*/
@RequiresPermissions("vehicleItemLibrary:export")
@AutoLog(value = "项目库-导出excel")
@ApiOperation(value="项目库-导出excel", notes="项目库-导出excel")
@GetMapping(value = "/exportXls")
@@ -156,7 +163,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
dos = lawsProjectLibraryService.list(queryWrapper);
}
if (dos.isEmpty()){
throw new JeroBootException("请选择数据导出!");
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
this.translate(dos);