1.调整部分查询

master
x_z 3 years ago
parent 896c73a563
commit 065577e40b

@ -2,6 +2,7 @@ package com.glxp.udi.admin.controller.info;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse;
@ -57,7 +58,7 @@ public class PlatformController {
@AuthRuleAnnotation("")
@GetMapping("/udims/platform/list")
public BaseResponse list(@RequestParam Map<String, Object> params) {
Page<PlatformEntity> page = platformService.list(params);
IPage<PlatformEntity> page = platformService.list(params);
PageSimpleResponse<PlatformEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());

@ -16,10 +16,6 @@ public interface SystemParamConfigDao extends BaseMapper<SystemParamConfigEntity
SystemParamConfigEntity selectByParamName(SystemParamConfigRequest systemParamConfigRequest);
SystemParamConfigEntity selectByParamKey(SystemParamConfigRequest systemParamConfigRequest);
SystemParamConfigEntity selectByParamKey(@Param("paramKey") String paramKey);
boolean updateById(SystemParamConfigSaveRequest systemParamConfigSaveRequest);
boolean updateParentId(SystemParamConfigSaveRequest systemParamConfigSaveRequest);

@ -5,6 +5,8 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.dao.info.PlatformDao;
@ -67,14 +69,24 @@ public class PlatformService {
return true;
}
public Page<PlatformEntity> list(Map<String, Object> map) {
Page<PlatformEntity> pageParam = new Page<>(-1, -1);
public IPage<PlatformEntity> list(Map<String, Object> map) {
QueryWrapper<PlatformEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(String.valueOf(map.get("id"))), "id", map.get("id"))
.like(StrUtil.isNotBlank(String.valueOf(map.get("name"))), "name", map.get("name"))
.like(StrUtil.isNotBlank(String.valueOf(map.get("host"))), "host", map.get("host"));
if (map.get("page") != null && map.get("limit") != null) {
Integer page = Integer.valueOf(map.get("page").toString());
Integer limit = Integer.valueOf(map.get("limit").toString());
pageParam = new Page<>(page, limit);
IPage<PlatformEntity> pageParam = new Page<>(page, limit);
return platformDao.selectPage(pageParam, wrapper);
} else {
List<PlatformEntity> list = platformDao.selectList(wrapper);
IPage<PlatformEntity> pageResult = new Page<>();
pageResult.setTotal(list.size());
pageResult.setRecords(list);
return pageResult;
}
return platformDao.list(pageParam, map);
}
public int count(Map<String, Object> map) {

@ -1,5 +1,6 @@
package com.glxp.udi.admin.service.param;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.param.SystemParamConfigCustomerDao;
import com.glxp.udi.admin.dao.param.SystemParamConfigDao;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
@ -23,7 +24,7 @@ public class SystemParamConfigService {
private SystemParamConfigCustomerDao systemParamConfigCustomerDao;
public SystemParamConfigEntity selectByParamKey(String key) {
return systemParamConfigDao.selectByParamKey(key);
return systemParamConfigDao.selectOne(new QueryWrapper<SystemParamConfigEntity>().eq("paramKey", key));
}
public boolean updateById(SystemParamConfigSaveRequest systemParamConfigSaveRequest) {
@ -45,7 +46,7 @@ public class SystemParamConfigService {
for (String paramKey : systemParams) {
//判断用户是否已经添加过此参数配置
if (systemParamConfigCustomerDao.countByCustomerId(paramKey, customerId) == 0) {
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigDao.selectByParamKey(paramKey);
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigDao.selectOne(new QueryWrapper<SystemParamConfigEntity>().eq("paramKey", paramKey));
list.add(systemParamConfigEntity);
}
}

@ -1,6 +1,7 @@
package com.glxp.udi.admin.service.param;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.SystemParamConstant;
@ -72,7 +73,7 @@ public class SystemParamCustomerConfigService {
//查询用户参数表,若用户有自定义此参数,则使用用户自己定义的参数,没有则使用默认参数
SystemParamConfigCustomerEntity systemParamConfigCustomer = systemParamConfigCustomerDao.selectByParamKeyAndCustomerId(paramKey, customerId);
if (null == systemParamConfigCustomer) {
return systemParamConfigDao.selectByParamKey(paramKey);
return systemParamConfigDao.selectOne(new QueryWrapper<SystemParamConfigEntity>().eq("paramKey", paramKey));
} else {
SystemParamConfigEntity systemParamConfigEntity = new SystemParamConfigEntity();
BeanUtil.copyProperties(systemParamConfigCustomer, systemParamConfigEntity);

@ -14,11 +14,6 @@
SELECT * FROM system_param_config WHERE paramName=#{paramName}
</select>
<select id="selectByParamKey" parameterType="com.glxp.udi.admin.req.param.SystemParamConfigRequest"
resultType="com.glxp.udi.admin.entity.param.SystemParamConfigEntity">
SELECT * FROM system_param_config WHERE paramKey=#{paramKey}
</select>
<update id="updateById" parameterType="com.glxp.udi.admin.entity.param.SystemParamConfigEntity">
UPDATE system_param_config
<set>

Loading…
Cancel
Save