parent
1e3f5a682e
commit
4b528ea63b
@ -0,0 +1,40 @@
|
||||
package com.ruoyi.gysl.entity.BaseModel;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公共实体类
|
||||
* @author du
|
||||
* @since 2025/3/21 13:48
|
||||
*/
|
||||
@Data
|
||||
public class BaseModel {
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createId;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateId;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.gysl.entity.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 项目评价配置请求参数
|
||||
* @author du
|
||||
* @since 2025/3/21 17:13
|
||||
*/
|
||||
@Data
|
||||
public class PjpzRequest {
|
||||
|
||||
/**
|
||||
* 评价要素
|
||||
*/
|
||||
@ApiModelProperty(value = "评价要素")
|
||||
private String pjys;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.gysl.entity.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 项目知识库分页请求类
|
||||
* @author du
|
||||
* @since 2025/3/21 14:37
|
||||
*/
|
||||
@Data
|
||||
public class XmzskPageReq {
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String lx;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.gysl.entity.response.ImgResponse;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目图例组装实体类
|
||||
* @author du
|
||||
* @since 2025/3/21 16:03
|
||||
*/
|
||||
@Data
|
||||
public class ImgResponse {
|
||||
|
||||
@ApiModelProperty("图片")
|
||||
private String[] images;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.gysl.entity.response;
|
||||
|
||||
import com.ruoyi.gysl.entity.response.ImgResponse.ImgResponse;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 项目图例分页返回类
|
||||
* @author du
|
||||
* @since 2025/3/21 15:52
|
||||
*/
|
||||
@Data
|
||||
public class ProjectLegendResponse {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("图片类型1")
|
||||
private ImgResponse type1;
|
||||
|
||||
@ApiModelProperty("图片类型2")
|
||||
private ImgResponse type2;
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.ruoyi.gysl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.gysl.entity.Xmzsk;
|
||||
|
||||
/**
|
||||
* (Xmzsk)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-02-24 14:31:17
|
||||
*/
|
||||
public interface XmzskDao extends BaseMapper<Xmzsk> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.gysl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.gysl.entity.Xmzsk;
|
||||
import com.ruoyi.gysl.entity.request.XmzskPageReq;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* (Xmzsk)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-02-24 14:31:17
|
||||
*/
|
||||
public interface XmzskMapper extends BaseMapper<Xmzsk> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 所有数据
|
||||
*/
|
||||
Page<Xmzsk> page(Page<Xmzsk> page,@Param("req") XmzskPageReq req);
|
||||
}
|
||||
|
@ -1,25 +1,23 @@
|
||||
package com.ruoyi.gysl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.gysl.entity.Xmxl;
|
||||
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目巡礼(Xmxl)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-03-19 14:19:22
|
||||
* @since 2025-03-21 14:15:40
|
||||
*/
|
||||
public interface XmxlService extends IService<Xmxl> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param zwIdPageReq 查询实体
|
||||
* @return 所有数据
|
||||
* 查询所有数据
|
||||
*/
|
||||
Page<Xmxl> page(Page<Xmxl> page , ZwIdPageReq zwIdPageReq);
|
||||
List<Xmxl> list(ZwIdPageReq projectRemark);
|
||||
}
|
||||
|
||||
|
@ -1,32 +1,29 @@
|
||||
package com.ruoyi.gysl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.gysl.entity.Xmxl;
|
||||
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
|
||||
import com.ruoyi.gysl.mapper.XmxlMapper;
|
||||
import com.ruoyi.gysl.entity.Xmxl;
|
||||
import com.ruoyi.gysl.service.XmxlService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目巡礼(Xmxl)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-03-19 14:19:22
|
||||
* @since 2025-03-21 14:15:41
|
||||
*/
|
||||
@Service("xmxlService")
|
||||
public class XmxlServiceImpl extends ServiceImpl<XmxlMapper, Xmxl> implements XmxlService {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param zwIdPageReq 查询实体
|
||||
* @return 所有数据
|
||||
* 查询所有数据
|
||||
*/
|
||||
@Override
|
||||
public Page<Xmxl> page(Page<Xmxl> page, ZwIdPageReq zwIdPageReq) {
|
||||
return baseMapper.page(page,zwIdPageReq);
|
||||
public List<Xmxl> list(ZwIdPageReq projectRemark) {
|
||||
return baseMapper.list(projectRemark);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.gysl.mapper.PjpzMapper">
|
||||
<select id="page" resultType="com.ruoyi.gysl.entity.Pjpz">
|
||||
select * from pjpz
|
||||
<where>
|
||||
<if test="req.pjys != null and req.pjys != ''">
|
||||
AND pjys like concat('%',#{req.pjys},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.gysl.mapper.WysmxInformationMapper">
|
||||
<select id="selectOne" resultType="com.ruoyi.gysl.entity.WysmxInformation">
|
||||
select * from wysmx_information
|
||||
<where>
|
||||
<if test="req.xmId != null and req.xmId != ''">
|
||||
AND xm_id = #{req.xmId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.gysl.mapper.XmzskMapper">
|
||||
<select id="page" resultType="com.ruoyi.gysl.entity.Xmzsk">
|
||||
select * from xmzsk
|
||||
<where>
|
||||
<if test="req.name != null and req.name != ''">
|
||||
AND name like concat('%',#{req.name},'%')
|
||||
</if>
|
||||
<if test="req.lx != null and req.lx != ''">
|
||||
AND lx = #{req.lx}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -1,132 +1,128 @@
|
||||
//package com.ruoyi.framework.config;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.HashSet;
|
||||
//import java.util.List;
|
||||
//import javax.sql.DataSource;
|
||||
//import org.apache.ibatis.io.VFS;
|
||||
//import org.apache.ibatis.session.SqlSessionFactory;
|
||||
//import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
//import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.core.env.Environment;
|
||||
//import org.springframework.core.io.DefaultResourceLoader;
|
||||
//import org.springframework.core.io.Resource;
|
||||
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
//import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
//import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
//import org.springframework.core.type.classreading.MetadataReader;
|
||||
//import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
//import org.springframework.util.ClassUtils;
|
||||
//import com.ruoyi.common.utils.StringUtils;
|
||||
//
|
||||
///**
|
||||
// * Mybatis支持*匹配扫描包
|
||||
// *
|
||||
// * @author ruoyi
|
||||
// */
|
||||
//@Configuration
|
||||
//public class MyBatisConfig
|
||||
//{
|
||||
// @Autowired
|
||||
// private Environment env;
|
||||
//
|
||||
// static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
|
||||
//
|
||||
// public static String setTypeAliasesPackage(String typeAliasesPackage)
|
||||
// {
|
||||
// ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
|
||||
// MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
|
||||
// List<String> allResult = new ArrayList<String>();
|
||||
// try
|
||||
// {
|
||||
// for (String aliasesPackage : typeAliasesPackage.split(","))
|
||||
// {
|
||||
// List<String> result = new ArrayList<String>();
|
||||
// aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
||||
// + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
|
||||
// Resource[] resources = resolver.getResources(aliasesPackage);
|
||||
// if (resources != null && resources.length > 0)
|
||||
// {
|
||||
// MetadataReader metadataReader = null;
|
||||
// for (Resource resource : resources)
|
||||
// {
|
||||
// if (resource.isReadable())
|
||||
// {
|
||||
// metadataReader = metadataReaderFactory.getMetadataReader(resource);
|
||||
// try
|
||||
// {
|
||||
// result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
|
||||
// }
|
||||
// catch (ClassNotFoundException e)
|
||||
// {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (result.size() > 0)
|
||||
// {
|
||||
// HashSet<String> hashResult = new HashSet<String>(result);
|
||||
// allResult.addAll(hashResult);
|
||||
// }
|
||||
// }
|
||||
// if (allResult.size() > 0)
|
||||
// {
|
||||
// typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
|
||||
// }
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return typeAliasesPackage;
|
||||
// }
|
||||
//
|
||||
// public Resource[] resolveMapperLocations(String[] mapperLocations)
|
||||
// {
|
||||
// ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
|
||||
// List<Resource> resources = new ArrayList<Resource>();
|
||||
// if (mapperLocations != null)
|
||||
// {
|
||||
// for (String mapperLocation : mapperLocations)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Resource[] mappers = resourceResolver.getResources(mapperLocation);
|
||||
// resources.addAll(Arrays.asList(mappers));
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// // ignore
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return resources.toArray(new Resource[resources.size()]);
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
|
||||
// {
|
||||
// String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
|
||||
// String mapperLocations = env.getProperty("mybatis.mapperLocations");
|
||||
// String configLocation = env.getProperty("mybatis.configLocation");
|
||||
// typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
||||
// VFS.addImplClass(SpringBootVFS.class);
|
||||
//
|
||||
// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||
// sessionFactory.setDataSource(dataSource);
|
||||
// sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
||||
// sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
||||
// sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
||||
// return sessionFactory.getObject();
|
||||
// }
|
||||
//}
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.apache.ibatis.io.VFS;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* Mybatis支持*匹配扫描包
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class MyBatisConfig
|
||||
{
|
||||
@Autowired
|
||||
private Environment env;
|
||||
|
||||
static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
|
||||
|
||||
public static String setTypeAliasesPackage(String typeAliasesPackage)
|
||||
{
|
||||
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
|
||||
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
|
||||
List<String> allResult = new ArrayList<String>();
|
||||
try
|
||||
{
|
||||
for (String aliasesPackage : typeAliasesPackage.split(","))
|
||||
{
|
||||
List<String> result = new ArrayList<String>();
|
||||
aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
||||
+ ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
|
||||
Resource[] resources = resolver.getResources(aliasesPackage);
|
||||
if (resources != null && resources.length > 0)
|
||||
{
|
||||
MetadataReader metadataReader = null;
|
||||
for (Resource resource : resources)
|
||||
{
|
||||
if (resource.isReadable())
|
||||
{
|
||||
metadataReader = metadataReaderFactory.getMetadataReader(resource);
|
||||
try
|
||||
{
|
||||
result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.size() > 0)
|
||||
{
|
||||
HashSet<String> hashResult = new HashSet<String>(result);
|
||||
allResult.addAll(hashResult);
|
||||
}
|
||||
}
|
||||
if (allResult.size() > 0)
|
||||
{
|
||||
typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return typeAliasesPackage;
|
||||
}
|
||||
|
||||
public Resource[] resolveMapperLocations(String[] mapperLocations)
|
||||
{
|
||||
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
|
||||
List<Resource> resources = new ArrayList<Resource>();
|
||||
if (mapperLocations != null)
|
||||
{
|
||||
for (String mapperLocation : mapperLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
Resource[] mappers = resourceResolver.getResources(mapperLocation);
|
||||
resources.addAll(Arrays.asList(mappers));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
return resources.toArray(new Resource[resources.size()]);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
return interceptor;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue