Commit f1b8c8dc authored by hkl's avatar hkl

feat:1.人工检查数据导入bug

parent 2a2816f0
......@@ -65,7 +65,6 @@
<properties>
<package.environment>dev</package.environment>
</properties>
</profile>
<!-- 黄康林本地配置-->
......
......@@ -95,10 +95,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
private IMovementTqiStandardManagerService movementTqiStandardManagerService;
@Resource
private AnalysisAlgorithmMapper analysisAlgorithmMapper;
@Resource
private IRailInspectionEquipmentItemService railInspectionEquipmentItemService;
@Resource
private IRailInspectionEquipmentItemDetailService railInspectionEquipmentItemDetailService;
@Resource
private AsyncTask asyncTask;
......@@ -285,40 +281,9 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
@ApiOperation(value = "删除动静态几何尺寸数据及相关联的数据", notes = "删除动静态几何尺寸数据及相关联的数据")
@GetMapping(value = "/delete")
public Result<String> delete(@ApiParam(name = "动静态几何尺寸数据id", required = true) String id, @ApiParam(name = "动静态几何尺寸数据类型", required = true) String type) {
if ("1".equals(type)) {
//人工静态检查相关
//删除里程详情
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
//删除里程相关
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
} else if ("2".equals(type)) {
// 删除里程
railInspectionEquipmentItemService.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, id).remove();
// 删除里程明细
railInspectionEquipmentItemDetailService.lambdaUpdate().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, id).remove();
} else if ("4".equals(type)) {
//删除添乘仪详情
movementAdditiveInfoService.lambdaUpdate().eq(MovementAdditiveInfo::getMovementMasterId, id).remove();
} else if ("3".equals(type)) {
//删除轨检车-》轨道动态几何尺寸容许值差管理值
movementDiferenceManagerService.lambdaUpdate().eq(MovementDiferenceManager::getMovementMasterId, id).remove();
//删除轨检车-》超限记录报告
movementOverReportService.lambdaUpdate().eq(MovementOverReport::getMovementMasterId, id).remove();
//删除轨检车-》区段总结报告
movementSectionReportService.lambdaUpdate().eq(MovementSectionReport::getMovementMasterId, id).remove();
//删除轨检车-》公里总结报告表
movementSummaryReportService.lambdaUpdate().eq(MovementSummaryReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里总结报告
movementTqiKilometerReportService.lambdaUpdate().eq(MovementTqiKilometerReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里状态评定标准
movementTqiKilometerStandardManagerService.lambdaUpdate().eq(MovementTqiKilometerStandardManager::getMovementMasterId, id).remove();
//删除轨检车-》TQI总结报告
movementTqiReportService.lambdaUpdate().eq(MovementTqiReport::getMovementMasterId, id).remove();
//删除轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
movementTqiStandardManagerService.lambdaUpdate().eq(MovementTqiStandardManager::getMovementMasterId, id).remove();
}
//删除动静态几何尺寸数据
this.service.lambdaUpdate().eq(MovementRecordsMaster::getId, id).remove();
this.movementRecordsMasterFace.delete(id, type);
return Result.OK("删除成功!");
}
......
......@@ -19,4 +19,6 @@ public interface MovementRecordsMasterFace {
void updateLabourCheckItem(MovementCourse record);
void uploadFile(MultipartFile file, String id);
void delete(String id, String type);
}
......@@ -8,13 +8,12 @@ import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementCourse;
import org.jeecg.modules.checkData.entity.MovementCourseInfo;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.entity.*;
import org.jeecg.modules.checkData.face.MovementRecordsMasterFace;
import org.jeecg.modules.checkData.service.IMovementCourseInfoService;
import org.jeecg.modules.checkData.service.IMovementCourseService;
import org.jeecg.modules.checkData.service.IMovementRecordsMasterService;
import org.jeecg.modules.checkData.service.*;
import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchCheckDataMap;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisAlgorithmMapper;
import org.jeecg.modules.dynamicStaticAnalysis.service.IAnalysisBatchCheckDataMapService;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
......@@ -25,6 +24,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
......@@ -39,6 +39,32 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
@Resource
private IMovementRecordsMasterService movementRecordsMasterService;
@Resource
private IMovementOverReportService movementOverReportService;
@Resource
private IMovementSectionReportService movementSectionReportService;
@Resource
private IMovementSummaryReportService movementSummaryReportService;
@Resource
private IMovementTqiKilometerReportService movementTqiKilometerReportService;
@Resource
private IMovementTqiKilometerStandardManagerService movementTqiKilometerStandardManagerService;
@Resource
private IMovementTqiReportService movementTqiReportService;
@Resource
private IMovementTqiStandardManagerService movementTqiStandardManagerService;
@Resource
private IMovementDiferenceManagerService movementDiferenceManagerService;
@Resource
private IMovementAdditiveInfoService movementAdditiveInfoService;
@Resource
private IRailInspectionEquipmentItemService railInspectionEquipmentItemService;
@Resource
private IRailInspectionEquipmentItemDetailService railInspectionEquipmentItemDetailService;
@Resource
private IAnalysisBatchCheckDataMapService analysisBatchCheckDataMapService;
@Override
public void saveLabourCheckItem(MovementCourse record) {
......@@ -299,6 +325,56 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
}
}
@Override
public void delete(String id, String type) {
List<AnalysisBatchCheckDataMap> existAnalysisList = analysisBatchCheckDataMapService.lambdaQuery()
.eq(AnalysisBatchCheckDataMap::getEkId, id)
.list();
if (ObjectUtil.isNotEmpty(existAnalysisList)) {
Optional<String> optionalStr = existAnalysisList.stream()
.map(AnalysisBatchCheckDataMap::getAnalysisBatchCode)
.reduce((analysisBatchCode1, analysisBatchCode2) -> analysisBatchCode1 + "," + analysisBatchCode2);
String msg = "该数据下关联分析批次:【" + optionalStr.get() + "】";
throw JeecgBootException.error(msg);
}
if ("1".equals(type)) {
//人工静态检查相关
//删除里程详情
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
//删除里程相关
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
} else if ("2".equals(type)) {
// 删除里程
railInspectionEquipmentItemService.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, id).remove();
// 删除里程明细
railInspectionEquipmentItemDetailService.lambdaUpdate().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, id).remove();
} else if ("4".equals(type)) {
//删除添乘仪详情
movementAdditiveInfoService.lambdaUpdate().eq(MovementAdditiveInfo::getMovementMasterId, id).remove();
} else if ("3".equals(type)) {
//删除轨检车-》轨道动态几何尺寸容许值差管理值
movementDiferenceManagerService.lambdaUpdate().eq(MovementDiferenceManager::getMovementMasterId, id).remove();
//删除轨检车-》超限记录报告
movementOverReportService.lambdaUpdate().eq(MovementOverReport::getMovementMasterId, id).remove();
//删除轨检车-》区段总结报告
movementSectionReportService.lambdaUpdate().eq(MovementSectionReport::getMovementMasterId, id).remove();
//删除轨检车-》公里总结报告表
movementSummaryReportService.lambdaUpdate().eq(MovementSummaryReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里总结报告
movementTqiKilometerReportService.lambdaUpdate().eq(MovementTqiKilometerReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里状态评定标准
movementTqiKilometerStandardManagerService.lambdaUpdate().eq(MovementTqiKilometerStandardManager::getMovementMasterId, id).remove();
//删除轨检车-》TQI总结报告
movementTqiReportService.lambdaUpdate().eq(MovementTqiReport::getMovementMasterId, id).remove();
//删除轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
movementTqiStandardManagerService.lambdaUpdate().eq(MovementTqiStandardManager::getMovementMasterId, id).remove();
}
//删除动静态几何尺寸数据
movementRecordsMasterService.lambdaUpdate().eq(MovementRecordsMaster::getId, id).remove();
}
/**
* 当前行处理器
......
......@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem;
......@@ -28,6 +30,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -105,7 +108,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
items.add(item);
// 读取item详情
int skipRow = readItemDetail(i, titleHeader, item.getId(), rowRecords, itemDetails);
int skipRow = readItemDetail(i, titleHeader, item, rowRecords, itemDetails);
i = i + skipRow;
sort++;
} else {
......@@ -127,7 +130,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
}
}
private int readItemDetail(int rows, String titleHeader, String itemId, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) {
private int readItemDetail(int rows, String titleHeader, RailInspectionEquipmentItem item, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) {
// 解析检查项目:1行:跳过2行不解析
List<Object> checkItems = rowRecords.get(rows + 2);
// 解析测点:1行
......@@ -153,7 +156,8 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail();
itemDetail.setId(UUIDGenerator.generate());
itemDetail.setRailInspectionEquipmentItemId(itemId);
itemDetail.setRailInspectionEquipmentId(item.getRailInspectionEquipmentId());
itemDetail.setRailInspectionEquipmentItemId(item.getId());
// 检查项目
String checkItem = checkItems.get(i).toString();
itemDetail.setCheckItem(checkItem);
......@@ -173,7 +177,17 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
// 测点值向后偏移一个
itemDetail.setMeasurePoint(measurePoint + 1);
// 获取登录用户信息
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (ObjectUtil.isNotEmpty(loginUser)) {
itemDetail.setCreateBy(loginUser.getRealname());
itemDetail.setUpdateBy(loginUser.getRealname());
}
itemDetail.setInfoSort(sort++);
itemDetail.setDelFlag("0");
itemDetail.setCreateTime(new Date());
itemDetail.setUpdateTime(new Date());
itemDetails.add(itemDetail);
}
......
......@@ -740,7 +740,12 @@ public class AnalysisAlgorithm {
// 2.根据分析批次的里程查询出映射单元
List<MovementOverReportUnitDeviceMap> overReportUnitDeviceMaps = new ArrayList<>();
List<MovementTqiReportUnitDeviceMap> movementTqiReportUnitDeviceMaps = new ArrayList<>();
List<String> unitDeviceIds = new ArrayList<>();
for (Map<String, Object> unitDevice : unitDeviceList) {
// 添加所有单元ID
String unitDeviceId = Convert.toStr(unitDevice.get("id"));
unitDeviceIds.add(unitDeviceId);
BigDecimal startMileage = Convert.toBigDecimal(unitDevice.get("startMileage"));
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
BigDecimal endMileage = Convert.toBigDecimal(unitDevice.get("endMileage"));
......@@ -1054,6 +1059,20 @@ public class AnalysisAlgorithm {
unitDevice.put("railVehicleCheckScoreList", scoreList);
}
// 3.先删除旧的关联关系,在新增
movementOverReportUnitDeviceMapService.lambdaUpdate()
.in(MovementOverReportUnitDeviceMap::getUnitId, unitDeviceIds)
.remove();
movementOverReportUnitDeviceMapService.saveBatch(overReportUnitDeviceMaps);
movementTqiReportUnitDeviceMapService.lambdaUpdate()
.in(MovementTqiReportUnitDeviceMap::getUnitId, unitDeviceIds)
.remove();
movementTqiReportUnitDeviceMapService.saveBatch(movementTqiReportUnitDeviceMaps);
}
/**
......
package org.jeecg.modules.dynamicStaticAnalysis.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -42,7 +43,9 @@ public class AnalysisBatchUnitDeviceController extends JeecgController<AnalysisB
@PostMapping(value = "/listRecord")
public Result<IPage<AnalysisBatchUnitDeviceVO>> listRecord(@RequestBody AnalysisBatchUnitDeviceDTO dto) {
Page<AnalysisBatchUnitDeviceVO> pageData = new Page<>(dto.getPageNo(), dto.getPageSize());
pageData = this.service.listRecord(pageData, dto);
if (ObjectUtil.isNotEmpty(dto.getUnitTypeList()) && ObjectUtil.isNotEmpty(dto.getGradeJudgeList())) {
pageData = this.service.listRecord(pageData, dto);
}
return Result.OK(pageData);
......
......@@ -300,7 +300,7 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
message = "选中" + totalNum + "条数据已删除数据" + successNum + "条";
if (totalNum - successNum > 0) {
message = message + ",未删除" + failNum + "条。未删除" + failMessage + "原因是线路下面有关联设备故不能被删除";
message = message + ",未删除" + failNum + "条。未删除" + failMessage + "原因是区间下面有关联数据故不能被删除";
}
return Result.batchDelete(message);
}
......
package org.jeecg.modules.system.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiParam;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.mapper.SysDictMapper;
import org.jeecg.modules.system.model.DuplicateCheckVo;
import org.jeecg.modules.system.security.DictQueryBlackListHandler;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -25,7 +21,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.*;
/**
* @Title: DuplicateCheckAction
......@@ -40,14 +36,59 @@ import java.util.List;
@Api(tags = "重复校验")
public class DuplicateCheckController {
@Autowired
SysDictMapper sysDictMapper;
@Resource
private SysDictMapper sysDictMapper;
@Autowired
DictQueryBlackListHandler dictQueryBlackListHandler;
@Resource
private DictQueryBlackListHandler dictQueryBlackListHandler;
@Autowired
private ISysUserService sysUserService;
@RequestMapping(value = "/checks", method = RequestMethod.GET)
@ApiOperation("重复校验接口")
public Result<String> doDuplicateChecks(HttpServletRequest request) {
Map<String, String[]> requestParameterMap = request.getParameterMap();
// 如果参数为空或者表名不传
if (requestParameterMap.size() == 0 || ObjectUtil.isEmpty(requestParameterMap.get("tableName"))) {
Result<String> rs = new Result<>();
rs.setCode(500);
rs.setSuccess(true);
rs.setMessage("数据为空,不作处理!");
return rs;
}
Map<String, String> map = new LinkedHashMap<>();
StringBuilder checkSql = new StringBuilder();
String[] sqlInjCheckValues = new String[requestParameterMap.size()];
int i = 0;
for (Map.Entry<String, String[]> entry : requestParameterMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue()[0];
if (ObjectUtil.isEmpty(value)) {
continue;
}
sqlInjCheckValues[i++] = value;
checkSql.append(value).append(SymbolConstant.COMMA);
map.put(key, value);
}
// SQL注入校验(只限制非法串改数据库)
SqlInjectionUtil.filterContent(sqlInjCheckValues);
if (!dictQueryBlackListHandler.isPass(checkSql.toString())) {
return Result.error(dictQueryBlackListHandler.getError());
}
// 验证参数
Long num = sysDictMapper.duplicateCheckCountSqlByPrams(map);
if (num == null || num == 0) {
// 该值可用
return Result.ok("该值可用!");
} else {
// 该值不可用
log.info("该值不可用,系统中已存在!");
return Result.error("");
}
}
/**
* 校验数据是否在系统中是否存在
......@@ -93,40 +134,11 @@ public class DuplicateCheckController {
} else {
// 该值不可用
log.info("该值不可用,系统中已存在!");
// return Result.error("该值不可用,系统中已存在!");
return Result.error("");
}
}
/**
* 校验用户相关信息是否存在
*
* @return
*/
// @RequestMapping(value = "/checkUser", method = RequestMethod.GET)
// @ApiOperation("校验用户相关信息是否存在")
// public Result<String> checkUser(@ApiParam(name = "需要校验的参数", required = true) String name,@ApiParam(name = "类型", required = true) String type) {
// LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery();
// if("1".equals(type)){
// lambdaQuery.eq(SysUser::getUsername, name);
// }
// if("2".equals(type)){
// lambdaQuery.eq(SysUser::getRealname, name);
// }
// if("3".equals(type)){
// lambdaQuery.eq(SysUser::getWorkNo, name);
// }
// if("4".equals(type)){
// lambdaQuery.eq(SysUser::getPhone, name);
// }
// lambdaQuery.eq(SysUser::getDelFlag, 0);
// List<SysUser> list = sysUserService.list(lambdaQuery);
// if (list != null && list.size() > 0) {
// return Result.error("参数已存在");
// }
// return Result.ok("");
// }
/**
* VUEN-2584【issue】平台sql注入漏洞几个问题
* 部分特殊函数 可以将查询结果混夹在错误信息中,导致数据库的信息暴露
*
......
......@@ -26,104 +26,114 @@ import java.util.Map;
* @since 2018-12-28
*/
public interface SysDictMapper extends BaseMapper<SysDict> {
/**
* 重复检查SQL
/**
* 重复检查SQL
*
* @param duplicateCheckVo
* @return
*/
@Deprecated
public Long duplicateCheckCountSql(DuplicateCheckVo duplicateCheckVo);
* @return
*/
@Deprecated
public Long duplicateCheckCountSql(DuplicateCheckVo duplicateCheckVo);
/**
* 重复校验 sql语句
*
* @param duplicateCheckVo
* @return
*/
@Deprecated
public Long duplicateCheckCountSqlNoDataId(DuplicateCheckVo duplicateCheckVo);
@Deprecated
public Long duplicateCheckCountSqlNoDataId(DuplicateCheckVo duplicateCheckVo);
/**
* 通过字典code获取字典数据
*
* @param code 字典code
* @return List<DictModel>
* @return List<DictModel>
*/
public List<DictModel> queryDictItemsByCode(@Param("code") String code);
public List<DictModel> queryDictItemsByCode(@Param("code") String code);
/**
* 查询有效的数据字典项
* @param code
* @return
*/
List<DictModel> queryEnableDictItemsByCode(@Param("code") String code);
/**
* 查询有效的数据字典项
*
* @param code
* @return
*/
List<DictModel> queryEnableDictItemsByCode(@Param("code") String code);
/**
* 通过多个字典code获取字典数据
*
* @param dictCodeList
* @return
*/
public List<DictModelMany> queryDictItemsByCodeList(@Param("dictCodeList") List<String> dictCodeList);
/**
* 通过多个字典code获取字典数据
*
* @param dictCodeList
* @return
*/
public List<DictModelMany> queryDictItemsByCodeList(@Param("dictCodeList") List<String> dictCodeList);
/**
* 通过查询指定table的 text code 获取字典
*
* @param table
* @param text
* @param code
* @return List<DictModel>
*/
@Deprecated
public List<DictModel> queryTableDictItemsByCode(@Param("table") String table,@Param("text") String text,@Param("code") String code);
@Deprecated
public List<DictModel> queryTableDictItemsByCode(@Param("table") String table, @Param("text") String text, @Param("code") String code);
/**
* 通过查询指定table的 text code 获取字典(指定查询条件)
*
* @param table
* @param text
* @param code
* @param filterSql
* @return List<DictModel>
*/
@Deprecated
public List<DictModel> queryTableDictItemsByCodeAndFilter(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("filterSql") String filterSql);
@Deprecated
public List<DictModel> queryTableDictItemsByCodeAndFilter(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
/**
* 通过查询指定table的 text code 获取字典
*
* @param table
* @param key
* @param value
* @return List<Map<String,String>>
* @return List<Map < String, String>>
*/
@Deprecated
@Select("select ${key} as \"label\",${value} as \"value\" from ${table}")
public List<Map<String,String>> getDictByTableNgAlain(@Param("table") String table, @Param("key") String key, @Param("value") String value);
@Deprecated
@Select("select ${key} as \"label\",${value} as \"value\" from ${table}")
public List<Map<String, String>> getDictByTableNgAlain(@Param("table") String table, @Param("key") String key, @Param("value") String value);
/**
* 通过字典code获取字典数据
*
* @param code
* @param key
* @return
*/
public String queryDictTextByKey(@Param("code") String code,@Param("key") String key);
public String queryDictTextByKey(@Param("code") String code, @Param("key") String key);
/**
* 可通过多个字典code查询翻译文本
* @param dictCodeList 多个字典code
* @param keys 数据列表
* @return
*/
List<DictModelMany> queryManyDictByKeys(@Param("dictCodeList") List<String> dictCodeList, @Param("keys") List<String> keys);
/**
* 可通过多个字典code查询翻译文本
*
* @param dictCodeList 多个字典code
* @param keys 数据列表
* @return
*/
List<DictModelMany> queryManyDictByKeys(@Param("dictCodeList") List<String> dictCodeList, @Param("keys") List<String> keys);
/**
* 通过查询指定table的 text code key 获取字典值
*
* @param table
* @param text
* @param code
* @param key
* @return String
*/
@Deprecated
public String queryTableDictTextByKey(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("key") String key);
@Deprecated
public String queryTableDictTextByKey(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("key") String key);
// /**
// * 通过查询指定table的 text code key 获取字典值,可批量查询
......@@ -148,18 +158,20 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
//// @Deprecated
//// public List<DictModel> queryTableictByKeys(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyArray") String[] keyArray);
/**
* 查询所有部门 作为字典信息 id -->value,departName -->text
* @return
*/
public List<DictModel> queryAllDepartBackDictModel();
/**
* 查询所有用户 作为字典信息 username -->value,realname -->text
* @return
*/
public List<DictModel> queryAllUserBackDictModel();
/**
* 查询所有部门 作为字典信息 id -->value,departName -->text
*
* @return
*/
public List<DictModel> queryAllDepartBackDictModel();
/**
* 查询所有用户 作为字典信息 username -->value,realname -->text
*
* @return
*/
public List<DictModel> queryAllUserBackDictModel();
// /**
// * 通过关键字查询出字典表
// * @param table
......@@ -183,93 +195,104 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
// */
// //IPage<DictModel> queryTableDictItems(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyword") String keyword);
/**
* 根据表名、显示字段名、存储字段名 查询树
* @param table
* @param text
* @param code
* @param pid
* @param hasChildField
/**
* 根据表名、显示字段名、存储字段名 查询树
*
* @param table
* @param text
* @param code
* @param pid
* @param hasChildField
* @param query
* @param pidField
* @return
*/
@Deprecated
List<TreeSelectModel> queryTreeList(@Param("query") Map<String, String> query,@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("pidField") String pidField,@Param("pid") String pid,@Param("hasChildField") String hasChildField,@Param("converIsLeafVal") int converIsLeafVal);
/**
* 删除
* @param id
*/
@Select("delete from sys_dict where id = #{id}")
public void deleteOneById(@Param("id") String id);
/**
* 查询被逻辑删除的数据
* @return
*/
@Select("select * from sys_dict where del_flag = 1")
public List<SysDict> queryDeleteList();
/**
* 修改状态值
* @param delFlag
* @param id
*/
@Update("update sys_dict set del_flag = #{flag,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR}")
public void updateDictDelFlag(@Param("flag") int delFlag, @Param("id") String id);
/**
* 分页查询字典表数据
* @param page
* @param query
* @return
*/
@Deprecated
public Page<DictModel> queryDictTablePageList(Page page, @Param("query") DictQuery query);
/**
* 查询 字典表数据 支持查询条件 分页
* @param page
* @param table
* @param text
* @param code
* @param filterSql
* @return
*/
@Deprecated
IPage<DictModel> queryTableDictWithFilter(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
/**
* 查询 字典表数据 支持查询条件 查询所有
* @param table
* @param text
* @param code
* @param filterSql
* @return
*/
@Deprecated
List<DictModel> queryAllTableDictItems(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
/**
* 查询字典表的数据
* @param table 表名
* @param text 显示字段名
* @param code 存储字段名
* @param filterSql 条件sql
* @param codeValues 存储字段值 作为查询条件in
* @return
*/
List<DictModel> queryTableDictByKeysAndFilterSql(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql, @Param("codeValues") List<String> codeValues);
/**
* 根据应用id获取字典列表和详情
* @param lowAppId
* @param tenantId
* @return
*/
@InterceptorIgnore(tenantLine = "true")
* @return
*/
@Deprecated
List<TreeSelectModel> queryTreeList(@Param("query") Map<String, String> query, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("pidField") String pidField, @Param("pid") String pid, @Param("hasChildField") String hasChildField, @Param("converIsLeafVal") int converIsLeafVal);
/**
* 删除
*
* @param id
*/
@Select("delete from sys_dict where id = #{id}")
public void deleteOneById(@Param("id") String id);
/**
* 查询被逻辑删除的数据
*
* @return
*/
@Select("select * from sys_dict where del_flag = 1")
public List<SysDict> queryDeleteList();
/**
* 修改状态值
*
* @param delFlag
* @param id
*/
@Update("update sys_dict set del_flag = #{flag,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR}")
public void updateDictDelFlag(@Param("flag") int delFlag, @Param("id") String id);
/**
* 分页查询字典表数据
*
* @param page
* @param query
* @return
*/
@Deprecated
public Page<DictModel> queryDictTablePageList(Page page, @Param("query") DictQuery query);
/**
* 查询 字典表数据 支持查询条件 分页
*
* @param page
* @param table
* @param text
* @param code
* @param filterSql
* @return
*/
@Deprecated
IPage<DictModel> queryTableDictWithFilter(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
/**
* 查询 字典表数据 支持查询条件 查询所有
*
* @param table
* @param text
* @param code
* @param filterSql
* @return
*/
@Deprecated
List<DictModel> queryAllTableDictItems(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
/**
* 查询字典表的数据
*
* @param table 表名
* @param text 显示字段名
* @param code 存储字段名
* @param filterSql 条件sql
* @param codeValues 存储字段值 作为查询条件in
* @return
*/
List<DictModel> queryTableDictByKeysAndFilterSql(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql, @Param("codeValues") List<String> codeValues);
/**
* 根据应用id获取字典列表和详情
*
* @param lowAppId
* @param tenantId
* @return
*/
@InterceptorIgnore(tenantLine = "true")
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
Long duplicateCheckCountSqlByPrams(@Param("map") Map<String, String> map);
}
......@@ -2,233 +2,264 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.SysDictMapper">
<!-- 通过字典code获取字典数据 -->
<select id="queryDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code})
order by s.sort_order asc, s.create_time DESC;
</select>
<!-- 通过字典code获取有效的字典数据项 -->
<select id="queryEnableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code})
and s.status = 1
order by s.sort_order asc, s.create_time DESC;
</select>
<!-- 通过多个字典code获取字典数据 -->
<select id="queryDictItemsByCodeList" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany">
SELECT
dict.dict_code,
item.item_text AS "text",
item.item_value AS "value"
FROM
sys_dict_item item
INNER JOIN sys_dict dict ON dict.id = item.dict_id
WHERE dict.dict_code IN (
<foreach item="dictCode" collection="dictCodeList" separator=",">
#{dictCode}
</foreach>
)
ORDER BY item.sort_order ASC
</select>
<!-- 通过字典code获取字典数据 -->
<select id="queryDictTextByKey" parameterType="String" resultType="String">
select s.item_text from sys_dict_item s
where s.dict_id = (select id from sys_dict where dict_code = #{code})
and s.item_value = #{key}
</select>
<!-- 通过字典code获取字典数据,可批量查询 -->
<select id="queryManyDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany">
SELECT
dict.dict_code,
item.item_text AS "text",
item.item_value AS "value"
FROM
sys_dict_item item
INNER JOIN sys_dict dict ON dict.id = item.dict_id
WHERE dict.dict_code IN (
<foreach item="dictCode" collection="dictCodeList" separator=",">
#{dictCode}
</foreach>
)
AND item.item_value IN (
<foreach item="key" collection="keys" separator=",">
#{key}
</foreach>
)
</select>
<!--通过查询指定table的 text code 获取字典-->
<select id="queryTableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table}
</select>
<!--通过查询指定table的 text code 获取字典(指定查询条件)-->
<select id="queryTableDictItemsByCodeAndFilter" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
where ${filterSql}
</if>
</select>
<!--通过查询指定table的 text code key 获取字典值-->
<select id="queryTableDictTextByKey" parameterType="String" resultType="String">
select ${text} as "text" from ${table} where ${code}= #{key}
</select>
<!--通过查询指定table的 text code key 获取字典值,可批量查询
<select id="queryTableDictTextByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
<foreach item="key" collection="keys" separator=",">
#{key}
</foreach>
)
</select>-->
<!--通过查询指定table的 text code key 获取字典值,包含value
<select id="queryTableDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} in
<foreach item="key" collection="keyArray" open="(" separator="," close=")">
#{key}
</foreach>
</select>-->
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSql" resultType="Long" parameterType="org.jeecg.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal} and id &lt;&gt; #{dataId}
</select>
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSqlNoDataId" resultType="Long" parameterType="org.jeecg.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal}
</select>
<!-- 查询部门信息 作为字典数据 -->
<select id="queryAllDepartBackDictModel" resultType="org.jeecg.common.system.vo.DictModel">
select id as "value",depart_name as "text" from sys_depart where del_flag = '0'
</select>
<!-- 查询用户信息 作为字典数据 -->
<select id="queryAllUserBackDictModel" resultType="org.jeecg.common.system.vo.DictModel">
select username as "value",realname as "text" from sys_user where del_flag = '0'
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字查询
<select id="queryTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table} where ${text} like #{keyword}
</select> -->
<!-- 根据表名、显示字段名、存储字段名、父ID查询树 -->
<select id="queryTreeList" parameterType="Object" resultType="org.jeecg.modules.system.model.TreeSelectModel">
select ${text} as "title",
${code} as "key",
<!-- udapte-begin-author:taoyan date:20211115 for: 自定义树控件只显示父节点,子节点无法展开 (此处还原不可再改) /issues/I4HZAL -->
<if test="hasChildField != null and hasChildField != ''">
<choose>
<when test="converIsLeafVal!=null and converIsLeafVal==1">
(case when ${hasChildField} = '1' then 0 else 1 end) as isLeaf,
</when>
<otherwise>
${hasChildField} as isLeaf,
</otherwise>
</choose>
</if>
<!-- udapte-end-author:taoyan date:20211115 for: 自定义树控件只显示父节点,子节点无法展开 (此处还原不可再改) /issues/I4HZAL -->
${pidField} as parentId
from ${table}
where
<!-- udapte-begin-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
<if test="query == null">
<choose>
<when test="pid != null and pid != ''">
${pidField} = #{pid}
</when>
<otherwise>
(${pidField} = '' OR ${pidField} IS NULL)
</otherwise>
</choose>
</if>
<if test="query!= null">
1 = 1
<foreach collection="query.entrySet()" item="value" index="key" >
<choose>
<when test="key == 'tenant_id'">
and tenant_id = #{value}
</when>
<otherwise>
and ${key} LIKE #{value}
</otherwise>
</choose>
</foreach>
<!-- udapte-end-author:sunjianlei date:20220615 for: 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
<choose>
<when test="pid != null and pid != ''">
and ${pidField} = #{pid}
</when>
<otherwise>
and (${pidField} = '' OR ${pidField} IS NULL)
</otherwise>
</choose>
<!-- udapte-end-author:sunjianlei date:20220615 for: 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
</if>
<!-- udapte-end-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
</select>
<!-- 分页查询字典表数据 -->
<select id="queryDictTablePageList" parameterType="Object" resultType="org.jeecg.common.system.vo.DictModel">
select ${query.text} as "text",${query.code} as "value" from ${query.table}
where 1 = 1
<if test="query.keyword != null and query.keyword != ''">
<bind name="bindKeyword" value="'%'+query.keyword+'%'"/>
and (${query.text} like #{bindKeyword} or ${query.code} like #{bindKeyword})
</if>
<if test="query.codeValue != null and query.codeValue != ''">
and ${query.code} = #{query.codeValue}
</if>
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 分页-->
<select id="queryTableDictWithFilter" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
${filterSql}
</if>
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 获取所有 -->
<select id="queryAllTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
${filterSql}
</if>
</select>
<!-- 查询字典表的数据 支持设置过滤条件、设置存储值作为in查询条件 -->
<select id="queryTableDictByKeysAndFilterSql" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
<foreach item="key" collection="codeValues" separator=",">
#{key}
</foreach>
)
<if test="filterSql != null and filterSql != ''">
and ${filterSql}
</if>
</select>
<!--根据应用id获取字典列表和详情-->
<select id="getDictListByLowAppId" resultType="org.jeecg.modules.system.entity.SysDict">
select id,dict_name,dict_code from sys_dict
where
del_flag = 0
and low_app_id = #{lowAppId}
and tenant_id = #{tenantId}
</select>
<!-- 通过字典code获取字典数据 -->
<select id="queryDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select s.item_value as "value", s.item_text as "text"
from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code})
order by s.sort_order asc, s.create_time DESC;
</select>
<!-- 通过字典code获取有效的字典数据项 -->
<select id="queryEnableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select s.item_value as "value", s.item_text as "text"
from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code})
and s.status = 1
order by s.sort_order asc, s.create_time DESC;
</select>
<!-- 通过多个字典code获取字典数据 -->
<select id="queryDictItemsByCodeList" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany">
SELECT
dict.dict_code,
item.item_text AS "text",
item.item_value AS "value"
FROM
sys_dict_item item
INNER JOIN sys_dict dict ON dict.id = item.dict_id
WHERE dict.dict_code IN (
<foreach item="dictCode" collection="dictCodeList" separator=",">
#{dictCode}
</foreach>
)
ORDER BY item.sort_order ASC
</select>
<!-- 通过字典code获取字典数据 -->
<select id="queryDictTextByKey" parameterType="String" resultType="String">
select s.item_text
from sys_dict_item s
where s.dict_id = (select id from sys_dict where dict_code = #{code})
and s.item_value = #{key}
</select>
<!-- 通过字典code获取字典数据,可批量查询 -->
<select id="queryManyDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany">
SELECT
dict.dict_code,
item.item_text AS "text",
item.item_value AS "value"
FROM
sys_dict_item item
INNER JOIN sys_dict dict ON dict.id = item.dict_id
WHERE dict.dict_code IN (
<foreach item="dictCode" collection="dictCodeList" separator=",">
#{dictCode}
</foreach>
)
AND item.item_value IN (
<foreach item="key" collection="keys" separator=",">
#{key}
</foreach>
)
</select>
<!--通过查询指定table的 text code 获取字典-->
<select id="queryTableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value"
from ${table}
</select>
<!--通过查询指定table的 text code 获取字典(指定查询条件)-->
<select id="queryTableDictItemsByCodeAndFilter" parameterType="String"
resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
where ${filterSql}
</if>
</select>
<!--通过查询指定table的 text code key 获取字典值-->
<select id="queryTableDictTextByKey" parameterType="String" resultType="String">
select ${text} as "text"
from ${table}
where ${code} = #{key}
</select>
<!--通过查询指定table的 text code key 获取字典值,可批量查询
<select id="queryTableDictTextByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
<foreach item="key" collection="keys" separator=",">
#{key}
</foreach>
)
</select>-->
<!--通过查询指定table的 text code key 获取字典值,包含value
<select id="queryTableDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} in
<foreach item="key" collection="keyArray" open="(" separator="," close=")">
#{key}
</foreach>
</select>-->
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSql" resultType="Long"
parameterType="org.jeecg.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*)
FROM ${tableName}
WHERE ${fieldName} = #{fieldVal}
and id &lt;&gt; #{dataId}
</select>
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSqlNoDataId" resultType="Long"
parameterType="org.jeecg.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*)
FROM ${tableName}
WHERE ${fieldName} = #{fieldVal}
</select>
<!-- 查询部门信息 作为字典数据 -->
<select id="queryAllDepartBackDictModel" resultType="org.jeecg.common.system.vo.DictModel">
select id as "value", depart_name as "text"
from sys_depart
where del_flag = '0'
</select>
<!-- 查询用户信息 作为字典数据 -->
<select id="queryAllUserBackDictModel" resultType="org.jeecg.common.system.vo.DictModel">
select username as "value", realname as "text"
from sys_user
where del_flag = '0'
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字查询
<select id="queryTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table} where ${text} like #{keyword}
</select> -->
<!-- 根据表名、显示字段名、存储字段名、父ID查询树 -->
<select id="queryTreeList" parameterType="Object" resultType="org.jeecg.modules.system.model.TreeSelectModel">
select ${text} as "title",
${code} as "key",
<!-- udapte-begin-author:taoyan date:20211115 for: 自定义树控件只显示父节点,子节点无法展开 (此处还原不可再改) /issues/I4HZAL -->
<if test="hasChildField != null and hasChildField != ''">
<choose>
<when test="converIsLeafVal!=null and converIsLeafVal==1">
(case when ${hasChildField} = '1' then 0 else 1 end) as isLeaf,
</when>
<otherwise>
${hasChildField} as isLeaf,
</otherwise>
</choose>
</if>
<!-- udapte-end-author:taoyan date:20211115 for: 自定义树控件只显示父节点,子节点无法展开 (此处还原不可再改) /issues/I4HZAL -->
${pidField} as parentId
from ${table}
where
<!-- udapte-begin-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
<if test="query == null">
<choose>
<when test="pid != null and pid != ''">
${pidField} = #{pid}
</when>
<otherwise>
(${pidField} = '' OR ${pidField} IS NULL)
</otherwise>
</choose>
</if>
<if test="query!= null">
1 = 1
<foreach collection="query.entrySet()" item="value" index="key">
<choose>
<when test="key == 'tenant_id'">
and tenant_id = #{value}
</when>
<otherwise>
and ${key} LIKE #{value}
</otherwise>
</choose>
</foreach>
<!-- udapte-end-author:sunjianlei date:20220615 for: 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
<choose>
<when test="pid != null and pid != ''">
and ${pidField} = #{pid}
</when>
<otherwise>
and (${pidField} = '' OR ${pidField} IS NULL)
</otherwise>
</choose>
<!-- udapte-end-author:sunjianlei date:20220615 for: 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
</if>
<!-- udapte-end-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
</select>
<!-- 分页查询字典表数据 -->
<select id="queryDictTablePageList" parameterType="Object" resultType="org.jeecg.common.system.vo.DictModel">
select ${query.text} as "text",${query.code} as "value" from ${query.table}
where 1 = 1
<if test="query.keyword != null and query.keyword != ''">
<bind name="bindKeyword" value="'%'+query.keyword+'%'"/>
and (${query.text} like #{bindKeyword} or ${query.code} like #{bindKeyword})
</if>
<if test="query.codeValue != null and query.codeValue != ''">
and ${query.code} = #{query.codeValue}
</if>
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 分页-->
<select id="queryTableDictWithFilter" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
${filterSql}
</if>
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 获取所有 -->
<select id="queryAllTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table}
<if test="filterSql != null and filterSql != ''">
${filterSql}
</if>
</select>
<!-- 查询字典表的数据 支持设置过滤条件、设置存储值作为in查询条件 -->
<select id="queryTableDictByKeysAndFilterSql" parameterType="String"
resultType="org.jeecg.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
<foreach item="key" collection="codeValues" separator=",">
#{key}
</foreach>
)
<if test="filterSql != null and filterSql != ''">
and ${filterSql}
</if>
</select>
<!--根据应用id获取字典列表和详情-->
<select id="getDictListByLowAppId" resultType="org.jeecg.modules.system.entity.SysDict">
select id, dict_name, dict_code
from sys_dict
where del_flag = 0
and low_app_id = #{lowAppId}
and tenant_id = #{tenantId}
</select>
<select id="duplicateCheckCountSqlByPrams" resultType="java.lang.Long">
SELECT COUNT(*) FROM ${map.tableName} WHERE 1=1
<foreach collection="map" index="key" item="value">
<if test="key != 'tableName' and key != 'id'">
AND ${key} = #{value}
</if>
<if test="key == 'id'">
AND ${key} &lt;&gt; #{value}
</if>
</foreach>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment