This commit is contained in:
PQZ 2025-03-18 14:38:10 +08:00
commit 90b2145b28
7 changed files with 84 additions and 0 deletions

View File

@ -92,6 +92,10 @@ public class BaseCategoryController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BaseCategory baseCategory)
{
List<BaseCategory> list = baseCategoryService.selectByCode(baseCategory.getCode());
if(!list.isEmpty()){
return error("唯一编码重复!");
}
return toAjax(baseCategoryService.save(baseCategory));
}
@ -117,4 +121,29 @@ public class BaseCategoryController extends BaseController
List<String> list = new ArrayList<>(Arrays.asList(ids));
return toAjax(baseCategoryService.removeByIds(list));
}
/**
* 根据code查分类字典list
* @author vinjor-M
* @date 11:31 2025/3/18
* @param code code
* @param isSystem 是否系统级
* @return com.ruoyi.common.core.domain.AjaxResult
**/
@GetMapping("/listByCode")
public AjaxResult listByCode(@RequestParam(value = "code") String code,
@RequestParam(value = "isSystem",required = false) Integer isSystem)
{
List<BaseCategory> list = baseCategoryService.selectByCode(code);
if(list.isEmpty()){
return error("未查询到该字典项!");
}
LambdaQueryWrapper<BaseCategory> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BaseCategory::getPid,list.get(0).getId());
if(null!=isSystem){
queryWrapper.eq(BaseCategory::getIsSystem,isSystem);
}
queryWrapper.orderByAsc(BaseCategory::getSort);
return success(baseCategoryService.list(queryWrapper));
}
}

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.security.access.prepost.PreAuthorize;
@ -109,4 +111,18 @@ public class BaseConfigController extends BaseController
List<String> list = new ArrayList<>(Arrays.asList(ids));
return toAjax(baseConfigService.removeByIds(list));
}
/**
* 获取基础配置-账户配置小程序配置的内容详细信息-根据code获取
*/
@GetMapping(value = "/getConfigByCode")
public AjaxResult getConfigByCode(String code)
{
LambdaQueryWrapper<BaseConfig> queryWrapper = new LambdaQueryWrapper<BaseConfig>().eq(BaseConfig::getCode,code);
List<BaseConfig> list = baseConfigService.list(queryWrapper);
if(list.isEmpty()){
error("未查询到相关配置!");
}
return success(list.get(0));
}
}

View File

@ -15,4 +15,13 @@ import com.ruoyi.base.domain.BaseCategory;
public interface IBaseCategoryService extends IService<BaseCategory>
{
IPage<BaseCategory> queryListPage(BaseCategory pageReqVO, Page<BaseCategory> page);
/**
* 根据code查询字典
* @author vinjor-M
* @date 11:32 2025/3/18
* @param code
* @return java.util.List<com.ruoyi.base.domain.BaseCategory>
**/
List<BaseCategory> selectByCode(String code);
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.base.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -27,4 +29,17 @@ public class BaseCategoryServiceImpl extends ServiceImpl<BaseCategoryMapper,Base
public IPage<BaseCategory> queryListPage(BaseCategory pageReqVO, Page<BaseCategory> page) {
return baseCategoryMapper.queryListPage(pageReqVO, page);
}
/**
* 根据code查询字典
*
* @param code
* @return java.util.List<com.ruoyi.base.domain.BaseCategory>
* @author vinjor-M
* @date 11:32 2025/3/18
**/
@Override
public List<BaseCategory> selectByCode(String code) {
return this.list(new LambdaQueryWrapper<BaseCategory>().eq(BaseCategory::getCode,code));
}
}

View File

@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryListPage" parameterType="BaseConfig" resultMap="BaseConfigResult">
<include refid="selectBaseConfigVo"/>
<where>
del_flag=0
<if test="entity.code != null and entity.code != ''"> and code = #{entity.code}</if>
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
<if test="entity.jsonStr != null and entity.jsonStr != ''"> and json_str = #{entity.jsonStr}</if>

View File

@ -28,11 +28,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryListPage" parameterType="BaseRights" resultMap="BaseRightsResult">
<include refid="selectBaseRightsVo"/>
<where>
del_flag=0
<if test="entity.userType != null and entity.userType != ''"> and user_type = #{entity.userType}</if>
<if test="entity.code != null and entity.code != ''"> and code = #{entity.code}</if>
<if test="entity.name != null and entity.name != ''"> and name like concat('%', #{entity.name}, '%')</if>
<if test="entity.rightsType != null and entity.rightsType != ''"> and rights_type = #{entity.rightsType}</if>
<if test="entity.rightsCycle != null and entity.rightsCycle != ''"> and rights_cycle = #{entity.rightsCycle}</if>
</where>
order by user_type,sort asc,create_time asc
</select>
</mapper>

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.incrementer.H2KeyGenerator;
import com.baomidou.mybatisplus.extension.incrementer.KingbaseKeyGenerator;
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import com.baomidou.mybatisplus.extension.incrementer.PostgreKeyGenerator;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.ruoyi.framework.handler.DefaultDBFieldHandler;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
@ -33,4 +34,15 @@ public class MybatisAutoConfiguration {
return new DefaultDBFieldHandler(); // 自动填充参数类
}
/** Mybatis plus 分页插件 **/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// 设置请求的页面大于最大页后操作 true调回到首页false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量默认 500 -1 不受限制
paginationInterceptor.setLimit(-1);
return paginationInterceptor;
}
}